Start learning 50% faster. Sign in now
First Pass: (5 1 4 2 8 ) –> (1 5 4 2 8 ), Here, algorithm compares the first two elements, and swaps since 5 > 1. ( 15 4 2 8 ) –> ( 14 5 2 8 ), Swap since 5 > 4 ( 1 45 2 8 ) –> ( 1 42 5 8 ), Swap since 5 > 2 ( 1 4 25 8 ) –> ( 1 4 25 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 ) ( 14 2 5 8 ) –> ( 12 4 5 8 ), Swap since 4 > 2 ( 1 24 5 8 ) –> ( 1 24 5 8 ) ( 1 2 45 8 ) –> ( 1 2 45 8 ) Now, the array is already sorted, but our algorithm does not know if it is completed. The algorithm needs onewhole pass withoutany swap to know it is sorted. Third Pass: (1 2 4 5 8 ) –> (1 2 4 5 8 ) ( 12 4 5 8 ) –> ( 12 4 5 8 ) ( 1 24 5 8 ) –> ( 1 24 5 8 ) ( 1 2 45 8 ) –> ( 1 2 45 8 )
Who has been appointed as the Chairman of the National Technical Research Organisation (NTRO)?
Which condition must be met by custodian banks to issue IPCs, according to the revised RBI guidelines?
What was the significant finding of the World Bank report regarding India's GDP growth?
Which is the most peaceful country in the world according to the Global Peace Index 2023?
Recently, In order to reach seventeen lakh defense pensioners nationwide, the Defence Ministry has inked an MoU with which two banks?
What is the primary purification technology used in GAIL’s CBG plant in Ranchi?
Which new development scheme in Himachal Pradesh promotes natural farming?
Who released recommendations on "Encouraging Innovative Technologies, Services, Use Cases and Business Models through Regulatory Sandbox in Digital Comm...
Recently PM Narendra Modi inaugurated Jagadguru Shrisant Tukaram Maharaj Shila Mandir in____?
The Defense Minister of India had inaugurated a Siyom Bridge on 3rd January, 2023 at a cost of Rs 724 crore, in which state of India?