Question
Download Solution PDFWhich of the following is not a stable sorting algorithm ?
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFThe correct answer is Selection sort.
- Selection sort is not a stable sorting algorithm.
- In a stable sorting algorithm, the relative order of equal elements is preserved.
- Selection sort does not guarantee that the relative order of equal elements will be maintained.
- This is because Selection sort works by repeatedly finding the minimum element and moving it to the correct position, which can disrupt the order of equal elements.
- Insertion sort, Bubble sort, and Merge sort are stable sorting algorithms.
- Insertion sort maintains the relative order of equal elements by inserting elements into their correct position without changing the order of equal elements.
- Bubble sort preserves the relative order of equal elements by repeatedly swapping adjacent elements to move larger elements to the end of the list.
- Merge sort maintains the relative order of equal elements by dividing the list into halves, sorting each half, and then merging the sorted halves while preserving the order of equal elements.
Last updated on Jun 12, 2025
-> NIELIT Scientific Assistant city intimation slip 2025 has been released at the official website.
-> NIELIT Scientific Assistant exam 2025 is scheduled to be conducted on June 28.
-> A total number of 113 revised vacancies have been announced for the post of Scientific Assistant in Computer Science (CS), Information Technology (IT), and Electronics & Communication (EC) streams.
-> Online application form, last date has been extended up to from 17th April 2025.
->The NIELT has revised the Essential Qualifications for the post of Scientific Assistant. Candidates must possess (M.Sc.)/ (MS)/ (MCA) / (B.E.)/ (B.Tech) in relevant disciplines.
-> The NIELIT Scientific Assistant 2025 Notification has been released by the National Institute of Electronics and Information Technology (NIELIT).