jeudi 28 février 2019

Use random library to get two random numbers from list do this step until it sort

Step 1: Take the elements of the list_1 as input. Step 2: randomly choose two indexes i and j within the range of the size of list_1. Step 3: Swap the elements present at the indexes i and j. After doing this, check whether the list_1 is sorted or not. Step 4: Repeat step 3 and 4 until the array is not sorted.




Aucun commentaire:

Enregistrer un commentaire