Google Interview Question
Applications DevelopersCountry: India
In memory representation, is it a good idea ?
Maintain a DB with good data modelling like key words mapping and other attributes mapping which can give fast data access.
NB: I would prefer auto ranking (number of hits by users), typically popularity
If user types keywords like romantic, latest, fight movie with specific time of comedy/action/romance or may be some other attributes.
Then we need to translate into SQL syntax
say for examples,
romantic movies->search by keyword romantic
latest movies->release date < sysdate order by release date (limit N)
action more than 10 minutes->typically romantic movie
so on ...
If any search criteria missing then system has to update missing search criteria intelligently
Each movie is a object of a movie class with attributes like genre, name, review stars, length, list of review comments, etc..
- Subhajit June 15, 2013Now store these movie objects into memory or secondary storage disk.
Create hashmaps with the key as the attribute(genre, length, etc..) and value as arraylist of the object references. So there is one genres hashmap, one movie length hashmap, multipe lead actors hashmaps, etc..
The hashmaps can be maintained in memory.
Whenever a new movie object is created update the hashmaps.
For answering the queries have the corresponding hashmap look up.