Data Sturcture 3 Sem Practical File
Data Sturcture 3 Sem Practical File
SUBMITTED TO :- SUBMITTED BY :-
RAJ SIR YASH SAHU
BCA 3RD SEMESTER
Subject-Data Structure Using C
int main() {
if(arr[i] % 2 == 0)
evenCount++;
else
oddCount++;
return 0;
}
Q.3 Consider two single dimensional array of size 2 and 3
respectively. Write a program in c to print numbers.
int i;
printf("Array 1: ");
printf("\nArray 2: ");
return 0;
}
Q.4 Define a B-Tree and its properties. Create a b-tree in the
following sequences
12,5,14,45,20,5,67,8,34,11,16,63,22,77
Properties of B-tree:
Steps for creating a B-Tree for the given sequence: For simplicity, I
won’t write the full code for creating a B-tree. The process is a bit
lengthy, but here's how it works:
Begin by inserting the elements one by one (12, 5, 14, 45, 20, 5, 67,
8, 34, 11, 16, 63, 22, 77).
After each insertion, if a node exceeds the maximum allowed
number of keys, it will split into two nodes, and the middle value
is promoted to the parent node.
Ensure that the B-tree properties are maintained during insertion.
Q.5 Write a program in C to delete duplicate elements from an
array of 20 integers.
int main() {
// Input 20 integers
scanf("%d", &arr[i]);
// Remove duplicates
if(arr[i] == arr[j]) {
isDuplicate = 1;
break;
if(isDuplicate == 0) {
arr[k++] = arr[i];
}
}
return 0;