Selection Sort

Selection Sort Work on basic Principle. This algorithm Search minimum element of given array. And set at first Position. and again follow same Process for find second minimum element and set at second Postion. This Process repet again and again untill ynless our array become a fully sorted Assending or Dessending Order.



Selection Sort Algorithm Implementation

                    
                        s=int(input("Inter Your List Size"))
                        num=[]
                        for a in range (s):
                            x=int(input("Enter Element"))
                            num.append(x)
                        l=len(num)
                        for i in range(l):
                            mean_value = i
                            for j in range(i,l):
                                if num[j] < num[mean_value]:
                                    mean_value = j
                            temp = num[i]
                            num[i] = num[mean_value]
                            num[mean_value] = temp
                        print(num)
                    
                    
            
                

Selection Short Algorithm Analysis


                    Best Case: O(n^2)
                    Average Case: O(n^2)
                    Worst Case: O(n^2)
                    Space Complecity: 1
                    Selection Short Algorithm are Internal Shorting Algorithm
                    Selection Short Algorithm are Non-Recursive Shorting Algorithm
                    Stability: No Selection Short Algorithm Are Not Stable Algorithm
                    Adpative: No Selection Short Algorithm Are Not Adpative Algorithm
                   

© Written By Prince Singh