Poblems on divide and conquer (for practicals)
Požadavky na absolvování
- Consider a variant of mergesort which divides the sequence into more than 2 parts, sorts recursively and merges. Will it run faster than mergesort?
- Given a collection of n nuts of distinct sizes and n bolts such that there is a one-to-one correspondence between the nuts and the bolts, find for each nut its corresponding bolt.
- Lets have skyscraper with n levels and k eggs. Egg is an object for
which there exists a constant m so if we throw the egg away from a window in
level at most m, it will never break. If we throw it from any higher level it will
always break. Design algorithm to determine value m when number of steps is
measured as number of times the egg is thrown out from the window (we have
unlimited computation power otherwise) for the following cases:
1. k = 1,
2. k = ∞,
3. k = 2. - Is it possible to compare 5 elements with 7 comparisons?
Naposledy změněno: středa, 22. dubna 2020, 20.20