51. In which sorting algorithm, every adjacent pair is compared and swapped if they are not in the right order?
(A) Insertion Sort
(B) Bubble Sort
(C) Selection Sort
(D) Linear Sort
Answers
Answered by
1
Answer:
The correct answer is (b) Bubble sort. It takes two elements at a time, compares them and swaps their position if it is not in the correct sequence.
This sorting algorithm is time-consuming, but the simplest one and therefore easiest to understand. This is the main advantage of this algorithm. However, the working of this can be optimised by introducing a 'flag' to keep a check whether the elements are actually getting swapped inside the 'for' loop.
Answered by
6
In which sorting algorithm, every adjacent pair is compared and swapped if they are not in the right order?
(A) Insertion Sort
(B) Bubble Sort☑️☑️☑️☑️☑️☑️
(C) Selection Sort
(D) Linear Sort
Similar questions