Computer Science, asked by psaAishGusumi, 1 year ago

Write algorithm and program that accepts a list of integers and outputs the name of Sorting Method that needs to be used to sort the list based on best, average and worst case complexities.

Answers

Answered by Rahul06
4
#include <iostream>
void Sort(int &a, int &b, int &c){
if(a>b)
{ int tmp = a;
        a = b;
        b = tmp;
}
if(a>c){
int tmp = a;
         a=c;
         c = tmp;
}
int main(){
std::cout << "Enter three integers: " << std::endl;
     int num1;
     int num2;
     int num3;
    std::cin >> num1 >> num2 >> num3;
   
int output1 = num1;
    int output2 = num2;
     int output3 = num3;
Sort(output1,output2,output3);
std::cout << num1 << " " << num2 << " " << num3 << " "
<< " in sorted order: ";
std::cout << output1 << " " << output2 << " " << output3 << std::endl;
return 0;
}

check this

it takes integer

if you want to take array

just change int into array

and that should work

Similar questions