Tag: data structure
The Trie is common used data structure to speed up the word searching. The Trie is a structure to index the words character by character. Trie Definition in C++ …
Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granularity) and you may assume …
Task: Design a Data Structure (Container) that supports O(1) constant time in Adding, Removing and Getting a Random Element with Equal Probability. For example: // RandomDS.add(3) // RandomDS.add(4) // …
Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. …
We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance between two points on a plane is …