Data Structures Using C

Data Structures Practical 7

Data Structures Practical 7 Question 1 Modify the bubble sort program to handle invalid input, such as non-string data or strings that exceed the maximum length. strbubblesort.c C #include <stdio.h> #include <conio.h> #include <string.h> #define MAX_STRINGS 100 #define MAX_LENGTH 10 void bubbleSortStrings(char arr[][MAX_LENGTH], int size) { int i, j; char temp[MAX_LENGTH]; for (i = 0;

Data Structures Practical 7 Read More »

Data Structures Practical 6

Data Structures Practical 6 Question 1 Modify the Bubble Sort algorithm to sort an array in descending order. bubblesort.c C #include <stdio.h> #include <conio.h> #define max 30 void main() { int i, size, temp, j, arr[max]; clrscr(); printf("nEnter the number of elements in the array : "); scanf("%d", &size); printf("nEnter the elements: "); for (i

Data Structures Practical 6 Read More »

Data Structures Practical 3

Data Structures Practical 3 Question 1 Write a simple C program to perform linear search on an array of Strings to find Case- Insensitive search for a string searchstr.c C #include <stdio.h> #include <conio.h> #include <string.h> void main() { char items[5][20] = {"Apple", "baNana", "CHERRY", "orange", "Grapes"}; char searchStr[20]; int i, found = 0; clrscr();

Data Structures Practical 3 Read More »