Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6836951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:25:03+00:00 2026-05-26T23:25:03+00:00

http://www.cs.pitt.edu/~kirk/cs1501/animations/Sort1.html is this applet counting right? Selection sort for 5 4 3 2 1,

  • 0

http://www.cs.pitt.edu/~kirk/cs1501/animations/Sort1.html is this applet counting right? Selection sort for 5 4 3 2 1, I see 2 swaps, but the applet is counting 4 exchanges….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:25:04+00:00Added an answer on May 26, 2026 at 11:25 pm

    I guess it’s a matter of definition. He is doing a swap in the end of every loop, even if he is swapping one element against itself. In his case, the swaps will be:

    • Original: 5 4 3 2 1
    • Swap pos 1 and 5: 1 4 3 2 5
    • Swap pos 2 and 4: 1 2 3 4 5
    • Swap pos 3 and 3: 1 2 3 4 5
    • Swap pos 4 and 4: 1 2 3 4 5

    (No swap is done for the last element since that will always be in the correct place)

    A simple if statement could be used to eliminate the two last swaps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://www.html5canvastutorials.com/webgl/html5-canvas-webgl-plane-with-three-js/ In this example its just a rotating plane. I'm an html 5 beginner
http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_1.html So on that tutorial where it has: conflict(Coloring) :- adjacent(X,Y), color(X,Color,Coloring), color(Y,Color,Coloring). Am
http://www.docjar.com/html/api/org/apache/catalina/realm/JDBCRealm.java.html To use this JDBCRealm we need two tables, user and user_role. user table
http://www.security.org.sg/code/loadexe.html http://pastebin.com/QFHASx75 I've compiled this but can't get it to work properly, It runs
http://www.frostjedi.com/terra/scripts/demo/jquery02.html According to this link elements can be moved around by doing $('#container1').append($('#container2')). Unfortunately,
http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking Why is this line needed? System.GC.SuppressFinalize(tl.leakDetector); I would have thought the finalizer should
http://www.sitepoint.com/build-to-do-list-30-minutes/ So I was doing this (http://www.sitepoint.com/build-to-do-list-30-minutes/) tutorial and everyting went OK. but now
http://www.chris-wang.com/ If you hover over the textual navigation words on this page, you'll see
http://www.boost.org/doc/libs/1_35_0/doc/html/boost/get_id405862.html template<typename U, typename T1, typename T2, ..., typename TN> U & get(variant<T1, T2,
http://www.boost.org/boost-build2/doc/html/bbv2/installation.html Tried following those instructions, but they do not work. What I did: Open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.