0% found this document useful (0 votes)
462 views74 pages

Labmanual BE03000081 Data Structure Ce

Uploaded by

nisargnlp3818
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
462 views74 pages

Labmanual BE03000081 Data Structure Ce

Uploaded by

nisargnlp3818
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 74

Degree Engineering

A Laboratory Manual for

Data Structures
(BE03000081)

[B. E. (Computer Engineering): Semester – 3]

Enrollment No
Name
Branch
Academic Term
Institute Name

Directorate of Technical Education


Gandhinagar, Gujarat
Government Engineering College, Bhavnagar
Computer Engineering Department

CERTIFICATE

This is to certify that Mr./Ms.

Enrollment No. of B. E. Semester – III from Computer

Engineering Department of this Institute (GTU Code:021) has satisfactorily

completed the Practical / Tutorial work for the subject Data structure

(BE03000081) for the academic year 2025-26.

Place:

Date:

Signature of Course Faculty Head of the Department


Data Structures (BE03000081) Enrollment No:

Preface

The Data Structures Lab Manual has been carefully designed to complement the core
theoretical concepts taught in the Data Structures course, which is foundational to the field of
Computer Science and Engineering. This manual serves as a bridge between theory and practical
implementation, helping students develop the essential skills required to design, implement, and
analyze various data structures and the algorithms that operate on them.
Data Structures form the backbone of many critical areas such as operating systems, databases,
artificial intelligence, compilers, and software engineering. Understanding and implementing them
effectively is vital for solving complex computational problems. The experiments included in this
manual are aimed at fostering problem-solving abilities, logical thinking, and programming skills in
students.

In line with GTU’s competency-based and outcome-oriented curriculum, this manual


emphasizes not just performing experiments but developing core psychomotor skills, industry-
relevant competencies, and critical thinking. Each experiment is structured with clearly defined
competencies, course outcomes, practical outcomes, and industry-relevant skills, followed by a
concise theoretical background, procedure, code implementation, and precautionary
measures.

The manual encourages students to study the theoretical concepts and procedures in advance,
allowing them to perform experiments more effectively and confidently. It also supports faculty
members with guidelines and assessment rubrics to ensure student-centric, safe, and meaningful lab
sessions.

We hope this manual becomes a valuable resource in your learning journey and contributes to
building a strong foundation in data structures and algorithmic thinking.
Data Structures (BE03000081) Enrollment No:

DTE’s Vision

▪ To provide globally competitive technical education

▪ Remove geographical imbalances and inconsistencies

▪ Develop student friendly resources with a special focus on girls’ education and support to
weaker sections
▪ Develop programs relevant to industry and create a vibrant pool of technical professionals

Institute’s Vision
To transform the students into good human beings, employable engineering graduates and continuous
learners by inculcating human values and imparting excellence in technical education.

Institute’s Mission
To impart education to rural and urban students, so as to earn respect from the society and thereby
improving the living standards of their families and become asset for the industry and society. To foster
a learning environment with technology integration and individual attention, so that the students imbibe
quality technical knowledge, skill-development and character building.

Department’s Vision

To achieve excellence for providing value based education in computer science and Information
Technology through innovation, team work and ethical practices.

Department’s Mission

 To produce graduates according to the need of industry, government, society and scientific
community and to develop partnership with industries, government agencies and R & D
Organizations for knowledge sharing and overall development of faculties and students.
 To motivate students/graduates to be entrepreneurs.
 To motivate students to participate in reputed conferences, workshops, symposiums, seminars and
related technical activities.
 To impart human and ethical values in our students for better serving of society.
Data Structures (BE03000081) Enrollment No:
Programme Outcomes (POs)

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of
the information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities
with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to
the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader
in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive
clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change
Data Structures (BE03000081) Enrollment No:

Program Specific Outcomes (PSOs)


 An ability to design solutions by simulating computer engineering problems in absence of real time
environment.
 An ability to learn and use of open source tools in the areas like operating systems, computer
programming, computer networks and database management.
 An ability to face competitive examinations for higher education and PSUs.

Program Educational Objectives (PEOs)

 Have careers in industry, research & academics focusing on the application of the information
technologies and take leadership positions in the industry and also initiate businesses offering
innovative solutions.
 Capable of adapting to new technologies and constantly upgrade their skills with an attitude
towards lifelong learning.
 Act conscientiously about the potentials and the responsibilities of the computing profession in the
context of science, technology, society and humanity.
Data Structures (BE03000081) Enrollment No:

Practical – Course Outcome matrix

Course Outcomes (COs)


Define and classify various data structures, storage structures and common
CO-1
operations on them.
Use various linear data structures with their representation and perform
CO-2
different operations on them.
Use various nonlinear data structures with their representation and perform
CO-3
different operations on them.
CO-4 Apply various searching and sorting techniques on small and large data set.
Solve the given problem using an appropriate data structure to achieve
CO-5 optimal performance and compare its performance with Other possible data
structures.

C C C C C
Sr.
Practical Outcome/Title of experiment O O O O O
No.
1 2 3 4 5

1. Classification of Data Structure and Stack

1.1 Classify various data structures


1.2 Implement a program for stack that performs
following operations using array. (a) PUSH (b)
POP (c) PEEP (d) CHANGE (e) DISPLAY
1.3 Implement a program to convert infix notation to
postfix notation using stack. √ √ √
1.4 Write a program to implement Tower of Hanoi
problem.
1.5 Identify widely used application which use stack
data structure for implementation of its important
feature.
2. Queue

