0% found this document useful (0 votes)
15 views66 pages

STP Report 2025 Uday

Uploaded by

Lovish Jindal
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)
15 views66 pages

STP Report 2025 Uday

Uploaded by

Lovish Jindal
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/ 66

CHAPTER -1

INTRODUCTION
1. Overview of the course training program

During my summer training, I enrolled in a specialized course on Data Structures and


Algorithms (DSA) conducted in Bhagwan Parshuram Institute of Technology (BPIT) in
collaboration with Coding Blocks, a reputed training institution in India. The course was
designed with a focus on imparting in-depth knowledge of core computer science
concepts that form the foundation of programming and software development.
The training emphasized a blend of conceptual clarity, algorithmic thinking, and
practical coding exercises, making it highly relevant for students aspiring to excel in
coding interviews, competitive programming, and software engineering roles. This
report highlights the key aspects of the training, including the course overview,
objectives, institutional profile, and personal learning experiences gained throughout the
program.
The training program was carefully structured to cover a wide range of topics in data
structures and algorithms, starting from the basics and gradually moving toward
intermediate and advanced concepts. The primary focus was to help students gain the
ability to analyze, design, and implement efficient solutions to computational problems.
The program spanned 7 months, with each week dedicated to specific modules such as:
● Foundations: Arrays, Strings, and Introduction to Complexity Analysis.
● Intermediate Topics: Recursion, Backtracking, and Linked Lists.
● Advanced Topics (introductory level): Stacks, Queues, Searching, and Sorting
Algorithms.
Each module was supplemented with assignments, coding contests, and live practice
sessions, ensuring that students not only understood the theoretical aspects but also
gained the ability to apply them in practice.
To enhance the learning experience, the training also included:
● Hands-on Coding Exercises: Solving problems on platforms such as HackerBlocks
and other competitive programming environments.

10
● Doubt-Solving Sessions: Interactive mentor-led discussions to resolve conceptual or
coding-related challenges.
● Assignments and Projects: Structured problems designed to strengthen analytical and
logical reasoning.
The systematic progression from simple to complex topics ensured a strong learning
curve and built confidence in tackling diverse algorithmic problems.

2. Objectives of the training

The summer training was conducted with a set of well-defined objectives aimed at
strengthening both technical and professional skills. The core objectives included:

1.2.1 Strengthening Fundamentals:


To build a solid foundation in data structures such as arrays, linked lists, stacks, and
queues, along with classical algorithms for searching and sorting.
1.2.2 Enhancing Problem-Solving Skills:
To develop the ability to break down a problem into smaller sub-problems and solve
them systematically using efficient algorithms.
1.2.3 Understanding Algorithmic Complexity:
To analyze the time and space complexities of algorithms using Big-O, Big-Theta,
and Big-Omega notations, which is critical for writing optimized code.
1.2.4 Improving Practical Coding Efficiency:
To gain proficiency in C++ programming with extensive use of the Standard Template
Library (STL), enabling quick and efficient implementation of solutions.
1.2.5 Exposure to Real-World Applications:
To understand how core data structures are applied in building systems like

11
compilers, operating systems, databases, and applications like search engines or file
systems.
1.2.6 Preparation for Career Opportunities:
To prepare for technical interviews, competitive programming contests, and software
engineering challenges that require a deep understanding of DSA.
1.2.7 Encouraging Independent Learning:
To foster a habit of self-study, debugging, and exploring multiple approaches to
problem-solving beyond classroom instructions.
By the end of the training, the program aimed to ensure that each participant could
confidently approach real-world computational challenges and devise solutions with
optimized algorithms and appropriate data structures.

3. Trainer/Institute Profile

Coding Blocks is a premier training institute that has established itself as a leader in
imparting coding and software development skills to students and professionals.
Founded with the vision of bridging the gap between academic knowledge and industry
requirements, the institute offers a wide range of courses in areas such as:
● Data Structures and Algorithms (DSA)
● Web Development (Frontend and Backend)
● Android and iOS App Development
● Machine Learning and Artificial Intelligence
● Competitive Programming
Coding Blocks is known for its structured curriculum, experienced faculty, and
interactive teaching methodology. The institute employs a project-based learning
approach, where students are encouraged to work on coding assignments and real-world
problems, thereby ensuring skill development through practice and application.
The training infrastructure provided by the institution includes:
● Access to coding platforms like HackerBlocks, an in-house practice environment.

12
● Doubt-solving sessions with mentors and teaching assistants.
● Online lectures and recorded sessions for flexible learning.
● Industry-relevant curriculum aligned with placement preparation.

Trainer Profile – Karthik Mathur

The training was conducted under the mentorship of Mr. Karthik Mathur, a highly
experienced faculty member at Coding Blocks. Mr. Mathur is renowned for his expertise
in Data Structures, Algorithms, and Competitive Programming, and has mentored
thousands of students in building a strong foundation in computer science. His teaching
methodology blends conceptual clarity with practical problem-solving skills, ensuring
that students not only learn how to implement algorithms but also understand the
underlying logic and efficiency of each approach.
Key aspects of his mentorship included:
● Breaking down complex concepts into simplified explanations, often using real-world
analogies.
● Providing in-depth analysis of algorithms while comparing multiple approaches to
problem-solving.
● Encouraging critical and independent thinking during assignments and coding
challenges.
● Offering constructive feedback on coding practices, efficiency, and optimization
techniques.
The balance of theory, practice, and competitive insights created an engaging
environment that helped students enhance their algorithmic thinking and gain confidence
in tackling real-world coding challenges.

Fig 1.1 Coding Blocks logo


13
14
CHAPTER -2

COURSE OVERVIEW

1. Detailed description of the course content

