0% found this document useful (0 votes)
5 views23 pages

Data Structures and Algorithms

Uploaded by

shoaib altaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views23 pages

Data Structures and Algorithms

Uploaded by

shoaib altaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Data Structures

and Algorithms
Purpose of learning DSA?
P\ 1.Problem-Solving Skills:
● Think logically
● Choose the right approach to solve a problem efficiently
● Write optimized and efficient code that performs well
2. Building Applications: Many real-world applications require efficient data
processing. For example, search engines, social media platforms, and financial systems
rely heavily on efficient data structures and algorithms.
3.Interview Preparation: Many technical job interviews focus heavily on DSA
concepts. Companies like Google, Amazon, Facebook, and Microsoft often ask
candidates to solve problems that require a good understanding of data structures and
algorithms.
4.Performance: Efficient data structures and algorithms are essential for writing code
that runs quickly and uses resources (memory, CPU) effectively. This is crucial for
applications that need to scale or handle large volumes of data.
What are Data Structures and Algorithm?

Data Structures: Ways to organize and store data


Algorithms: A step by step procedure or formula for
solving a problem.
● Book shelf as a Data Structure
● Algorithms are like recipes in a kitchen
Linear and Nonlinear
Most common Data structures
1. Array/list
2. String
3. Linkedlist
4. dictionaries/hashmap
5. stack/queue
6. Trees
7. Graphs
Most common coding algorithms
1.Binary search
2. Linear Search
4. Merge sort
5. Quicksort
6. insertion sort
7. Selection sort
8. Heap sort
Array Data Structure
An array is a linear data structure. It is a collection of items of same
data type(int, float, boolean, string)
It hold upto N items
Why we use arrays?
To store large number of elements under a single variable name.
How to access elements in array?
Every element of an array can accessed through its index.

Index of array always starts with 0 and ends at N-1.


Array Capacity VS Array Length
Number of element an array can hold is called its capacity of array.

Arr[6] = [1,2,3,4,5,6]

arr= [1,2,3,4,5,6]

Number of elements currently in an array is called length of array.

Length of array = len(arr)


Types of Arrays
Arrays can be categorized into different types:
1.One dimensional array
2. Two dimensional array
3. Three dimensional array
1.One Dimensional Array
Basic operations in an Array
Array Insertion
Inserting a new element in an array

1. Inserting a new element at the end of the array.


2. Inserting a new element at the beginning of the
array.
3. Inserting a new element at any given index of the
array.
Array Deletion
Array Search
Real time Applications of Array

Music and Videos: Have you ever


noticed how your phone or computer
can play music and videos smoothly?
That's because they use arrays to store
the individual sounds and images that
make up the media.

You might also like