2 votes 2 votes The given array is $\text{arr={1, 2, 4, 3}}$. Bubble sort is used to sort the array elements. How many passes will be done to sort the array? $4$ $2$ $1$ $3$ Algorithms nielit-sta-2020 algorithms sorting bubble-sort + – gatecse asked Dec 9, 2020 • recategorized Jul 5, 2022 by Lakshman Bhaiya gatecse 829 views answer comment Share Follow See 1 comment See all 1 1 comment reply Raghav Khajuria commented Dec 5, 2023 reply Follow Share In Bubble Sort after every pass largest element will place at its correct position.1st Pass : 1 ,2 ,4 ,3 1,2 --- no exchange2,4 – no exchange4,3 – exchange1 , 2 ,3,4 After one pass array is sorted ,to confirm we can have a one more pass which will not have any exchange.Answer should be C (1) 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Option D Bubble sort will take maximum n-1 passes to completely sort array of n elements. So here array size is 4, it will take 3 passes to sort this array. Reference:- https://runestone.academy/runestone/books/published/pythonds/SortSearch/TheBubbleSort.html Asim Siddiqui 4 answered Mar 19, 2021 Asim Siddiqui 4 comment Share Follow See all 0 reply Please log in or register to add a comment.