2.1 Write a program to implement QUEUE using


arrays that performs following operations (a)
INSERT (b) DELETE (c) DISPLAY
2.2 Write a program to implement Circular Queue
using arrays that performs following operations. √ √
(a) INSERT (b) DELETE (c) DISPLAY
2.3 Identify widely used application which use
Queue data structure for implementation of its
important feature.

3. Singly linked list

3.1 Write a menu driven program to implement √ √


Data Structures (BE03000081) Enrollment No:

following operations on the singly linked list.


(a) Insert a node at the front of the linked list.
(b) Insert a node at the end of the linked list.
(c) Insert a node such that linked list is in
ascending order. (According to info. Field)
(d) Delete a first node of the linked list.
(e) Delete a node before specified position.
(f) Delete a node after specified position.
3.2 Write a program to implement stack using linked
list.
3.3 Write a program to implement queue using
linked list.

4. Doubly linked list

4.1 Write a program to implement following


operations on the doubly linked list.
(a) Insert a node at the front of the linked list.
√ √
(b) Insert a node at the end of the linked list.
(c) Delete a last node of the linked list.
(d) Delete a node before specified position.

5. Circular linked list

5.1 Write a program to implement following


operations on the circular linked list.
(a) Insert a node at the end of the linked list.
(b) Insert a node before specified position.
(c) Delete a first node of the linked list. √ √
(d) Delete a node after specified position.
5.2 Identify widely used application which use
Linked List for implementation of its important
feature.

6. Tree

6.1 Write a program which create binary search tree.


6.2 Implement recursive tree traversing methods in-
order, pre-order and post-order traversal
√ √
6.3 Identify widely used application which use Tree
data structure for implementation of its important
feature.

7. Graph

7.1 Write a program to perform BFS and DFS on


given graph.
√ √
7.2 Identify widely used application which use
Graph data structure for implementation of its
Data Structures (BE03000081) Enrollment No:

important feature.

8. Searching

8.1 Write a program to implement Linear Search.


8.2 Write a program to implement Binary Search.
8.3 Identify widely used application which use √ √
Searching technique for implementation of its
important feature.

9. Sorting

9.1 Write a program to implement Quick Sort


9.2 Write a program to implement Merge Sort
9.3 Write a program to implement Bubble Sort
9.4 Write a program to implement Insertion Sort √ √
9.5 Identify widely used application which use
Sorting technique for implementation of its
important feature.

10 Hashing and File Structure

10.1Write a program to create hash table and


handle
the collision using linear probing.
10.2Write a program to demonstrate the file
primitives √ √
such as fopen, fclose, fprintf.
10.3 Identify widely used application which use
Hashing technique for implementation of its
important feature.
Data Structures (BE03000081) Enrollment No:
Industry Relevant Skills

The following industry relevant competencies are expected to be developed in the student by
undertaking the practical work of this laboratory.
1. Will be able to classify data structures and identify storage representation of primitive
and non-primitive data structures
2. Will be able to implement various operations on Stack, Queue, Link list, Tree, Graph,
Hashing and File operations.
3. Will be able to understand need of sorting and searching for various applications
4. Will be able to apply various data structure to design real time applications in efficient
manner.

Guidelines for Faculty members

1. Teacher should provide the guideline with demonstration of practical to the students
with all features.
2. Teacher shall explain basic concepts/theory related to the experiment to the students before
starting of each practical
3. Involve all the students in performance of each experiment.
4. Teacher is expected to share the skills and competencies to be developed in the
students and ensure that the respective skills and competencies are developed in the
students after the completion of the experimentation.
5. Teachers should give opportunity to students for hands-on experience after the
demonstration.
6. Teacher may provide additional knowledge and skills to the students even though not
covered in the manual but are expected from the students by concerned industry.
7. Give practical assignment and assess the performance of students based on task
assigned to check whether it is as per the instructions or not.
8. Teacher is expected to refer complete curriculum of the course and follow the
guidelines for implementation.

Instructions for Students

1. Students are expected to carefully listen to all the theory classes delivered by the faculty
members and understand the COs, content of the course, teaching and examination scheme,
skill set to be developed etc.
2. Students will have to perform experiments on computer system on which C/C++ compiler is
installed to execute programs of data structure.
3. Students should develop programs and execute all the programs using C/C++ compiler.
Students have to show output of each program in their practical file.
4. Students are instructed to submit practical list as per given sample list shown on next page.
5. Student should develop a habit of submitting the experimentation work as per the schedule
and s/he should be well prepared for the same.
Data Structures (BE03000081) Enrollment No:
Common Safety Instructions

Students are expected to

1. switch on the PC carefully (not to use wet hands)


2. shutdown the PC properly at the end of your Lab
3. carefully handle the peripherals (Mouse, Keyboard, Network cable etc)
4. use Laptop in lab after getting permission from Teacher
5. carefully handle all lab resources
Data Structures (BE03000081) Enrollment No:

Index
(Progressive Assessment Sheet)

Dat Sign.
Sr Date
e of Assess of Re
. Page of
N
Objective(s) of Experiment perf ment Teache mar
No. subm
o. orm Marks r with ks
ission
ance date

1. Classification of Data Structure and Stack


