+0  
 
0
89
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.

Guest May 27, 2017
Sort: 

1+0 Answers

 #1
avatar+17512 
+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.

geno3141  May 27, 2017

10 Online Users

avatar
We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.  See details