Microsoft Interview Question
Software Engineer / DevelopersCountry: India
Interview Type: In-Person
I also think trie should be good here .....we can do some tweaking ...when the name of a class ends in a trie we can keep a pointer to another trie which contains the methods of this class ... ..so in effect one global trie for all classes and each leaf in this trie point one unique trie which can all the methods in that class....same logic can be applied if we need a hierarchy of classes ..
You should mention to the customer that in the background the IDE continually tries to build/compile. This code runs in a separate thread. While auto complete may be well described using a TRIE, the trie is built over and over again as part of compilation in the background thread. The suggestion for properties and methods is implemented using REFLECTIONS (in C# or java).
Dictionary suffice the needs. Keys will be different class namespaces. There values will be what all public methods and variables that class/inteface exposes. This will be applied even for the curent class.
- Ash February 26, 2012