+0  
 
0
374
1
avatar

We have a dictionary consisting of 106 words. If we use a binary tree as a spell checker, estimate how many checks might be required to test whether "name" is a valid word.

 May 27, 2017
 #1
avatar+17746 
+1

It takes at most  n  checks to find an item in a field of  2n - 1  items.

 

When  n = 6,  26 - 1  =  63

When  n = 7,  27 - 1  =  127

 

So, if you have 106 words, it will take a binary search at most 7 checks.

 May 27, 2017

23 Online Users

avatar
avatar
avatar
avatar
avatar
avatar