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 one of the following is NOT one of the 7C’s of effective communication?
Consider the following statement:
I. MDs and CEOs of asset reconstruction companies (ARCs) cannot have more than three terms in office.
<...GoDigit Life, the life insurance business of GoDigit Insurance has raised equity funding from two major private sector lenders Axis Bank and HDFC Bank. ...
Calculate Proprietary Ratio
Accounts relating to income, revenue, gain expenses, and losses are termed as:
Which of the following is/are the major aim of Financial Inclusion?
Which private sector bank has launches 7th edition of knowledge summit 'Evolve' for MSMEs with sub-themes such as 'Digitalisation to Building Indian SME...
How must entities with multiple lines of business (LoBs) granted by IFSCA complete their registration on the FIU-IND FINNET 2.0 Portal as per the March ...
Which of the following is not a key characteristic of project financing?
Consider the following Statements and choose the option with correct Statements.
I- Pradhan Mantri Awaas Yojana –Gramin (PMAY-G) was launched i...