0% found this document useful (0 votes)
11 views29 pages

Data Structure Using C Lab Manual Future University

The document is a lab manual for a Data Structure course using C for the session 2025-26 at Future University, detailing various programming exercises. It includes programs for one-dimensional and two-dimensional arrays, searching and sorting techniques, stack and queue implementations, and linked list operations. Each program section outlines the aim, algorithm, code, expected output, and viva questions for students to understand and practice data structures.

Uploaded by

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

Data Structure Using C Lab Manual Future University

The document is a lab manual for a Data Structure course using C for the session 2025-26 at Future University, detailing various programming exercises. It includes programs for one-dimensional and two-dimensional arrays, searching and sorting techniques, stack and queue implementations, and linked list operations. Each program section outlines the aim, algorithm, code, expected output, and viva questions for students to understand and practice data structures.

Uploaded by

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

Future University

Department of Computer Science and Engineering

Lab Manual
Data Structure Using C (Lab)
Session: 2025–26

Faculty: Dr. Shivangi Ghildiyal


PROGRAM LIST
Array (1D) One Dimensional
1. 1. Program to Traverse an Array
2. 2. Program to Insert Item into Unsorted Array
3. 3. Program to Insert Item into Sorted Array
4. 4. Program to Delete Item from Array
5. 5. Program to Merge Two Sorted Array

Array (2D) Two Dimensional


6. 1. Program to Traverse a 2-D Array
7. 2. Program to Transpose a 2-D Array
8. 3. Program to Add Two 2-D Arrays
9. 4. Program to Multiply Two 2-D Arrays

Searching Techniques
10. 1. Program to Search an Item using LINEAR SEARCH
11. 2. Program to Search an Item using BINARY SEARCH

Sorting Techniques
12. 1. Program to Sort an Array using BUBBLE SORT
13. 2. Program to Sort an Array using SELECTION SORT
14. 3. Program to Sort an Array using INSERTION SORT
15. 4. Program to Sort an Array using QUICK SORT

Stack (Using Array)


16. 1. Program to Implement Stack using Array

Queue
17. 1. Program to Implement Queue using Array
18. 2. Program to Implement Circular Queue using Array

Linked List
19. 1. Program to Create a Linked List
20. 2. Program to Traverse a Linked List
21. 3. Program to Insert Item as First Node
22. 4. Program to Insert Item as Last Node
23. 5. Program to Insert Item At the Required Position
24. 6. Program to Delete a First Node
25. 7. Program to Delete a Last Node
26. 8. Program to Delete any Node at Required Position
27. 9. Program to Search an Item in an Unsorted Linked List
LAB PROGRAM DETAILS

Array (1D) One Dimensional

Program to Traverse an Array


AIM:
To program to traverse an array.

ALGORITHM:
1. Start
2. Write the logic for program to traverse an array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Traverse an Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Insert Item into Unsorted Array
AIM:
To program to insert item into unsorted array.

ALGORITHM:
1. Start
2. Write the logic for program to insert item into unsorted array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Insert Item into Unsorted Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Insert Item into Sorted Array
AIM:
To program to insert item into sorted array.

ALGORITHM:
1. Start
2. Write the logic for program to insert item into sorted array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Insert Item into Sorted Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Delete Item from Array
AIM:
To program to delete item from array.

ALGORITHM:
1. Start
2. Write the logic for program to delete item from array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Delete Item from Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Merge Two Sorted Array
AIM:
To program to merge two sorted array.

ALGORITHM:
1. Start
2. Write the logic for program to merge two sorted array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Merge Two Sorted Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Array (2D) Two Dimensional
Program to Traverse a 2-D Array
AIM:
To program to traverse a 2-d array.

ALGORITHM:
1. Start
2. Write the logic for program to traverse a 2-d array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Traverse a 2-D Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Transpose a 2-D Array
AIM:
To program to transpose a 2-d array.

ALGORITHM:
1. Start
2. Write the logic for program to transpose a 2-d array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Transpose a 2-D Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Add Two 2-D Arrays
AIM:
To program to add two 2-d arrays.

ALGORITHM:
1. Start
2. Write the logic for program to add two 2-d arrays.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Add Two 2-D Arrays
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Multiply Two 2-D Arrays
AIM:
To program to multiply two 2-d arrays.

