5.3

From The Algorithm Design Manual Solution Wiki
Revision as of 00:54, 21 September 2020 by Algowikiadmin (talk | contribs) (Created page with "(1) Do a binary search within the range of <math>1-n</math>. You guess the right number within O(log n) questions. (2) If you don't know n start with a random number <math>2^...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

(1) Do a binary search within the range of . You guess the right number within O(log n) questions.

(2) If you don't know n start with a random number and if it is larger than the number you are looking for do a binary search within as in (1). If is less then guess and repeat.


Back to Chapter 5