Question
5,1,4,2,8 how many more pass are needed to finish
sorting by bubble sorting technique?Solution
First Pass: ( 5 1 4 2 8 ) –> ( 1 5 4 2 8 ), Here, algorithm compares the first two elements, and swaps since 5 > 1. ( 1 5 4 2 8 ) –> ( 1 4 5 2 8 ), Swap since 5 > 4 ( 1 4 5 2 8 ) –> ( 1 4 2 5 8 ), Swap since 5 > 2 ( 1 4 2 5 8 ) –> ( 1 4 2 5 8 ), Now, since these elements are already in order (8 > 5), algorithm does not swap them. Second Pass: ( 1 4 2 5 8 ) –> ( 1 4 2 5 8 ) ( 1 4 2 5 8 ) –> ( 1 2 4 5 8 ), Swap since 4 > 2 ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 ) ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 ) Now, the array is already sorted, but our algorithm does not know if it is completed. The algorithm needs one whole pass without any swap to know it is sorted. Third Pass: ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 ) ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 ) ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 ) ( 1 2 4 5 8 ) –> ( 1 2 4 5 8 )
Which of the following statements is/are incorrect regarding Asian Development Bank (ADB)?
1. ADB was formed as a result of a resolution passed a...
India is set to finalize the terms of reference for a Free Trade Agreement (FTA) with which country in early October 2025?Â
Where was India’s first port-based Green Hydrogen Pilot Project inaugurated in September 2025?Â
What key initiative is part of the Comprehensive Integrated Border Management System (CIBMS)?
Which framework did the RBI introduce to improve weak urban cooperative banks (UCBs)? Â
In which year was the Central Warehousing Corporation established?
Dr Subhash Babu is, _____Indian scientist, to be awarded Bailey K. Ashford Medal?
- Who won the 2025 Women's T20 World Cup held in Bangladesh?
- What is the primary objective of the AI Kiran initiative under IndiaAI Mission?
Why is July 22 observed as National Flag Day in India?Â