0% found this document useful (0 votes)
21 views24 pages

2025-07-29T07 - 19 - 53.438Z - Dsa Basics

Uploaded by

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

2025-07-29T07 - 19 - 53.438Z - Dsa Basics

Uploaded by

Ajay Thakare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

BEGINNER FRIENDLY

DSA GUIDE
Everything you need to kickstart your DSA journey

Ultimate Guide to Building Strong DSA Fundamentals


1

*Disclaimer*
E v e r y o n e l e a r n s u n i q u e ly .

What matters is developing the problem solving ability

to solve new problems.

This Doc will help you with the same.

BOSSCODER
ACADEMY #BeTheBoss 1
Introduction
I If you're already comfortable with basic programming syntax in
languages like C++, Java, or Python, it's time to build a strong
foundation in Data Structures and Algorithms (DSA) — a crucial step for
cracking coding interviews and solving real-world computational
problems efficiently.

BOSSCODER
ACADEMY
#BeTheBoss 2
Learn and Practice

01 Time & Space Complexity

W h at t o l e a r n

Big O notation :

Big O describes how the runtime or space requirement of an algorithm


grows as the input size increases

It gives an upper bound for performance, helping us compare algorithms.

BOSSCODER
ACADEMY
#BeTheBoss 3
Worst/Average/Best cases :

