Question: 2. Given that Figure 3 is a Linked List, and p,q,x,y are pointers to be used. i. Write the line(s) of code to delete the


2. Given that Figure 3 is a Linked List, and p,q,x,y are pointers to be used. i. Write the line(s) of code to delete the last node ii. Write the line(s) of code to delete the third node (1 Marks) iii. Write the line(s) of code to delete the first node iv. Write the line(s) of code to delete one node if Figure 3 is: (0.5 Marks Each) a. A stack b. A queue 3. Given a structure Car with model (array of character) and color (string) as members of structure. Use pointer operator to store data for an ist car. Hints: Use ist as structure variable and istptr as the pointer. (3 Marks) 1. Given that Figure 1 , and Figure 2 are linked lists. Numbers 1 through 6 are the imaginary names of pointers and p,q,x,y are the pointers. Consider that a new node named Node is to be added to the list, answer the question which follows: i. Using Figure 1, mention the pointer(s) which will be involved to join the Node: a. At the end of the list. (0.5 Marks Each) b. At the beginning of the list. c. After the second node. ii. To complete the action in i.b) and i.c), arrange the pointer in the required order (i.e which pointer should start and which should follow). Hints: Use Figure 1. a. For i.b). b. For i.a). (0.5 Marks Each) iii. For actions in i.a), i.b), and i.c); write one or two lines of codes to accomplish the action (remember that the new node has already been created and the place to join it has already been indicated). Hints: Use Figure 2. a. For i.a). b. For i.b). c. For i.c). iv. Write the line(s) of code to add the new node if: (1 Mark Each) a. Figure 2 is a queue b. Figure 2 is a stack v. If the structure name is List, write the structure definition for Linked List shown in the figures. (1.5 Marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
