0% found this document useful (0 votes)
15 views

model practical.ds

Data structure lab questions bank

Uploaded by

mrohith0089
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)
15 views

model practical.ds

Data structure lab questions bank

Uploaded by

mrohith0089
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/ 21

1.

Write a c program to implement circular queue ADT to do the insertion and deletion
operation.

2.Write a C program that uses functions to perform the following:

a) Create a singly linked list of integers.

b) Delete a given integer from the above linked list.

c) Display the contents of the above list after deletion

3.Write a C program to implement stack ADT using linked list implementation.

4.Write a c program to implement the polynomial addition and multiplication. Use linked
list implementation.

5.Write a C program to implement infix to postfix conversion for the following

i) A + B * C + D ii) (A + B) * (C + D) iii) A * B + C * D iv) A + B + C + D

6.Write a c program to create a binary search tree by satisfying the property, the balancing
factor for every node is at most 1.

7.Write a c Program to implement AVL trees and its Operations

8.Write a C program to implement the binary heap using priority queues.

9.Find the shortest paths from the source to all vertices in the given graph using Dijkstra’s
algorithm.
10 Write a C program to implement Prim’s Algorithm for suitable example.

11 Write a C program to implement linear search algorithm

12 Write a C program to implement binary search algorithm

13 Write a C programs for implementing the following sorting methods to arrange a list of
integers in ascending order:

a) Insertion sort b) Merge sort


14 Consider an array of size 7 with elements 13, 9, 21, 15, 39, 19, and 27 and find the element
39 in the list by implementing linear search algorithm in C language.

15 Substantiate the importance of MAX Heap in insertion and deletion by programming using C

1. Write a c program to implement circular queue ADT to do the insertion and deletion
operation ..

2 Write a c program to implement the following operations for Queue ADT using Array
implementation.

i)Insert ii) Delete iii) Display

3 Write a c program to implement the following operations for Stack ADT using Array
implementation

4 Implement First In First Out order of queue ADT using arrays in C.

Write a C program that uses functions to perform the following:

a) Create a singly linked list of integers.

b) Delete a given integer from the above linked list.

C) Display the contents of the above list after deletion.


Write a program in C to create a singly linked list of n nodes and display it in reverse
order.

Write a program in C to insert a new node at the end of a Singly Linked List.

Write a program in C to search an existing element in a singly linked list.

Write a program in C to delete the last node of Singly Linked List.

Write a program in C to delete a node from the middle of Singly Linked List.

3. Write a C program to implement stack ADT using linked list implementation


Write a C program to implement linear queue using linked list method.
Write a c program to perform push and pop operation on stack. The stack should be
implemented using linked list method.
Write a C program to insert and delete of an element in a linear queue (Choices i) Front
of the Queue ii)Rear of the Queue ).

Write a c program to implement the polynomial addition and multiplication. Use linked
list implementation

Write a C program to add the polynomial equations 3x^3+5^2+4x^0 and


7x^3+4x^2+8x^0. For addition use List ADT

Write a C program to implement the polynomial manipulation for the below

i) 9x2 - 3x and - 6x2 + 8x - 3. Ii) 5x3 - 2x2 + x - 3 and - 2x3 + x2 + 5x + 1


Write a C program to implement the polynomial manipulation for 5x + 3y, 4x – 4y +
z and -3x + 5y + 2z.

Write a C program to implement infix to postfix conversion for the following

i) A + B * C + D ii) (A + B) * (C + D) iii) A * B + C * D iv) A + B + C + D

Write a C program to evaluate the postfix expression “2 3 1 * + 9 -“.

Write a C program to implement infix to postfix and prefix conversion for the following

i) A*B+C ii) X/Y *Z iii) P +Q *R-S

Write a C program to implement and evaluate the postfix expression.

6. Write a c program to create a binary search tree by satisfying the property, the balancing
factor for every node is at most 1

How to implement the search operation on a binary search tree after adding new element.
Write a C program, to implement the above.

Write a C program that uses functions to perform the following:

a) Create a binary search tree of integers.

b) Traverse the above Binary search tree non recursively in inorder

4. Write a C program to perform the following operations:

a) Insert an element into a binary search tree.

b) Delete an element from a binary search tree.

c) Search for a key element in a binary search tree.

1) Write a c Program to implement AVL trees and its Operations

2) Write a c program to perform the following operations:


a) Insert an element into a AVL tree.

