Question: The programming language is C++ 4. Using the info given in problem 3. Add a member funtion Merge(0 that has the following precondition and postcondition

 The programming language is C++ 4. Using the info given in

The programming language is C++

4. Using the info given in problem 3. Add a member funtion Merge(0 that has the following precondition and postcondition 1) Precondition: list2 that has been initialized and not empty 2) Postcondition: Insert all the elements to the current list from list2 . Analyze its time complexity in terms of n which is the number of elements in the list2 3) How would you program the same function if it was an Unsorted List instead of SortedList. Write code for the function and explain the runtime difference between both lists Consider the ADT "Sorted List" Class SortedList Public: SortedType0 int getLenth0 void putltem(Itemtype item); inserts an item Itemtype getNextltemO; void deleteltem(Itemtype item Ideletes a specified item /returns size of the list //returns the next item pointed by the index private int length; Nodetype* listData Nodetype* currentPos; //length of the list //head of the list //current pointer to the list Class Itemtype Public Itemtype0 int getValue0://returns the value Private int value struct Nodetype Itemtype info; Nodetype* next; 4. Using the info given in problem 3. Add a member funtion Merge(0 that has the following precondition and postcondition 1) Precondition: list2 that has been initialized and not empty 2) Postcondition: Insert all the elements to the current list from list2 . Analyze its time complexity in terms of n which is the number of elements in the list2 3) How would you program the same function if it was an Unsorted List instead of SortedList. Write code for the function and explain the runtime difference between both lists Consider the ADT "Sorted List" Class SortedList Public: SortedType0 int getLenth0 void putltem(Itemtype item); inserts an item Itemtype getNextltemO; void deleteltem(Itemtype item Ideletes a specified item /returns size of the list //returns the next item pointed by the index private int length; Nodetype* listData Nodetype* currentPos; //length of the list //head of the list //current pointer to the list Class Itemtype Public Itemtype0 int getValue0://returns the value Private int value struct Nodetype Itemtype info; Nodetype* next

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!