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 8509221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:22:33+00:00 2026-06-11T03:22:33+00:00

Hi I am working on the code stable selection sort,and I have been able

  • 0

Hi I am working on the code stable selection sort,and I have been able to get the correct result, but I am not sure if there are corner cases in the code.The data I am sorting like this
a[0]=new Data(1,’d’);
a[1]=new Data(2,’c’);
a[2]=new Data(3,’a’);
a[3]=new Data(4,’b’);
a[4]=new Data(5,’d’);
a[5]=new Data(6,’c’);
a[6]=new Data(8,’a’);
a[7]=new Data(9,’a’);
a[8]=new Data(10,’a’);

as you can see it is sorted by numbers and I am supposed to sort it by characters now.

So the logic of sort of Data objects I have used is like this:

in the loop of finding the smallest element, we will not just find the smallest element but smallest element with smallest int. That way order of the elements will remain the same

even though it is working just fine, are there any corner cases I have missed here?

for ex : lets take up itunes, first we sort by the ids of the songs and after that we want to sort by their names. I hope it makes every thing clear

  • 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-06-11T03:22:35+00:00Added an answer on June 11, 2026 at 3:22 am

    No, you have not missed anything. This is the standard technique to make any unstable algorithms stable: impose a total ordering! Any ties are resolved by the second key – which is the input order. I assume you correctly implemented lexicographical ordering here, it’s not entirely clear from your description.

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

Sidebar

Related Questions

I have this working code, but now i need to be able to change
I've installed node-qunit (stable) from npm, but can't seem to get any tests working.
I currently have stable code between a client (IdTCPClient) and a server (IdTCPServer) working
I have working code of js, it shows different div for selected option. <html>
I have some working code with a crutch to add BOM marker to a
Possible Duplicate: xcode code sense color/completion not working Code loses syntax color in Xcode
I want to know i can do something similar to this (not working) code
As a beginner in Ocaml, I have this current working code: ... let ch_in
OK the code is now working, but it still needs work. The values I
I've got some jQuery (1.6.2, latest stable) code which is working in Chrome, Firefox,

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.