Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Data Structure Laboratory Experiment

1. Implement the Algorithm for Reversing elements of an Array.


2. Write a program in C++ to swap values of two variables without using third variables.

3. Write a C++ program to create an M×N matrix and verify whether it is a sparse matrix. If it is a sparse matrix,
represent it using an array
4. Implement an algorithm to remove duplicate elements in a sorted array
5. Implement the Algorithm for Linear Search
6. Implement the Algorithm for Binary Search.
7. Implement the Algorithm for Bubble Sort.
8. Implement the Algorithm for Selection Sort.
9. Implement the Algorithm for Insertion Sort
10. Implement the Algorithm for Factorial using Recursion.
11. Take two numbers N and K as an input. Create an array Arr of length N and initialize it with zeros. Change the
value to 1 of even indexes if k is even, otherwise change the value of odd indexes to 1. Print Arr in the end.
(Consider 0 as even)
12. Implement the Algorithm for Inserting a Node at the beginning and end of a Linked List.
13. Implement the Algorithm for Inserting a Node at the Given Location of a Linked List.
14. Implement the Algorithm for Deleting a Node of a Linked List.
15. Implement the Algorithm for Inserting a Node at the beginning of a Doubly Linked List.
16. Implement the Algorithm for Inserting a Node by data field of a Doubly Linked List.
17. Implement the Algorithm to Insert a new Node in a Circular Linked List after a Node whose data field is Given.
18. Implement the Algorithm for Operations to be performed on Stack DS using Linked List.
19. Implement the Algorithm to Delete first Node of a Circular Linked List.
20. Implement the Algorithm for Operations to be performed on Queue DS using Array.
21. Implement the Algorithm for Circular Queue DS using Liked List.
22. Implement the Algorithm for Post Order Traversal of a BST.
23. Implement the Algorithm for Pre Order Traversal of a BST.
24. Implement the Algorithm for In Order Traversal of a BST.
Computer Programming Laboratory Experiment

1) Write a program in C++ using Structure that contains following variables Full Name, Roll Number,
Gender and weight (float type). Store detail of 5 students.
2) Create a structure named Complex with 2 data members (one integer type and one
float type). Print the values of these two-variable using pointer.
3) Write a program in C++ using Class (without using constructor) that contains following variables
Full Name, Roll Number, Gender, Ph No and weight (float type). The variables Ph Number and
weight are Privet. Store detail of 5 students and print the detail of every student.
4) Write a program in C++ using Class (Using constructor) that contains following variables Full
Name, Roll Number, Gender, Ph No and weight (float type). The variables Ph Number and weight are
Privet. Store detail of 10 students.
5) Create a class BOX which has two object Box1 and Box2. Length and Width are the
two member variables of the class. The Length Box2 is 40% more than that of Box1
but Width of Box2 is 30% less than that of Box1. Write a C++ code using copy
constructor to find the area of Box1 and Box2.
6) Create a class called "Person" that represents a person's details such as name, age, and gender.
Implement constructor overloading to allow the creation of a person object in the following ways:
i. Default constructor that initializes name as "Unknown", age as 0, and gender as "Not
specified".
ii. Constructor that takes parameters for name and age and initializes the member variables
accordingly. The gender should be set as "Not specified".
iii. Constructor that takes parameters for name, age, and gender and initializes the member
variables accordingly.
7) Write a C++ program that creates objects of the Person class using different constructors and
displays the details (name, age, and gender) of each person
8) Write a C++ program to find the area of circle using Class circle which have following details: a.
Accept radius from the user b. Calculate the area c. Display the result
9) Write a C++ program to define a class employee having members Emp-id, Emp-name, basic salary
and functions accept () and display (). Calculate DA=25% of basic salary, HRA=800, I-tax=15% of
basic salary. Display the payslip using appropriate output format.
10) Define a class to represent a bank account of 5 persons. Include the following members:
Data members:
1) Name of the depositor
2) Account number
3) Type of account
4) Balance amount in the account. .
Account number and Balance are Privet member variables. Write a main program that will display the
name, Account number and balance after depositing or withdrawing an amount.

11) Write a program in C++ to demonstrate the Function overloading feature of C++.
12) Write a program in C++ using Class which shows function Overriding.
13) Write a program in C++ using Class which shows operator Overriding.
14) Create a class called "Complex" to represent complex numbers. Overload the addition operator (+) to
add two complex numbers together. Provide a member function to display the result of the addition.
15) Write a program in C++ using Class that takes input the height, length, breadth of a Box and displays
Volume of two different Box. (Class Box)
16) Write a program in C++ using class to show use of Friend function and Friend class.
17) Write a C++ program to create multilevel inheritance.
18) Write a C++ program to demonstrate multiple inheritance feature of a Class.
19) Using multilevel inheritance, write a C++ program to make a basic calculator to do following
calculations a. Addition, 2. Subtraction, 3. Multiplication, 4. Division,
20) Create a class for an electricity board that charges the following rates to users
a) For first 100 units : 50p per unit
b) For next 200 units : 60p per unit
c) Beyond 300 units : 80p per unit
All users are charged a minimum of Rs.150. If the total cost is more than Rs.250.00 then an
additional charges of 15% are added. Write a C++ program using class to read the names of users &
number of units consumed & print out the charges with names.
21) Write C++ programs to explain the importance of Template functions and class.
22) Write a program to copy the content of one file “input.txt” to another file “output.txt”.

You might also like