Question: 5. Program 7.9 is the sources codes for function named find pos (). This function will find the location of a node in a linear

 5. Program 7.9 is the sources codes for function named find

pos (). This function will find the location of a node in

5. Program 7.9 is the sources codes for function named find pos (). This function will find the location of a node in a linear linked list which is sorted in ascending order. In this function, the integer variable named item is the key to be searched in the list. //Program 7.9 void link_list::find pos (int item) previousNode = NULL; currentNode = header; while (currentNode && item > currentNode ->elem) ( previousNode = currentNode; currentNode = currentNode ->link; ) a. If the statement find_pos (35) is executed and implemented on a linear linked list as shown in Figure 7.18, show the position of the pointer variable previousNode and currentNode in the figure. elem link elem link elem link elem link NUL head 40 - 45 60 70 Figure 7.18 b. Based on the position of the pointer variables head, previousNode and currentNode drawn in part (a), write a program code that is able to insert the value 35 in the linked list. In the program, you have to use the variable NewNode which is declared and created in the statement below: nod *NewNode =new (node); NewNode ->elem = 35; c. If the statement find pos (63) is executed and implemented on a linear linked list as shown in Figure 7.19, show the position of the pointer variable previousNode and currentNode in the figure. elem link elem link elem link 45 elem link 70 NULT head 40 60 Figure 7.19 d. Based on the position of the pointer variables previousNode and currentNode drawn in part (c), write a program code that is able to insert the value 63 in the linked list. In the program, you have to use the variable NewNode which is declared and created in the statement below: nod *NewNode = new (nod); NewNodeu->elem = 63; e. If the statement find_pos (70) is executed and implemented on a linear linked list as shown in Figure 7.20, show the position of the pointer variable previousNode and currentNode in the figure. elem lip link elem link elem 40 elem link 45 70 head 60 Figure 7.20 f. Based on the position of the pointer variables previousNode and currentNode drawn in part (e), write a program code that is able to delete 70 from the linked list

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!