Skip to content

AkshyaRD/Selection-Sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Selection-Sort

Selection sort is a simple and efficient sorting algorithm that works by repeatedly selecting the smallest (or largest) element from the unsorted portion of the list and moving it to the sorted portion of the list.
The algorithm repeatedly selects the smallest (or largest) element from the unsorted portion of the list and swaps it with the first element of the unsorted portion.
This process is repeated for the remaining unsorted portion of the list until the entire list is sorted.

Working of Selection Sort

  1. Set the first element as minimum.
    image

2.Compare minimum with the second element.
If the second element is smaller than minimum, assign the second element as minimum.
Compare minimum with the third element.
Again, if the third element is smaller, then assign minimum to the third element otherwise do nothing.
The process goes on until the last element.

image

  1. After each iteration, minimum is placed in the front of the unsorted list.
    image

4.For each iteration, indexing starts from the first unsorted element.
Step 1 to 3 are repeated until all the elements are placed at their correct positions.

image
image
image
image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages