forked from benbrandt/cs50
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestions.txt
28 lines (28 loc) · 1.8 KB
/
questions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
0. A lung disease that is otherwise known as silicosis
1. Returns resource usage for particular thread(s).
2. 16
3. Since it is being called in a function, we pass in the pointer so we can
save the return value outside of the function call.
4. Main loads the dictionary into memory, as well as the text to check. Then
it reads the text one character at a time, It checks if the character is a
letter or a ' (if we're already inside of a word) and adds that letter to
the word. If the word is longer than 45 character, we read the rest of the
word and move on. If the word has a digit in it, we also discard the word.
Once we hit any other character, the word is complete, we add the null
character at the end, increment our word count, check if the word is
mispelled, and print it to the terminal if so.
5. fscanf might try and write a word longer than our maximum length to our
array.
6. Because we aren't changing their values.
7. The spell checker is built with a trie data structure, which each node
contains a boolean value if the current node represents the end of a word,
and an array of node pointers representing the 26 letters and an apostrophe.
8. My load time is usually around 0.12s for the large dictionary, but I forgot
to turn off the unload error earlier so I wasn't getting times before that.
9. I'm not really sure what else I can do to improve the performance at this
point since the trie structure already seems pretty efficient. Since it is
able to check the entire War and Peace document in about .5s, it seems to be
performant enough at the moment.
10. At the moment I think most of the bottlenecks are in the file i/o and node
creation segments. I could potentially look into more efficient ways of
storing info to improve the speed.