The Worst Topics Flashcards
What order does pre order tree traversal go in?
N L R
What order does in order tree traversal go in?
L N R
What order does post order tree traversal go in?
L R N
Name this notation and the traversal required to get this
2 + 3
Infix
In order traversal
Name this notation and the traversal required to get this
2 3 +
Reverse Polish
Post order
Name this notation and the traversal required to get this
+ 2 3
Polish
Pre order
What is open addressing?
Use hashing to find a candidate bucket, have a strategy to remap colliding keys and find them afterwards
What is secondary hashing?
Use a second hash function to pick the bucket, if there is still a collision, then revert to linear probing
What is linear probing?
Walking along the bucket until you find a free space to place the key/value pair
What is separate chaining?
The bucket is a list of key/value pairs. We hash to the bucket and then add it to the list at the position.
What is extendable hashing?
Process of splitting the bucket, consuming another bit of the hash code, and placing values in the newly split parts of the bucket
What features do we want from a hash function?
- Two keys that are close together, map far apart
- Low chance of two keys mapping to the same value
- Spread of the keys across the hash bucket
Describe the parsing pipeline
Source Text
Tokeniser
Parser
Parse tree
Describe the process of tokenising using a FSA
Tokenise the input source, generating a steam of tokens for the grammar, some tokens can carry values with them
FSA keeps track of the characters used, attaches them to the recognised symbol
Describe the process of recursive descent parsing
Treats each production as a small recogniser that looks at the token stream and tries to recognise itself
Try it and see it method