We use cookies to personalise content and advertisements and to analyse access to our website. Furthermore, our partners for online advertising receive pseudonymised information about your use of our website. cookie policy and privacy policy.
 
+0  
 
0
401
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+17774 
+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