DATA
STRUCTURES
AND
DATA STRUCTURES AND ALGORITHMS
ALGORITHMS
BY DIPENDRA RAJ SINGH
REG NO – 12018314
LOVELY PROFESSIONAL UNIVERSITY
B.TECH IN COMPUTER SCIENCE AND ENGINEERING
1
CERTIFICATION
DATA STRUCTURES AND ALGORITHMS 2
INTRODUCTION
What is an Algorithm?
An algorithm is a set of well-defined instructions or step to solve a particular problem. It
takes a set of input and produces a desired output.
FOR EXAMPLE – SEARCHING A PAGE IN A BOOK OF 1000 PAGES
GO ONE PAGE BY ONE
ANOTHER COULD BE GO TO A RANDOM PAGE AND LOOK ARE WE AHEAD OR
BEHIND OUR DESIRED PAGE THEN DO SAME WITH REMAING PAGES.
ALOGORITHM IS A APPROCH TO A PROBEM
DATA STRUCTURES AND ALGORITHMS 3
Data structures AND It’s types
A data structure is a particular way of organizing and storing data in a
computer.
DATA STRUCTURES AND ALGORITHMS 4
Array
Arrays are defined as the
collection of similar type of data
items stored at contiguous memory
locations. Array is the simplest
data structure where each data
element can be randomly accessed
by using its index number.
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.
DATA STRUCTURES AND ALGORITHMS
TYPES OF SEARCHING
1. Linear Search 2. Binary Search
DATA STRUCTURES AND ALGORITHMS 6
Sorting
Sorting Algorithms are methods of reorganizing a large number of items into some
specific order such as highest to lowest, or vice-versa, or even in some alphabetical
order.
DATA STRUCTURES AND ALGORITHMS 7
Linked List
Linked Lists are linear or sequential data
structures in which elements are stored
at non-contiguous memory locations and
are linked to each other using pointers.
Types-
1. Singly Linked List
2. Doubly Linked List
3. Circular Linked List
Basic Operations on Linked List. Traversal: To traverse all the nodes
one after another. Insertion: To add a node at the given position. ...
Sorting: To arrange nodes in a linked list in a specific order.
DATA STRUCTURES AND ALGORITHMS 8
Stack
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.
DATA STRUCTURES AND ALGORITHMS 12
Project : Sudoku solver
DATA STRUCTURES AND ALGORITHMS 13
DATA STRUCTURES AND ALGORITHMS 14
1 4
RETURN
EXPLANATION
DATA STRUCTURES AND ALGORITHMS 15
DATA STRUCTURES AND ALGORITHMS 16
Data Structure and technique I used
1. 2D ARRAY
2. RECURSION
3. BACKTRACKING
DATA STRUCTURES AND ALGORITHMS 17
Significance and Conclusion
DATA STRUCTURES AND ALGORITHMS 18
THANK YOU
DATA STRUCTURES AND ALGORITHMS 19