you are here->home->Class 12->Selection Sort
Selection Sort

Procedure

Real Lab Procedure 

  1. Creating a list variable "arr" to hold the numbers entered by user.  
  2. Insert five elements into "arr".  
  3. It stores the number of elements in the "arr" to the variable "size" for iteration.  
  4. Assuming that current minimum value(min_index) is at location 0.  
  5. Traverse the unsorted sub-list to find the minimum element in the list.  
  6. While traversing, if any element smaller than "min_index" is found, swap both values. Then that list is sorted sub-list. 
  7. Then, increment "min_index" to point to the next element in the unsorted sub-list.  
  8. Repeat 5-7 until the list is sorted. 

Simulator Procedure

  • Enter the input values. 
  • Click on the Submit button. 
  • Select the variables from the dropdown list.
  • Click on the Finish button or Start button to view the state diagram.
  • If you have clicked on the Start button, then use the Next and Previous buttons to view the State diagram.
  • Click on the Reset button when the State diagram is completed.