How does the stability of Insertion Sort make it suitable for certain applications?

  • Ignores equal elements
  • Maintains the relative order of equal elements
  • Randomly shuffles equal elements
  • Sorts equal elements based on a random key
The stability of Insertion Sort ensures that the relative order of equal elements is maintained. This property is crucial in applications where maintaining the original order of equivalent elements is necessary, such as sorting a database by multiple criteria without disturbing the existing order of records.
Add your answer
Loading...

Leave a comment

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