Di Pendra CPP
Di Pendra CPP
STRUCTURES
AND
For example, if we want to store the marks of a student in 6 subjects, then we don't need to
define different variable for the marks in different subject. instead of that, we can define
an array which can store the marks in each subject at a the contiguous memory locations.
An Array is actually a pointer that points to the first element of the array. Because
DATA STRUCTURES AND ALGORITHMS the array variable is a pointer, you can dereference it, which5 returns array element 0
Searching 6
Searching in data-structure refers to the process of finding a desired element in set of items.
Types-
1. Singly Linked List
2. Doubly Linked List
3. Circular Linked List
The 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).
A real-life example is a stack of plates: you can only take a plate from the top of the stack, and
you can only add a plate to the top of the stack.
APPLICATION- Reverse a Data , Processing Function Calls
DATA STRUCTURES AND ALGORITHMS 9
QUEUE
A queue is a useful data structure in programming. It is similar to the ticket queue outside a
cinema hall, where the first person entering the queue is the first person who gets the ticket.
Queue follows the First In Fast Out (FIFO) rule- the item that goes in first is the item that comes
out first.
APPLICATION- waiting lists for a single shared resource like printer, disk, CPU.
Queues are used in operating systems for handling interrupts
DATA STRUCTURES AND ALGORITHMS 10
TREE
A Tree is a non-linear data structure where each node is connected to a number of nodes with
the help of pointers or references.
BASIC TREE TERMINOLOGIES:
•Root
•Edge
•Siblings
•Leaf Nodes
DATA STRUCTURES AND ALGORITHMS 11
BINARY TREE
A Tree is said to be a Binary Tree if all of its nodes have atmost 2 children. That is, all of its
node can have either no child, 1 child, or 2 child nodes.
1. 2D ARRAY
2. RECURSION
3. BACKTRACKING