ALGORITHM:
1. Start
2. Write the logic for program to multiply two 2-d arrays.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Multiply Two 2-D Arrays
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Searching Techniques
Program to Search an Item using LINEAR SEARCH
AIM:
To program to search an item using linear search.

ALGORITHM:
1. Start
2. Write the logic for program to search an item using linear search.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Search an Item using LINEAR SEARCH
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Search an Item using BINARY SEARCH
AIM:
To program to search an item using binary search.

ALGORITHM:
1. Start
2. Write the logic for program to search an item using binary search.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Search an Item using BINARY SEARCH
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Sorting Techniques
Program to Sort an Array using BUBBLE SORT
AIM:
To program to sort an array using bubble sort.

ALGORITHM:
1. Start
2. Write the logic for program to sort an array using bubble sort.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Sort an Array using BUBBLE SORT
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Sort an Array using SELECTION SORT
AIM:
To program to sort an array using selection sort.

ALGORITHM:
1. Start
2. Write the logic for program to sort an array using selection sort.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Sort an Array using SELECTION SORT
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Sort an Array using INSERTION SORT
AIM:
To program to sort an array using insertion sort.

ALGORITHM:
1. Start
2. Write the logic for program to sort an array using insertion sort.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Sort an Array using INSERTION SORT
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Sort an Array using QUICK SORT
AIM:
To program to sort an array using quick sort.

ALGORITHM:
1. Start
2. Write the logic for program to sort an array using quick sort.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Sort an Array using QUICK SORT
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Stack (Using Array)
Program to Implement Stack using Array
AIM:
To program to implement stack using array.

ALGORITHM:
1. Start
2. Write the logic for program to implement stack using array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Implement Stack using Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Queue
Program to Implement Queue using Array
AIM:
To program to implement queue using array.

ALGORITHM:
1. Start
2. Write the logic for program to implement queue using array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Implement Queue using Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Implement Circular Queue using Array
AIM:
To program to implement circular queue using array.

ALGORITHM:
1. Start
2. Write the logic for program to implement circular queue using array.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Implement Circular Queue using Array
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Linked List
Program to Create a Linked List
AIM:
To program to create a linked list.

ALGORITHM:
1. Start
2. Write the logic for program to create a linked list.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Create a Linked List
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Traverse a Linked List
AIM:
To program to traverse a linked list.

ALGORITHM:
1. Start
2. Write the logic for program to traverse a linked list.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Traverse a Linked List
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Insert Item as First Node
AIM:
To program to insert item as first node.

ALGORITHM:
1. Start
2. Write the logic for program to insert item as first node.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Insert Item as First Node
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Insert Item as Last Node
AIM:
To program to insert item as last node.

ALGORITHM:
1. Start
2. Write the logic for program to insert item as last node.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Insert Item as Last Node
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Insert Item At the Required Position
AIM:
To program to insert item at the required position.

ALGORITHM:
1. Start
2. Write the logic for program to insert item at the required position.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Insert Item At the Required Position
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Delete a First Node
AIM:
To program to delete a first node.

ALGORITHM:
1. Start
2. Write the logic for program to delete a first node.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Delete a First Node
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Delete a Last Node
AIM:
To program to delete a last node.

ALGORITHM:
1. Start
2. Write the logic for program to delete a last node.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Delete a Last Node
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Delete any Node at Required Position
AIM:
To program to delete any node at required position.

ALGORITHM:
1. Start
2. Write the logic for program to delete any node at required position.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Delete any Node at Required Position
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?
Program to Search an Item in an Unsorted Linked List
AIM:
To program to search an item in an unsorted linked list.

ALGORITHM:
1. Start
2. Write the logic for program to search an item in an unsorted linked list.
3. Stop.

PROGRAM CODE:
```c
// C program for Program to Search an Item in an Unsorted Linked List
#include <stdio.h>
int main() {
// Write your code here
return 0;
}
```

OUTPUT:
Expected output based on the logic implemented.

VIVA QUESTIONS:
1. What is the purpose of this program?
2. Explain the logic used.
3. How can this be optimized?

You might also like