1.1 Classify various data structures
1.2 Implement a program for stack that
performs following operations using
array. (a) PUSH (b) POP (c) PEEP (d)
CHANGE (e) DISPLAY
1.3 Implement a program to convert infix
notation to postfix notation using stack.
1.4 Write a program to implement Tower of
Hanoi problem.
1.5 Identify widely used application which
use stack data structure for
implementation of its important feature.
2. Queue
2.1 Write a program to implement QUEUE
using arrays that performs following
operations (a) INSERT (b) DELETE (c)
DISPLAY
2.2 Write a program to implement Circular
Queue using arrays that performs
following operations. (a) INSERT (b)
DELETE (c) DISPLAY
2.3 Identify widely used application which
use Queue data structure for
implementation of its important feature.
3. Singly linked list
3.1 Write a menu driven program to
implement following operations on the
singly linked list.
(a) Insert a node at the front of the linked
list.
(b) Insert a node at the end of the linked
list.
(c) Insert a node such that linked list is in
ascending order. (According to info.
Data Structures (BE03000081) Enrollment No:

Field)
(d) Delete a first node of the linked list.
(e) Delete a node before specified
position.
(f) Delete a node after specified position.
3.2 Write a program to implement stack
using linked list.
3.3 Write a program to implement queue
using linked list.
4. Doubly linked list
1.1 Write a program to implement following
operations on the doubly linked list.
(a) Insert a node at the front of the linked
list.
(b) Insert a node at the end of the linked
list.
(c) Delete a last node of the linked list.
(d) Delete a node before specified
position.
5. Circular linked list
1.1 Write a program to implement following
operations on the circular linked list.
(a) Insert a node at the end of the linked
list.
(b) Insert a node before specified
position.
(c) Delete a first node of the linked list.
(d) Delete a node after specified
position.
1.2 Identify widely used application which
use Linked List for implementation of its
important feature.
6. Tree
6.1 Write a program which create binary
search tree.
6.2 Implement recursive tree traversing
methods in-order, pre-order and post-
order traversal.
6.3 Identify widely used application which
use Tree data structure for
implementation of its important feature.
7. Graph
Data Structures (BE03000081) Enrollment No:

7.1 Write a program to perform BFS and DFS


on given graph.
7.2 Identify widely used application which
use Graph data structure for
implementation of its important feature.
8. Searching
1.1 Write a program to implement Linear
Search.
1.2 Write a program to implement Binary
Search.
1.3 Identify widely used application which
use Searching technique for
implementation of its important feature.
9. Sorting
9.1 Write a program to implement Quick Sort
9.2 Write a program to implement Merge
Sort
9.3 Write a program to implement Bubble
Sort
9.4 Write a program to implement Insertion
Sort
9.5 Identify widely used application which
use Sorting technique for implementation
of its important feature.
1
Hashing and File Structure
0.
10.1Write a program to create hash table and
handle the collision using linear
probing.
10.2Write a program to demonstrate the file
primitives such as fopen, fclose, fprintf.
10.3Identify widely used application which
use Hashing technique for
implementation of its important feature.

Total
Data Structures (BE03000081) Enrollment No
Experiment No – 1
AIM: Classification of Data Structure and Stack

1.1 Classify various data structures


1.2 Implement a program for stack that performs following operations using array. (a) PUSH (b)
POP (c) PEEP (d) CHANGE (e) DISPLAY
1.3 Implement a program to convert infix notation to postfix notation using stack.
1.4 Write a program to implement the Tower of Hanoi problem.
1.5 Identify widely used applications which use stack data structure for implementation of its
important features.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO1, CO2, CO5

Objectives: (a) To analyze various data structures


(b) To understand the concepts of stack
(c) To implement various applications of the stack

Equipment/Instruments: Computer System with C/C++ compiler

Safety and necessary Precautions:

✔ Operate computer systems carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

1. Introduction to Data Structures

A data structure is a systematic way of organizing and storing data in a computer so that it can be
accessed and modified efficiently. It is fundamental to designing efficient algorithms. The choice of
the correct data structure depends on the type of operation to be performed, the data to be handled,
and the performance needs of the application.

Key reasons to use data structures:


● Efficient data access and modification
● Optimized use of memory and processor time
● Support for complex operations like searching, sorting, and indexing

A data structure is typically defined using an Abstract Data Type (ADT), which specifies:

Page No
Data Structures (BE03000081) Enrollment No
● The kind of data stored
● The operations that can be performed on it (e.g., insert, delete, search)

2. Stack: Last-In First-Out (LIFO) Structure

A stack is a linear data structure that operates on the Last-In First-Out (LIFO) principle. This means
that the last element added (pushed) to the stack is the first one to be removed (popped).

Basic Operations:
● Push: Add an element to the top of the stack.
● Pop: Remove the top element from the stack.
Characteristics:
● Only one end is accessible (the top).
● Think of it like a stack of plates or books — you add/remove only from the top.

Overflow and Underflow:


● Stack Overflow: Occurs when pushing to a full stack.
● Stack Underflow: Occurs when popping from an empty stack.
Pointer Used:
● SP (Stack Pointer): Keeps track of the top of the stack.

Diagrammatic Representation:

| 30 | ← Top (SP)
| 25 |
| 10 |
| |

After a pop operation:

| | ← Top (SP moved down)


| 25 |
| 10 |
| |

3. Infix to Postfix Conversion Using Stack

In infix expressions, operators are written between operands (e.g., A + B). In postfix expressions,
operators are written after their operands (e.g., AB+).

Stacks are used to convert infix expressions to postfix using the following algorithm:

Algorithm:
1. Scan the infix expression from left to right.

Page No
Data Structures (BE03000081) Enrollment No
2. If the symbol is:

○ Operand: Add it to the postfix output.


