c++ - What is the maximum number of comparisons required to find a key in a binary tree having 191 nodes and whose height is equal to nine? -


i know filled binary tree, height of tree equal floor(log2(n)), , maximum number of comparisons find given key h+1, or floor(log2(n)) + 1.

this question appears in review our final, , cannot recall how find answer. possible answers given 7, 8, 9, 10. answer either 9 or 10, don't know, because i'm not sure if should calculating answer based upon number 512 (2^9), or 191.

help appreciated!

since height specified, that's undoubtedly easiest way work.

the maximum number of comparisons maximum number of non-leaf nodes traverse getting root leaf node. depending on how he's defined height (which, unfortunately, isn't universally agreed upon) either height or 1 less height.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -