We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5c394e commit c339b9aCopy full SHA for c339b9a
C++/design-log-storage-system.cpp
@@ -1,4 +1,5 @@
1
-// Time: O(logn)
+// Time: put: O(logn), n is the size of the total logs
2
+// retrieve: O(logn + d), d is the size of the found logs
3
// Space: O(n)
4
5
class LogSystem {
@@ -12,12 +13,10 @@ class LogSystem {
12
13
granularity_["Second"] = 19;
14
}
15
- // Time: O(logn), n is the size of the total logs
16
void put(int id, string timestamp) {
17
lookup_.emplace(timestamp, id);
18
19
20
- // Time: O(logn + d), d is the size of the found logs
21
vector<int> retrieve(string s, string e, string gra) {
22
s = s.substr(0, granularity_[gra]) + s_filter_.substr(granularity_[gra]);
23
e = e.substr(0, granularity_[gra]) + e_filter_.substr(granularity_[gra]);
0 commit comments