○ Left parenthesis (: Push onto the stack.
○ Right parenthesis ): Pop and add all operators from the stack to postfix output until
a left parenthesis is encountered. Discard the pair of parentheses.
○ Operator:
■ While there is an operator on the stack with higher or equal precedence,
pop it and add to output.
■ Then push the current operator onto the stack.

3. After the expression ends, pop all remaining operators from the stack to the postfix output.

Example:

Infix: A + B * C
Postfix: A B C * +

Operator Precedence Table:


Operator Precedence Associativity

* / % High Left to Right

+ - Low Left to Right

1.1 Classify various data structures

Classification of Data Structures:

Data structures can be classified as

1. Primitive data structure


2. Non-Primitive data structure
(a) Linear data structure
(b) Non-linear data structure

1. Primitive data structures: Primitive data structures are simple data structures
constructed using the standard data types of a computer language. Examples of primitive
data structures include variables, arrays, pointers, structures, unions, and more. These
structures are used to build more complex data structures

2. Non-primitive data structures: Non-primitive data structures are constructed using


primitive data structures and have specific functionality. They can be designed by a user
and are classified into two categories: linear data structures and non-linear data structures.

(a) Linear data structures

Page No
Data Structures (BE03000081) Enrollment No
Linear data structures are arranged as a continuous set of data elements in the memory
and can be constructed using array data types. In linear data structures, the adjacency
relationship between data elements is maintained.

Operations applied on linear data structure:

The following list of operations applied on linear data structures

✔ Add an element

✔ Delete an element

✔ Traverse

✔ Sort the list of elements

✔ Search for a data element

Examples of linear data structure

✔ Stack

✔ Queue

✔ Tables

✔ List

✔ Linked Lists.

(b) Non-linear Data Structure:

Non-linear data structures are not arranged in a continuous manner and include data
structures such as trees and graphs. These structures can be used to represent complex
relationships between data elements.

Operations applied on non-linear data structures:

The following list of operations applied on non-linear data structures.

✔ Add elements

✔ Delete elements

✔ Display the elements

Page No
Data Structures (BE03000081) Enrollment No
✔ Sort the list of elements

✔ Search for a data element

Examples of non-linear data structure

✔ Tree

✔ Decision tree

✔ Graph

✔ Forest

1.2 Implement a program for stack that performs following operations using array.
(a) PUSH (b) POP (c) PEEP (d) CHANGE (e) DISPLAY

Program:

Page No
Data Structures (BE03000081) Enrollment No
-

Output:

Page No
Data Structures (BE03000081) Enrollment No
1.3 Implement a program to convert infix notation to postfix notation using stack.

Program:

Use additional pages (A4 size) if required


Page No
Data Structures (BE03000081) Enrollment No
Output:

Page No
Data Structures (BE03000081) Enrollment No
1.4 Write a program to implement the Tower of Hanoi problem.

Program:

Output:

Page No
Data Structures (BE03000081) Enrollment No

1.5 Identify widely used application which use stack data structure for implementation of its
important feature.

Stack Applications:

1. Stack is used by compilers to check for balancing of parentheses, brackets and braces.
2. Stack is used to evaluate a postfix expression.
3. Stack is used to convert an infix expression into postfix/prefix form.
4. In recursion, all intermediate arguments and return values are stored on the processor’s
stack.
5. During a function call the return address and arguments are pushed onto a stack and on return
they are popped off.
6. Depth first search uses a stack data structure to find an element from a graph.

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Quiz:

(1) List various stack operations

(2) Differentiate FIFO and LIFO

Page No
Data Structures (BE03000081) Enrollment No
(3) Explain infix, prefix and postfix expressions

Suggested Reference:

1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here

Rubric-wise marks obtained:

Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q & A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Av Goo Avg. Good Av Goo
(1) (2) (1) (2) g. d (2) (1) (2) g. d (2)
(1) (1)
Marks

Page No
Data Structures (BE03000081) Enrollment No
Experiment No: 2

AIM : Queue

2.1 Write a program to implement QUEUE using arrays that performs following
operations (a)INSERT (b) DELETE (c) DISPLAY
2.2 Write a program to implement Circular Queue using arrays that performs following
operations. (a) INSERT (b) DELETE (c) DISPLAY
2.3 Identify widely used application which uses Queue data structure for implementation
of its important feature.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO2, CO5

Objectives: (a) To understand the concepts of Queue


(b) To analyze different algorithms on Queue
(c) To implement various operations on Queue

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

Queue

A queue is a data structure that follows the First In, First Out (FIFO) principle. It is a special type of
list where items are inserted at the rear and deleted from the front end. Queues can be compared to
real-world scenarios, such as people waiting in line at a bank.

There are various types of Queue in data structure

✔ Queue

✔ Circular Queue

✔ D-Queue

✔ Priority Queue

Page No
Data Structures (BE03000081) Enrollment No
2.1 Write a program to implement QUEUE using arrays that performs following
operations. (a)INSERT (b) DELETE (c) DISPLAY

Program:

// Write code of your program here

Use additional pages (A4 size) if required

Page No
Data Structures (BE03000081) Enrollment No

Output:

// Write output of your program here

2.2 Write a program to implement Circular Queue using arrays that performs following
operations. (a) INSERT (b) DELETE (c) DISPLAY

Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No

Output:

// Write output of your program here

Page No
Data Structures (BE03000081) Enrollment No
2.3 Identify widely used application which uses Queue data structure for implementation
of its important feature.

// Write relevant contents here

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Quiz:

