Lab Manual
Lab Manual
LAB MANUAL
Data Structure &
Applications Laboratory
Class:-SE
P: F–LTL–UG /03/R0
SCRT’s Pune Institute of Computer Technology, Pune
Department of Information Technology
Lab Manual
Course Code & Name:
3303203: Data Structures and Applications
Laboratory (DSAL)
Class: SE Semester: III
Prepared By:
Ms. J. H. Jadhav
Mr. S. D. Shelake
Mrs. K. Y. Digholkar
Dr. A. S. Ghotkar
Mrs. P. S. Shinde
Ms. S. G. Gaikwad
Compiled By:
Ms. J. H. Jadhav
P: F–LTL–UG /03/R0
VISION AND MISSION OF THE INSTITUTE
Vision:
Pune Institute of Computer Technology aspires to be the leader in higher technical
education and research of international repute.
Mission:
To be leading and most sought after Institute of education and research in emerging
engineering and technology disciplines that attracts, retains and sustains gifted individuals of
significant potential.
Vision:
The department aspires to be a transformative force in Information Technology
education and research, developing globally competitive professionals.
Mission:
1. Inculcate an environment of academic rigor in Information Technology education
promoting critical thinking, creativity, and problem-solving skills.
2. Foster research and industry collaboration by promoting multiddisciplinary
engagement among students and faculty, driving technological advancements to
address societal challenges.
3. Cultivate skilled professionals effective communication, leadership, and ethical
values.
P: F–LTL–UG /03/R0
PEO’s OF THE DEPARTMENT
1. Have a strong background in science and mathematics and an ability to design and
develop solutions for complex problems using modern tools in the field of
Information Technology.
2. Attain professional competence by industry collaboration, research, and innovation to
create solutions that drive technological progress and address societal and
environmental concerns through lifelong learning.
3. Have ability to communicate effectively, work well in team, and to manage IT
projects in multidisciplinary environment with ethical awareness.
P: F–LTL–UG /03/R0
PROGRAM OUTCOMES
P: F–LTL–UG /03/R0
Course Objectives
Course Outcomes
1. Analyze algorithms and determine algorithm correctness and time efficiency class.
2. Implement abstract data type (ADT) and data structures for given application.
3. Design algorithms based on techniques like brute -force, divide and conquer, greedy,
etc.).
4. Solve problems using algorithmic design techniques and data structures.
5. Analyze of algorithms with respect to time and space complexity.
P: F–LTL–UG /03/R0
CO-PO-PSO Mapping
Implement and
CO1 Analyse Linked List
to solve real world 2 2 2 2 1 - - - 1 - 2 1 - 2
problems of
moderate complexity.
Select and implement
CO2 appropriate data
structure from stack
and queue for real
2 2 2 2 1 - - - 1 - 2 1 - 2
world problem
solving like
expression solving
and backtracking.
Analyze the
CO3 performance of
searching and sorting
2 2 2 3 1 - - - 1 - 2 1 - 2
algorithms for
specified problem
statement.
Implement file for
CO4 efficient data storage
and retrieval and
2 2 2 2 1 - - - 1 - 2 1 - 2
apply an appropriate
hashing technique to
resolve collisions.
Implement complete
CO5 software solution
using an appropriate
2 2 3 3 1 1 1 2 3 1 3 2 3 2
data structure to
solve real world
problem.
P: F–LTL–UG /03/R0
IMPORTANT GUIDELINES
P: F–LTL–UG /03/R0
TERM WORK RUBRICS
P: F–LTL–UG /03/R0
3303203: DATA STRUCTURE AND APPLICATIONS
LABORATORY
Practice Assignment
• Implement a CPP program for Palindrome Checking for number
and character.
• Implement a CPP program that reads an integer n and stores the
first n Fibonacci numbers in an array
• Implement a CPP program for Matrix
Addition/Subtraction/Multiplication with Menu-Driven Using
Functions
• Implement a CPP Convert Decimal to Binary/Octal/Hex 06
• Use class for student databases and implement a CPP program to
include functions for addition, display and append with Menu
Driven Functionality.
• Implement a CPP program for employee databases using
constructor, destructor.
• Implement a CPP program for employee databases using
constructor, destructor.
Linked List
"Efficient Data Management Using Linked Lists: Implementing
Dynamic Operations for Contact Management System"
Utilize Singly and Doubly Linked Lists to manage a Contact
Management System. The system will support key operations such as:
1 • Creating a contact list dynamically. 06 CO1
• Adding new contacts efficiently.
• Deleting contacts when no longer needed.
• Searching for specific contacts based on name or number.
• Reversing the contact list for alternate viewing orders.
• Traversing through the list to display all stored contacts.
P: F–LTL–UG /03/R0
Stack and Queue
"Implementing Queues and Stacks Using Linked Lists for Real-
World Task Management Systems"
This problem involves designing and implementing queues and stacks
using linked lists, focusing on their practical applications in real-world
scenarios such as:
CO1,
2 06
• Task Scheduling System (Queue): Managing tasks in a first-in, CO2
first-out (FIFO) order, such as print job scheduling or process
management in an operating system.
• Undo/Redo Functionality (Stack): Implementing an undo/redo
feature in text editors or design software using a last-in, first-out (LIFO)
approach.
Searching and Sorting
Consider a student database of SEIT class (at least 15 records). Database
contains different fields of every student like Roll No, Name and SGPA.
(array of structure)
a) Design a roll call list, arrange list of students according to roll
numbers in ascending order (Use Bubble Sort)
b) Arrange a list of students alphabetically. (Use Insertion sort)
3 c) Arrange a list of students to find out the first ten toppers from a class. 06 CO3
(Use Quick sort)
d) Search for students according to SGPA. If more than one student has
the same SGPA, then print a list of all students having the same SGPA.
e) Search for a particular student according to name using binary search
without recursion. (all the student records having the presence of search
key should be displayed)
(Note: Implement either Bubble sort or Insertion Sort.)
Stack Application
Conversion and Evaluation of Expressions
• Implement a program to convert an infix expression to prefix
CO1,
4 08
and postfix notation. CO2
• Evaluate both prefix and postfix expressions.
Use STL for implementation.
Priority Queue and Double-Ended Queue
Implementation of a Priority Queue CO1,
5 04
CO2
• Develop a priority queue where elements are dequeued based
P: F–LTL–UG /03/R0
on priority rather than insertion order.
• Support operations such as insertion, deletion, and display.
Implementation of a Double-Ended Queue (Deque)
• Implement a double-ended queue where insertion and deletion
can happen from both ends.
Support operations such as enqueue front, enqueue rear, deque front,
dequeue rear.
Hashing
"Designing a Secure User Credential Storage System Using
Hashing: Collision Handling with and without Chaining"
Problem Statement:
Develop a hashing-based system for securely storing user credentials,
6 04 CO4
where usernames act as keys and hashed passwords as values.
Implement and demonstrate collision handling using:
• Chaining (Array-based collision resolution)
• Open Addressing (Linear or Quadratic Probing without
chaining)
File Handling
The department maintains student’s database. The file contains roll
number, name, division and address. Write a program to create a
sequential file to store and maintain student data. It should allow the user
7 04 CO6
to add, delete information about students. Display information of a
particular student. If the record of the student does not exist an
appropriate message is displayed. If a student record is found it should
display the student details.
Mini Project
"Real-World Solution Development Using Fundamental Data
Structures and Algorithms"
Problem Statement: Design and develop a real-world application that
P: F–LTL–UG /03/R0
This is for Student’s Journal
Assignment write-up should be in this format
Assignment No:
Title:
Aim:
Objective:
Problem Statement:
Conclusion:
P: F–LTL–UG /03/R0
Practice Assignments
Problem Statement: Without and by using class and Functions
8. Factorial of a Number
9. Fibonacci Series
P: F–LTL–UG /03/R0
4. Class with Constructor and Destructor
Create a class Counter with a constructor to initialize count and a destructor to print a
message when an object is destroyed.
2. Parameterized Constructor
Create a class Rectangle with a constructor that takes length and width as parameters and
computes area and perimeter.
3. Constructor Overloading
Implement a class Box with multiple constructors: one with no parameters, one with a single
dimension (cube), and one with three dimensions.
P: F–LTL–UG /03/R0
5. Print Message from Constructor and Destructor
Create a class LifeCycle that prints messages from both its constructor and destructor to
observe object lifecycle.
6. Copy Constructor
Create a class Person that has a copy constructor which performs a deep copy of dynamically
allocated memory (e.g., copying name as a char*).
P: F–LTL–UG /03/R0
8. Educational Institution Example
Base class Institution, derived classes School and College, and further derived
classes for EngineeringCollege, etc.
9. Employee → Permanent → Manager
Use multilevel inheritance to handle employee types with different benefits.
10. Multiple Inheritance: Printer and Scanner → Copier
Combine functionality of two base classes using multiple inheritance.
11. Hybrid Inheritance Example
Combine multiple and hierarchical inheritance to show a diamond problem and solve
using virtual base class.
P: F–LTL–UG /03/R0
Assignment No: 1
Title: Linked List
Aim: Use of Singly and Doubly Linked List for implementation of Contact Management System
Objective:
1. To understand and implement the concepts of Singly and Doubly Linked Lists for efficient
data storage and manipulation.
2. To develop a functional Contact Management System that allows operations such as adding,
deleting, searching, and displaying contact details using linked list data structures.
3. Comparing the advantages and limitations of Singly and Doubly Linked Lists in terms of
traversal, insertion, and deletion within the Contact Management System
CO Mapped: CO1
Problem Statement:
"Efficient Data Management Using Linked Lists: Implementing Dynamic Operations for
Contact Management System"
Utilize Singly and Doubly Linked Lists to manage a Contact Management System. The system
will support key operations such as:
• Creating a contact list dynamically.
• Adding new contacts efficiently.
• Deleting contacts when no longer needed.
• Searching for specific contacts based on name or number.
• Reversing the contact list for alternate viewing orders.
• Traversing through the list to display all stored contacts.
Expected Outcome:
1. Clear understanding of the working and structural differences between Singly Linked List and
Doubly Linked List.
2. A functional Contact Management System capable of performing operations such as adding,
deleting, searching, and displaying contact details using Singly and Doubly Linked Lists.
3. Ability to compare and analyze the performance of Singly and Doubly Linked Lists for
contact management system.
Pre-requisites:
P: F–LTL–UG /03/R0
Suggested Study Material: (Blogs / Videos / Courses / Web Sites / Books / e-Books)
Step 1: Start
Step 2: Create a new node newNode
Step 3: Assign data to newNode.data
Step 4: Set newNode.next = NULL
P: F–LTL–UG /03/R0
Step 6:
• If the list is empty (head == NULL)
o Set head = newNode
• Else
o Initialize temp = head
o While temp.next != NULL
▪ Set temp = temp.next
o Set temp.next = newNode
Step 1: Start
• Else, proceed
Step 3:
P: F–LTL–UG /03/R0
Case 2: Deletion at the End
Step 4:
Step 5:
• If position == 1
o Perform Deletion at Beginning
• Else
o Initialize temp = head
o Loop from i = 1 to position - 2
▪ If temp == NULL or temp.next == NULL, print "Position out of range" and
stop
▪ Set temp = temp.next
o Initialize toDelete = temp.next
o If toDelete == NULL, print "Position out of range" and stop
o Set temp.next = toDelete.next
o Free memory of toDelete
Step 6: Stop
Step 1: Start
P: F–LTL–UG /03/R0
Step 5: Repeat while temp != NULL
• If temp.data == key
o Stop
• Else
o Increment position by 1
Step 7: Stop
Step 1: Start
• Else, proceed
• Print temp.data
Step 5: Stop
Test Cases:
Addition:
Deletion:
P: F–LTL–UG /03/R0
o Element for deletion is not present in the list
o Varying position of element to be deleted
o First place, last place, in between
Search:
o Appropriate result with clear message about the status of each of the operation.
Inference:
• Linked Lists provide an efficient way to handle dynamic data where frequent insertion,
deletion, and traversal operations are required.
• The Singly Linked List offers a simple structure for basic contact management, while the
Doubly Linked List provides improved flexibility, allowing both forward and backward
traversal, making deletion and updating operations more convenient.
Oral questions:
1. What is the difference between a singly linked list and a doubly linked list?
2. Why are linked lists preferred over arrays in a Contact Management System?
3. How does dynamic memory allocation help while implementing linked lists?
4. What are the advantages of using a doubly linked list in your Contact Management System?
5. How would you insert a new contact at the beginning of a singly linked list?
6. What changes are required to insert a contact at the end of a doubly linked list?
7. What are the steps to delete a specific contact by name from a doubly linked list?
8. How do you handle memory deallocation when deleting a node from the linked list?
9. How can you modify a contact’s information once it is stored in the linked list?
10. What are the time complexities for insertion, deletion, and search operations in singly and
doubly linked lists?
11. Which linked list (singly or doubly) would you prefer if frequent deletions are required?
Why?
12. How would you handle duplicate contact names in your Contact Management System
P: F–LTL–UG /03/R0
Assignment No: 2
Title: Stack and Queue
Aim: Implementing Stack and Queue Using Linked Lists for Real-World Task Management Systems
Objective:
1. To implement a Queue using linked lists for simulating real-world FIFO task scheduling.
2. To develop a Stack using linked lists for modelling LIFO-based undo/redo operations.
3. To analyse the efficiency and suitability of linked lists in dynamic data structure applications.
4. To demonstrate real-world use cases of queues and stacks in task management systems.
Problem Statement:
"Implementing Queues and Stacks Using Linked Lists for Real-World Task Management
Systems"
This problem involves designing and implementing queues and stacks using linked lists, focusing
on their practical applications in real-world scenarios such as:
• Task Scheduling System (Queue): Managing tasks in a first-in, first-out (FIFO) order, such
as print job scheduling or process management in an operating system.
• Undo/Redo Functionality (Stack): Implementing an undo/redo feature in text editors or
design software using a last-in, first-out (LIFO) approach.
Expected Outcome:
1. Efficient execution of task scheduling and undo/redo operations using linked list-based Queue
and Stack implementations.
2. Improved understanding of dynamic memory management and pointer manipulation in real-
world data structure applications.
3. Demonstration of how linked lists enhance flexibility and scalability in practical task
management systems.
Pre-requisites:
1. Understanding stack/Queue
2. Structure in C/C++
Suggested Study Material: (Blogs / Videos / Courses / Web Sites / Books / e-Books)
P: F–LTL–UG /03/R0
Implementation Requirements: (Components / Digital Kits / Platform / Software / Hardware)
• Stack Concepts
A stack is a linear data structure that follows the LIFO (Last In, First Out) principle, where the last
element added is the first to be removed.
When a stack is implemented using a linked list, each element (called a node) contains:
The top of the stack is represented by the head of the linked list.
• Queue Concepts
Queue operations using a linked list involve dynamically adding and removing elements while
maintaining the FIFO (First In, First Out) principle.
Structure of Node:
Stack operations
PUSH (Insert an element at the top)
Create newNode
newNode.data ← value
newNode.next ← Stack.top
Stack.top ← newNode
End Procedure
P: F–LTL–UG /03/R0
POP (Remove and return the top element)
Procedure POP(Stack)
Return
End If
temp ← Stack.top
value ← temp.data
Stack.top ← Stack.top.next
Delete temp
Return value
End Procedure
Procedure PEEK(Stack)
Return
End If
Return Stack.top.data
End Procedure
Function ISEMPTY(Stack)
End Function
Queue Operations:
ENQUEUE Operation (Insert element at rear)
P: F–LTL–UG /03/R0
newNode ← Allocate memory for new node
newNode.data ← value
newNode.next ← NULL
Queue.front ← newNode
Queue.rear ← newNode
Else
Queue.rear.next ← newNode
Queue.rear ← newNode
End If
End Procedure
Procedure DEQUEUE(Queue)
Return
End If
temp ← Queue.front
value ← temp.data
Queue.front ← Queue.front.next
Queue.rear ← NULL
End If
Delete temp
Return value
End Procedure
Function PEEK(Queue)
P: F–LTL–UG /03/R0
Print "Queue is Empty"
Return
End If
Return Queue.front.data
End Function
Function ISEMPTY(Queue)
End Function
Test Cases:
Operations Performed:
Expected Output:
Enqueued: Task1
Enqueued: Task2
Enqueued: Task3
Dequeued: Task1
Operations Performed:
P: F–LTL–UG /03/R0
• Push actions: Edit1, Edit2, Edit3
Expected Output:
Pushed: Edit1
Pushed: Edit2
Pushed: Edit3
Inference:
The implementation showcases the use of linked lists to implement stacks and queues for
efficient task management, reinforcing key concepts of dynamic memory and linear data structures.
Oral questions:
1. What is the main difference between a stack and a queue in terms of task order?
2. Why is a linked list preferred over an array in dynamic task handling systems?
3. How does a queue model a print job scheduler?
4. What real-world scenario does the stack in your program simulate?
5. What happens when you dequeue from an empty queue?
6. What type of list traversal is used in stack operations?
7. Explain what ‘LIFO’ means using your undo/redo system.
8. What would happen if you forget to update the rear pointer after dequeueing the last task?
9. How do you identify an empty stack or queue in your code?
10. Which pointer in the linked list stack points to the most recent action?
P: F–LTL–UG /03/R0
Assignment No: 3
Title: Searching and Sorting
Aim: To implement various searching and sorting algorithms on a student database using an array of
structures.
Objective:
CO Mapped: CO3
Problem Statement:
• Name (String)
• SGPA (Float)
c. Sort students by SGPA in descending order using Quick Sort to get top 10 toppers.
d. Search for students by SGPA using Linear Search and display all matches.
e. Search for student(s) by name using non-recursive Binary Search, display all partial matches.
Expected Outcome:
Pre-requisites:
1. Understanding of Arrays
2. Structure in C/C++
3. Basic Sorting/Searching Algorithms
Suggested Study Material: (Blogs / Videos / Courses / Web Sites / Books / e-Books)
• https://www.geeksforgeeks.org/dsa/sorting-algorithms/
P: F–LTL–UG /03/R0
• https://www.tutorialspoint.com/data_structures_algorithms/sorting_algorithms.htm
• Concepts of Structure
• Array of Structure
• Sorting
o Bubble sort
o Insertion sort
o Quick sort
• Searching
o Linear search
o Binary search
⮚ Create a structure
BubbleSort(Student s[], n)
Step 1: For Pass = 1 to n-1
Step 2: For i = 0 to (n – pass – 1)
i. If s[i].roll_no < s[i+1].roll_no
ii. Swap (s[i]. s[i+1])
iii. End if
Step 3: End for
Step 4: End For
Step 5 : Stop
P: F–LTL–UG /03/R0
insertion_Sort (Struct student S[], int n)
P: F–LTL–UG /03/R0
➢ Searching Algorithms
//Here s is array of structure student, key is sgpa of student to be searched and displayed, n is total
number of students in record
Step 1: Set i to 0 and flag to 0
Step 2: While i<n
i. If s[i].sgpa==key
a. Print s[i].roll_no, s[i].name
b. Set flag to 1
c. i++
Step 3: End while
Step 4: If flag==0
i. Print No student found with sgpa=value of key
Step 5: End if
Step 6: End of linear_ sear
P: F–LTL–UG /03/R0
Test Cases:
Inference:
Oral questions:
P: F–LTL–UG /03/R0
Assignment No: 4
Title: Stack: Conversion and Evaluation of Expressions
Aim: To implement a program that converts an infix expression to both prefix and postfix notation
and evaluates them using Standard Template Library (STL), demonstrating understanding of
expression conversion, stack operations, and expression evaluation.
Objective:
1. To understand the concept and implementation of Stack data structure using SLL.
2. To understand the concept of conversion of expression.
3. To understand the concept of evaluation of expression.
Problem Statement: Implement a program to convert an infix expression to prefix and postfix
notation. • Evaluate both prefix and postfix expressions. Use STL for implementation.
Expected Outcome:
Pre-requisites:
Suggested Study Material: (Blogs / Videos / Courses / Web Sites / Books / e-Books)
• https://ds1-iiith.vlabs.ac.in/data-structures-1/
• https://ds2-iiith.vlabs.ac.in/data-structures-2/
• http://cse01-iiith.vlabs.ac.in/
P: F–LTL–UG /03/R0
One of the disadvantages of the infix notation is that we need to use parentheses to control the
evaluation of the operators. We thus have an evaluation method that includes parentheses and two
operator priority classes. In the postfix and prefix notations, we do not need parentheses; each
provides only one evaluation rule.
Although some high-level languages use infix notation, such expressions cannot be directly evaluated.
Rather, they must be analyzed to determine the order in which the expressions are to be evaluated.
P: F–LTL–UG /03/R0
If we see any other symbol (+, *, (), then we pop entries from the stack until we find an entry of
lower priority. One exception is that we never remove a (from the stack except when processing a ).
For the purposes of this operation, + has lowest priority and (highest.
When the popping is done, we push the operator onto the stack.
Finally, if we read the end of input, we pop the stack until it is empty, writing symbols onto the
output.
The idea of this algorithm is that when an operator is seen, it is placed on the stack. The stack
represents pending operators. However, some of the operators on the stack that have high precedence
are now known to be completed and should be popped, as they will no longer be pending. Thus prior
to placing the operator on the stack, operators that are on the stack, and which are to be completed
prior to the current operator, are popped.
This is illustrated in the following table:
Parentheses simply add an additional complication. We can view a left parenthesis as a high-
precedence operator when it is an input symbol (so that pending operators remain pending) and a low-
precedence operator when it is on the stack (so that it is not accidentally removed by an operator).
Right parentheses are treated as the special case.
To see how this algorithm performs, we will convert the long infix expression above into its
postfix form. First, the symbol a is read, so it is passed through to the output.
Then + is read and pushed onto the stack. Next b is read and passed through to the output.
The state of affairs at this juncture is as follows:
Next, a * is read. The top entry on the operator stack has lower precedence than *, so nothing is output
and * is put on the stack. Next, c is read and output. Thus far, we have
P: F–LTL–UG /03/R0
The next symbol is a +. Checking the stack, we find that we will pop a * and place it on the output;
pop the other +, which is not of lower but equal priority, on the stack; and then push the +.
The next symbol read is a (. Being of highest precedence, this is placed on the stack. Then d is read
and output.
We continue by reading a *. Since open parentheses do not get removed except when a closed
parenthesis is being processed, there is no output. Next, e is read and output.
The next symbol read is a +. We pop and output * and then push +. Then we read and output f.
We read a * next; it is pushed onto the stack. Then g is read and output.
The input is now empty, so we pop and output symbols from the stack until it is empty.
As before, this conversion requires only O(N) time and works in one pass through the input. We can
add subtraction and division to this repertoire by assigning subtraction and addition equal priority and
multiplication and division equal priority. A subtle point is that the expression a - b - c will be
converted to a b - c - and not a b c - -. Our algorithm does the right thing, because these operators
associate from left to right. This is not necessarily the case in general, since exponentiation associates
P: F–LTL–UG /03/R0
right to left: = 28 = 256, not 43 = 64. We leave as an exercise the problem of adding
exponentiation to the repertoire of operators.
Let’s work on one more example before we formally develop the algorithm.
A + B * C – D / E converts to A B C * + D E / -
The transformation of this expression is shown in following figure. Because it uses all of the basic
arithmetic operators, it is a complete test.
P: F–LTL–UG /03/R0
Priority 1: + -
Priority 0: (
P: F–LTL–UG /03/R0
1 createStack (stack)
2 loop (for each character in formula)
1 if (character is open parenthesis)
1 pushStack (stack, character)
2 elseif (character is close parenthesis)
1 popStack (stack, character)
2 loop (character not open parenthesis)
1 concatenate character to postFixExpr
2 popStack (stack, character)
3 end loop
3 elseif (character is operator) //Test priority of token to token at top of stack
1 stackTop (stack, topToken)
2 loop (not emptyStack (stack) AND priority(character) <= priority(topToken))
1 popStack (stack, tokenOut)
2 concatenate tokenOut to postFixExpr
3 stackTop (stack, topToken)
3 end loop
4 pushStack (stack, token)
4 else // Character is operand
1 Concatenate token to postFixExpr
5 end if
3 end loop //Input formula empty.
//Pop stack to postFix
4 loop (not emptyStack (stack))
1 popStack (stack, character)
2 concatenate token to postFixExpr
5 end loop
6 return postFix
end inToPostFix
P: F–LTL–UG /03/R0
Post postfix value computed
Return value of expression
1 createStack (stack)
2 loop (for each character)
1 if (character is operand)
1 pushStack (stack, character)
2 else
1 popStack (stack, oper2)
2 popStack (stack, oper1)
3 operator = character
4 set value to calculate (oper1, operator, oper2)
5 pushStack (stack, value)
3 end if
3 end loop
4 popStack (stack, result)
5 return (result)
end postFixEvaluate
Test Cases:
Validation
If Stack Empty Display message “Stack Empty”
If memory not available Display message “memory not available”
Parenthesis matching Display appropriate message open/close parenthesis missing
Infix to postfix /prefix Test Cases
A$B*C-D+E/F/(G+H) AB$C*D-EF/GH+/+
((A+B)*C-(D-E))$(F+G) AB+C*DE—FG+$
A-B/(C*D$E) ABCDE$*/-
A^B^C ABC^^
P: F–LTL–UG /03/R0
INPUT: PREFIX OUTPUT:
A$B*C-D+E/F/(G+H) +-*$ABCD//EF+GH
((A+B)*C-(D-E))$(F+G) $-*+ABC-DE+FG
A-B/(C*D$E) -A/B*C$DE
A^B^C ^A^BC
Inference:
• Importance of tokenization.
• Need of stack in expression conversion and evaluation.
Oral questions:
P: F–LTL–UG /03/R0
Assignment No: 5
Title: Priority Queue and Double-Ended Queue
Aim: To implement and demonstrate the working of a Priority Queue and a Double-Ended Queue
(Deque) supporting standard operations such as insertion, deletion, and display.
Objective:
Problem Statement:
Expected Outcome:
1. Implement and manipulate Priority Queues and Deques using linear data structures.
2. Understand how different queue types optimize data access in real-world scenarios.
Pre-requisites:
Suggested Study Material: (Blogs / Videos / Courses / Web Sites / Books / e-Books)
• https://www.geeksforgeeks.org/dsa/priority-queue-set-1-introduction/
• https://www.geeksforgeeks.org/dsa/deque-set-1-introduction-applications/
P: F–LTL–UG /03/R0
Input: Minimum 5 Records
Priority Queue:
A normal priority queue maintains elements in order of their priority, but unlike heaps, it can be
implemented more simply using arrays or linked lists — with less efficient performance but easier
algorithms.
Assuming a max-priority queue (higher value = higher priority), here’s the algorithm using a sorted
array (descending order of priority):
➢ insert(item, priority)
➢ peek()
➢ extract_max()
➢ is_empty()
P: F–LTL–UG /03/R0
Let:
• arr[MAX] = storage
➢ is_full()
return True
else:
return False
➢ is_empty()
if (front == -1):
return True
else:
return False
➢ insert_front(x)
if is_full():
report overflow
else if is_empty():
front = rear = 0
else if front == 0:
front = MAX - 1
else:
front = front - 1
arr[front] = x
➢ insert_rear(x)
if is_full():
report overflow
P: F–LTL–UG /03/R0
else if is_empty():
front = rear = 0
rear = 0
else:
rear = rear + 1
arr[rear] = x
➢ delete_front()
if is_empty():
report underflow
front = rear = -1
front = 0
else:
front = front + 1
➢ delete_rear()
if is_empty():
report underflow
front = rear = -1
else if rear == 0:
rear = MAX - 1
else:
rear = rear – 1
➢ get_front()
if is_empty():
report underflow
P: F–LTL–UG /03/R0
else:
return arr[front]
➢ get_rear()
if is_empty():
report underflow
else:
return arr[rear]
P: F–LTL–UG /03/R0
Inference:
The implementation demonstrated how Priority Queues manage elements based on priority, making
them ideal for scheduling tasks, while Deques allow insertion and deletion from both ends, offering
flexibility in various algorithms. Implementing and testing these structures highlighted their key
operations and practical applications.
Oral questions:
P: F–LTL–UG /03/R0
Assignment No: 6
Title: Hashing
Aim: To design and implement a secure system for storing user credentials using hashing techniques
and to demonstrate collision resolution using chaining and open addressing
Objective:
CO Mapped: CO4
Problem Statement:
Develop a hashing-based system for securely storing user credentials, where usernames act as keys
and hashed passwords as values. Implement and demonstrate collision handling using:
Expected Outcome:
Pre-requisites:
Suggested Study Material: (Blogs / Videos / Courses / Web Sites / Books / e-Books)
• https://www.geeksforgeeks.org/hashing-data-structure/
• https://www.youtube.com/watch?v=RVkQISfOCnI
• https://www.youtube.com/watch?v=shs0KM3wKv8
• Book: “Data Structures and Algorithm Analysis in C++” by Mark Allen Weiss
• https://www.programiz.com/dsa/hash-table
P: F–LTL–UG /03/R0
Implementation Requirements: (Components / Digital Kits / Platform / Software / Hardware)
Input:
Chaining Method:
1. Compute hash index from username
2. Hash password using secure algorithm
3. Insert user and hashed password in linked list at index
Test Cases:
Inference:
Hashing provides an efficient way to store and retrieve user credentials. Chaining allows multiple
entries at one index using linked lists, suitable for high-collision environments. Open addressing
avoids extra space but may lead to longer search times under high load.
P: F–LTL–UG /03/R0
Oral questions:
P: F–LTL–UG /03/R0
Assignment No: 7
Title: FILE Handling
Aim: To implement Sequential File using CPP and perform various operation on it.
Objective:
CO Mapped: CO4
Problem Statement: Department maintains student database. The file contains roll number, name,
division and address. Implement a CPP program to -
1. Create a sequential file to store and maintain student data.
2. It should allow the user to add and delete information of students.
3. Display information of particular student.
i. If the student record does not exist an appropriate message is displayed.
ii. If student record is found it should display the student details.
Expected Outcome:
Pre-requisites:
P: F–LTL–UG /03/R0
Suggested Study Material: (Blogs / Videos / Courses / Web Sites / Books / e-Books)
• https://www.geeksforgeeks.org/cpp/file-handling-c-classes/
• Concept of File
• Types of Files
• File organization (Concept, feature, drawback, operations)
• Applications of file
P: F–LTL–UG /03/R0
➢ Add a record AddNewRecords()
Step 1: Open StudentData for append // file pointer will automatically moved to the end of file
Step2: If FileNotPresent
i. Display error message
ii. Exit
Step 3: end if
Step 4: Display “Please enter the information of student: ”
i. Get rollno, name, division, address, date of birth, percentage, grade
ii. Write rollno, name, division, address, date of birth, percentage, grade into StudentData
Step 5: Close StudentData
Step 6: END
P: F–LTL–UG /03/R0
➢ Delete a Record Delete Record(key)
Test Cases:
Inference:
The implementation demonstrates the use of file handling in C++ to manage student records. It allows
adding, deleting, and displaying data, reinforcing concepts of object-oriented programming and basic
database operations.
Oral questions:
P: F–LTL–UG /03/R0
5. What is the use of ios::trunc mode?
6. What is the return type of open() method?
7. Which is the default mode of the opening using the fstream class?
8. Which is the default mode of the opening using the ifstream class?
P: F–LTL–UG /03/R0
Assignment No: 8
Title: Mini Project
Aim: Real-World Solution Development Using Fundamental Data Structures and Algorithms
Objective:
1. Implement core linear data structures to efficiently store and process data.
2. Apply searching algorithms to enable fast data retrieval and minimize search time.
3. Use sorting techniques to organize data for optimized processing and retrieval.
4. Optimize performance to ensure the solution can handle large datasets efficiently.
5. Design a scalable and maintainable application using fundamental DSA principles.
CO Mapped: CO5
Problem Statement:
Design and develop a real-world application that leverages fundamental concepts of Data
structures and Algorithms (DSA), including linear data structures, searching, and sorting
techniques (with a preference for hashing). The solution should efficiently handle data storage,
retrieval, and processing while optimizing performance.
Expected Outcome:
6. Gain practical experience in applying core data structures and algorithms—such as arrays,
linked lists, searching, sorting, and hashing—to solve real-world problems.
7. Demonstrate efficient data storage, fast retrieval using hashing, and improved performance
through appropriate algorithm selection, reinforcing the importance of algorithmic thinking
and optimization in software development.
Instructions:
• Students have to form a group of 3 to 4 members.
• The group should appoint a Team Leader responsible for coordinating and submitting the
project.
• Members should distribute tasks evenly (e.g., coding, documentation, testing).
• Presentation: Each group will present their project, explaining their approach and findings.
P: F–LTL–UG /03/R0
Submit a Project Report including:
• Introduction
• Problem Definition
• Algorithm Explanation
• Code Implementation
• Test Cases and Results
• Conclusion and Future Scope
Note: Template will be provided for writing project report.
• Description: Design and implement a simple library management system. The system should
support basic operations like adding new books, searching for books, borrowing books, and
returning books.
• Data Structures Involved: Linked List for storing book information, Queue for
borrowing/returning operations, and HashMap for fast book search.
• Challenges:
o Implement efficient searching, borrowing, and returning of books.
o Handle book availability (e.g., how to keep track of borrowed and available books).
o Optimize the system for large datasets.
Problem Statement:
Design a system to store and manage student records (roll number, name, department, grades).
Problem Statement:
Build a system to track books in a library, including title, author, ISBN, and availability.
P: F–LTL–UG /03/R0
• Hashing for fast lookup by ISBN.
Problem Statement:
Develop an application to store and manage contact information (name, phone, email).
Problem Statement:
Create a system to manage patient records with details like patient ID, name, age, and diagnosis.
Problem Statement:
Design a system to manage products in a store (ID, name, quantity, price).
6. Attendance Tracker
Problem Statement:
Create a tool to track attendance of students/employees over time.
P: F–LTL–UG /03/R0