Final Dsal Lab Manual 2023 24 Sem II
Final Dsal Lab Manual 2023 24 Sem II
LAB MANUAL
SEM-II
Prepared by
PROF. ANAND GHARU
2023 - 24
Mumbai Education Trust
INSTITUTE OF ENGINEERING, NASHIK.
INDEX Batch : -
Sr. Page Date of Date of Sign of
Title
No No Conduction Submission Staff
GROUP - A
1 A-1 Consider telephone book database of N clients.
Make use of a hash table implementation to quickly
Don’t take
look up client‘s telephone number. Make use of two
print of
collision handling techniques and compare them using index for
number of comparisons required to find a set of DSAL File
telephone numbers
GROUP - B
B-5 A book consists of chapters, chapters consist of
sections and sections consist of subsections. Construct
3
a tree and print the nodes. Find the time and space
requirements of your method
GROUP - C
C-13 Represent a given graph using adjacency
6 matrix/list to perform DFS and using adjacency list to
perform BFS. Use the map of the area around the
college as the graph. Identify the prominent land marks
GROUP - D
D-18 Given sequence k = k1 <k2 < … <kn of n sorted
keys, with a search probability pi for each key ki .
8
Build the Binary search tree that has the least search
cost given the access probability for each key?
GROUP - E
E-22 Read the marks obtained by students of second
year in an online examination of particular subject.
10 Find out maximum and minimum marks obtained in
that subject. Use heap data structure. Analyze the
algorithm.
GROUP - F
F-23 Department maintains a student information. The
11 file contains roll number, name, division and address.
Allow user to add, delete information of student.
GROUP - A
SE Computer Engineering 2019 Pattern Data Structure Algorithm Lab (DSAL)
Objectives :
To understand concept of Hashing
To understand to find collision using hash function.
To understand and implement collision handing techniques
Problem Statement: -
Consider telephone book database of N clients. Make use of a hash table implementation to quickly look
up client‘s telephone number. Make use of two collision handling techniques and compare them using
number of comparisons required to find a set of telephone numbers
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source Python, Programming tool like Jupyter
Notebook, Pycharm, Spyder, G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Definitions :
Hashing :
Hash table :
Hash function :
Collision :
Probe, Load factor, Rehashing etc.
Introduction of Hashing :
What is Hashing?
What is a hash Key?
How Hashing Works?
Advantages of Hashing
Limitation/Disadvantages of Hashing
Applications of Hashing.
Hash Function: (with types of all hash function methods with examples)
Hash table (with its operations and example)
Collision resolution (handling techniques) : (Definition, Types, Explanation with advantages,
Disadvantages and Examples for each hashing techniques with step by step solution, time
complexity).
Algorithm:
Flowchart :
Conclusion:
Thus, We have successfully implemented hash table with different collision handling techniques.
Objectives :
To understand the concepts of set
To understand ADT for Set
To understand and implement ADT for Set operation
Problem Statement: -
To create ADT that implement the "set" concept. a. Add (new Element) -Place a value into the set , b.
Remove (element) Remove the value c. Contains (element) Return true if element is in collection, d.
Size () Return number of values in collection Iterator () Return an iterator used to loop over collection,
e. Intersection of two sets , f. Union of two sets, g. Difference between two sets, h. Subset
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source Python, Programming tool like Jupyter
Notebook, Pycharm, Spyder, G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Concept of ADT in details.
Explain set operation(all) with an examples
Algorithm:
Flowchart :
Conclusion:
Thus, We have successfully implemented SET Concepts(ADT).
GROUP - B
SE Computer Engineering 2019 Pattern Data Structure Algorithm Lab (DSAL)
Objectives :
To understand concept of tree data structure
To understand concept & features of object oriented programming.
Problem Statement: -
A book consists of chapters, chapters consist of sections and sections consist of subsections. Construct a
tree and print the nodes. Find the time and space requirements of your method.
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
State all terminologies of tree
Concept of tree in details (with advantages, Limitation, applications and example)
Algorithm:
Flowchart :
Conclusion:
Thus, We have successfully implement tree data structure.
Objectives :
To understand concept of tree data structure
To understand concept & features of object oriented programming.
Problem Statement: -
Beginning with an empty binary search tree, Construct binary search tree by inserting the values in the
order given. After constructing a binary tree - i. Insert new node, ii. Find number of nodes in longest
path from root, iii. Minimum data value found in the tree, iv. Change a tree so that the roles of the left
and right pointers are swapped at every node, v. Search a value.
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Introduction of Binary Search Tree : (Definition, Concepts(Working) or algorithms,
Operations of BST, advantages, Limitation, Applications and example).
Time Complexity of Binary Search Tree
Space Complexity of Binary Search Tree
Algorithm:
Flowchart :
Conclusion:
Thus, We have successfully implemented Binary Search Tree and Performed Various Operation on tree.
Objectives :
1. To Understand the concept of expression tree and binary tree.
2. To Understand the different type of traversals (recursive & non-recursive).
3. To understand the different notations like prefix, infix and postfix and the
conversion between them using data structures (like stack and tree).
Problem Statement: -
Construct an expression tree from the given prefix expression eg. +--a*bc/def and traverse it using post
order traversal (non recursive) and then delete the entire tree.
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Expression : (Definition, Concepts, Types of Expression(infix, Prefix and postfix
with examples)
Stack Data structure approach :(concepts, operations, ADT of stack)
Tree data structure approach : (Explain different traversal techniques with
algorithms and examples)
Compare Stack Vs Tree
Algorithm:
Flowchart :
Conclusion:
Thus, We have successfully implemented Expression tree and obtained output as postfix expression.
GROUP - C
SE Computer Engineering 2019 Pattern Data Structure Algorithm Lab (DSAL)
Objectives :
1. To Understand the concept of graph data structure.
2. To Understand the different type of traversals (recursive & non-recursive).
3. To understand the DFS and BFS traversal
Problem Statement: -
Represent a given graph using adjacency matrix/list to perform DFS and using adjacency list to perform
BFS. Use the map of the area around the college as the graph. Identify the prominent land marks as
nodes and perform DFS and BFS on that.
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Graph Data Structure: (Definition, Concepts, Types of graph, Operations, example
and applications)
Representation of Adjacency Matrix and List with example
DFS and BFS Traversal techniques with advantages, disadvantages, examples and
algorithms and applications
Compare DFS and BFS
Algorithm:
Flowchart :
Conclusion:
Thus, We have successfully implemented Graph using adjacency matrix.
Objectives :
1. To understand concept of Graph data structure
2. Understand & implement adjacency matrix for graph
Problem Statement: -
There are flight paths between cities. If there is a flight between city A and city B then there is an edge
between the cities. The cost of the edge can be the time that flight take to reach city B from A, or the
amount of fuel used for the journey. Represent this as a graph. The node can be represented by airport
name or name of the city. Use adjacency list representation of the graph or use adjacency matrix
representation of the graph. Justify the storage representation used..
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Graph Data Structure: (Definition, Concepts, Draw graph for given problem
statement i.e. node as cities and weight as time etc)
Representation of Adjacency Matrix with example(for above graph)
Undirected graph definition
Compare DFS and BFS
Algorithm:
Flowchart :
Conclusion:
Thus, This program gives us the knowledge of adjacency matrix graph.
GROUP - D
SE Computer Engineering 2019 Pattern Data Structure Algorithm Lab (DSAL)
Objectives :
1. To understand concept of OBST.
2. To understand concept & features like extended binary search tree.
Problem Statement: -
Given sequence k = k1 <k2 < … <kn of n sorted keys, with a search probability pi for each key ki .
Build the Binary search tree that has the least search cost given the access probability for each key?.
Outcome :
Define class for Extended binary search tree using Object Oriented features.
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Dynamic Programming
Principle of Optimality
OBST: (Definition, Concepts, advantages, disadvantages, applications and example)
Algorithms of OBST
Algorithm:
Flowchart :
Conclusion:
Thus, we have successfully implemented OBST tree
Objectives :
1. To understand concept of height balanced tree data structure.
2. To understand procedure to create height balanced tree.
Problem Statement: -
A Dictionary stores keywords and its meanings. Provide facility for adding new keywords, deleting
keywords, updating values of any entry. Provide facility to display whole data sorted in ascending/
Descending order. Also find how many maximum comparisons may require for finding any keyword.
Use Height balance tree and find the complexity for finding a keyword
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
AVL Tree : (Definition, Concepts, advantages, disadvantages, applications)
Types of AVL Rotation with example
Algorithms of AVL Tree, example of AVL Tree
Algorithm:
Flowchart :
Conclusion:
Thus, This program gives us the knowledge height balanced binary tree.
GROUP - E
SE Computer Engineering 2019 Pattern Data Structure Algorithm Lab (DSAL)
Objectives :
1. To understand concept of Heap data structure
2. Understand & implement Minheap and Maxheap function and perform heap sort
Problem Statement: -
Read the marks obtained by students of second year in an online examination of particular subject. Find
out maximum and minimum marks obtained in that subject. Use heap data structure. Analyze the
algorithm.
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Heap Data Structure: (Definition, Concepts, representation, advantages,
disadvantages, applications and example)
State Heapify, Minheap and Maxheap with representation and example.
Write algorithm for heap implementation(Maxheap and Minheap)
Algorithm:
Flowchart :
Conclusion:
Thus, we have successfully implemented Heap data structure with Minheap and Maxheap. .
GROUP - F
SE Computer Engineering 2019 Pattern Data Structure Algorithm Lab (DSAL)
Objectives :
To understand concept of file organization in data structure.
To understand concept & features of sequential file organization.
Problem Statement: -
Department maintains a student information. The file contains roll number, name, division and address.
Allow user to add, delete information of student. Display information of particular employee. If record
of student does not exist an appropriate message is displayed. If it is, then the system displays the
student details. Use sequential file to main the data.
Outcome :
Define class for sequential file using Object Oriented features.
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
File Organization :
Types/Methods of File Organization :
Explain Sequential File Organization (Definition, Concepts, representation,
Operations, advantages, disadvantages, applications and example)
The I/O system of C++ contains a set of classes that define the file handling methods.
These include ifstream, ofstream and fstream . These classes are derived from fstream base
and from corresponding stream classes. These classes are declared in fstream.h header file.
We must include this file in the program that uses file.(Explain in details from sent pdf)
Algorithm:
Flowchart :
Conclusion:
Thus, we have successfully implemented operations of sequential file organization.
Objectives :
To understand concept of file organization in data structure.
To understand concept & features of Indexed Sequential file organization.
Problem Statement: -
Company maintains employee information as employee ID, name, designation, and salary. Allow user
to add, delete information of employee. Display information of particular employee. If employee does
not exist an appropriate message is displayed. If it is, then the system displays the employee details. Use
index sequential file to maintain the data.
Outcome :
Define class for sequential file using Object Oriented features.
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source G++/GCC
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Indexed Sequential Access File Organization : (Definition, Concepts,
representation, Operations, advantages, disadvantages, applications and example)
Difference between Sequential vs Indexed Sequential File Organization
Algorithm:
Flowchart :
Conclusion:
Thus, we have successfully implemented operations of Indexed Sequential file Organization.
Mini Project
SE Computer Engineering 2019 Pattern Data Structure Algorithm Lab (DSAL)
Objectives :
To understand concept & features of Python programming.
Problem Statement: -
Design a mini project to implement Snake and Ladders Game using Python.
Outcome :
Software Requirements :
Operating System recommended :- 64-bit Open source Linux or its derivative
Programming tools recommended :- Open Source python, Pycharm IDE
Hardware Requirements :
i3 or above processor , 2 GB or above RAM, 512 GB or above Hard-disk etc
Theory :
Python:
• Python is a high-level, general-purpose and a very popular programming language.
• Python programming language (latest Python 3) is being used in web development, Machine
Learning applications, along with all cutting-edge technology in Software Industry.
• Python Programming Language is very well suited for Beginners, also for experienced
programmers with other programming languages like C++ and Java.
• Machine Learning
• GUI Applications (like Kivy, Tkinter, PyQt etc. )
• Web frameworks like Django (used by YouTube, Instagram, Dropbox)
• Image processing (like OpenCV, Pillow)
• Web scraping (like Scrapy, BeautifulSoup, Selenium)
• Test frameworks
• Multimedia
• Scientific computing
This Snakes and Ladders Game contains python file scripts (snakes_ladders.py), resources files and
sound files. The gameplay of the system, which is the user can choose an option either to play multiple
participant or with the computer.
Beginning of the game, the player needs to roll the dice and in the wake of moving it the game moves
the token consequently as indicated by the dice number. The interactivity is like the genuine one. Here,
the player likewise gets one more opportunity to roll the dice at whatever point he/she gets 6 number.
There are quantities of stepping stools and snakes in the game which causes the player to update or
minimization the square number. The player who arrives at the last square of the track is the champ.
Designing a complete Snake and Ladder game using object-oriented programming (Python OOP)
principles with the following rules and requirements :
Rules for game :
1. Here we create a board of size 10 and dice of side 6.
2. Each player puts their counter on the board at starting position at 1 and takes turns to roll the
dice.
3. Move your counter forward the number of spaces shown on the dice.
4. If your counter lands at the bottom of a ladder, you can move up to the top of the ladder. If your
counter lands on the head of a snake, you must slide down to the bottom of the snake.
5. Each player will get a fair chance to roll the dice.
6. On the dice result of 6, the user gets one more chance to roll the dice again. However, the same
user can throw the dice a maximum of 3 times.
Note: if the result of the dice is 6,6,6 the user can not throw the dice again as the maximum
attempts are over and the next user will get to throw the dice.
7. When the user rolls dice and it leads to an invalid move, the player should remain in the same
position.
Ex: when the user is in position 99 and rolling of dice yields any number more than one the user
remains in the same position.
8. Print the ranks of users who finished first, second, and so on…