(1) Explain concepts of Queue

(2) Define DQueue

(3) Differentiate Circular Queue and Priority Queue

Page No
Data Structures (BE03000081) Enrollment No
Suggested Reference:

1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here

Rubric-wise marks obtained:

Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q&A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Avg. Good Avg. Good Avg. Good
(1) (2) (1) (2) (1) (2) (1) (2) (1) (2)

Marks

Page No
Data Structures (BE03000081) Enrollment No
Experiment No: 3

AIM: Singly linked list

3.1 Write a menu driven program to implement following operations on the singly linked
list.
(a) Insert a node at the front of the linked list.
(b) Insert a node at the end of the linked list.
(c) Insert a node such that linked list is in ascending order. (According to INFO field)
(d) Delete a first node of the linked list.
(e) Delete a node before specified position.
(f) Delete a node after specified position.
3.2 Write a program to implement stack using linked list
3.3 Write a program to implement queue using linked list.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO2, CO5

Objectives: (a) To understand the concepts of singly linked list


(b) To analyze different algorithms on singly link list
(c) To implement various operations on singly link list

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously


Theory:
Singly link list
A linked list is a type of data structure that stores a collection of non-sequential data items. Unlike
arrays, linked lists are dynamic and their size can be changed during program execution. Each data
item in a linked list has a pointer that holds the memory address of the next data item in the list. The
data items in a linked list may not be stored in consecutive memory locations, but their pointers
make it easy to access them in any order.
A singly linked list, also known as a linear linked list, is a type of linked list in which all nodes are
connected together sequentially. Each node in a singly linked list contains data and a pointer to the
next node. The last node's pointer is set to null. The limitation of a singly linked list is that it can only
be traversed in one direction, in a forward direction.

Page No
Data Structures (BE03000081) Enrollment No
Operations on singly linked list

✔ Insert
- Insert at first position
- Insert at last position
- Insert into ordered list
✔ Delete

✔ Traverse list (Print list)

✔ Copy linked list

3.1 Write a menu driven program to implement following operations on the singly linked
list.
(a) Insert a node at the front of the linked list.
(b) Insert a node at the end of the linked list.
(c) Insert a node such that linked list is in ascending order.(According to INFO field)
(d) Delete a first node of the linked list.
(e) Delete a node before specified position.
(f) Delete a node after specified position.

Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No

Page No
Data Structures (BE03000081) Enrollment No
Output:

3.2 Write a program to implement stack using linked list

Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No
Output:

// Write output of your program here

3.3 Write a program to implement queue using linked list.

Program:

Page No
Data Structures (BE03000081) Enrollment No

Output:

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Page No
Data Structures (BE03000081) Enrollment No
Quiz:
(1) Which are the operations on singly link list?

(2) State the limitation of singly link list

(3) Compare array and singly link list

Suggested Reference:

1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here

Rubric-wise marks obtained:

Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q&A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Avg. Good Avg. Good Avg. Good
(1) (2) (1) (2) (1) (2) (1) (2) (1) (2)

Marks

Page No
Data Structures (BE03000081) Enrollment No
Experiment No: 4

AIM : Doubly linked list

4.1 Write a program to implement following operations on the doubly linked list.
(a) Insert a node at the front of the linked list.
(b) Insert a node at the end of the linked list.
(c) Delete a last node of the linked list.
(d) Delete a node before specified position.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO2, CO5

Objectives: (a) To understand the concepts of doubly linked list


(b) To analyze different algorithms on doubly link list
(c) To implement various operations on doubly link list

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

Doubly linked list

A doubly linked list is a data structure where each node contains data and two pointers - one to point
to the previous node (LPTR) and another to point to the next node (RPTR). The main advantage of a
doubly linked list is that we can traverse it in any direction, either forward or backward. Another
advantage is that we can delete a node with ease since we have pointers to both the previous and next
nodes. In contrast, a node on a singly linked list cannot be removed unless we have a pointer to its
predecessor. However, the drawback of a doubly linked list is that it requires more memory than a
singly linked list since we need an extra pointer to point to the previous node. In the image, L and R
denote the leftmost and rightmost nodes in the list, respectively. The left link of the L node and the
right link of the R node are both NULL, indicating the end of the list for each direction.

Page No
Data Structures (BE03000081) Enrollment No
Operations on doubly linked list

✔ Insert
- Insert at first position
- Insert at last position
- Insert into ordered list
✔ Delete

✔ Traverse list (Print list)

✔ Copy linked list

4.1 Write a program to implement following operations on the doubly linked list.
(a) Insert a node at the front of the linked list.
(b) Insert a node at the end of the linked list.
(c) Delete a last node of the linked list.
(d) Delete a node before specified position.

Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No
Output:

Page No
Data Structures (BE03000081) Enrollment No
Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Quiz:

(1) Explain structure of a node of doubly link list

(2) Which is the main advantage of doubly link list?

(3) What is the drawback of doubly link list?

Suggested Reference:

1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni, Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here


Rubric-wise marks obtained:

Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q&A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Avg. Good Avg. Good Avg. Good
(1) (2) (1) (2) (1) (2) (1) (2) (1) (2)

Marks

Page No
Data Structures (BE03000081) Enrollment No
Experiment No: 5

AIM : Circular linked list

5.1 Write a program to implement following operations on the circular linked list.
(a) Insert a node at the end of the linked list.
(b) Insert a node before specified position.
(c) Delete a first node of the linked list.
(d) Delete a node after specified position.
5.2 Identify widely used application which uses linked list for implementation of its
important feature.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO2, CO5

