Symbol table lookup is usually implemented with a hash table because
Answer: A
Correct answer: names must be found quickly and are looked up very frequently
Every identifier in the program is looked up at least once and usually several times, across several phases, so the lookup is on the compiler's hot path.
A hash table gives near constant time, where a linear list would give time proportional to the number of names. The trade is that ordering is lost, which is why scope handling uses a stack of tables or a chain of them alongside. No standard prescribes the structure; speed alone recommends it.
Please log in or register to report this question.