Skip to content

Commit

Permalink
Doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
teezzan committed Sep 3, 2022
1 parent e55813a commit 959f244
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ANSWERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ How does your code work?
-------
The most important part of the codebase is the "Storage" implementation. The "Storage" consists of two storage variables or mechanism.
- *`IpAddressTallyMap`*: A hashtable for mapping an item (IP address) to a count(number).
- *`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)`.
- *`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)`.

The methods of the "Storage" implementation are enumerated as follows.
- *`Truncate`*: This properly reinitialized the storage variables. A dummy hashmap is inserted at index 0 of *`FrequencyLookupTable`* because there should be no values there.
Expand Down
3 changes: 3 additions & 0 deletions storage/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ var emptyStruct struct{}
// A DefaultStorage defines a default Storage interface.
// This is the starting point of extending the library to work with other storage.
type DefaultStorage struct {
// IpAddressTallyMap is a hashtable for mapping an item to a count.
// FrequencyLookupTable is an array whose index is the frequency of
// occurrence of items and the value, a collection of such item.
IpAddressTallyMap map[string]int
FrequencyLookupTable []map[string]struct{}
}
Expand Down

0 comments on commit 959f244

Please sign in to comment.