Objectives: (a) To understand the concepts of circular linked list


(b) To analyze different algorithms on circular link list
(c) To implement various operations on circular link list

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

Circular linked list

A circular linked list is similar to a singly linked list, except that the last node points to the first node,
creating a circular arrangement of nodes. Unlike a singly linked list, it does not contain null pointers.
Traversal can only be done in one direction, i.e., the forward direction. The biggest advantage of a
circular linked list is that it saves time when we want to go from the last node to the first node
because it directly points to the first node. A good example of an application where a circular linked
list can be used is a time-sharing problem that can be solved by the operating system.

Operations on circular linked list

✔ Insert
- Insert at first position
Page No
Data Structures (BE03000081) Enrollment No
- Insert at last position
- Insert into ordered list
✔ Delete

✔ Traverse list (Print list)


5.1 Write a program to implement following operations on the circular linked list.
(a) Insert a node at the end of the linked list.
(b) Insert a node before specified position.
(c) Delete a first node of the linked list.
(d) Delete a node after specified position.

(a) Insert a node at the end of the linked list.


(b) Insert a node before specified position.
(c) Delete a first node of the linked list.
(d) Delete a node after specified position.

Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No

Output:

// Write output of your program here

5.2 Identify widely used application which uses linked list for implementation of its
important feature.

// Write relevant contents here

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Page No
Data Structures (BE03000081) Enrollment No
Quiz:

(1) What are disadvantages of circular link list?

(2) Differentiate Circular link list and Queue

(3) Which are the operations on circular link list?

Suggested Reference:

1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here

Rubric-wise marks obtained:


Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q&A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Avg. Good Avg. Good Avg. Good
(1) (2) (1) (2) (1) (2) (1) (2) (1) (2)

Marks

Page No
Data Structures (BE03000081) Enrollment No
Experiment No: 6

AIM : Tree

6.1 Write a program which create binary search tree.


6.2 Implement recursive tree traversing methods in-order, pre-order and post-order
traversal.
6.3 Identify widely used applications which use Tree data structure for implementation
of its important feature.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO3, CO5

Objectives: (a) To understand the concepts of Tree


(b) To analyze different algorithms on Tree
(c) To implement various operations on Tree

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

Binary Search Tree

A binary search tree is a binary tree in which each node possessed a key that satisfy the
following conditions

1. All key (if any) in the left sub tree of the root precedes the key in the root.
2. The key in the root precedes all key (if any) in the right sub tree.
3. The left and right sub tree sub trees of the root are again search trees.

Operations on tree

The most common operations performed on tree structure are that of traversal. This is a procedure
by which each node in the tree is processed exactly once in a systematic manner.

There are three ways of traversing a binary tree.

Page No
Data Structures (BE03000081) Enrollment No
1. Pre-order Traversal
2. In-order Traversal
3. Post-order Traversal
Pre-order

✔ Pre-order traversal of a binary tree is defined as follow

● Process the root node

● Traverse the left sub tree in pre-order

● Traverse the right sub tree in pre-order

✔ If particular sub tree is empty (i.e., node has no left or right descendant) the traversal is
performed by doing nothing, In other words, a null sub tree is considered to be fully
traversed when it is encountered.

In-order

✔ The In-order traversal of a binary tree is given by following steps,

● Traverse the left sub tree in In-order

● Process the root node

● Traverse the right sub tree in In-order

Post-order

✔ The post-order traversal is given by

● Traverse the left sub tree in post-order

● Traverse the right sub tree in post-order

● Process the root node

6.1 Write a program which create binary search tree.


6.2 Implement recursive tree traversing methods in-order, preorder and post-order
traversal.

Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No
Output:

// Write output of your program here

6.3 Identify widely used applications which use Tree data structure for implementation
of its important feature.

// Write relevant contents here

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Page No
Data Structures (BE03000081) Enrollment No
Quiz:

(1) Define binary search tree

(2) Explain pre-order, in-order and post order traversal techniques

(3) Which are the applications of binary search tree?

Suggested Reference:

3. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
4. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
5. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
6. http://www.geeksforgeeks.org/data-structures/
7. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here


Rubric-wise marks obtained:

Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q&A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Avg. Good Avg. Good Avg. Good
(1) (2) (1) (2) (1) (2) (1) (2) (1) (2)

Marks

Page No
Data Structures (BE03000081) Enrollment No
Experiment No: 7

AIM : Graph

7.1 Write a program to perform BFS and DFS on given graph.


7.2 Identify widely used applications which use graphs data structure for implementation
of its important feature.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO3, CO5

Objectives: (a) To understand the concepts of graphs


(b) To analyze different algorithms on graphs
(c) To implement various operations on graphs

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

Graph:

A graph G can be defined as a non-empty set of vertices or nodes (V) and a set of edges (E) that
represents the relationship or connection between those nodes. The edges can be defined as a
mapping from E to pairs of elements of V. A graph can be represented as G = (V, E), where V
represents the set of nodes and E represents the set of edges. Each edge of the graph G can be
associated with a pair of nodes of the graph. If an edge X belongs to E and is associated with a pair of
nodes (u, v), where u and v belong to V, then we say that edge X connects node u and node v.

Depth First Search (DFS):

DFS is a graph traversal algorithm that is similar to the preorder traversal of a tree. The traversal can
start from any vertex vi of the graph. Initially, the vertex vi is visited, and then all the adjacent
vertices to vi are traversed recursively using DFS. As a graph can have cycles, we need to avoid
revisiting a node. To achieve this, when a vertex V is visited, it is marked as visited and should not
be selected for traversal again.

