Question
Download Solution PDFWhat is the name of the sorting method that refers to sorting a given list of elements and swapping them if they are unordered ?
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFThe correct answer is Bubble Sort.
Key Points
- Bubble Sort
- It sorts a given list of elements by repeatedly comparing the adjacent elements and swapping them if they are unordered.
- For a list with n elements, the bubble sort makes a total of n – 1 passes to sort the list.
- In each pass, the required pairs of adjacent elements of the list will be compared.
- In order to arrange elements in ascending order, the largest element is identified after each pass and placed at the correct position in the list.
- This can be considered as the largest element being ‘bubbled up’. Hence the name Bubble sort.
Additional Information
- Deque or Double Ended Queue is a type of queue in which insertion and removal of elements can either be performed from the front or the rear.
- Selection Sort
- To sort a list having n elements, the selection sort makes (n-1) number of passes through the list.
- The list is considered to be divided into two lists - the left list containing the sorted elements, and the right list containing the unsorted elements.
- Initially, the left list is empty, and the right list contains all the elements.
- Insertion Sort
- Like Selection sort, in Insertion sort also, the list is divided into two parts - one of sorted elements and another of unsorted elements.
- Each element in the unsorted list is considered one by one and is inserted into the sorted list at its appropriate position.
- In each pass, the sorted list is traversed from the backward direction to find the position where the unsorted element could be inserted.
Last updated on Jun 13, 2025
->HSSC CET Application Deadline 2025 has been extended. The last date to apply online is 14th June till 11:59 PM.
->Earlier, Haryana CET Group C Notice for EWS Certificate was out. A valid format of EWS Certificate has been given in the Notice.
-> Haryana CET Group C Notification 2025 was out on 26th May 2025.
-> The HSSC CET Registration 2025 is open from 28th May to 14th June 2025.
-> The minimum educational qualification to apply for the Common Eligibility Test is 10+2/equivalent
-> Candidate applying for CET should not be less than 18 years of age and not more than 42 years.
-> Aspirants must go through the Haryana CET Previous Years’ Papers to understand the need for the exam and prepare for the exam in the right direction.