b) Delete an element from a AVL tree.

c) Search for a key element in a AVL tree.

3) Write a C program to perform rotation (RR ,LL, LR,RL) on AVL tree .

4) Write a C program to perform following operation on AVL tree

i) Search

ii) Insertion

Iii)Deletion
4. Write a C program to construct an AVL tree by inserting numbers from 1 to 8.
5. Construct AVL tree for the following data 21,26,30,9,4,14,28,18,15,10,2,3,7 by using C
implementation.
6. Construct AVL tree by inserting numbers 1 to 10 by implementing C program.

7. Write a C program to implement the binary heap using priority queues.

8. Write a C program to implement priority queue using heap.

9. Write a C program to insert and delete an element in Max heap binary tree.

10. Write a C program to find Maximum and minimum of element in max heap tree.

9. Write a C program to implement Dijkstra’s algorithm

10. Find the shortest paths from the source to all vertices in the given graph
using Dijkstra’s algorithm.
11. Using Dijkstra’s Algorithm, find the shortest distance from source vertex ‘S’ to
remaining vertices in the following graph-
12. Find shortest path between all the vertices using Dijkstra’a
Algorithm.

10. i)Write a C program to implement Prim’s Algorithm for suitable example.

ii) Construct the minimum spanning tree (MST) for the given graph using Prim’s
Algorithm-

iii. Write a C program to construct MST using Prims algorithm for the given graph
iv) Write a C program to implement Minimum Spanning Tree using Prim‘s algorithm

11.i) Write a C program to implement linear search algorithm.

ii) Consider an array of size 7 with elements 13, 9, 21, 15, 39, 19, and 27 and find the
element 39 in the list by implementing linear search algorithm in C language.

ii) Find the element 41 from the given list, by implementing sequential search
algorithm in C language,

iii) Write a C program to implement binary search algorithm


iv) Find the number 18 in the given list by implementing the binary search tree in C
language. {20,14,6,8,12,10,4,16,18,2}
v) Given a sorted array arr[] of n elements, write a function to search
a given element x in arr[] and return the index of x in the array.
Input: arr[] = {10, 20, 30, 50, 60, 80, 110, 130, 140, 170}, x = 110

1. Write a C programs for implementing the following sorting methods to arrange a

list of integers in ascending order:

b) Insertion sort b) Merge sort

2 Write a C program that implements the following

i) Insertion sort ii) Selection sort

Write a C program to sort the given unsorted array of elements using insertion sort
{12,31,25,8,32,17}

Write a C program to sort the given unsorted array of elements using insertion sort

Write a C program to implement selection sort for the given array


{10,5,2,1}.
Write a C program to implement selection sort for the given array
arr[] = {64, 25, 12, 22, 11}.

Write a C program to implement the merge sort.

How to avoid collision? Write a C program to implement linear probing method to


avoid collision.

Insert the following sequence of keys in the hash table

{9, 7, 11, 13, 12, 8}Use linear probing technique for collision
resolution.

How to resolving hash collisions in hash tables ? Write a C program to


implement .quadratic probing technique to give the solution for hash collisions.

1. Write a c program to implement the following operations for Queue ADT using Array
implementation.

i)Insert ii) Delete iii) Display

2. Write a program in C to insert a new node at the end of a Singly Linked List.

3. Write a C program to insert and delete of an element in a linear queue

(Choices i) Front of the Queue ii)Rear of the Queue ).

4. Write a C program to add the polynomial equations 3x^3+5^2+4x^0 and


7x^3+4x^2+8x^0. For addition use List ADT

5. Write a C program to implement and evaluate the postfix expression.


6. How to implement the search operation on a binary search tree after adding new element.
Write a C program, to implement the above.

Write a C program that uses functions to perform the following:

a) Create a binary search tree of integers.

b) Traverse the above Binary search tree non recursively in inorder

7. Write a c program to perform the following operations:

a) Insert an element into a AVL tree.

b) Delete an element from a AVL tree.

c) Search for a key element in a AVL tree.

8. Write a C program to insert and delete an element in Max heap binary tree.

9. Write a C program to implement Dijkstra’s algorithm

10. Construct the minimum spanning tree (MST) for the given graph using Prim’s Algorithm-
11. Find the number 18 in the given list by implementing the binary search tree in C
language. {20,14,6,8,12,10,4,16,18,2}

12. Write a C program to sort the given unsorted array of elements using insertion sort