Page No
Data Structures (BE03000081) Enrollment No

Breadth First Search (BFS)

● Breadth First Search (BFS) starts from a vertex v0 and marks it as visited. Then, all the
vertices adjacent to v0 are visited next.
● Let the vertices adjacent to v0 be v1, v2, v3, and v4. These vertices are marked as visited.

● All unvisited vertices adjacent to v1, v2, v3, and v4 are visited next.

● The above process continues until all vertices are visited.

● The algorithm for BFS maintains a list of vertices that have been visited but not explored for
adjacent vertices. This list is stored in a queue.
● The queue initially contains the starting vertex.

● In each iteration, a vertex is removed from the queue, and its adjacent vertices, which have
not been visited yet, are added to the queue.
● The algorithm terminates when the queue becomes empty.

7.1 Write a program to perform BFS and DFS on given graph.

Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No
Output:

// Write output of your program here

7.2 Identify widely used applications which use graphs data structure for implementation
of its important feature.

// Write relevant contents here

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Page No
Data Structures (BE03000081) Enrollment No
Quiz:

(1) Define Directed Acyclic Graph (DAG).

(2) Differentiate DFS and BFS.

(3) State the applications of graph.

Suggested Reference:

1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here

Rubric-wise marks obtained:

Page No
Data Structures (BE03000081) Enrollment No
Experiment No: 8

AIM : Searching

8.1 Write a program to implement Linear Search.


8.2 Write a program to implement Binary Search.
8.3 Identify widely used applications which use Searching technique for implementation
of its important feature.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO4, CO5

Objectives: (a) To understand the concepts of Searching


(b) To analyze different algorithms on Searching
(c) To implement various operations on Searching

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

Linear/Sequential Search

● Linear search, also known as sequential search, is a technique used in computer science to
find a specific value in a list by sequentially checking each of its elements one at a time until
the desired one is found.
● It is the simplest search algorithm and a form of brute-force search. Its worst-case cost is
proportional to the number of elements in the list.

Binary Search

● If we have an array that is sorted, we can use a much more efficient algorithm called Binary
Search.
● In Binary Search, we divide the array into two equal halves and compare the middle element
with the search element.

Page No
Data Structures (BE03000081) Enrollment No
● If the middle element is equal to the search element, we have found the element and return its
index; otherwise, if the middle element is less than the search element, we look at the right
part of the array, and if the middle element is greater than the search element, we

look at the left part of the array.

8.1 Write a program to implement Linear Search.

Program:

// Write code of your program here

Output:

// Write output of your program here

Page No
Data Structures (BE03000081) Enrollment No

8.2 Write a program to implement Binary Search.

Program:

// Write code of your program here

Output:

// Write output of your program here

Page No
Data Structures (BE03000081) Enrollment No

8.3 Identify widely used applications which use Searching technique for implementation
of its important feature.

// Write relevant contents here

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Quiz:

(1) List out searching algorithms

(2) Differentiate sequential search and binary search

(3) Which are the applications of binary search algorithm?

Page No
Data Structures (BE03000081) Enrollment No
Suggested Reference:

1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here

Rubric-wise marks obtained:

Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q&A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Avg. Good Avg. Good Avg. Good
(1) (2) (1) (2) (1) (2) (1) (2) (1) (2)

Marks

Page No
Data Structures (BE03000081) Enrollment No

Experiment No: 9

AIM : Sorting

9.1 Write a program to implement Quick Sort


9.2 Write a program to implement Merge Sort
9.3 Write a program to implement Bubble Sort
9.4 Write a program to implement Insertion Sort
9.5 Identify widely used applications which use Sorting technique for implementation
of its important feature.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO4, CO5

Objectives: (a) To understand the concepts of Sorting


(b) To analyze different algorithms on Sorting
(c) To implement various operations on Sorting

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

Bubble sort

Bubble sort, also known as sinking sort, is a comparison-based sorting algorithm. It works by
repeatedly scanning through the list to be sorted, comparing adjacent elements and swapping them if
they are not in the correct order. In each pass through the list, the largest element bubbles up to the
top. The algorithm repeats these processes until no more swaps are needed, indicating that the list is
sorted. Although it is simple to understand and implement, bubble sort has a worst-case and average
time complexity of O(n^2), making it too slow for large inputs. Insertion sort is a more efficient
alternative for small lists.

Merge Sort

Page No
Data Structures (BE03000081) Enrollment No
● The merge sort algorithm is based on the classical divide-and-conquer paradigm. It operates
as follows:

▪ DIVIDE: Partition the n-element sequence to be sorted into two sub sequences of
n/2 elements each.
▪ CONQUER: Sort the two sub sequences recursively using the merge sort.

▪ COMBINE: Merge the two sorted sub sequences of size n/2 each to produce the
sorted sequence consisting of n elements.

Quick Sort

Quicksort is currently the fastest known sorting algorithm and often the most practical choice for
sorting, with an average expected running time of O(n log(n)). Its operation consists of the following
steps:
● Pick an element from the array, known as a pivot.

● Reorder the array so that all elements with values less than the pivot are placed before it,
while all elements with values greater than the pivot come after it (elements with equal
values can go either way). This operation is called partitioning, and at the end of it, the pivot
is in its final position.
● Recursively apply the above steps to the sub-arrays of elements with smaller and greater
values, respectively. Quicksort, like merge sort, is a divide-and-conquer recursive
algorithm.
● The basic divide-and-conquer process for sorting a sub array is given in the following three
easy steps:
▪ Divide

