SUMMER TRAINING REPORT
ON
CSE443
Submitted in partial fulfillment of the requirements for the award of a degree of
B.tech
( Computer Science & Engineering)
Submitted to
LOVELY PROFESSIONAL UNIVERSITY,PUNJAB
From 05/06/2024 to 20/07/2024
SUBMITTED BY
Name of student: Manoranjan Sahoo
Registration Number:12219036
Summer Training Certificate
ACKNOWLEDGEMENT
I would like to express my gratitude to Lovely Professional University for providing me
with the golden opportunity to attend this wonderful summer training program PEP class
focused on Competitive Programming. This program also helped me complete a lot of
homework and learning tasks, allowing me to discover many new concepts. I am truly
thankful to them for this experience.
I have put in significant effort toward this project; however, it would not have been
possible without the kind support and help of many individuals and organizations. I would
like to extend my sincere thanks to all of them.
A special thank you to our trainer, Rakesh sir , for her guidance, monitoring, and constant
encouragement, as well as for meticulously correcting our assignments with great attention
and care. She took the time to go through the project and training sessions, making
necessary corrections whenever needed, and for that, we are very grateful.
Table of Contents
1. Basic Concepts
Data Structures: Definition, Importance
Algorithms: Definition, Importance
Complexity Analysis: Time and Space Complexity
Big O Notation: Best, Worst, and Average Case
2. Data Structures
Primitive Data Structures
o Integer, Float, Character, Boolean
Non-Primitive Data Structures
o Arrays
o Linked Lists
o Stacks
o Queues
o Trees
o Graphs
o Hash Tables
o Heaps
o Sets
o Matrices
3. Advanced Data Structures
Binary Trees
Binary Search Trees (BST)
AVL Trees
B-Trees
Red-Black Trees
Trie
Segment Trees
Fenwick Trees (Binary Indexed Tree)
4. Algorithm Types
Searching Algorithms
o Linear Search
o Binary Search
o Depth First Search (DFS)
o Breadth First Search (BFS)
Sorting Algorithms
o Bubble Sort
o Selection Sort
o Insertion Sort
o Merge Sort
o Quick Sort
o Heap Sort
o Counting Sort
o Radix Sort
Dynamic Programming
o Memorization
o Tabulation
Greedy Algorithms
Divide and Conquer
Backtracking
Branch and Bound
5. Graph Algorithms
Dijkstra’s Algorithm
Bellman-Ford Algorithm
Floyd-Warshall Algorithm
Kruskal’s Algorithm
Prim’s Algorithm
Topological Sorting
Shortest Path Algorithms
Minimum Spanning Tree (MST)
6. String Algorithms
Knuth-Morris-Pratt (KMP)
Rabin-Karp Algorithm
Z Algorithm
Trie-Based Search
7. Mathematical Algorithms
Greatest Common Divisor (GCD)
Least Common Multiple (LCM)
Sieve of Eratosthenes
Modular Arithmetic
Exponentiation by Squaring
8. Miscellaneous Algorithms
Union-Find
Kruskal’s Algorithm
Topological Sorting
Flood Fill Algorithm
9. Advanced Topics
Amortized Analysis
NP-Completeness
P vs NP Problem
Approximation Algorithms
Randomized Algorithms
Parallel Algorithms
10. Practical Applications
Real-World Examples: Applications of DSA in different fields like databases,
networking, operating systems, etc
1. Basic Concepts
1.1 Introduction
Data Structures and Algorithms (DSA) are fundamental topics in computer science that form
the backbone of software development and problem-solving. Understanding these concepts is
crucial for designing efficient and effective software systems.
1.2 Data Structures
1.2.1 Definition
A data structure is a particular way of organizing and storing data in a computer so that it can
be accessed and modified efficiently. Data structures provide a means to manage large
amounts of data, such as databases or internet indexing services.
1.2.2 Importance
Data structures are essential for managing large datasets, optimizing code performance, and
ensuring that operations such as searching, sorting, and data retrieval are efficient. Choosing
the right data structure can significantly affect the performance and scalability of an
application.
1.3 Algorithms
1.3.1 Definition
An algorithm is a step-by-step procedure or formula for solving a problem. Algorithms are the
essence of computing, as they define the exact sequence of operations required to achieve a
particular outcome.
1.3.2 Importance
Algorithms are critical for solving computational problems efficiently. By using the right
algorithm, developers can optimize the performance of their applications, reduce execution
time, and ensure that resources are used effectively.
1.4 Complexity Analysis
1.4.1 Time Complexity
Time complexity is a computational complexity that describes the amount of time it takes to
run an algorithm. It is usually expressed in terms of Big O notation (e.g., O(n), O(log n)),
which describes the upper bound of the algorithm's running time based on the input size.
Best Case: The scenario where the algorithm performs the minimum number of
operations.
Worst Case: The scenario where the algorithm performs the maximum number of
operations.
Average Case: The expected number of operations considering all possible inputs.
1.4.2 Space Complexity
Space complexity refers to the amount of memory an algorithm requires to execute, as a
function of the input size. Like time complexity, it is also expressed using Big O notation.
Auxiliary Space: The extra space or temporary space used by an algorithm, excluding
the input data.
1.5 Big O Notation
1.5.1 Definition
Big O Notation is a mathematical notation used to describe the upper limit of an algorithm's
complexity. It gives an upper bound on the time or space required by an algorithm as a
function of the input size, helping to understand the algorithm's efficiency.
1.5.2 Common Big O Notations
O(1): Constant time complexity – the operation does not depend on the size of the
input.
O(n): Linear time complexity – the operation's time grows linearly with the size of the
input.
O(log n): Logarithmic time complexity – the operation's time grows logarithmically
with the size of the input.
O(n^2): Quadratic time complexity – the operation's time grows quadratically with the
size of the input.
Understanding the basic concepts of Data Structures and Algorithms, including complexity
analysis and Big O notation, is essential for designing efficient software systems. These
concepts provide a foundation for tackling more advanced topics and real-world problems in
computer science.
2. Data Structures
2.1 Definition
A data structure is a systematic way of organizing and storing data in a computer so that it can
be accessed and modified efficiently. Different types of data structures are suited to different
kinds of applications, and some are highly specialized to specific tasks.
2.2 Importance
Data structures are essential because they are the foundation for creating efficient algorithms.
Proper data structuring can reduce time complexity and memory usage, which is crucial in
building scalable applications. The right choice of data structure can lead to substantial
improvements in performance and resource utilization.
2.3 Primitive Data Structures
Primitive data structures are the most basic types of data structures, which are directly
supported by the programming language. These include:
Integer: Represents whole numbers.
Float: Represents real numbers with fractional parts.
Character: Represents a single character, like a letter or number.
Boolean: Represents two possible values: true or false.
2.4 Non-Primitive Data Structures
Non-primitive data structures are more complex and are built upon primitive data types. They
include:
2.4.1 Linear Data Structures
Arrays: A collection of elements of the same type stored in contiguous memory
locations.
Linked Lists: A sequence of elements, where each element points to the next one,
allowing for efficient insertion and deletion.
Stacks: Follows Last In, First Out (LIFO) principle, used in functions like undo
mechanisms.
Queues: Follows First In, First Out (FIFO) principle, used in scheduling tasks.
2.4.2 Non-Linear Data Structures
Trees: A hierarchical structure with nodes connected by edges. Binary Trees, AVL
Trees, and B-Trees are common types.
Graphs: A set of nodes connected by edges, used to model networks.
Hash Tables: Maps keys to values using a hash function, allowing for fast data
retrieval.
Heaps: A specialized tree-based structure that satisfies the heap property, used in
priority queues.
3. Algorithms
3.1 Definition
An algorithm is a set of well-defined instructions or a step-by-step procedure to solve a
particular problem. Algorithms are fundamental in computer science, as they provide the
logical sequence of steps required to perform computations.
3.2 Importance
Algorithms are critical for ensuring that software functions efficiently. By optimizing
algorithms, developers can reduce the time and space required to process data, leading to
faster and more responsive applications.
4. Complexity Analysis
4.1 Time Complexity
Time complexity measures the amount of time an algorithm takes to complete as a function of
the input size. It helps determine the efficiency of an algorithm. The different scenarios
include:
Best Case: The minimal time an algorithm requires.
Worst Case: The maximum time an algorithm might take.
Average Case: The expected time considering all possible inputs.
4.2 Space Complexity
Space complexity measures the amount of memory an algorithm uses as a function of the
input size. It includes:
Auxiliary Space: The extra space an algorithm uses apart from the input data.
4.3 Big O Notation
Big O Notation is used to describe the upper bound of an algorithm's time or space
complexity. It helps in analyzing the performance of algorithms and includes common
notations such as:
O(1): Constant time complexity.
O(n): Linear time complexity.
O(log n): Logarithmic time complexity.
O(n^2): Quadratic time complexity.
5. Data Structures in Detail
5.1 Arrays
An array is a collection of elements of the same type stored in contiguous memory locations.
It allows for efficient data retrieval using indexing but is limited by its fixed size.
5.2 Linked Lists
A linked list is a sequence of elements where each element (node) points to the next. It allows
for efficient insertion and deletion, especially when the size of the data set is dynamic.
5.3 Stacks
A stack is a collection that follows the Last In, First Out (LIFO) principle. It is used in
scenarios where the most recently added element must be accessed first, such as in undo
operations or expression evaluation.
5.4 Queues
A queue is a collection that follows the First In, First Out (FIFO) principle. It is used in
scenarios where the first added element must be accessed first, such as task scheduling or
buffering.
5.5 Trees
Trees are hierarchical data structures with nodes connected by edges. The root node is the
starting point, and each node can have multiple children. Trees are used in databases, file
systems, and for representing hierarchical data.
Binary Trees: Each node has at most two children.
Binary Search Trees (BST): A binary tree with a specific ordering property.
AVL Trees: A self-balancing binary search tree.
B-Trees: Used in databases and file systems for efficient searching.
5.6 Graphs
Graphs consist of nodes (vertices) and edges connecting them. Graphs are used to model
networks, such as social networks, computer networks, or transportation systems.
Directed Graphs: Edges have a direction, indicating a one-way relationship.
Undirected Graphs: Edges do not have a direction, indicating a two-way relationship.
Weighted Graphs: Edges have weights, representing the cost or distance between
nodes.
5.7 Hash Tables
Hash tables store key-value pairs and use a hash function to compute an index into an array of
buckets or slots. This allows for fast data retrieval, with collision handling mechanisms like
chaining or open addressing.
5.8 Heaps
Heaps are specialized tree-based structures that satisfy the heap property, where the parent
node is always greater than or equal to its children in a max heap, or less than or equal to its
children in a min heap. Heaps are used in implementing priority queues.
6. Algorithm Types
6.1 Searching Algorithms
Searching algorithms are used to find an element within a data structure.
Linear Search: Iterates through each element until the desired one is found.
Binary Search: Efficiently finds an element in a sorted array by repeatedly dividing
the search interval in half.
6.2 Sorting Algorithms
Sorting algorithms arrange the elements of a data structure in a particular order.
Bubble Sort: Repeatedly swaps adjacent elements if they are in the wrong order.
Merge Sort: Divides the array into halves, sorts them, and then merges them.
Quick Sort: Picks a pivot element and partitions the array around it.
6.3 Dynamic Programming
Dynamic programming solves problems by breaking them down into smaller subproblems
and storing the results to avoid redundant calculations.
Memorization: Stores the results of expensive function calls.
Tabulation: Builds a table to solve subproblems in a bottom-up manner.
6.4 Greedy Algorithms
Greedy algorithms make a series of choices, each of which looks the best at the moment,
hoping that these local choices lead to a global optimum.
6.5 Divide and Conquer
Divide and Conquer algorithms break a problem into smaller subproblems, solve each
subproblem recursively, and then combine the results.
6.6 Backtracking
Backtracking algorithms explore all possible solutions by building a solution incrementally
and abandoning solutions that fail to satisfy the constraints.
6.7 Branch and Bound
Branch and Bound is an algorithm design paradigm for solving combinatorial optimization
problems, using bounding techniques to reduce the number of possible solutions.
7. Graph Algorithms
7.1 Dijkstra’s Algorithm
Dijkstra's algorithm finds the shortest path between nodes in a graph, typically used for
routing and navigation.
7.2 Bellman-Ford Algorithm
The Bellman-Ford algorithm also finds the shortest path but can handle graphs with negative
weights, unlike Dijkstra's algorithm.
7.3 Floyd-Warshall Algorithm
The Floyd-Warshall algorithm finds the shortest paths between all pairs of nodes in a graph.
7.4 Kruskal’s Algorithm
Kruskal’s algorithm finds the minimum spanning tree (MST) for a connected, undirected
graph.
7.5 Prim’s Algorithm
Prim’s algorithm also finds the MST but grows the tree by adding the nearest vertex to the
current tree.
7.6 Topological Sorting
Topological sorting arranges the nodes in a directed acyclic graph (DAG) such that for every
directed edge uv, vertex u comes before v.
8. String Algorithms
8.1 Knuth-Morris-Pratt (KMP) Algorithm
The KMP algorithm is an efficient string searching algorithm that avoids redundant
comparisons.
8.2 Rabin-Karp Algorithm
The Rabin-Karp algorithm uses hashing to search for a pattern in a string.
8.3 Z Algorithm
The Z algorithm is used to find all occurrences of a pattern in a string in linear time.
8.4 Trie-Based Search
A Trie is a tree-like data structure used for efficient retrieval of strings, often used in
applications like autocomplete and spell checking
About MONGO DB COURCE:
We also followed a structured methodology introduction to Mongo DB for our Summer
training by Mongo DB university.
Which starts from
Intro to MongoDB This unit gives an overview of MongoDB fundamentals, from the
document model to CRUD operations to indexing, that you will learn during the
Introduction to MongoDB course.
Getting Started with MongoDB Atlas Learn about MongoDB Atlas, our multi-cloud
developer data platform, its latest features, and how to deploy your first cluster.
MongoDB and the Document Model Want to learn more about MongoDB and the
document model? In this unit, you’ll learn how to manage MongoDB databases,
collections, and documents.
Connecting to a MongoDB Database Learn how to connect to MongoDB databases by
using connection strings. Connection strings allow you to connect your cluster with the
mongo shell, with Compass (our GUI that enables querying, optimizing and analyzing
MongoDB data), and to an application.
MongoDB CRUD Operations: Insert and Find DocumentsLearn how to create, find, and
query MongoDB documents in the mongo shell.
MongoDB CRUD Operations: Replace and Delete Documents Learn how to replace
and delete documents in the mongo shell. .
About Project:
Apna Rooms: (A Pg Booking Website) Used regularly by over 5,000 students to find
the perfect PG Developed a PG booking platform for LPU students.
Used JavaScript, HTML, CSS, and Passport.
I collected detailed listings for nearly 100 buildings.
Include prices, descriptions, locations, owner contacts, and Google Map links.
Allows users to log in and leave reviews. helped students find ideal accommodations
and boost bookings by 40%
Used *Merge sort*(DSA ALGO) to list the rooms in ascending order in order to help
students in finding the best option at the best price.
Idea for the project:
During my first stay outside the university for two months, I realized how challenging it
can be to find a good room. The endless searching in the heat and cold to find the
perfect place was exhausting. From that moment, I decided to create a website that
would list all the PG accommodations near LPU.
After a lot of hard work collecting information, photos, and prices for nearly 100
buildings, I am excited to introduce apnarooms.tech. This website provides detailed
listings, including prices, descriptions, locations, owner contacts, and even exact Google
Map locations, making it easier for you to find the right room.
I hope this website will be a valuable resource for you all. You can also log in to leave
reviews about the PGs you've stayed in, helping other students make informed
decisions.
If you encounter any issues or have suggestions for improvement, please don't hesitate
to contact me using the number provided in the footer. The website is public in my
repository, and I welcome contributions. You can find the repo at
https://lnkd.in/guXqnaUq.
GitHub link: https://github.com/Manoranjanhere/ApnaRooms
Project Link: https://apnarooms.tech
GitHub link: https://github.com/Manoranjanhere/ApnaRooms
Project Link: https://apnarooms.tech
GitHub link: https://github.com/Manoranjanhere/ApnaRooms
Project Link: https://apnarooms.tech