You are on page 1of 7

DAYANANDA SAGAR

UNIVERSITY
DEPARTMENT OF
COMPUTER SCIENCE &
ENGINEERING
SCHOOL OF ENGINEERING

DAYANANDA SAGAR UNIVERSITY


KUDLU GATE
BANGALORE – 560068

DATA STRUCTURES LAB MANUAL

Course Code:

USN:
Name:
Semester:
Section:
CERTIFICATE

This is to certify that a bonafide record of work done by Data


Structures practical laboratory in the department of Computer
Science Engineering by ……………………………………………
bearing USN Number …...………………………… of B.Tech III
SEM………………. in the academic year ………………….

No. of Experiments Given


…………………………………… Total No. of
Experiments done………………………………

Signature of Lab- Incharge

Signature of Examiner

1
INDEX

Sl. No CONTENTS Page No.


1 Objectives,Introduction about Lab 3,4
2 Guidelines to Students 5
3 List of Lab Exercises 6
4 Lab Experiment 1 7
5 Lab Experiment 2

6 Lab Experiment 3

7 Lab Experiment 4

8 Lab Experiment 5

9 Lab Experiment 6

10 Lab Experiment 7

11 Lab Experiment 8

12 Lab Experiment 9

13 Lab Experiment 10

14 Lab Experiment 11

15 Lab Experiment 12

16 Lab Experiment 13

17 Lab Experiment 14

18 Lab Experiment 15

19 Lab Experiment 16

20 Lab Experiment 17

2
LAB OBJECTIVES
Upon successful completion of this Lab the student will be able to:

● To perform arithmetic storage/operations using arrays

● To Implement C programs with concepts of pointers, structures

● To implement multidimensional array Matrix Multiplication

● To search element(s) in a multidimensional array

● To search elements in data structure with different search methods

● To implement stack, queue and their variations using arrays

● To implement stack, queue and their variations using linked lists

● To Implement Linked Lists and variations and use them to store data.

● To Implement Addition/multiplication 2 polynomial linked lists

● To implement graph & binary tree traversal techniques

● To evaluate postfix expressions tree

● To perform basic file operations

3
INTRODUCTION ABOUT LAB

There are 30 systems (Compaq Presario) installed in this Lab.

Their configurations are as follows:

Processor : Intel I7 Processor

Network Interface Card: Present

RAM : 8GB

Hard Disk : 500 GB

Software

 All systems are configured in DUAL BOOT mode i.e., Students can boot from
Windows 8 or Linux as per their lab requirement. This is very useful for students
because they are familiar with different Operating Systems so that they can execute
their programs in different programming environments.

 Each student has a separate login for database access

 On the server, an account for each student has been created.

 This is very useful because students can save it in their own accounts. Each
student's work is safe and secure from other students.

 Latest Technology like J2EE, is installed in some systems. Before submitting their
final project, they can start doing mini projects from 2nd year onwards.

 Systems are provided for students in the 1:1 ratio.

 Systems are assigned numbers and the same system is allotted for students when
they work in the lab.

4
GUIDELINES TO STUDENTS
● Equipment in the lab for the use of the student community. Students need to
maintain a proper decorum in the computer lab. Students must use the
equipment with care. Any damage caused is punishable.
● Students are required to carry their observation / programs book with completed
exercises while entering the lab.
● Students are supposed to occupy the machines allotted to them and are not
supposed to talk or make noise in the lab. The allocation is put up on the lab
notice board.
● Lab records need to be submitted on or before the date of submission.
● Do not touch, connect or disconnect any plug or cable without
● your lecturer/laboratory technician’s permission
● Read and understand how to carry out an activity thoroughly before
coming to the laboratory.
● Do not carry eatables to the laboratory.
● Program coding and compilation instructions: Open Terminal and type the
following in shell command line:
○ To Type your program: gedit filename.c
○ To Compile your program: gcc filename.c
○ To Execute : ./a.out

5
LIST OF LAB EXERCISES
1.Write a program to add, subtract, multiply and divide two integers using user defined type
function with return type.

2. Write a program to find the sum of digits of the number and print the reverse of that
number using Recursive Function.

3. Write a program to add and multiply two matrices using pointers.

4. A structure stores the x & y coordinates of a point on the screen, a rectangle structure
stores the coordinates of the upper left & the lower right points corners of a rectangle. Write
a function that accepts rectangle structure r as an argument and computes the area of r.

5. Design, Develop and Implement a menu driven Program in C for the Searching Techniques
on arrays i.e, 1. Linear search 2. Binary search. If unsorted array is given as input, your
program must perform sorting (bubble sort) to use it as input for binary search algorithm.

6. Write a C program for array representation of Stack /Queue with basic functions.

7. Write a C program to convert infix expression to postfix expression.

8. Write a C program to convert infix expression to prefix expression.

9. Write a C program to evaluate Postfix expression.

10. Write a C program to solve tower of hanoi using recursion.

11. Write a C program to perform the following operations on Circular QUEUE of Characters
a. Insert b.Delete c. Demonstrate Overflow and Underflow situations.

12. Implement the following operations (Demonstration of stack and Queues) on Singly
Linked List (SLL)/ Doubly Linked List (DLL) of Student Data with the fields: RollNo, Name,
Semester a. Create a SLL of N Students Data by using front insertion. b. Display the count
of nodes in it c. Perform Insertion / Deletion at End of SLL d. Perform Insertion / Deletion at
Front of SLL .

13. Write a C Program to Implement Addition 2 polynomial linked lists.

14. Implement a menu driven Program in C for the following operations on Binary Search
Tree (BST) of Integers 6, 9, 5, 2, 8, 15, 24, 14, 7, 8, 5, 2 as input. a. Create a BST of N Integers
b. Traverse the BST in In-order, Pre-order and Post-order c. Search the BST for a given
element (KEY) and report the parent.
15. Implement Program to create a binary expression tree given string of postfix expression
as input and perform In-order, Pre-order and Post-order traversal.

16. Implement a Program in C for the following operations on Graph(G) of Cities a. Create a
Graph of N cities using Adjacency Matrix. b. Print all the nodes reachable from a given
starting node in a digraph using DFS/BFS method.
17. Write a C program to implement File operations a. Open a file b. Write c. Read d. close
6

You might also like