The Summer Training Program (STP) in Data Structures and Algorithms (DSA) was
conducted at BPIT in collaboration with Coding Blocks. The course was designed to
provide students with a comprehensive understanding of fundamental and advanced
concepts in data structures, algorithms, and their practical applications. The training
aimed to strengthen problem-solving skills, improve algorithmic thinking, and prepare
students for coding interviews, competitive programming, and real-world software
development.

The curriculum was carefully structured to cover a wide range of topics as outlined
below:

2.1.1 Arrays and Character Arrays

● Understanding arrays and their applications.


● Algorithms such as Binary Search, Sorting Techniques, Maximum Subarray
Problems, and Searching Algorithms.
● Handling character arrays to understand variations in memory usage and data
manipulation.

2.1.2 Strings

● Use of the String class and its methods.


● Concepts of immutability, memory diagrams, and intern pools.
● Problem-solving with strings, including substring searches and manipulations.

2.1.3 Bitmasking

● Working with bitwise operators (AND, OR, XOR, NOT) at machine level.

15
● Applications of bitmasking in faster algorithms.
● Use cases in recursion and dynamic programming.

16
2.1.4 Standard Template Library (STL)

● Introduction to vectors, sets, maps, stacks, and queues.


● Importance of STL in writing optimized and cleaner code for competitive
programming.

2.1.5 Recursion, Backtracking, and Complexity Analysis

● Basics of recursion and forming recurrence relations.


● Applications of recursion in arrays, strings, and subsets.
● Backtracking problems such as N-Queens, Rat in a Maze, and Sudoku Solver.
● Analysis of time and space complexity to optimize solutions.

2.1.6 Object-Oriented Programming (OOPs)

● Role of OOP in building data structures.


● Concepts of classes, objects, inheritance, and encapsulation.
● Linking real-world entities to programming constructs.

2.1.7 Linked Lists

● Singly, doubly, and circular linked lists.


● Operations such as insertion, deletion, traversal, and reversal.
● Advanced problems like cycle detection and intersection nodes.

2.1.8 Stacks and Queues

● Stack implementation and applications in Balanced Parentheses, Stock Span, and


Histogram Problems.
● Queue and its role in tree/graph algorithms.
● Deque and its application in sliding window problems.

2.1.9 Advanced Data Structures

● Binary Trees and Binary Search Trees (BSTs): Traversals, insertions, and deletions.

17
● Heap: Applications in priority queues and finding top-k elements.
● Hashmaps: Constant time insertion/deletion and their role in optimization.

18
● Tries: Efficient searching and auto-suggestion features.

2.1.10 Dynamic Programming (DP) and Greedy Algorithms

● 1D DP: Fibonacci, Staircase problems, and Knapsack (Top-down and Bottom-up


approaches).
● 2D DP: Matrix Chain Multiplication, Longest Common Subsequence (LCS), and
Optimal Game Strategy.
● Greedy Algorithms: When and how to apply greedy approaches effectively.

2.1.11 Advanced String Algorithms

● Pattern matching using KMP, Z-algorithm, Rabin-Karp.


● Applications in coding interviews and online assessments.

2. Modules Covered

Module 1: Fundamentals of Programming and Complexity Analysis

● Introduction to programming in C++ (language used for implementation).


● Basics of input/output, operators, conditional statements, and loops.
● Functions, recursion, and modular programming.
● Understanding time complexity (Big-O, Big-Theta, Big-Omega) and space
complexity.
● Best, average, and worst-case analysis of algorithms.

Module 2: Arrays and Strings

● Static and dynamic arrays, memory allocation.


● Traversals, searching, and sorting techniques.
● Advanced problems on subarrays, prefix/suffix computations, and sliding window
techniques.
19
● String manipulation, pattern matching, and string hashing basics.

20
Module 3: Linked Lists

● Singly and doubly linked lists.


● Circular linked lists.
● Insertion, deletion, and traversal operations.
● Solving problems like cycle detection, intersection point, and reversing a linked list.

Module 4: Stacks and Queues

● Conceptual understanding and implementation using arrays and linked lists.


● Applications in expression evaluation, backtracking, and browser history.
● Variants: Circular queues, Deques, and Priority queues.

Module 5: Recursion and Backtracking

● Recursive problem-solving strategies.


● Problems like Tower of Hanoi, N-Queens, Rat in a Maze, Sudoku solver.
● Backtracking as a systematic trial-and-error method.

Module 6: Advanced Topics in Searching and Sorting

● Divide and Conquer algorithms: Merge Sort, Quick Sort.


● Binary Search and its applications.
● Optimized searching in rotated arrays, matrix search, and binary search on answers.

3. Tools, software, or equipment used

2.3.1 Programming Language: C++ (with extensive use of STL).

2.3.2 Practice Platforms: HackerBlocks, LeetCode, Codeforces, VS Code.

2.3.3.Learning Material: Coding Blocks curated notes, assignments, and interview-focused


question sets.

21
2.4 Training Methodology

22
The pedagogy followed during the training included:

1. Instructor-Led Sessions – Explanation of concepts with real-world examples.


2. Live Coding – Demonstrations of algorithm implementations in C++.
3. Assignments & Homework – Weekly problem sets for hands-on practice.
4. Practice Contests – Simulated competitive programming challenges.
5. Doubt-Solving Sessions – Interactive mentor guidance.
6. Project Work – Application of DSA concepts in real-world-inspired tasks.

Fig. 2.1 Used tools logo

23
CHAPTER – 3

WORK UNDERTAKEN

1. Title and aim of the project or tasks given during the course

The core component of the Summer Training Program was not only learning theoretical
concepts but also applying them in the form of assignments and coding challenges. The
training emphasized practical implementation of Data Structures and Algorithms (DSA) to
develop strong problem-solving skills. Every concept introduced during lectures was
followed by structured tasks that required its application in real coding environments.

