zeroByzero
BAN USER- 0of 0 votes
AnswersDesign a system where you can reutrn top 20 queries made in last 24 hours to users.
- zeroByzero in United States
Think on the scale of Google and Yahoo. How would you store data. What will be your data structures, algorithm to get that data.Describe your assumptions etc.
For simplicity, you can assume that every web server create a log file with query and timestamp.| Report Duplicate | Flag | PURGE
Amazon
I guess the answer should be the "node before the front node" of the queue, since for deletion in O(1) you need node before front , since list is circulary connceted so rear can also be approached by this node so both insertiona nd deletion will be O(1
- zeroByzero December 27, 2012yes,
since for deletion in O(1) you need node before front , since list is circulary connceted so rear can also be approached by this node so both insertiona nd deletion will be O(1)
i think this approach should work, there is a little addition to your algo,
- zeroByzero January 10, 2013IF has for 1st character do not exist , then also check for last character of string, and if it exist then insert this node before the hash of the last character .