Data Structure
Data Structure
2. Linked Lists:
Linked List is a linear data structure. Unlike arrays, linked list
elements are not stored at a contiguous location; the elements are
linked using pointers.
3. Stack:
Stack is a linear data structure which follows a particular order in
which the operations are performed. The order may be LIFO(Last In
First Out) or FILO(First In Last Out). In stack, all insertion and
deletion are permitted at only one end of the list.
Stack Operations:
push (): When this operation is performed, an element is inserted into
the stack.
Pop (): When this operation is performed, an element is removed from
the top of the stack and is returned.
4. Queue:
Like Stack, Queue is a linear structure which follows a particular
order in which the operations are performed. The order is First In First
Out (FIFO). In the queue, items are inserted at one end and deleted
from the other end. A good example of the queue is any queue of
consumers for a resource where the consumer that came first is served
first.
Queue Operations:
Enqueue (): Adds an element to the end of the queue..
Dequeue (): Removal of elements from the queue.
Front (): Acquires the data element available at the front node of the
queue without deleting it.
Rear (): This operation returns the element at the rear end without
removing it.
5. Binary Tree:
Unlike Arrays, Linked Lists, Stack and queues, which are linear data
structures, trees are hierarchical data structures. A binary tree is a tree
data structure in which each node has at most two children, which are
referred to as the left child and the right child. It is implemented
mainly using Links.