Selection Sort

Selection sort is a straightforward sorting algorithm. This sorting method is an in-place comparison-based algorithm that divides the list into two halves, the sorted part on the left end and the unsorted part on the right. Initially, the sorted section is empty, while the unsorted section contains the complete list.

The smallest element from the unsorted array is chosen and swapped with the leftmost element, and that element is added to the sorted array. This operation is repeated until the unsorted array boundary is moved one element to the right.

This algorithm is not suitable for large data sets as its average and worst case complexities are of Ο(n2), where n is the number of items.


Step 1 − Set MIN to location 0
Step 2 − Search the minimum element in the list
Step 3 − Swap with value at location MIN
Step 4 − Increment MIN to point to next element
Step 5 − Repeat until list is sorted


procedure selection sort 
   list  : array of items
   n     : size of list

   for i = 1 to n - 1
   /* set current element as minimum*/
      min = i    
      /* check the element to be minimum */

      for j = i+1 to n 
         if list[j] < list[min] then
            min = j;
         end if
      end for

      /* swap the minimum element with the current element*/
      if indexMin != i  then
         swap list[min] and list[i]
      end if
   end for
end procedure

11 thoughts on “Selection Sort”

  1. Tremendous things here. I am very satisfied to see your post.

    Thanks so much and I am taking a look forward to contact
    you. Will you please drop me a e-mail?

  2. My brother recommended I might like thbis website. He used tto
    be etirely right. Thiis submit actually madxe myy day.
    You can not believe simpoly hoow so mch time I hhad spent for thhis info!
    Thaank you!

  3. Lesbians and anmalsTo sepl vintage booksEscort resorts inn tthe caribeanEnormius hanginbg tit cumshotsAduot comics swee
    gwendoline imagesAllba hite bikiniChubby mature tubeSnnap
    too mother fuckerFree porn bigtitsMonsters off cock jordan navaehRobin m nudeDisabilkity aand oler adultsHow to masure dick lenghBehind black cock fromAir guitar seex positio definitionFrree nude gallery of blaack womanStyles of shqved pussyLife’s
    magazine nude olympicStockings legs fuckJenna jamson bblack fuckingLesbian cunningBabysitter being fuckedGeorgee
    urre amateur radioPlump llatin women nue picturesBest sog tto fost pmp toBlaxk woman blowiing white mann pornAnal induced male origasmAngedls cockPrivate orgyDangerous
    currves movie adultAftsr orgasmsFungal iinfection under breastTeenn bdsm self storiesTiips onn performing anal sexTexas convicted sex offendersAdult faan ficyion storyIpnone hentai
    sitesCriws ober sexBraless amateurVintae lipstick holderBranson losikng richard virginityVictordia
    bbc sexual heath clinicAnnime pink haired porn picturesProgesterone
    and breast tendernessMisssouri swinger’s clubsA1 adult sitePasxsed oout aked
    manMadks book mark revgiew adultGay shoots loadNastty bbw
    galleriesFinering redheadsTeen ass licking portn moviesFree dirgy porn clipAskan voyeur changingLoong leg mlf
    iin nylonsTeenbs arrt photosCum on tiits free videoMatuhre copule ssex picturesAmater matufe creampieVeryy knotty pornstarMenn shaving wonens pussiesStockikngs annd high heeos are sexyTeen girlks losung virginity oon videosJesxe jamess slutGirls iin alaska nudeLadie puub nightt pornNude gdeg gorman gallerySexxy hairty picsTeenn iin trainijg videoSex
    iin ancient civilizationsSpamk photo001Hentai + galleryGardner’s adlt intelligencesFelicity feey nuyde
    galleryRommeo and juiet cartoon sexBeth smith porn lookalikesVolos ffor teensCluub game stripAsian poached chickenTeens fucking fat guysTeenss 14 aand underScreemihg fucxk machine
    vidsLimp dick sisssy maidsSan antonio spurs george hil nakedDrinkging
    piszs pornVintage klaxonn navy alarm foor sale Spunk guslersFiind wwomen that like sex pordn grandblaceTickle lesbianMillf what iss
    itTeen girls gohe wild videoNeew westminster escortsSmple lesbian downloadColony aduilt theaterTootally freee adul online datingKavitha
    poprn torrentPusssy iin thhe tubAnuus bleaqch 2009 jelslft enterprioses ltdStarss off erotic confessionsBlowjjob smilingVintaqge
    jones neww york sunglassesThhe simpsons lesbianHairy black shemaleJakin world large penis surveyBaby-doll diaper ftish movie3d
    meahes cockJoi ryder ass shakeFrree girl onn topp pornographyAdylt basic skiols resource centreRed haired mipf eatingVintage talestries made in italyVintae
    singer sweing machikne diagramGaay gllry hooes floridaHoard stern shiut pornOriginal sin sexx scenesFetish
    festival tqmpa flEsfort bareback ukVintage trailer rust repairFreee dvdxs hoot pussyFreee nude pregant womn fucking picturesUppoes nudeCandid
    fucxking linda milof palsades park student teachber whiteheadAmitter big assesFree folot sex moviesSeven midgetsTeenn bi-sexual porno freeWanking cuntTeen club inferno walled lake michiganBuy leisurte suut larry magna cuum laudde uncut
    versionEvva black sexIn jeersey mssage neww sexualShark sex movieLivee
    sex shpw in europeBeautifuul busty chinese babePhilips
    electronics breast cancer dvdApoodaca gayy leon mexico nuevoNude picc
    robbie williamsGay single holidaysSupper flexible sexMetthylphenidate maxsimum adylt doseAn aadult frogTamil nudxe fuck assAviva sexMasturbaton bewach free videoEdiie falco nue thhe quietThoswe
    fuckinbg filipinas

  4. My spouse and I absolutely love your blog and find nearly all of your post’s to be just what I’m looking for. Do you offer guest writers to write content for you? I wouldn’t mind composing a post or elaborating on most of the subjects you write concerning here. Again, awesome blog!


Leave a Comment

Your email address will not be published. Required fields are marked *