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

509 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!

  5. What’s Happening i am new to this, I stumbled upon this I have discovered It absolutely helpful and it has helped me out loads. I hope to contribute & aid other customers like its helped me. Good job.

  6. Hello my friend! I wish to say that this post is awesome, great written and include almost all significant infos. I would like to peer extra posts like this.

  7. Only wanna comment on few general things, The website design and style is perfect, the subject material is really good. “Taxation WITH representation ain’t so hot either.” by Gerald Barzan.

  8. Howdy this is kinda of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

  9. Unquestionably believe that which you stated. Your favorite reason appeared to be on the net the easiest thing to be aware of. I say to you, I definitely get irked while people think about worries that they plainly do not know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people can take a signal. Will likely be back to get more. Thanks

  10. You could definitely see your skills in the work you write. The sector hopes for even more passionate writers such as you who aren’t afraid to say how they believe. All the time go after your heart. “The point of quotations is that one can use another’s words to be insulting.” by Amanda Cross.

  11. 저희는 구글 계정 판매 전문 회사입니다.우리의 구글 계정은 이메일, 문서, 캘리더, 클라우드 저장 등의 기능을 포함한 포괄적인 디지털 솔루션을 제공합니다.구글 계정을 통해 우리는 사용자에게 효율적인 협업 플랫품을 제공하여 개인과 팀이 일과 삶을 더 스마트하게 관리할 수 있도록 지원합니다.

  12. 비아그라 구매 구입. 정품비아그라 파는곳 구매방법. 가격 효능 복용법. 빠른배송. 비아그라구입처.비아그라 구매를 원하신다면, 저희 사이트에서 다양한 옵션을 확인해보세요. 안전하고 신속한 배송으로 만족할 수 있습니다. 지금 방문해보세요!

  13. I’ve been browsing online greater than three hours nowadays, but I by no means found any fascinating article like yours. It¦s beautiful worth enough for me. Personally, if all website owners and bloggers made just right content as you probably did, the internet will be much more useful than ever before.