▪ Conquer

▪ Combine

Page No
Data Structures (BE03000081) Enrollment No
9.1 Write a program to implement Quick Sort

Program:

// Write code of your program here

Output:

// Write output of your program here

Page No
Data Structures (BE03000081) Enrollment No
9.2 Write a program to implement Merge Sort

Program:

// Write code of your program here

Output:

// Write output of your program here

Page No
Data Structures (BE03000081) Enrollment No

9.3 Write a program to implement Bubble Sort

Program:

// Write code of your program here

Output:

// Write output of your program here

Page No
Data Structures (BE03000081) Enrollment No

9.4 Write a program to implement Insertion Sort

Program:

// Write code of your program here

Output:

// Write output of your program here

Page No
Data Structures (BE03000081) Enrollment No

9.5 Identify widely used applications which use Sorting technique for implementation
of its important feature.

// Write relevant contents here

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Quiz:

(1) Define sorting

(2) What is divide-and-conquer strategy for sorting?

(3) Which is the best suitable sorting algorithm as per its execution time?

Suggested Reference:
1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.
Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here

Rubric-wise marks obtained:


Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q&A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Avg. Good Avg. Good Avg. Good
(1) (2) (1) (2) (1) (2) (1) (2) (1) (2)

Marks

Page No
Data Structures (BE03000081) Enrollment No

Experiment No: 10

AIM : Hashing and File Structure

10.1 Write a program to create hash table and handle the collision using linear probing.
10.2 Write a program to demonstrate the file primitives such as fopen, fclose, fprintf.
10.3 Identify widely used applications which use Hashing technique for implementation of
its important feature.

Date: // Write date of experiment here

Competency and Practical Skills: Logic building and programming

Relevant CO: CO4, CO5

Objectives: (a) To understand the concepts of Hashing techniques


(b) To implement various file operations

Equipment/Instruments: Computer System with turbo C/C++

Safety and necessary Precautions:

✔ Operate computer system carefully and responsibly.

✔ Use required lab resources cautiously

Theory:

Hashing

Hashing is a method used to map a large number of data items to a smaller table by utilizing a
hashing function. This technique transforms a range of key values into a range of indexes of an
array. There are two different forms of hashing.

1. Open hashing or external hashing: Open or external hashing, allows records to be stored
in unlimited space (could be a hard disk). It places no limitation on the size of the tables.
2. Close hashing or internal hashing: Closed or internal hashing, uses a fixed space for
storage and thus limits the size of hash table.

Hashing Functions
Characteristics of a Good Hash Function
● A good hash function avoids collisions.

● A good hash function tends to spread keys evenly in the array.

Page No
Data Structures (BE03000081) Enrollment No
● A good hash function is easy to compute.

Different hashing functions

1. Division-Method
2. Folding Method
3. Algebraic Coding
4. Multiplicative Hashing
5. Digit Analysis
6. Mid-square Methods
7. Length Dependent Method

Collision Resolution Strategies

● Collision resolution is the main problem in hashing.

● If the element to be inserted is mapped to the same location, where an element is already
inserted then we have a collision and it must be resolved.
● There are several strategies for collision resolution. The most commonly used are :
1. Separate chaining - used with open hashing
2. Open addressing - used with closed hashing

File

In computing, a file is a group of records, where each record comprises one or more fields that have
the same sequence. Typically, each field has a predetermined length.

Different file organizations

1. Sequential files
2. Direct files
3. Index files
4. Indexed Sequential files
5. Relative files

Primitive Operations on a File

1. Creation
2. Insertion
3. Deletion
4. Updation
5. Reading
6. Searching

Page No
Data Structures (BE03000081) Enrollment No
10.1 Write a program to create hash table and handle the collision using linear probing.

Page No
Data Structures (BE03000081) Enrollment No
Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No
Output:

// Write output of your program here

10.2 Write a program to demonstrate the file primitives such as fopen, fclose, fprintf.

Program:

// Write code of your program here

Page No
Data Structures (BE03000081) Enrollment No
Output:

// Write output of your program here

Page No
Data Structures (BE03000081) Enrollment No

10.3 Identify widely used applications which use Hashing technique for implementation of
its important feature.

// Write relevant contents here

Observations:

// Write your observation here

Conclusion:

// Write conclusion here

Quiz:

(1) What is internal hashing and external hashing?

(2) Explain linear probing.

(3) Which are primitive operations on file?

Page No
Data Structures (BE03000081) Enrollment No

Suggested Reference:

1. An Introduction to Data Structures with Applications. by Jean-Paul Tremblay & Paul G.


Sorenson Publisher-Tata McGraw Hill.
2. Data Structures using C & C++ -By Ten Baum Publisher – Prenctice-Hall International
3. Fundamentals of Computer Algorithms by Horowitz, Sahni,Galgotia Pub. 2001 ed.
4. http://www.geeksforgeeks.org/data-structures/
5. http://www.coursera.org/specializations/data-structures-algorithms

References used by the students:

// Write references used by you here

Rubric-wise marks obtained:

Completeness
Problem Coding
Logic and accuracy
Rubric Understanding Standards Q&A Total
Building (2) (2)
s (2) (2)
Avg. Good Avg. Good Avg. Good Avg. Good Avg. Good
(1) (2) (1) (2) (1) (2) (1) (2) (1) (2)

Marks

Page No

You might also like