The tasks and projects undertaken during the course were aimed at exposing students to a
wide spectrum of problems, ranging from beginner-level exercises such as implementing
arrays and strings, to advanced challenges like solving backtracking problems and performing
operations on trees. By doing so, the training encouraged the development of logical
reasoning, algorithmic thinking, and efficiency-oriented programming practices.

The primary aim of the practical work was to ensure that students could:

● Strengthen conceptual clarity through hands-on coding practice. Each theoretical


session was followed by assignments where students were expected to write optimized
code and analyze its performance. For example, while learning sorting algorithms,
problems were designed to compare Bubble Sort, Merge Sort, and Quick Sort on
different datasets to highlight their efficiency and limitations.
● Implement fundamental and advanced data structures effectively. Tasks covered a
wide range of DSA concepts, including arrays, linked lists, stacks, queues, and
introductory trees. Students worked on insertion, deletion, searching, traversal, and
problem-solving tasks for each of these structures. For instance, assignments on stacks
involved solving the Balanced Parentheses Problem and Stock Span Problem, while
linked list tasks included cycle detection and reversal.
● Master algorithmic paradigms such as recursion and backtracking. A significant
24
portion of the tasks revolved around recursive problem-solving. Problems such as
Tower of Hanoi, N-Queens, Rat in a Maze, and Word Search in a Matrix

25
were assigned to help students understand how recursion and backtracking can
simplify otherwise complex challenges.
● Prepare for competitive programming and technical interviews. The training
integrated a competitive coding environment by conducting regular coding contests.
Problems were designed in the style of company interview questions (Amazon,
Google, Microsoft, Flipkart, etc.), helping students gain familiarity with the type of
challenges faced during placements. The continuous practice of analyzing problem
statements, applying the right data structure, and writing efficient solutions improved
both speed and accuracy, essential traits for technical assessments.
● Develop independent problem-solving and debugging skills. One of the most
important aims of the project tasks was to encourage students to debug their own code,
identify logical flaws, and optimize their approaches without over- reliance on
solutions. This independence fostered confidence in approaching unfamiliar problems
and finding innovative solutions.

In summary, the assignments and mini-projects undertaken during the training were not mere
academic exercises but carefully designed skill-building tasks. They reinforced theoretical
knowledge, strengthened analytical thinking, encouraged creativity in problem-solving, and
laid a strong foundation for future exploration of advanced computer science concepts.

2. Step-by-step approach to solving the given problem

The following sequence was followed throughout the training to solve problems and
undertake tasks:

1. Problem Understanding: Carefully analyzing the statement and constraints.


2. Algorithm Design: Identifying the most suitable data structure or algorithm.
3. Complexity Analysis: Estimating time and space requirements.
4. Implementation: Writing code in C++ with the help of STL (Standard Template
Library).
5. Testing and Debugging: Running the solution on multiple test cases.
26

6. Optimization: Improving the efficiency of the solution if possible.

27
3. Comprehensive Study of Data Structures and Algorithms

In this section, I will provide a detailed explanation of all the major topics covered during the
training program. Each topic includes:

● Theoretical Overview – basic concepts and applications.


● Key Algorithms – important approaches commonly used.
● Sample Code Implementations – example problems solved during the training.

3.1. Introduction to Programming in C++

C++ was chosen as the language of instruction due to its efficiency, flexibility, and powerful
Standard Template Library (STL). Unlike higher-level languages, C++ provides both low-
level memory management capabilities and high-level abstractions, making it ideal for
mastering DSA.

Key features of C++ used during the training included:

● Data Types and Variables – handling integers, floating-point numbers, characters, and
strings.
● Control Structures – decision-making with if-else, iteration with for, while, and do-
while loops.
● Arrays and Pointers – understanding memory storage, indexing, and dynamic
allocation.
● Object-Oriented Concepts – a brief introduction as a precursor to advanced modules.

Example: Simple C++ program for input and output

28
Fig. 3.1 Simple CPP code

29
3.2. Basics of Input/Output, Operators, and Conditional Statements

Participants were introduced to fundamental operations in C++:

● Operators: Arithmetic (+,-,*,/,%), Relational (==, !=, >, <), Logical (&&, ||, !), and
Bitwise operators.
● Conditional Statements:
o if-else for decision making.
o switch-case for multi-branch conditions.

Example: Largest of three numbers using conditionals

Fig. 3.2 Largest of three numbers

3.3. Functions, Recursion, and Modular Programming

Functions help break down large programs into smaller, manageable modules.

● Types of Functions: User-defined and library functions.


● Parameter Passing: Call by value, call by reference.
● Recursion: A technique where a function calls itself to solve smaller sub-problems,
particularly useful for problems like factorial, Fibonacci, and divide-and-conquer
algorithms.
30
Example: Recursive function for factorial

Fig. 3.3 Factorial code

3.4. Understanding Time and Space Complexity

Analyzing an algorithm’s efficiency was one of the most crucial parts of this module.
Participants learned:

● Time Complexity:
o Big-O (O): Upper bound (worst-case).
o Big-Theta (Θ): Average-case.
o Big-Omega (Ω): Lower bound (best-case).

Example: Linear vs Binary Search complexities

● Linear Search: O(n) time.


● Binary Search: O(log n) time.
● Space Complexity:
o Memory usage due to variables, data structures, and recursion stack.
o Example: Recursive algorithms consume extra space due to stack frames.

Algorithms behave differently under different inputs:

● Best Case: Input that requires the minimum number of operations.

31
● Worst Case: Input that requires the maximum number of operations.

32
● Average Case: Expected performance over a set of inputs.

Example: Binary Search

