Question: Write a program to implement (a) Selection Sort, (b) Bubble Sort and (c) Insertion Sort From the main, declare an array dynamically, and get
Write a program to implement (a) Selection Sort, (b) Bubble Sort and (c) Insertion Sort From the main, declare an array dynamically, and get N number of data (of any type) and call one function at a time. Use an option to call any of the function. Option='S', call selection sort Option = 'B', call Bubble sort Option='1', call Insertion Sort Print the sorted array in each case. Write five functions: a) int Min(Data A[ ], int I, int N) b) void SelectionSort(Data A[ ], int N) c) void BubbleSort(Data A[], int N) d) void InsertionSort(Data A[ ], int N) e) void PrintArray(Data A[ ], int N) And main function int N; cin >> N; Data * A; A = new Data [N]; Use this statement after using namespace std, to change data type easily. typedef int Data;
Step by Step Solution
3.52 Rating (162 Votes )
There are 3 Steps involved in it
Below are the algorithmic steps for the three sorting algorithms used in your C program Selection Sort Bubble Sort and Insertion Sort Selection Sort A... View full answer
Get step-by-step solutions from verified subject matter experts
