The Student Room Group
Which question is the bubble sort one?
Reply 2
Original post by NotNotBatman
Which question is the bubble sort one?


2b it is binary not bubble.

D1 will do that to you :redface:
You can divide the number of items by 2 until the result is <1 and the number of times you divided it is the number of comparisons.
I usually just put it in my calculator and count.

it's because if you have 11 names, you'll have two sublists one with 6 names and one with 5 names and for the max number of comparisons you delete the list with 5 names. And you would always delete the list with less names for max comparisons.
Reply 4
Original post by NotNotBatman
You can divide the number of items by 2 until the result is <1 and the number of times you divided it is the number of comparisons.
I usually just put it in my calculator and count.

it's because if you have 11 names, you'll have two sublists one with 6 names and one with 5 names and for the max number of comparisons you delete the list with 5 names. And you would always delete the list with less names for max comparisons.



Thank you perfect.

Quick Reply

Latest