Professional Documents
Culture Documents
DS 2
DS 2
• A linked list is a linear data structure, in which the elements are not stored at
contiguous memory locations. The elements in a linked list are linked using pointers
as shown in the below image:
Cont..
• A linked list is a linear data structure that includes a series of connected nodes. Here, each node stores
the data and the address of the next node.
• You have to start somewhere, so we give the address of the first node a special name called HEAD.
Also, the last node in the linked list can be identified because its next portion points to NULL.
How to represent linked list
• struct node
• {
• int data;
• struct node *next;
• };
Types of linked list
There are three common types of Linked List.
• Singly Linked List
• Doubly Linked List
• Circular Linked List
There are some of the properties of an array that are listed as follows -
• Each element in an array is of the same data type and carries the same size that is 4 bytes.
• Elements in the array are stored at contiguous memory locations from which the first element is stored
at the smallest memory location.
• Elements of the array can be randomly accessed since we can calculate the address of each element of
the array with the given base address and the size of the data element.
Cont..
Question 3 : Preorder : A B D E C F G
Inorder : D B E A F C G
What is postorder ?