Question:

An array with 3 elements is arranged in ascending order as follows:
Name the technique used:

Show Hint

In \textbf{Bubble sort}, adjacent elements are compared and swapped repeatedly. If you see the largest element moving step by step toward the end, it is usually Bubble sort.
  • Bubble sort
  • Linear Search
  • Selection sort
  • Binary Search
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Observe the sequence of swaps carefully.
The given array changes as follows: \[ [4 \quad 1 \quad 3] \rightarrow [1 \quad 4 \quad 3] \rightarrow [1 \quad 3 \quad 4] \] In the first step, the adjacent elements \(4\) and \(1\) are compared and swapped because \(4>1\).
In the second step, the adjacent elements \(4\) and \(3\) are compared and swapped because \(4>3\).
So, the array gets sorted by repeatedly comparing and swapping adjacent elements.
Step 2: Recall the idea of Bubble Sort.
Bubble sort is a sorting technique in which adjacent elements are compared one by one, and if they are in the wrong order, they are swapped. In each pass, the largest element gradually moves toward the end of the array, just like a bubble rising upward.
Here, \(4\) first moves one position to the right and then again to the right until it reaches its correct place: \[ [4 \quad 1 \quad 3] \rightarrow [1 \quad 4 \quad 3] \rightarrow [1 \quad 3 \quad 4] \] This exactly matches the working of Bubble sort.
Step 3: Compare with the other options.
  • (A) Bubble sort: Correct, because adjacent elements are swapped repeatedly.
  • (B) Linear Search: Incorrect, because linear search is used for finding an element, not sorting.
  • (C) Selection sort: Incorrect, because selection sort selects the minimum element and places it in the correct position, rather than swapping adjacent elements repeatedly.
  • (D) Binary Search: Incorrect, because binary search is a searching method used on sorted arrays, not a sorting technique.
Step 4: Conclusion.
Since the array is sorted by comparing and swapping neighboring elements step by step, the technique used is Bubble sort.
Final Answer:Bubble sort.
Was this answer helpful?
0
0

Questions Asked in ICSE Class X board exam

View More Questions