Data Structures Using C

Data Structures Practical 16

Data Structures Practical 16 Question 1 Write a C program to perform following operations on Empty stack: PUSH (10), PUSH (20), POP, PUSH (10), PUSH (20), POP, POP, POP, PUSH (20),POP. stack.c C #include <stdio.h> #include <conio.h> #include <stdlib.h> #define max 7 int stack[max]; int top = -1; void push(int element); int pop(); void display();

Data Structures Practical 16 Read More »

Data Structures Practical 12

Data Structures Practical 12 Question 1 Write a function to insert a node at the beginning of a Singly Linked List. linkedlist.c C #include <stdio.h> #include <stdlib.h> #include <conio.h> struct Node { int data; struct Node *next; }; struct Node *start = NULL; void insertAtBeginning(int data); void displayList(); void main() { int choice, data; char

Data Structures Practical 12 Read More »

Data Structures Practical 11

Data Structures Practical 11 Question 1 Create an interactive game where the user enters a list of strings, and the program sorts them using insertion sort. Allow the user to add or remove strings dynamically and see the sorting process step by step. strinsertion.c C #include <stdio.h> #include <string.h> #include <conio.h> #define MAX_ITEMS 20 #define

Data Structures Practical 11 Read More »

Data Structures Practical 9

Data Structures Practical 9 Question 1 Write a C program to sort an array of Strings using Selection Sort. selectionstr.c C #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define MAX_ELEMENTS 50 #define MAX_LENGTH 30 void selection(char arr[MAX_ELEMENTS][MAX_LENGTH], int size); int Min(char a[MAX_ELEMENTS][MAX_LENGTH], int start, int end); void main() { char arr[MAX_ELEMENTS][MAX_LENGTH]; int i, size;

Data Structures Practical 9 Read More »

Data Structures Practical 8

Data Structures Practical 8 Question 1 Modify the Selection Sort algorithm to handle arrays containing negative numbers. selectionsort.c C #include <stdio.h> #include <conio.h> #include <stdlib.h> #define max 50 void selection(int arr[], int size); int Min(int a[], int start, int end); void main() { int arr[max]; int i, size; clrscr(); printf("Enter the number of elements in

Data Structures Practical 8 Read More »