Reviewer Dsa
Reviewer Dsa
- Arrays
- Linked List
- Stacks
- Queues
- Trees
- Graphs
- Hash Tables
Algorithms are step-by-step instructions or procedures to perform a specific task or solve particular
problem.
- Primitive Data Structures – basic data structure provided by programming languages include
integers, floating-numbers, characters, and Boolean values.
- Linear Data Structure – data elements arranged sequentially or linearly. Example: array, stack,
queue, linked list etc
- Static Data Structure – has a fixed memory size. Example: array
- Dynamic Data Structure – the size is not fixed. Example: queue, stack etc.
- Non-Linear Data Structure – not placed sequentially or linearly and can’t traverse all the
elements in a single run only. Example: tress and graph
Linked List – elements are not stored at contiguous memory location.
- Double-linked list – allows for traversal in both forward and backward directions
- Circular-linked list – last node point back to the head node either singly or doubly linked
OPERATION USED OF LINKED LIST
- Insertion
- Deletion
- Searching
- Dynamic Size – grow and shrink dynamically, as memory allocation is done at runtime
- Insertion and Deletion – adding or removing elements
- Flexibility – reorganized and modified without requiring a contiguous block of memory
- Random Access – do not allow direct access to elements by index. Traversal is required to reach
a specific node4
- Extra Memory – require additional memory for storing pointers, compared to arrayd
“Queue” is an abstract data type or linear data structure, somewhat similar to stacks. But unlike stacks,
a queue is open at both ends. It is considered as an ordered collection of items where the insertion of
new element happens at one end, which is called as the “rear” (also called as the “tail”), and the
removal of existing element takes place from the other end called as the “front” (also called as the
head).
This ordering principle is sometimes called “FIFO” (first-in first-out), which is also known as the idea of
“first-come first-served” method.
▪ peek() − Gets the element at the front of the queue without removing it.
1. peek() - This function helps to see the data at the front of the queue. The algorithm of
3. isempty() - In contrast to isfull() function, the isempty() function determines whether the queue is
empty or not by determining the value that the front holds. Algorithm of isempty() function is as
follows−
▪ Else, the access element is pointed out by ‘front’. ▪ Increment the ‘front’ to point to the next
accessible data. ▪ Return success.