Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool lookup(string s)
- {
- // TODO
- int start = 0;
- int end = dictionary.size;
- int mid = start + end / 2;
- while (end - start > 0)
- {
- if (strcmp(s, dictionary.words[mid].letters) == 0)
- {
- return true;
- }
- if (strcmp(s, dictionary.words[mid].letters) < 0)
- {
- end = mid - 1;
- }
- if (strcmp(s, dictionary.words[mid].letters) > 0)
- {
- start = mid + 1;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement