Question: Question 2 You are given a linked list with the following set of nodes in sequence: 36, 25,55, 32 and 47. The first node is


Question 2 You are given a linked list with the following set of nodes in sequence: 36, 25,55, 32 and 47. The first node is referred by Head reference variable and the second node is referred by Preference variable. Write Java statements to do the following operations: i. Change the value of the third node to 85. Show all possible statements. (2 mark) ii. Create node 77 and insert it after the first node. Show all steps involved. (4 marks) 111. Set a reference variable Q that point to the fourth node. Then delete the pointed node and deallocate the memory. Show all steps involved. (4 mark) Question 1 An array is a collection of elements of a similar data type while linked list is an ordered collection of elements of the same type in which each element is connected to the next using reference variable. Compare array-based list with linked-list for the following aspects: i. ii. iii. iv. V. Storage allocation Order of the elements Insertion and deletion of elements Searching techniques Memory requirements Discuss the benefit and drawback of using linked list over array-based list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
