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;
- while (start <= end)
- {
- int mid = (start + end) / 2;
- if (strcmp(s, dictionary.words[mid].letters) == 0)
- {
- dictionary.words[mid].found = true;
- 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