anubhav9042
BAN USER
Comments (3)
Reputation 10
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
1
of 1 vote
I think when we get a new tag we can't just compare with the root.
What if the number of times it has appeared is less than the root but greater than the 2nd/ 3rd highest tag???
I suggest using a min heap. Add randomly n tags and build min-heap and then for remaining of the tags compare with root of heap and change if current_tag.count > roothead.count and call heapify. Same can be done when we get a new tag.
This way we always maintain a heap of N elements with maximum counts
Also I think we could use a balanced BST and whenever we want the trending topics, we could just do reverse inorder traversal.
Comment hidden because of low score. Click to expand.
0
of 0 vote
seems legit.
- anubhav9042 August 21, 2015Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
I think we should be doing something similar to Elevator/Scan disk scheduling here.
- anubhav9042 October 15, 2015Any thoughts?