How would you find the maximum number of comparisons and the maximum number of swaps that might be needed in a bubble sort to rearrange seven numbers into ascending order?
How do you workout the number of swaps in bubble sort?
looking at your profile I dont think youre a troll but this thread is more than 7 years old.
Its pretty straightforward to work out based on the order of the numbers just by counting it swap by swap though, i dont think a formula as such for the number of swaps in a given bubble sort exist
looking at your profile I dont think youre a troll but this thread is more than 7 years old.
Its pretty straightforward to work out based on the order of the numbers just by counting it swap by swap though, i dont think a formula as such for the number of swaps in a given bubble sort exist
😂😂 oops didnt see it was made 2009 Thanks and i also need help in knowing how to find the number of comparisons when using quick sort? Is it the same as finding the number of comparisons for the bubble sort?
😂😂 oops didnt see it was made 2009 Thanks and i also need help in knowing how to find the number of comparisons when using quick sort? Is it the same as finding the number of comparisons for the bubble sort?
I saw your profile, you got a* in maths and furthermaths, that's amazing! Could you please give me some tips on how to revise and what you used. Also what was you daily study routine, since once i reach home i have tonnes of homework to get through first and then not much time for revision for all my subjects. Thanks
😂😂 oops didnt see it was made 2009 Thanks and i also need help in knowing how to find the number of comparisons when using quick sort? Is it the same as finding the number of comparisons for the bubble sort?
oh thats okay then, in the future if a thread is super old just make a new one
quick sort is the pivot one right? if so then the number of comparisons is surely equal to the number of items in the list since every item must be a pivot at some point. If you mean how many lines of work you need to do (ie how many recursions of the algorithm) then that really just depends on the items, it will vary.
short answer though, im not sure. If that was an exam question i doubt id get it right