Skip to content

Commit 959f244

Browse files
committed
Doc update
1 parent e55813a commit 959f244

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ANSWERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ How does your code work?
1818
-------
1919
The most important part of the codebase is the "Storage" implementation. The "Storage" consists of two storage variables or mechanism.
2020
- *`IpAddressTallyMap`*: A hashtable for mapping an item (IP address) to a count(number).
21-
- *`FrequencyLookupTable`*: An array whose index is the frequency of occurrence of items and the value, the collection of such item. To ensure an efficient search, insert and delete operation, the collection is modelled as a hashtable with a runtime complexity of an amortized `O(1)`.
21+
- *`FrequencyLookupTable`*: An array whose index is the frequency of occurrence of items and the value, a collection of such item. To ensure an efficient search, insert and delete operation, the collection is modelled as a hashtable with a runtime complexity of an amortized `O(1)`.
2222

2323
The methods of the "Storage" implementation are enumerated as follows.
2424
- *`Truncate`*: This properly reinitialized the storage variables. A dummy hashmap is inserted at index 0 of *`FrequencyLookupTable`* because there should be no values there.

storage/memory.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ var emptyStruct struct{}
66
// A DefaultStorage defines a default Storage interface.
77
// This is the starting point of extending the library to work with other storage.
88
type DefaultStorage struct {
9+
// IpAddressTallyMap is a hashtable for mapping an item to a count.
10+
// FrequencyLookupTable is an array whose index is the frequency of
11+
// occurrence of items and the value, a collection of such item.
912
IpAddressTallyMap map[string]int
1013
FrequencyLookupTable []map[string]struct{}
1114
}

0 commit comments

Comments
 (0)