● Best Case: O(1) (middle element is target).


● Worst Case: O(log n) (keep halving until one element remains).
● Average Case: O(log n).

3.5. Arrays

● An array is a collection of elements of the same data type stored in contiguous


memory locations.
● Each element can be accessed directly using its index, which makes arrays highly
efficient for random access operations (O(1) time).
● However, insertion and deletion (other than at the end) may require shifting elements,
leading to O(n) complexity.
● Storing and processing lists of numbers (marks, salaries, etc.).
● Representing matrices and 2D grids.
● Used as the building blocks for advanced data structures such as heaps, hash tables,
and dynamic programming tables.

Important Array Algorithms

1. Linear Search – Sequentially checks each element until the target is found.
o Time Complexity: O(n).
o Space Complexity: O(1)

int linearSearch(int arr[], int n, int key)

{ for(int i = 0; i < n; i++) {

33
if(arr[i] == key) return i;
}
return -1;
}

2. Binary Search – Efficient searching in a sorted array using divide-and-conquer.

● Time Complexity: O(log n).


● Space Complexity: O(1).

int binarySearch(int arr[], int n, int key)

{ int left = 0, right = n-1;

while(left <= right) {

int mid = left + (right - left) / 2;

if(arr[mid] == key) return mid;

else if(arr[mid] < key) left = mid + 1;

else right = mid - 1;

return -1;

3. Kadane’s Algorithm (Maximum Subarray Sum) – Finds the largest sum of a


contiguous subarray.

● Time Complexity: O(n).


● Space Complexity: O(1).

34
Fig. 3.4 Kadane’s algorithm

4. Sorting Algorithms (Array-Based)

● Bubble Sort → O(n²).


● Merge Sort → O(n log n).
● Quick Sort → O(n log n) (average).

3.6. Character Arrays

Character arrays are a variation of arrays specifically used to store text and strings.

● They are null-terminated (\0) sequences of characters in C/C++.


● Operations include string concatenation, comparison, reversal, etc.
● Useful for understanding memory handling and low-level string manipulation.

3.7. Strings

C++ provides the string class which is more powerful and easier to use than character arrays.

Key Features:

● Dynamic memory allocation (unlike fixed-size character arrays).


● Built-in functions: length(), substr(), find(), erase(), compare().

35
● Immutability: Unlike Java, C++ strings are mutable but handle memory efficiently.

Important String Algorithms:

36
1. Palindrome Check

bool isPalindrome(string s) {

int l = 0, r = s.length() - 1;

while(l < r) {

if(s[l] != s[r]) return false;

l++; r--;

}
return true;

2. Pattern Matching (Naïve Algorithm)

void searchPattern(string text, string pattern)

{ int n = text.length(), m = pattern.length();

for(int i = 0; i <= n-m; i++) {

int j;
for(j = 0; j < m; j++) { if(text[i+j]

!= pattern[j]) break;

}
If (j == m) cout << "Pattern found at index " << i << endl;
}
}

3. Anagram Detection (checking if two strings contain the same characters)


bool isAnagram(string s1, string s2) {
if(s1.length() != s2.length()) return false;
sort(s1.begin(), s1.end());
sort(s2.begin(), s2.end());
return s1 == s2;

37
3.8. Linked Lists

Linked lists are one of the most fundamental linear data structures studied in Data Structures
and Algorithms. Unlike arrays, which store elements in contiguous memory locations, a
linked list is composed of nodes connected using pointers. Each node consists of two parts:

1. Data field – stores the actual data.


2. Pointer (or reference) – stores the address of the next node in the sequence.

This property makes linked lists dynamic in nature and highly flexible in terms of memory
usage.

Types of Linked Lists

1. Singly Linked List – Each node points to the next node; traversal is only possible in
one direction.
2. Doubly Linked List – Each node has two pointers: one pointing to the next node and
one to the previous node; allows bidirectional traversal.
3. Circular Linked List – The last node points back to the first node, forming a circular
chain.

Advantages over Arrays:

● Dynamic memory allocation – size can be increased/decreased at runtime.


● Efficient insertion/deletion – no need for shifting elements.
● Suitable for implementing stacks, queues, and adjacency lists in graphs.

Disadvantages:

● No direct access to elements (must traverse sequentially).


● Extra memory is required for pointers.

38
Common Operations on Linked Lists

1. Insertion
o At the beginning.
o At the end.
o At a specific position.
2. Deletion
o From the beginning.
o From the end.
o From a specific position.
3. Traversal – Iterating through all nodes to process data.
4. Reversal – Changing the links so the list points in the opposite direction

Important Algorithms and Problems

(i) Detecting a Cycle in a Linked List

Using Floyd’s Cycle Detection Algorithm (Tortoise and Hare Method):

bool hasCycle(Node* head)

{ Node* slow = head;

Node* fast = head;

while(fast != NULL && fast->next != NULL)

{ slow = slow->next;

fast = fast->next->next;

if(slow == fast) return true;

return false;

(ii) Reversing a Linked List

39
Node* reverseList(Node* head)

{ Node* prev = NULL;

40
Node* curr = head;

Node* next = NULL;

while(curr != NULL) {

next = curr->next;

curr->next = prev;

prev = curr;

curr = next;

return prev;

Fig. 3.5 Linked List

3.9. Stacks and Queues

Stacks and Queues are abstract data types (ADTs) built upon arrays or linked lists. They
form the basis of many algorithms and are widely applied in solving real-world problems,
compiler design, operating systems, and interview questions.

Both are linear data structures but differ in their order of element access:

● Stack: LIFO (Last In, First Out).


● Queue: FIFO (First In, First Out).

41
Stacks

A stack is a linear data structure that follows the LIFO principle, meaning the last element
inserted is the first one to be removed.

● Basic Operations:
o push(x) → insert an element at the top.
o pop() → remove the top element.
o peek() / top() → view the top element.
o isEmpty() → check if the stack is empty.

Implementation Methods

1. Array-based stack – Fixed size, simple to implement.


2. Linked list-based stack – Dynamic size, memory-efficient.
3. STL (C++ Standard Template Library) – stack<int> s;

Ex- Balanced Parentheses


bool isValid(string s) {

stack<char>st;

for(char ch : s) {

if(ch == '(' || ch == '{' || ch == '[')

{ st.push(ch);

} else {
if(st.empty()) return false;

char top = st.top(); st.pop();

if((ch == ')' && top != '(') ||


(ch == '}' && top != '{') ||
(ch == ']' && top != '[')) {

return false

42
return st.empty();

Queues

A queue is a linear data structure that follows the FIFO principle: elements are inserted
from the rear (enqueue) and removed from the front (dequeue).

● Basic Operations:
o enqueue(x) → insert element at rear.
o dequeue() → remove element from front.
o peek() / front() → get the rst element.
o isEmpty() → check if the queue is empty.

1. Simple Queue – Standard FIFO queue.


2. Circular Queue – Last position connects back to first, efficient memory use.
3. Deque (Double-Ended Queue) – Insertion/deletion allowed at both ends.
4. Priority Queue – Elements served based on priority instead of order.

Ex- Implementing a Queue using Array


class Queue {

int* arr;

int front, rear, size, capacity;

public:

Queue(int c)

{ capacity = c;

arr = new int[capacity];

front = size = 0;

rear = capacity - 1;

43
fi
bool isFull() { return size == capacity; }

bool isEmpty() { return size == 0; }

void enqueue(int x) {

if(isFull()) return;

rear = (rear + 1) % capacity;

arr[rear] = x;

size++;

void dequeue()

{ if(isEmpty())

return;

front = (front + 1) % capacity;

size--;

int getFront() { return isEmpty() ? -1 : arr[front]; }

};

Fig. 3.6 Stack and Queue

3.10. Recursion and Backtracking

Recursion and backtracking are fundamental concepts in algorithm design that help solve
complex problems by breaking them down into simpler subproblems. This module played a
44
crucial role in enhancing problem-solving and logical thinking skills during the training
program.

45
Recursion

Recursion is a programming technique where a function calls itself, either directly or


indirectly, to solve a problem. It is based on the principle of solving a larger problem by
reducing it into smaller subproblems of the same type.

Key Components of Recursion

1. Base Case → Condition under which the recursion stops.


2. Recursive Case → Function calls itself with smaller input.
3. Stack Memory → Each recursive call is stored in the system’s function call
stack.

Examples of Recursion

(i) Fibonacci Numbers


int fibonacci(int n)
{ if(n == 0) return 0;
if(n == 1) return 1;

return fibonacci(n - 1) + fibonacci(n - 2);


}

Advantages of Recursion

● Simplifies code for problems naturally defined recursively (trees, graphs).


● Easier to implement divide-and-conquer algorithms.

Disadvantages of Recursion

● Overhead of function calls (stack memory usage).


● Can lead to stack overflow if base case is missing.

Backtracking

Backtracking is a refined form of recursion where we explore all possible solutions by

46
making choices step by step, and when a choice leads to an invalid state, we backtrack and
try a different path.

47
It is often described as a trial-and-error approach with pruning.

Steps in Backtracking

1. Choose a solution step.


2. Recursively attempt to solve subproblems.
3. If a step leads to a dead end, backtrack (undo the step).
4. Continue exploring until all valid solutions are found.

Important Backtracking Problems

(i) N-Queens Problem

Fig. 3.7 N-Queen Code

(ii) Rat in a Maze Problem


Find a path for a rat from the start to the destination in a maze.

48
Fig. 3.8 Rat in a maze code

Applications of Recursion and Backtracking

● Recursion:
o Traversing trees and graphs.
o Divide-and-conquer algorithms (Merge Sort, Quick Sort).
o Mathematical problems (factorial, Fibonacci, GCD).
● Backtracking:
o Puzzle solving (Sudoku, N-Queens).
o Pathfinding (Maze problems).
o Word search and string permutations.

3.11. Sorting Algorithms

(i) Bubble Sort

● Repeatedly compares adjacent elements and swaps them if they are in the wrong
order.
● Time Complexity: O(n²).
● Space Complexity: O(1).

void bubbleSort(int arr[], int n)

{ for(int i = 0; i < n-1; i++) {

for(int j = 0; j < n-i-1; j++) {


49
if(arr[j] > arr[j+1]) swap(arr[j], arr[j+1]);

50
(ii) Insertion Sort

● Builds a sorted array one element at a time by inserting each element into its correct
position.
● Time Complexity: O(n²) (worst), O(n) (best, already sorted).
● Space Complexity: O(1).

(iii) Selection Sort

● Repeatedly finds the minimum element and places it at the beginning.


● Time Complexity: O(n²).
● Space Complexity: O(1).

(iv) Merge Sort (Divide and Conquer)

● Recursively divides the array into halves and merges them in sorted order.
● Time Complexity: O(n log n).
● Space Complexity: O(n).

(v) Quick Sort

● Uses partitioning around a pivot.


● Time Complexity: O(n log n) average, O(n²) worst.
● Space Complexity: O(log n).

51
Table no. 3.1 Time Complexities

Algorithm Time Complexity Space Complexity Best Use Case


Linear Search O(n) O(1) Small arrays,
unsorted data
Binary Search O(log n) O(1) Sorted arrays
Bubble Sort O(n²) O(1) Educational, very
small datasets
Insertion Sort O(n²) O(1) Small, nearly sorted
arrays
Merge Sort O(n log n) O(n) Large datasets, stable
sort

Quick Sort O(n log n) O(log n) General purpose


sorting

Counting Sort O(n+k) O(n+k) Integers within


limited range

52
4. Tools and Techniques Applied

Programming Language: C++ (preferred for DSA due to STL).

STL Components: Vectors, Sets, Maps, Queues, Stacks.

Problem-Solving Platforms: HackerBlocks, LeetCode, and in-class contests.

Algorithmic Paradigms: Divide and Conquer, Recursion, Backtracking, Greedy Approach.

Fig. 3.9 Container Types in Cpp

5. Results and Analysis

The completion of assignments, coding challenges, and practice problems during the Summer
Training Program provided measurable improvements in both conceptual understanding and
coding proficiency. The outcomes of the work undertaken can be summarized as follows:

3.5.1 Strengthened Understanding of Core DSA Concepts

● Successfully implemented fundamental data structures such as arrays, strings, linked


lists, stacks, queues, trees, and hash maps, gaining clarity on their real-world
applications.
● Developed the ability to choose the appropriate data structure based on the problem
constraints.

53
2. Improved Problem-Solving and Algorithmic Thinking

54
● Solved a wide range of problems on recursion, backtracking, searching, and sorting,
which enhanced logical reasoning and algorithm design skills.
● Learned to optimize brute-force approaches into efficient solutions by applying time
and space complexity analysis.

3.5.3 Coding Efficiency and Accuracy

● Significant improvement in coding speed and accuracy was observed while solving
assignments and participating in contests.
● Regular coding practice on platforms such as HackerBlocks enabled familiarity with
industry-level problem-solving standards.

3.5.4 Real-Time Debugging and Optimization Skills

● Developed the ability to identify logical errors and optimize code for better
performance.
● Learned practical techniques like using STL (Standard Template Library) for faster
implementation.

5. Application of DSA in Mini-Projects

● Implemented small-scale coding projects (such as maze-solving, stock span problem,


sorting visualizers, and linked list operations), which demonstrated the practical
applications of data structures.
● Backtracking-based problems like N-Queens and Rat in a Maze provided insights into
solving real-world search and optimization problems.

3.5.6 Analytical Insights

Comparative analysis of different algorithms (e.g., Merge Sort vs Quick Sort, Linear vs
Binary Search) reinforced the importance of algorithm selection in achieving efficiency.
Understood the trade-offs between time complexity, space complexity, and ease of
implementation.

55
Overall, the training provided a structured pathway from basic programming fundamentals to
advanced algorithmic problem-solving. The combination of theory, assignments, coding
contests, and projects resulted in:

Stronger coding confidence.


Readiness for competitive programming and technical interviews.
Practical exposure to solving problems similar to those encountered in the software industry.

56
CHAPTER -4

SKILLS ACQUIRED

4.1.Technical skills gained

One of the most significant outcomes of this training program was the enhancement of my
technical expertise in the domain of programming and data structures.

4.1.1.Proficiency in C++ Programming

● C++ was the primary language of instruction and implementation throughout the
training.
● I developed expertise in writing modular, efficient, and well-structured code.
● Learned advanced C++ concepts including:
o Dynamic memory allocation using new and delete.
o Object-oriented programming basics (classes, objects, constructors).
o Use of templates for generic programming.
● Gained fluency in applying the Standard Template Library (STL) to solve complex
problems efficiently:
o vector for dynamic arrays.
o map and unordered_map for frequency counting and lookups.
o set for maintaining unique elements.
o stack and queue for implementing standard problems like balanced parentheses
or sliding window maximum.

Example:
Instead of manually implementing a frequency counter using arrays, I used
unordered_map<int,int> to solve frequency-related problems in O(n) time. This not only
improved efficiency but also exposed me to industry-standard coding practices.

4.1.2.In-depth Knowledge of Data Structures

● Implemented fundamental data structures like arrays, strings, linked lists, stacks, and
queues.
57
● Explored non-linear data structures such as trees and heaps, which are essential in
real-world applications.

58
● Learned how different data structures are suited for different problem domains:
o Arrays for constant-time indexing.
o Linked lists for dynamic memory and efficient insertion/deletion.
o Stacks for parsing and backtracking problems.
o Queues for scheduling and simulations.
o Trees for hierarchical data and searching.
o Hashing for fast retrieval in O(1) average time.

Real-world insight: Databases and compilers make extensive use of these structures, so
learning them practically gave me a sense of how software systems are built at scale.

3. Algorithm Design and Analysis

● Gained a structured understanding of algorithm design paradigms, including:


o Divide and Conquer → Merge Sort, Quick Sort.
o Greedy Algorithms → Activity Selection Problem.
o Recursion and Backtracking → N-Queens, Rat in a Maze.
o Dynamic Programming (introductory) → Fibonacci, Knapsack.
● Learned asymptotic notations (Big-O, Big-Theta, Big-Omega) to analyze algorithm
efficiency.
● Understood trade-offs: A simple brute-force solution may be correct but inefficient,
while optimized algorithms save both time and resources.

4. Coding on Competitive Platforms

● Practiced extensively on Leetcode and HackerBlocks, which simulated the


environment of competitive coding.
● Learned to solve problems within strict time limits and test against multiple hidden
test cases.
● Improved debugging under pressure, which is critical for technical interviews.

4.2. Analytical and Problem-Solving Skills

The training emphasized logic, critical thinking, and optimization, making me a more
59
confident problem solver.

60
1. Algorithmic Thinking

● Developed the ability to break down large problems into smaller sub-problems.
● Learned systematic approaches: recursion for repetitive patterns, greedy when choices
matter, and dynamic programming for overlapping subproblems.

Example: In solving the Longest Increasing Subsequence (LIS), I first tried a brute-force
recursion (O(2^n)), then learned to optimize it with dynamic programming (O(n²)) and later
binary search (O(n log n)).

4.2.2 Optimization Mindset

● Learned not to stop after finding a working solution, but to continuously refine it.
● Compared different sorting algorithms (Bubble Sort, Merge Sort, Quick Sort) to
understand their efficiency.
● Understood that choosing the right algorithm and data structure makes the difference
between passing and failing time limits.

4.2.3. Debugging and Testing Skills

● Learned practical debugging strategies:


o Printing intermediate variables.
o Testing small inputs before scaling up.
o Using STL containers to simplify implementation and reduce bugs.
● Practiced writing test cases for edge conditions, like:
o Empty arrays.
o Single-element inputs.
o Very large inputs (performance testing).

4.2.4. Real-World Problem Solving

● Recognized how DSA concepts apply in real systems:


o Search Engines → Use of tries and hash tables.
o Operating Systems → Scheduling via queues.

61
o Databases → Indexing with trees and hash maps.
o Navigation Apps → Graph algorithms for shortest path.

62
CHAPTER -5

OBSERVATIONS AND LEARNING OUTCOMES

The Training Program on Data Structures and Algorithms (DSA) proved to be a highly
enriching and transformative experience. Throughout the duration of the training, I made
several observations regarding the structure of the program, the teaching methodology, the
practical problem-solving environment, and the peer learning culture. These observations
helped me identify areas of strength in the training as well as areas for self-improvement.

The program also resulted in multiple learning outcomes, both academic and professional,
that will benefit me in my future studies, competitive programming journey, and career in
software engineering.

1. Observations

5.1.1 Structured Curriculum and Progression

● The course was logically structured, beginning with fundamental programming


concepts in C++ before moving into advanced topics like recursion, linked lists, trees,
and hashing.
● Each module followed a step-by-step progression, which ensured conceptual clarity
before tackling complex problems.

5.1.2 Balanced Focus on Theory and Practice

● Observed that the training did not just emphasize theoretical lectures but placed equal
importance on coding exercises, assignments, and contests.
● This blend of conceptual teaching and practical application helped reinforce learning
effectively.

5.1.3 Mentorship and Guidance

● The role of the trainer, Mr. Karthik Mathur, was pivotal in simplifying complex
concepts through real-world analogies.
63
● His guidance during doubt-solving sessions and coding discussions helped me
understand alternate problem-solving approaches.

5.1.4 Peer Learning Environment

● Collaborative discussions with peers during coding challenges created a healthy


competitive atmosphere.
● Observed that working in groups exposed me to multiple perspectives and coding
styles, enhancing my learning.

5.1.5 Use of Tools and Platforms

● Practical assignments were frequently conducted on HackerBlocks, which provided a


real-time environment for coding contests.
● Observed how such platforms replicate industry-standard competitive environments,
building speed and accuracy.

5.1.6 Assignments and Projects as Reinforcement

● Small-scale projects and problem-solving tasks acted as practical reinforcements of


theoretical concepts.
● Observed that applying DSA concepts in tasks such as pathfinding, sorting visualizers,
and recursion-based puzzles increased my retention of the subject matter.

5.1.7 Progressive Improvement in Problem-Solving

● Initially, solving problems required more time and multiple attempts. However, with
regular practice and feedback, I observed significant improvement in speed, accuracy,
and confidence.

2. Learning Outcomes

The following learning outcomes were achieved as a result of the training program:
64
5.2.1 Conceptual Mastery of DSA

65
● Gained a strong understanding of fundamental and intermediate concepts in arrays,
strings, recursion, backtracking, linked lists, stacks, queues, and trees.
● Learned to analyze and compare algorithms in terms of time and space complexity.

5.2.2 Practical Coding Expertise

● Acquired hands-on experience in implementing data structures and algorithms in C++


using STL.
● Improved significantly in writing efficient, modular, and bug-free code.

5.2.3 Competitive Programming Readiness

● Developed the ability to solve problems under contest conditions.


● Enhanced my problem-solving pace and accuracy on competitive platforms like
HackerBlocks.

5.2.4 Critical and Analytical Thinking

● Learned how to break complex problems into smaller sub-problems.


● Acquired the skill of comparing multiple solution approaches and selecting the most
optimal one.

5.2.5 Professional and Soft Skills

● Improved collaboration and communication while working with peers.


● Learned to document solutions, explain algorithmic choices, and present them clearly.
● Enhanced time management and self-discipline by balancing lectures, practice
sessions, and assignments.

5.2.6 Application-Oriented Learning

● Understood how DSA concepts are applied in real-world domains, including:


o Search Engines (hashing, tries).
o Operating Systems (scheduling with queues).
o Databases (trees and indexing).
66
o Navigation Systems (graph algorithms).

67
CHAPTER -6

SUMMARY, CONCLUSION AND SUGGESTIONS

The Training Program on Data Structures and Algorithms (DSA) proved to be an invaluable
experience that combined classroom learning with hands-on practice. It provided an
opportunity to bridge the gap between theoretical knowledge gained during coursework and
its practical applications in real-world problem-solving.

Throughout the duration of the program, I was able to strengthen my programming


fundamentals, explore a wide variety of data structures and algorithms, and develop a
structured problem-solving mindset. In addition, I improved my collaborative and
professional skills, which are equally important in the industry.

This chapter presents a comprehensive summary of the training, the key conclusions drawn,
and suggestions for further improvement of such programs.

6.1 Summary of the overall learning experience

The training experience can be summarized under multiple dimensions:

6.1.1 Comprehensive Coverage of Core Concepts

● The curriculum covered fundamental to advanced DSA topics, starting with C++
basics and moving into arrays, strings, recursion, backtracking, linked lists, stacks,
queues, and trees.
● This structured progression ensured a smooth learning curve, where each new concept
was built on the previous one, reinforcing long-term understanding.
● Theoretical discussions were always tied to real-world applications, which made the
concepts easier to grasp and more meaningful.

6.1.2 Hands-on Implementation

● The training emphasized “learning by doing.” Almost every theoretical session was
followed by coding tasks.
68
● Assignments required direct implementation of data structures like linked lists,
queues, and stacks, ensuring that I did not just memorize the concepts but truly
understood them.
● For instance:
o Arrays were reinforced through problems on prefix sums, sliding windows,
and searching algorithms.
o Recursion was practiced using puzzles like the Tower of Hanoi, N-Queens, and
Maze Solver.
o Stacks and queues were applied in expression parsing, backtracking, and
scheduling tasks.

6.1.3 Competitive Programming Environment

● Coding contests on HackerBlocks simulated the environment of competitive


programming and technical interviews.
● These contests required me to solve multiple problems within a fixed time, teaching
me how to manage time under pressure.
● Over time, I observed improvement in my coding speed, debugging efficiency, and
ability to design optimized solutions.

6.1.4 Mentorship and Guidance

● Under the mentorship of Mr. Karthik Mathur, I experienced teaching that was clear,
insightful, and application-oriented.
● His explanations often connected abstract concepts with real-world use cases (e.g.,
queues in OS scheduling, trees in databases).
● His feedback during doubt-solving sessions encouraged independent thinking and
critical analysis.

6.1.5 Growth in Problem-Solving Ability

● Initially, I relied on brute-force approaches and took a lot of time to debug.


● As the training progressed, I learned to focus on optimization, edge-case handling,

69
and time complexity analysis.

70
● By the end, I could confidently solve intermediate-level problems and attempt
advanced ones with structured approaches.

6.1.6 Transformation Observed

● Before Training: My knowledge of DSA was limited to basic loops, arrays, and
simple algorithms. Coding speed was low, and optimization was minimal.
● After Training: I can now confidently implement multiple data structures, analyze
algorithm efficiency, and design solutions for real-world inspired problems.

6.2 Recommendations for Improving the Training Program

While the training was impactful and effective, a few improvements could make future
programs even more beneficial:

1. Extension of Duration
Certain topics like Graphs, Advanced Trees, and Dynamic Programming
require more time for in-depth coverage.
Extending the training duration or introducing a Part II advanced module
could strengthen learning further.
2. More Real-World Projects
While assignments were excellent for reinforcing concepts, larger mini-
projects (e.g., scheduling systems, file management simulators, or search
applications) would make the program more application-driven.
3. Periodic Assessments with Feedback
Weekly or bi-weekly assessments with detailed performance feedback
would help students track their improvement more systematically.
4. Team-Based Assignments
Group-based projects or contests could help students develop team
collaboration skills, mirroring real software development environments.
5. Industry Guest Lectures
Including sessions from industry experts who apply DSA in domains like
machine learning, big data, or software engineering would expose students

71
to career applications.
6. Advanced Competitive Practice

72
Introducing contests aligned with Codeforces or LeetCode difficulty levels
would prepare students for global-level competitive programming.

6.3 Scope for Further Skill Development

The program provided a strong foundation, but learning DSA is a continuous process. Areas
for further development include:

1. Advanced Topics in DSA


Graphs: Shortest path algorithms, spanning trees, and network flows.
Dynamic Programming: Knapsack, DP on trees, DP with bitmasking.
Advanced Trees: Segment trees, Fenwick trees (BIT), AVL trees.
2. System Design and Applications
Applying DSA knowledge to build scalable systems (e.g., recommendation
engines, caching systems, or indexing in databases).
3. Competitive Programming
Regular practice on Codeforces, AtCoder, and LeetCode to improve speed and
versatility.
4. Cross-Disciplinary Learning
Exploring connections between DSA and fields like Artificial Intelligence,
Operating Systems, and Cybersecurity to expand the scope of applications.

6.4 Conclusion

The Summer Training Program on Data Structures and Algorithms was not just a course, but
a holistic learning experience that strengthened my technical foundation, improved my
analytical skills, and enhanced my professional competencies.

● It provided me with the confidence to solve real-world problems using DSA concepts.
● It nurtured a problem-solving mindset that goes beyond academics into practical
applications.
● It prepared me for the next stages of my career, including competitive programming,
technical interviews, and professional development in software engineering.

73
In conclusion, the training successfully met its objectives by bridging the gap between theory
and practice. The skills and knowledge gained will remain an integral part of my academic
journey and professional growth.

74
BIBLIOGRAPHY

[1] Robert Lafore. (2002). Data Structures and Algorithms in C++. Sams Publishing.
[2] Coding Blocks. (2023). Official Training Programs & Course Material. Retrieved
from: https://codingblocks.com [visited on : 20/08/25]
[3] HackerBlocks (2023). Coding Practice Platform. Retrieved from:
https://hack.codingblocks.com [visited on : 20/08/25]
[4] GeeksforGeeks. (2023). Data Structures and Algorithms Tutorials. Retrieved from:
https://www.geeksforgeeks.org [visited on: 19/08/25]
[5] LeetCode. (2023). Programming Problems and Solutions. Retrieved from:
https://leetcode.com [visited on: 20/08/25]
[6] Codeforces. (2023). Competitive Programming Contests. Retrieved from:
https://codeforces.com [visited on: 19/08/25]
[7] C++ STL Documentation. (2023). C++ Standard Template Library Reference.
Retrieved from: https://en.cppreference.com [visited on : 2-/08/25]

75

You might also like