Write a function that will traverse a list find a node


Write a "length" function that will take a list as a parameter and return the number of nodes in the list.

1) Write a "count odds" function that will take a list as a parameter and return the number of odd nodes in the list.

2) Write a function that will modify the data in the nodes in your list in some way - for instance, add one to each of the even nodes.

3) Write a function to find the "nth" node in a list. Pass into the function the head of a list and an integer value representing an ordinal position in the list. Return a pointer to the node in the nth position. For instance, nthNode(aList, 1) called on the following list would return a pointer to the node containing the value 5. 

4) Write a function that will traverse a list, find a node containing a particular value and duplicate that node, adding another node with the same value in the next position of the list.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write a function that will traverse a list find a node
Reference No:- TGS02653244

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)