Heap Sort Implementation

GTU ADA Practical – 3 Implementation of max-heap sort algorithm #include #include int size; void max_heapify(int *, int); void build_max(int *); void heapsort(int *); int heap_size; void main() { printf(“Enter size of arrayn”); scanf(“%d”, &size); int a[size], i, j, p, k = size – 1; printf(“Enter %d elements in arrayn”, size); for (i = 0; […]

Linear Search and Binary Search Algorithm Implementation

GTU ADA Practical – 2 Implementation and Time analysis of linear and binary search algorithm. #include #include #include #define size 500 void main() { int e, a[500], i, c = 0; clock_t end, start; double cpu; printf(“Enter element to search: “); scanf(“%d”, &e); printf(“nn”); for (i = 0; i < 500; i++) { a[i] = […]

Sorting Algorithms (Selection Sort, Bubble Sort, Merge Sort, and Quicksort)

GTU ADA Practical-1 Implementation and Time analysis of sorting algorithms. Bubble sort, Selection sort, Insertion sort, Merge sort and Quicksort #include #include #include #define size 900 int main() { int i, j, a[900], t, p, min; clock_t start, end; double cpu; /* BUBBLE SORT */ for (i = 0; i < size; i++) a[i] = […]