Question: Assignment 4 and 5 deal with a new Data Structure called LinkedList. A LinkedList is a daisy chain of components called ListNodes which are linked
Assignment and deal with a new Data Structure called LinkedList. A LinkedList is a daisy chain of components called ListNodes which are linked to each other. Each ListNode is an object that contains data and a pointer to the next ListNode in the daisy chain. Usually there is a front pointer that points to the start of this chain. When this pointer is null, the chain is empty. The last element of the chain has its nextpointer set to null to indicate that there is no listnode linked after it We will be using a Singly Linked List
Linked Lists are very widely used and an important sequential dynamic data structure and they have several advantages. Since they are composed of linked list node objects, the data structure can grow as nodes are added and shrink when nodes are deleted. No prior size commitment is needed. No pre set size requirement. Secondly, and importantly, since listnodes contain pointers to the next element, memory allocation for this data structure does not need to be contiguous. As and when needed, list nodes can be allocated from anywhere in the dynamic memory heap and daisychained together. It is still a sequential data structure in that the listnodes are chained in a sequence, but they do not need to reside in contiguous memory locations. This makes it a powerful and flexible way to store and access data.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
