Algorithms Included Bubble Sort: A simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
Quick Sort: A fast sorting algorithm based on the divide-and-conquer strategy. It picks an element as a pivot and partitions the array around the pivot.
Selection Sort: An in-place comparison sorting algorithm that divides the input list into a sorted and an unsorted region. It repeatedly selects the minimum element from the unsorted region and swaps it with the first element of the unsorted region.
Insertion Sort: A simple sorting algorithm that builds the final sorted array one item at a time. It is much less efficient on large lists than more advanced algorithms.
Merge Sort: A divide-and-conquer algorithm that divides the array into two halves, sorts each half, and then merges the sorted halves.
How to Use Clone the repository:
bash Copy code git clone https://github.com/your-username/sorting-algorithms-benchmark.git Compile the C program:
bash Copy code gcc sorting_benchmark.c -o sorting_benchmark Run the executable:
bash Copy code ./sorting_benchmark Results The program generates a random array of integers and applies each sorting algorithm individually. For each algorithm, it reports the number of operations performed and the time taken for sorting the array. This information is useful for comparing the efficiency of different sorting techniques.
Feel free to modify the array size (ARRAY_SIZE macro) and observe how the algorithms perform on larger or smaller datasets.
Note The code includes functions for initializing, printing, and sorting arrays. Timing information is obtained using the clock function. Contribution Feel free to contribute by adding more sorting algorithms, improving existing code, or providing additional insights into the results. Open an issue or submit a pull request with your changes.