Linked Lists is another linear data structure which stores data in sequential order. But unlike Arrays which stores data in contiguous memory locations, the linked lists Instead of allocating sequential blocks of memory allow the blocks to be anywhere in the memory heap as long as we have pointers from one block to the next.
The linked list consists of lists of items called nodes. Each node has two parts: info and link. The info part stores the actual data and link part stores the address of next node. So every node except the last node contains the address of the next node. The last node has the value NULL in its link part.
Stack is a linear data structure. It is also called Last In First Out (LIFO) data structure. In this type of data structure, the element which is last added is first to be removed.
The stack supports two operations:
Stack resembles a stack of trays in a cafeteria, or stack of boxes. Only the top tray can be removed from the stack and it is the last one that was added to the stack. A tray can be removed only if there are some trays on the stack, and a tray can be added only if there is enough room to hold more trays.
Queue is another linear data structure in which the elements are added at one end, called the rear, and deleted from the other end, called the front. It is also called First In First Out (FIFO) data structure.
Waiting lines in supermarkets, banks, ticket counters, food counters are common examples of queues.
Download as PDF
Read next: Hypertext Markup Language (HTML) ››
« Back to Course page
May – 2020 Edition
April – 2020 Edition
March – 2020 Edition
February – 2020 Edition
January – 2020 Edition
December – 2019 Edition
Punjab Civil Services 2020