Vous êtes sur la page 1sur 6

Data Structure Laboratory Exercises

III SEMESTER
INFORMATION SCIENCE & ENGINERRING

P M Shivamurthy
Department of Computer Science and Engineering
Sri Jayacharajendra College Of Enginnering
Mysore-570006

Contents
1 Exercises on Primitive Data Structures

2 Exercises on Linear datastructures with sequential storage


2.1 Exercises Arrays . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Exercises on Stack . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Exercises on Queues . . . . . . . . . . . . . . . . . . . . . . .

1
1
2
3

3 Exercises on Linear data structures with linked structures

4 Exercises on Non-linear data structures

Exercises on Primitive Data Structures


1. Write a program to know the following attributes:
1. The memory size in bytes
2. The maximum and minimum range of values
3. The memory addres in hex,decimal representation
for all possible primitive data types.(use limits.h and float.h)
2. Perform Bitwise operations on Integers and Real numbers and verify
the results.
3. Perform following operations on characters & strings
1. Perform arithmatic,logical operations on ASCII values and print
the results
2. Perform various character testing operations(use ctype.h)
4. Perform following operation on pointers
1. Using the address & dereferencing operators
2. Perform arithmatic operations on pointers for different datatypes
3. Perform various address calculation arithmatic used for addressing

Exercises on Linear datastructures with sequential storage

2.1

Exercises Arrays

1. Addressing opertions
1. Store nelements into an array using address computing technique
2. display the address and the value of members of the array
3. Implement a mutitype arrays
2. Demostrate the linearity of addresses of array elements of both one
dimension and two-dimensions.
3. Using 2-D array representation for a polynomial, design, develop, and
execute a program in C to accept two polynomials, add them, and then
print the resulting polynomial.
1

4. Design, develop, and execute a program in C & C++ based on the following requirements: An EMPLOYEE class is to contain the following
data members and member functions:
Data: Employee Number (an integer), Employee Name (a string of
characters),Basic Salary (an integer) , All Allowances (an integer), IT
(an integer), Net Salary (an integer).
Functions: to read the data of an employee, to calculate Net Salary
and to print the values of all the data members. (All Allowances =
123% of Basic; Income Tax (IT) = 30% of the gross salary (= basic Salary All Allowance); Net Salary = Basic Salary + All Allowances
IT)
use structures in C and class in C++
5. Design, develop, and execute a program in C & C++ to implement
the following operations on Strings. Display the results after every
operation.
1 Concatenation
2 Search & replace
3 Length
For C++, define a class called STRING & use operator overloading
6. Design, develop, and execute a program in C to create a max heap of
integers by accepting one element at a time and by inserting it immediately in to the heap. Use the array representation for the heap. Display
the array at the end of insertion phase.

2.2

Exercises on Stack

1. Write a program to implement stack operations in C & C++.(In C++


define a class STACK ).
2. Design, develop, and execute a program in C to convert a given valid
parenthesized infix arithmetic expression to postfix expression and then
to print both the expressions.
3. Design, develop, and execute a program in C to evaluate a valid postfix
expression using stack. Assume that the postfix expression is read as a
single line consisting of non-negative single digit operands and binary
arithmetic operators.

4. Solve the tower of hanoi puzzle with the help of explicit stack to simulate the recursion.

2.3

Exercises on Queues

1. Design, develop, and execute a program in C to simulate the using an


array. Provide the following operations:
Insert
Delete
Display
2. Demonstrate the reuse of fixed set of memory locations using circular
queue.
3. Implement a double-ended queue (dequeue) where insertion and deletion operations are possible at bot the ends.
4. Write a program to check for palindrome usng both stacks and queues

Exercises on Linear data structures with


linked structures
1. Write a program to implement singly,doubly & circular linked list with
insert, delete, search, view and delete function(both in C & C++)
2. Write a C Program using dynamic variables and pointers to construct
a stack & queue of integers using singly linked list
3. Using singly linked list for stacks, evaluate the given postfix expression

Exercises on Non-linear data structures


1. Write a program to implement tree with insert, delete and search function
2. Write a program in C & C++ to perform inorder, postorder and preorder traversal of a binary tree
3. Write a program of implement following Self-balancing search trees

AVL Tree
2-3 Trees
Red-Black Trees
B-Tree

Vous aimerez peut-être aussi