Assignment on Sorting a Array EXPLANATION OF CODE:
-
Input and Choice: The program first asks the user to input the number of elements and the elements themselves. Then, it presents a menu to select the sorting technique.
-
Switch Case: Based on the user's choice (1, 2, or 3), the corresponding sorting function is called.
-
Sorting Algorithms:
Bubble Sort: Repeatedly swaps adjacent elements if they are in the wrong order.
Selection Sort: Finds the minimum element from the unsorted part and swaps it with the first unsorted element.
Insertion Sort: Builds a sorted array one element at a time by comparing and inserting elements in their correct positions.