Professional Documents
Culture Documents
on
Submitted By
Registration Number:12013627
1|Page
DECLARATION
I hereby declare that I have completed my eight weeks summer training at GeeksforGeeks
platform from June to July under the guidance of MR. Sandeep Jain. I have worked with full
dedication during there 8 weeks of training and my learning outcomes fulfill the requirements
of training for the award of degree of B.tech. CSE, Lovely Professional University, Phagwara.
Shivshakti sharma
12013627
Date – 20 july2022
2|Page
ACKNOWLEDGEMENT
I would like to express my gratitude towards my University as well as Geeks for Geeks for
providing me the golden opportunity to do this wonderful summer training regarding DSA,
which also helped me in doing a lot of homework and learning. As a result, I came to know about
so many new things. So, I am really thank full to them.
Moreover, I would like to thank my friends who helped me a lot whenever I got stuck in some
problem related to my course. I am really thankful to have such a good support of them as they
always have my back whenever I need.
Also, I would like to mention the support system and consideration of my parents who have
always been there in my life to make me choose right thing and oppose the wrong. Without them
I could never had learned and became a person who I am now.
I have taken efforts in 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.
3|Page
Summer Training Certificate By Geeks for Geek:
4|Page
TABLE OF CONTENTS
1 Introduction 06
2 Technology Learnt 07 - 30
6 Conclusion 39
7 Bibliography 40
5|Page
6|Page
INTRODUCTION
DSA self-paced course is a complete package that helped me to learn Data Structures and
Algorithms from Basic to an Advance level. The course curriculum has been divided into 10
weeks, where I practiced questions and I have attempted the assessment tests accordingly. The
course offers a wealth of programming challenges that helped me to learn all about DSA and
making of an algorithm and how to solve problems and the logic behind the Algorithm.
The course was Self paced means I could join the course anytime and all the content will be
available to me once I get enrolled. There were video lectures to learn form and multiple-
choice questions to practice.
I learned Algorithmic techniques for solving various problems with full flexibility of time as I
was not time bounded.
This course does not require any prior knowledge of Data Structure and Algorithms, but a basic
knowledge of any programming language ( C++ ) will be helpful.
And as we all know Data Structure and Algorithm is a must skill in terms of Placement in any
company because it helps us to increase our problem solving skill.
7|Page
TECHNOLOGY LEARNT
It had 24 units which was further divided into chapters and then topics so during my
whole 8-week course I learned the following:
8|Page
using the array data structure. This page contains detailed tutorials on different
data structures (DS) with topic-wise problems
INTRODUCTION TO DSA
9|Page
• Analysis of Algorithm o in this I learned about background analysis through a
10 | P a g e
MATHEMATICS
11 | P a g e
• Quadratic Equations.
• Prime Numbers.
• Factorials
• Modular Arithmetic
BITMAGIC
Not
12 | P a g e
• Bitwise Operators in Java o Operation of AND,
RECURSION
• Introduction to Recursion
In recursion, a function or method has the ability to call itself to solve the
problem. The process of recursion involves solving a problem by turning it
into smaller varieties of itself. The process in which a function calls itself could
happen directly as well as indirectly. Recursion work in c++ programming:
• Applications of Recursion
13 | P a g e
•
ARRAYS
Types of Array
14 | P a g e
1. Fixed-sized array
2. Dynamic-sized array.
SEARCHING
The process of finding the desired information from the set of items stored
in the form of elements in the computer memory is referred to as
'searching in data structure'. These sets of items are in various forms,
such as an array, tree, graph, or linked list.
15 | P a g e
• Two Pointer Approach Problems
SORTING
16 | P a g e
• Implementation of C++ STL sort () function in Arrays and Vectors o
Time Complexities
• Sorting in c++
Algos
• Insertion Sort
• Merge Sort
• Quick Sort: Using Lomuto and Hoare o Time and Space analysis o Choice of
MATRIX
Matrix is a way to store data in an organized form in the form of rows and
columns. Matrices are usually used in computer graphics to project 3-
dimensional space onto a 2-dimensional screen. Matrices in the form of arrays
are used to store data in an organized form.
Uses:
- To represent class hierarchy using Boolean square matrix
- For data encryption and decryption
- To represent traffic flow and plumbing in a network
- To implement graph theory of node representation
17 | P a g e
• Introduction to Matrix in C++
• Multidimensional Matrix
• Transposing a matrix
• Rotating a Matrix
• Boundary Traversal
• Spiral Traversal
• Matrix Multiplication
HASHING
18 | P a g e
• Introduction and Time complexity analysis
• Application of Hashing
• Double Hashing
• C++
Unordered Set
Unordered Map
• Java
HashSet
HashMap
19 | P a g e
STRINGS
• Discussion of String DS
• Strings in CPP
• Strings in Java
• KMP Algorithm
LINKED
LIST
A linked list is a linear data structure, in which the elements are not stored
at contiguous memory locations
20 | P a g e
• Introduction Implementation in CPP.
Linked List
STACK
Stacks are a type of container adaptors with LIFO (Last in First
Out) type of working, where a new element is added at one end (top)
and an element is removed from that end only. Stack uses an
encapsulated object of either vector or deque (by default) or list
(sequential container class) as its underlying container, providing a
specific set of member functions to access its elements.
21 | P a g e
• Understanding the Stack data structure
• Applications of Stack
QUEUE
22 | P a g e
• Introduction and Application
• Implementation of the queue using array and LinkedList
23 | P a g e
DEQUE
Applications of deque
TREE
24 | P a g e
A tree is a nonlinear data structure, compared
to arrays, linked lists, stacks and queues which
are linear data structures. A tree can be empty
with no nodes or a tree is a structure
consisting of one node called the root and zero
or one or more subtrees.
• Introduction
25 | P a g e
•
Types of tree
• Binary tree. The binary tree is a type of tree data structure where every
parent node has a maximum of two child nodes.
...
• Binary Search Tree. These tree structures are non-linear and one node is
connected to a number of nodes. ...
• AVL Tree. The AVL trees are the types or variants of a binary tree. ...
• B-Tree
• Application
• Binary Tree
• Tree Traversal
• Implementation of:
• O In order Traversal
• o Preorder Traversal
• o Post order Traversal
• o Level Order Traversal (Line by Line)
• o Tree Traversal in Spiral Form
26 | P a g e
BINARY SEARCH TREE
• AVL Tree
HEAP
27 | P a g e
•
Build Heap
Heap Sort
GRAPH
28 | P a g e
• Introduction to Graph
Implementation in Java
29 | P a g e
•
in Java
• Kosaraju's Algorithm
• Articulation Point
• Bridges in Graph
• Tarjan’s Algorithm
GREEDY
30 | P a g e
BACKTRACKING
• Concepts of Backtracking
• Rat in a Maze
• N Queen Problem
DYNAMIC PROGRAMMING
31 | P a g e
•
• Dynamic Programming
• o Memorization
• o Tabulation
SEGMENT TREE
32 | P a g e
operations performed on a segment tree: Both range (i, j) and update take l o g ( n
) log(n) log(n) time, where n is the number of elements in the segment tree.
A Segment Tree can be built using recursion (bottom-up approach). Start with the
leaves and go up to the root and update the corresponding changes in the nodes that
are in the path from leaves to root. Leaves represent a single element.
• Construction
• Range Query
• Update Query
DISJOINT SET
33 | P a g e
•
• Union by Rank
• Path Compression
Kruskal's Algorithm
All of the above was part of my training during my summer break I specially choose the DSA
by Geeks for Geeks for reasons stated below:
• Data structure is a thing you need to know no matter in which language do you code.
• One need to learn how to make algorithm of a reallife problem he/she is facing.
34 | P a g e
• It had video lectures of all the topics from which one can easily learn. I prefer
learning from video rather than books and notes. I know books and notes and thesis
have their own significance but still video lecture or face to face lectures make it easy
to understand faster as we are involved Practically.
• This was a life time accessable course which I can use to learn even after my training
whenever I want to revise.
• Along with all these reasons one of the reasons was the Geeks for Geeks platform
which is offering the course because Geeks for Geeks is one of the best platforms for
Computer Science Students.
Week 1:
35 | P a g e
•
Week 2:
Week 3:
Week 4:
Week 5:
36 | P a g e
Day 2,3: Queue and Deque- - Introduction, implementation and operations using array
and linked list, few Questions, implement stack using queues and vice versa, Practice
Questions.
Day 4,5,6: Trees- Introduction and types of trees, Creation, Deletion, Insertion in a tree,
Binary trees and Practice Questions.
Day 7: Binary Search Trees- Trees- Introduction and properties of BST, Creation,
Searching, Deletion, Insertion in a BST, implementation of BST and Practice Questions.
Week 6:
Day 4,5,6,7: Graphs- Introduction to Graphs, properties, and representations, traverse the
graphs using BFS and DFS, detect cycles, find shortest paths, find strongly connected
components, etc. in a graph.
Practice Questions on BFS, DFS and all given algorithms.
Week 7:
Day 1,2: Greedy - Practice Questions related to different Greedy approaches given.
Day 3,4: Backtracking- Introduction, Rat in a maze, N Queen Problem, Suduko Problem.
Practice questions.
Week 8:
Day 2,3: Tries- Introduction to Tries, insert, search, delete, and updating in Tries, Practice
Questions.
37 | P a g e
•
Day 4,5: Segment Trees (Basic Level)- Introduction to Segment Trees and when to use
them, applying segment-trees in questions, Practice Questions.
Day 6,7: Disjoint Set- Introduction to DSU, Union by Rank and Path Compression,
Kruskal's algorithm, Practice Questions.
38 | P a g e
39 | P a g e
LEARNING OUTCOMES FROM TRAINING/TECHNOLOGY
LEARNT
For example, if we have to search our roll number in 2000 pages of Document how would we
do that?
• We can try another method in which we can directly go to page no. 1000 and we can
see if our roll no. is there or not if not we can move ahead and by repeating this and
eliminating we can search our roll no. in no time.
I have learnt a vast number of topics like Trees, Graphs, Linked Lists, Arrays, etc. I
understood their basics, there working, there implementation, and their practical use in the
problems we face while we solve a problem using coding.
40 | P a g e
When we work in IT sector (Software or Programing part to be specific) we need to solve the
problems and make programs write tons of code which will help us with the given problem
and to write a program one need to make different algorithms. Many algorithms combine to
make a program. Now, algorithm are written in some languages but they are not dependent
ton them, one need to make a plan and algo first then write it into any language whether i tis
C++ or JAVA or C or any other programing language. Algorithm is based on data structure
and its implementation and working. So, basically one need to have a good grip on DSA to
work in programing sector.
When you ask someone to make a decision for something the good one will be able to tell
you “I chose to do X because it’s better than A, B in these ways. I could have gone with C,
but I felt this was a better choice because of this “. In our daily life, we always go with that
person who can complete the task in a short amount of time with efficiency and using fewer
resources. The same things happen with these companies. The problem faced by these
companies is much harder and at a much larger scale. Software developers also have to make
the right decisions when it comes to solving the problems of these companies. Knowledge of
data structures like Hash Tables, Trees, Tries, Graphs, and various algorithms goes a long
way in solving these problems efficiently and the interviewers are more interested in seeing
how candidates use these tools to solve a problem.
I learned about how to break a problem into pieces and then find the solution then how to
maket he desired algorithm which will help me to solve my respective problem.
41 | P a g e
What I Learned from the course precisely:
This will help me during my career as a programmer and afterwards also whenever I need to
code. We are surrounded by a lot of real-world complex problems for which no one has the
solution. Observe the problems in-depth and you can help this world giving the solution
which no one has given before.
42 | P a g e
CONCLUSION.
a data structure is a data organization, management, and storage format that enables
efficient access and modification. More precisely, a data structure is a collection of data
values, the relationships among them, and the functions or operations that can be applied to
the data, i.e., it is algebraic expression about data.
Data structures are generally based on the ability of a computer to fetch and store data
at any place in its memory, specified by a pointer—a bit string, representing a memory
address, that can be itself stored in memory and manipulated by the program. Thus, the
array and record data structures are based on computing the addresses of data items
with arithmetic operations, while the linked data structures are based on storing
addresses of data items within the structure itself.
The implementation of a data structure usually requires writing a set of procedures that
create and manipulate instances of that structure. The efficiency of a data structure cannot
be analyzed separately from those operations. This observation motivates the theoretical
concept of an abstract data type, a data structure that is defined indirectly by the
operations that may be performed on it, and the mathematical properties of those operations
(including their space and time cost).
The course was Self placed means I could join the course anytime and all the content will be
available to me once I get enrolled. There were video lectures to learn form and multiple-
choice questions to practice.
I learned Algorithmic techniques for solving various problems with full flexibility of time as
I was not time bounded.
This course does not require any prior knowledge of Data Structure and Algorithms, but a
basic knowledge of any programming language (C++) will be helpful.
And as we all know Data Structure and Algorithm is a must skill in terms of Placement in
any company because it helps us to increase our problem-solving skill.
43 | P a g e
BIBLIOGRAPHY
• YouTube
44 | P a g e
Project
N-Queen Visualiser
45 | P a g e
Code
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"
/>
<title>N-Queen-Visualiser</title>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
/>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header class="header">
<h2>
N-Queens Visualiser <i class="fas fa-crown" style="color:
#fdfffc"></i>
</h2>
</header>
<div class="n-queen">
<div class="inputbox">
<input type="number" class="numberbox" id="numberbox" required />
<label>Enter total Queens</label>
</div>
<div class="slider-container">
<input
class="slider"
id="slider"
type="range"
min="0"
max="100"
value="60"
/>
<div id="progress-bar"></div>
</div>
<button class="play-button" id="play-button">
<i class="fa fa-play" aria-hidden="true"></i> Play
</button>
</div>
46 | P a g e
<div class="queen-arrangement" id="queen-arrangement"></div>
<div id="n-queen-board"></div>
<script src="app.js"></script>
</body>
</html>
CSS:
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
}
.header {
position: relative;
top: -20px;
width: 100%;
background-color: #011627;
color: #fdfffc;
}
.header h2 {
padding: 0.5em;
}
div.n-queen {
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
width: 70%;
max-width: 450px;
/* border: 1px solid red; */
}
.inputbox {
position: relative;
top: 1.5em;
bottom: 2em;
}
47 | P a g e
.numberbox {
width: 100%;
font-size: 14px;
padding: 4px;
border: none;
border-bottom: 2px solid #2ec4b6;
outline: none;
background: transparent;
}
.inputbox label {
position: absolute;
top: 4px;
left: 0px;
color: #2ec4b6;
font-size: 14px;
pointer-events: none;
transition: 0.3s;
}
.slider-container {
position: absolute;
left: 5%;
width: 90%;
/* text-align: center; */
margin: 0 auto;
top: 4em;
/* border: 2px solid red; */
}
.slider {
-webkit-appearance: none;
width: 100%;
margin: 0 auto;
height: 7px;
border-radius: 7px;
background: linear-gradient(90deg, #e8eddf 60%, #e8eddf 60%);
outline: none;
}
.slider::after {
48 | P a g e
content: "SLOW";
position: absolute;
top: -10px;
font-size: 14px;
font-weight: 500;
color: #fa7921;
}
.slider::before {
content: "FAST";
position: absolute;
top: -10px;
right: 0px;
font-size: 14px;
font-weight: 500;
color: #fa7921;
}
/* Google chrome */
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
position: relative;
top: -2px;
cursor: pointer;
background-color: #fa7921;
border-radius: 50%;
z-index: 2;
}
.slider::-webkit-slider-runnable-track {
-webkit-appearance: none;
height: 15px;
width: 15px;
z-index: 1;
color: #ffba08;
}
/* Mozilla firefox */
.slider::-moz-range-thumb {
width: 20px;
height: 20px;
background-color: #fa7921;
cursor: pointer;
position: relative;
top: -2px;
border-radius: 50%;
z-index: 2;
49 | P a g e
}
.slider::-webkit-slider-thumb:hover {
box-shadow: 0 0 0 2px white, 0 0 0 4px #fa7921;
}
#progress-bar {
width: 60%;
height: 7px;
background: #ffd200;
border-radius: 7px;
position: absolute;
top: 7px;
}
.play-button {
position: relative;
top: 80px;
left: 35%;
border: none;
outline: none;
color: #fdfffc;
width: 80px;
height: 35px;
background-color: #f72585;
border-radius: 10px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease-in-out;
/* z-index: 1; */
}
.play-button:hover {
opacity: 0.8;
transform: scale(1.05);
}
.queen-arrangement {
position: relative;
top: 140px;
text-align: center;
font-size: 18px;
font-weight: 500;
color: #247ba0;
}
#n-queen-board {
position: relative;
50 | P a g e
display: flex;
width: 80%;
top: 150px;
margin: 0 auto;
flex-wrap: wrap;
justify-content: center;
}
#n-queen-board div {
position: relative;
display: flex;
justify-content: center;
flex-direction: column;
margin: 0 10px;
box-shadow: 0 4px 8px 0 rgb(0, 0, 0, 0.2);
border-radius: 3px;
bottom: 10px;
}
table {
position: relative;
border-collapse: collapse;
margin: -10px 10px;
padding: 10px;
margin-bottom: 10px;
align-self: center;
}
td {
width: 35px;
height: 35px;
text-align: center;
}
h4 {
position: relative;
top: -5px;
padding: 8px;
width: 95%;
background-color: #0582ca;
align-self: center;
color: #fdfffc;
text-align: center;
border-radius: 4px 4px 0 0;
}
51 | P a g e
JS:
'use strict'
const numberbox = document.getElementById("numberbox");
const slider = document.getElementById("slider");
const progressBar = document.getElementById("progress-bar")
const playButton = document.getElementById('play-button');
const pauseButton = document.getElementById("pause-button");
class Queen {
constructor() {
this.position = Object.assign({}, pos);
// this.Board = 0;
this.uuid = [];
}
52 | P a g e
//Setting the current box color to orange
const table = document.getElementById(`table-
${this.uuid[board]}`);
const currentRow = table.firstChild.childNodes[r];
const currentColumn = currentRow.getElementsByTagName("td")[col];
currentColumn.innerHTML = queen;
// currentColumn.style.backgroundColor = "#FF9F1C";
await q.delay();
if (value == queen) {
column.style.backgroundColor = "#FB5607";
currentColumn.innerHTML = "-"
return false;
}
column.style.backgroundColor = "#ffca3a";
await q.delay();
}
if (value == queen) {
column.style.backgroundColor = "#fb5607";
currentColumn.innerHTML = "-"
return false;
}
column.style.backgroundColor = "#ffca3a";
await q.delay();
}
if (value == queen) {
column.style.backgroundColor = "#FB5607";
53 | P a g e
currentColumn.innerHTML = "-"
return false;
}
column.style.backgroundColor = "#ffca3a";
await q.delay();
}
return true;
}
54 | P a g e
let table = document.getElementById(`table-
${this.uuid[board]}`);
let row = table.firstChild.childNodes[r];
row.getElementsByTagName("td")[i].innerHTML = queen;
this.position[board][r] = i;
await q.delay();
board = Board;
// console.log(this.Board)
table = document.getElementById(`table-
${this.uuid[board]}`);
// console.log(JSON.parse(JSON.stringify(table)));
row = table.firstChild.childNodes[r];
row.getElementsByTagName("td")[i].innerHTML = "-";
delete this.position[`${board}`][`${r}`];
}
}
}
}
n = numberbox.value;
q = new Queen();
if (n > 8) {
numberbox.value = "";
alert("Queen value is too large");
return;
} else if (n < 1) {
numberbox.value = "";
alert("Queen value is too small");
return;
}
55 | P a g e
const para = document.createElement("p");
para.setAttribute("class", "queen-info");
para.innerHTML = `For ${n}x${n} board, ${array[n] - 1} arrangements
are possible.`;
arrangement.appendChild(para);
56 | P a g e
57 | P a g e
58 | P a g e
59 | P a g e