Worst Case: Maximum steps algorithm will take (used in Big O

Average Case: Expected number of steps (average inputs

Best Case: Minimum steps (not commonly used for complexity)

Practice Time/space complexity of basic operations


Practice
(looping, recursion, searching)

BOSSCODER
ACADEMY
#BeTheBoss
4
02 Array

An array is a data structure that can hold the elements of the same type. It
cannot contain the elements of different types like integer with character.

The commonly used operation in an array is insertion,


deletion, traversing, searching.

# Algorithm Practice Link

01 Linear Search Link

02 Binary Search Link

03 Reverse an Array Link

04 Find Min/Max in Array Link

05 Basic Prefix Sum Link

BOSSCODER
ACADEMY
#BeTheBoss 5
03 Linked Lists

A linked list is a sequence of nodes where each node contains:


Data (the value being stored)
A pointer/reference to the next node in the sequence
Unlike arrays, linked lists don't require contiguous memory allocation,
allowing for more flexible memory usage

Types of Linked List:

Singly linked list: Each node points to the next node, forming a one-way chain
Doubly linked list: Each node has pointers to both the next and previous nodes,
allowing two-way traversal
Circular linked list: The last node points back to the first node, forming a closed
loop.

# Algorithm Practice Link

01 Insertion at Tail Link

02 Delete given node Link

03 Reverse a Linked List Link

04 Merge Two sorted List Link

BOSSCODER
ACADEMY
#BeTheBoss 6
04 Stack & Queue

stack:

A stack is a linear data structure that follows LIFO (Last In First Out) order
Operation: push, pop, top, isEmpty

# Algorithm Practice Link

01 Implement stack Link


using array

02 Implement stack Link


using Linked List

03 Valid Parentheses Link

04 Palindrome Linked List Link

Queue:

A queue is a linear data structure that follows FIFO (First In First Out) order
Operations: enqueue, dequeue, front, isEmpty

# Algorithm Practice Link

01 Implement stack Link


using array

BOSSCODER
ACADEMY #BeTheBoss 7
# Algorithm Practice Link

02 Implement stack Link


using Linked List

03 Number of Recent Link


Calls

05 Strings

A string is a sequence of characters, they involve a small set of elements.

For example: Lowercase English alphabets → only 26 characters and ASCII


characters → 256 characters

# Algorithm Practice Link

01 Palindrome Check Link

02 Basic String Link


Manipulation

03 Reverse String Link

04 To Lower case Link

BOSSCODER
ACADEMY #BeTheBoss 8
06 Searching

Searching is the process of finding an element in a given data


structure (like an array or list).

There are two common types:

Linear Search: Goes through each element one by one.


Time complexity: O(n
Best when the data is unsorted or small in size.

# Algorithm Practice Link

01 Searching in an Array Link

Binary Search: Repeatedly divides the array in half to find the element.
Works only on sorted arrays
Time complexity: O(log n)

# Algorithm Practice Link

01 Search in an Link
Sorted Array

02 Missing Number Link

BOSSCODER
ACADEMY #BeTheBoss 9
07 Sorting

Sorting is the process of arranging elements in a particular order

(ascending or descending).

It is used to improve the efficiency of searching, comparison, and data


organization.

Types of SORTING:

Insertion Sort : Builds the sorted array one element at a time by inserting
elements into their correct position
Merge Sort : Divides the array into halves, recursively sorts them, and merges
the sorted halves
Quick Sort : Picks a pivot, partitions the array around it, and recursively sorts
the partitions
Selection Sort : Repeatedly selects the minimum element and places it at the
beginning.

# Algorithm Practice Link

01 Insertion Sort Link

02 Merge Sort Link

03 Quick Sort Link

04 Selection Sort Link

BOSSCODER
ACADEMY
#BeTheBoss 10
08 Hashing

Hashing is a technique used to map data to a fixed-size value (called a hash)


which helps in efficient data storage, retrieval, and lookup — especially in data
structures like hash tables, dictionaries, and sets.

Average-case time complexity: O(1) for insertion, deletion, and search


Used in applications like caching, dictionaries, sets, and databases.

A Hash collision occurs when two different keys produce the same hash value and
are assigned to the same index in the hash table.

Since collisions are unavoidable in fixed-size tables, we need techniques to

handle them.
Separate Chaining: Each index in the hash table contains a linked list of entries
that hash to the same index. New elements are simply added to the list at that
index.
Open Addressing: Instead of using a list, this method finds another empty slot
in the table using a probing strategy.
Linear Probing: If a collision happens at index i, check i+1, then i+2, and
so on
Quadratic Probing: Probes in steps of squares: i+1², i+2², i+3², etc
Double Hashing: Uses a second hash function to decide the step size
for probing.

BOSSCODER
ACADEMY
#BeTheBoss 11
# Algorithm Practice Link

01 Design HashMap Link

02 Design HashSet Link

09 Recursion

Recursion is a programming technique where a function calls itself to solve


smaller instances of the same problem.

It is especially useful for problems that can be broken down into similar
subproblems, such as tree traversal, factorial, and Fibonacci
Key Concept
Base Case: The condition that stops recursio
Recursive Case: The part where the function calls itsel
Call Stack: Keeps track of recursive function calls

# Algorithm Practice Link

01 Factorial Link

02 Power of Three Link

BOSSCODER
ACADEMY #BeTheBoss 12
# Algorithm Practice Link

03 Pow(x,n) Link

04 Fibonacci Number Link

05 Unique 3-digit Even Link


Number

10 Trees

A tree is a hierarchical data structure made up of nodes, with one node


designated as the root and all other nodes forming subtrees of the root.

It is a non-linear data structure, ideal for representing hierarchical relationships


such as folders in a filesystem or organization structures.

Binary Tree Traversals (Inorder, Preorder, Postorder)

# Algorithm Practice Link

01 Inorder Link

02 Preorder Link

BOSSCODER
ACADEMY #BeTheBoss 13
# Algorithm Practice Link

03 Postorder Link

04 Same Tree Link

05 Maximum depth of Link


Binary Tree

06 Path Sum Link

BOSSCODER
ACADEMY #BeTheBoss 14
11 Heap

A Heap is a special tree-based data structure that satisfies the heap property:

In a Max Heap, for every node i, the value of i is greater than or equal to its
children
In a Min Heap, for every node i, the value of i is less than or equal to its children
It is a complete binary tree (all levels completely filled except possibly the last,
filled from left to right)

O p e r at i o n s o n H e a p :

Heapify: Rearranges a tree or array to maintain the heap property

Insert: Add a new element and adjust (heapify up)

Delete: Remove the root element and heapify down

# Algorithm Practice Link

Operations on
01 Link
binary min heap

Heap Sort

It is a comparison-based sorting algorithm that uses a Max Heap (or Min Heap) to
sort elements.

BOSSCODER
ACADEMY
#BeTheBoss 15
# Algorithm Practice Link

01 Heap Sort Link

02 Minimum Cost Link


of ropes

03 Kth Largest Element Link


in a Stream

04 Last Stone Weight Link

12 Greedy Algorithm

A Greedy Algorithm is a problem-solving approach that builds up a solution step


by step, always choosing the option that looks best at the moment (locally optimal),
hoping that this leads to a globally optimal solution.

# Algorithm Practice Link

01 Longest Palindrome Link

02 Assign Cookies Link

BOSSCODER
ACADEMY #BeTheBoss 16
# Algorithm Practice Link

03 Array Partition Link

04 Can Place Link


Flowers

05 Lemonade Change Link

Note: Greedy algorithms don’t always guarantee the correct answer for every
problem — only for those that satisfy the properties mentioned above. If a problem
fails with greedy, dynamic programming might be the better fit.

13 Dynamic Programming

Dynamic Programming (DP) is a technique used to solve problems by breaking


them down into smaller overlapping subproblems and storing their results to avoid
redundant computations.

It is especially useful in optimization problems and is based on two main


strategies: Memoization (Top-Down) and Tabulation (Bottom-Up)
DP helps in reducing the time complexity of problems that have overlapping
subproblems and optimal substructure.

BOSSCODER
ACADEMY #BeTheBoss 17
# Algorithm Practice Link

01 Fibonacci (Memoization/ Link


Tabulation)

02 Climbing Stairs Link

03 Pascal’s Triangle Link

04 Best Time to Buy Link


and Sell Stocks

05 Counting Bits Link

BOSSCODER
ACADEMY #BeTheBoss 18
14 Graph

A Graph is a non-linear data structure consisting of nodes (also called vertices)


and edges that connect them. It is used to model relationships and networks such
as social connections, maps, and web page linking.

Node and Edges :

A node represents an entity (e.g., a person, city, etc.


An edge represents a connection or relationship between node
Graphs can be:
Directed (edges have direction
Undirected (edges go both ways)

BOSSCODER
ACADEMY #BeTheBoss 19
A 2D array used to represent a grap
matrix[i][j] = 1 means there is an edge from node i to node j
It takes more space (O(V²)).

0 1 2 3 4 5
0 1 0 1 1 1 1 0
1 0 0 1 0 0
1 0 0 0 1 1
1 1 0 0 0 1
1 0 1 0 0 0
5 0 0 1 1 0 0

Adjacency List :
A node represents an entity (e.g., a person, city, etc.
An edge represents a connection or relationship between nodes

0 1 0 1 2
1 0 2
2 0 1
2 3 3 2

BOSSCODER
ACADEMY #BeTheBoss 20
Uses a list where each node stores a list of connected node
More space-efficient than a matrix (O(V + E)
Ideal for sparse graphs (i.e. where most nodes are not directly connected)

# Algorithm Practice Link

01 Print adjacency list Link

Weighted graph :

Edges have weights or costs (e.g., distance, time, price


Used in algorithms like Dijkstra’s or Prim’s for shortest path problems

Graph Traversal Algorithm :

BFS (Breadth-First Search)


Explores all neighbours at the current depth before going deepe
Implemented using a queue

# Algorithm Practice Link

01 Rotting Oranges Link

Find if Path Exists


02 Link
in Graph

BOSSCODER
ACADEMY
#BeTheBoss 21
DFS (Depth-First Search)
Explores as far as possible along each branch before backtracking
Implemented using recursion or a stack
Useful for cycle detection, topological sort, etc.

# Algorithm Practice Link

01 Directed Graph Cycle Link

Number of
02 Link
Islands

BOSSCODER
ACADEMY
#BeTheBoss 22
Why Bosscoder?
01 Structured Industry-
vetted Curriculum 02 1:1 Mentorship

Sessions

Our curriculum covers everything you need to get You are assigned a personal mentor currently working in
become a skilled software engineer & get placed. Top product based companies.

03 2200+ Alumni
placement 04 24 LPA AVER AGE
PAC K AGE

2200+ Alumni placed at Top Product-based companies. Our Average Placement Package is 24 LPA and
highest is 98 LPA

Niranjan Bagade 10 Years Dheeraj Barik 2 Years

NICE Hike British Petroleum Infosys Hike Amazon


Software Eng. 83% Software Engineer Software Engineer 550% SDE 2
Specialist

Explore More

You might also like