{12,31,25,8,32,17}

13. Write a C program to implement selection sort for the given array

arr[] = {64, 25, 12, 22, 11}.

1. Implement First In First Out order of queue ADT using arrays in C.

2. Write a program in C to create a singly linked list of n nodes and display it


in reverse order.

3. Write a c program to perform push and pop operation on stack. The stack
should be implemented using linked list method.

4. Write a C program to implement the polynomial manipulation for the


below

i) 9x2 - 3x and - 6x2 + 8x - 3. ii) 5x3 - 2x2 + x - 3 and - 2x3 + x2 + 5x + 1

5. Write a C program to evaluate the postfix expression “2 3 1* + 9 –“.

6. Write a C program to perform the following operations:

a) Insert an element into a binary search tree.

b) Delete an element from a binary search tree.


c) Search for a key element in a binary search tree.

7. Write a C program to perform rotation (RR ,LL, LR,RL) on AVL tree .

8. Write a C program to find Maximum and minimum of element in max


heap tree.

9.

Find shortest path between all the vertices using Dijkstra’a Algorithm.

11 Write a C program to implement Minimum Spanning Tree using Prim‘s


algorithm

12 Write a function to search a given element x in arr[] and return the index
of x in the array using Linear search and Binary search.

Input: arr[] = {10, 20, 30, 50, 60, 80, 110, 130, 140, 170}, x = 110

13 Write a C program to sort the given unsorted array of elements using


insertion sort
{14, 33, 27, 10, 35, 19, 42, 44}

14. Write a C program to implement LIFO structure using Linked List method.

15 i)Write a C program to implement the operations of FIFO structure using array


implementation.

ii) Write a C program to sort the n elements using selection sort.

16, Write a C program to create a binary search tree by satisfying the property, the
balancing factor for every node is at most 1.

17. Write a C program to implement an application of list ADT-Polynomial


subtraction

18 Execute the push and pop operation performed on stack of size 7 using C
program.

19 Write a C program to implement insertion and deletion on both sides of a


Queue, in Queue ADT.

20 Write a C program to implement a self-balancing tree with nodal height


difference of 1 unit.
1. Write a c program to implement the following operations for Stack ADT using Array
implementation

i) Insert ii) Delete iii) Display

2. Write a C program to search an existing element in a singly linked list.

3. Write a C program to implement linear queue using linked list method.

4. Write a C program to implement the polynomial manipulation for

5x + 3y, 4x – 4y + z and -3x + 5y + 2z.

5. Write a C program to implement infix to postfix and prefix conversion for the
following

vi) A*B+C ii) X/Y *Z iii) P +Q *R-S

6. Construct AVL tree for the following data 21,26,30,9,4,14,28,18,15,10,2,3,7 by using C


implementation.

7. Using Dijkstra’s Algorithm, find the shortest distance from source vertex ‘S’ to
remaining vertices in the following graph-

8. Write a C program to implement Prim’s Algorithm for suitable example.


9. Find the element 41 from the given list, by implementing sequential search algorithm in
C language,

11 Write a C programs for implementing the following sorting methods to arrange a

list of integers in ascending order:

c) Insertion sort b) Merge sort


12 i)Write a C program to implement selection sort for the given array

arr[] = {64, 25, 12, 22, 11}.

ii)Write a C program to implement merge sort for the {38, 27, 43, 3, 9, 82, 10}

13 i)Write a C program to implement LIFO structure, using array implementation.

ii)Write a C program to find an element in a list by using sequential order.

14 Write a C program to implement List ADT using linked list method to perform the following

a) Create a Linked list with the elements 10,25,46,59


b) Insert 30 after 22
c) Delete the element 22 from the list
d) In end of the Every above the operation Display all the elements.
15. Write a C program to implement binary search tree for the following operations

a) Create a BST with the elements 11,22,5,19,17,10


b) Insert a node with the element 7
c) Delete the element 10
d) Display the element of the BST in preorder.
16 Write a C program to implement any one of the hashing technique.

17 Write a C program to implement circular queue data structures using array implementation.

18 Write a C program to implement singly linked list to perform the following operations

i) Creation
ii) Insertion
iii) Deletion
19 Construct the minimum spanning tree (MST) for the given graph using Prim’s
Algorithm-

20 Write a C program to sort the given unsorted array of elements using


insertion sort
{12,31,25,8,32,17}

You might also like