Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++: Please answer correctly, I will upvote! 1) Modify the following code as needed to run in your environment. As well as the values for

C++: Please answer correctly, I will upvote!

1) Modify the following code as needed to run in your environment. As well as the values for M and N given in the code, test all combinations of values of M = 2, 3, 5, 10 and N = 103, 104, 105, 106.

2) Explain the node class and the main function through comments in the code file and a written summary that includes your displayed test results.

3) Create the following functions for processing nodes: remove(), insert(), next(), annd item(). Test them independently of the processing done in the code below. Be sure to document your code, summarize the way you implemented them, and how you tested the functions.

4) Replace any operations in the code below with equivalent functions that you implemented in problem 3 above, where appropriate. Document your replacements and give proof in your summary that you get the same results as with the original code.

------------------------------------------

#include

usingnamespacestd; classnode { public: intitem; node* next; node(intx, node* t) { item = x; next = t; } }; typedefnode *link; intmain() { inti, N = 9, M = 5; link t = newnode(1, 0); t->next = t; link x = t; for(i = 2; i <= N; i++) x = (x->next = newnode(i, t)); while(x != x->next) { for(i = 1; i < M; i++) x = x->next; x->next = x->next->next; } cout << x->item << endl; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

What else could you do?

Answered: 1 week ago

Question

=+2 Identify six guidelines for drafting effective website content

Answered: 1 week ago

Question

=+informational reports, analytical reports, and proposals

Answered: 1 week ago