Class defining the structure of trie node and containing the methods to perform operations on them.
More...
@@ -198,66 +286,66 @@ static constexpr uint8_t
E
-
-
151 Tnode *cur_pos =
this ,
-
-
153 int letter_index = 0, delete_from_index = 0, i = 0, n = entry.
size ();
-
-
155 for (i = 0; i < n; i++) {
-
-
157 letter_index =
tolower (entry[i]) - 97;
-
-
-
160 if (cur_pos->english[letter_index] ==
nullptr ) {
-
-
-
-
-
-
-
-
168 delete_from = cur_pos;
-
-
170 delete_from_index = i - 1;
-
-
-
-
-
175 cur_pos = cur_pos->english[letter_index];
-
-
-
-
-
180 if (!cur_pos->endOfWord) {
-
-
-
-
-
-
-
-
188 cur_pos->endOfWord =
false ;
-
189 cur_pos->frequency = 0;
-
-
-
-
-
194 letter_index =
tolower (entry[delete_from_index + 1]) - 97;
-
-
196 cur_pos = delete_from->english[letter_index];
-
-
198 delete_from->english[letter_index] =
nullptr ;
-
-
-
-
202 if (n > delete_from_index + 2) {
-
203 DeleteFrom (cur_pos, entry, delete_from_index + 2);
-
-
-
-
-
-
+
+
151 Tnode *cur_pos =
this ,
+
+
153 int letter_index = 0, delete_from_index = 0, i = 0, n = entry.
size ();
+
+
155 for (i = 0; i < n; i++) {
+
+
157 letter_index =
tolower (entry[i]) - 97;
+
+
+
160 if (cur_pos->english[letter_index] ==
nullptr ) {
+
+
+
+
+
+
+
+
168 delete_from = cur_pos;
+
+
170 delete_from_index = i - 1;
+
+
+
+
+
175 cur_pos = cur_pos->english[letter_index];
+
+
+
+
+
180 if (!cur_pos->endOfWord) {
+
+
+
+
+
+
+
+
188 cur_pos->endOfWord =
false ;
+
189 cur_pos->frequency = 0;
+
+
+
+
+
194 letter_index =
tolower (entry[delete_from_index + 1]) - 97;
+
+
196 cur_pos = delete_from->english[letter_index];
+
+
198 delete_from->english[letter_index] =
nullptr ;
+
+
+
+
202 if (n > delete_from_index + 2) {
+
203 DeleteFrom (cur_pos, entry, delete_from_index + 2);
+
+
+
+
+
+
void DeleteFrom(Tnode *delete_from, std::string delete_string, int remove_index)
Function recursively deletes the substring character by character iterating through the string to be ...
Definition: trie_multiple_search.cpp:134
uint8_t numberOfChildren(Tnode *node)
Function to count the number of children a node in the trie has.
Definition: trie_multiple_search.cpp:69
@@ -267,13 +355,13 @@ static constexpr uint8_t
E
-
+
◆ DeleteFrom()
@@ -314,26 +402,26 @@ Here is the call graph for this function:
-
-
136 if (delete_string.
size () == remove_index) {
-
137 int letter_index =
tolower (delete_string[remove_index]) - 97;
-
-
139 DeleteFrom (delete_from->english[letter_index], delete_string,
-
-
-
-
-
+
+
136 if (delete_string.
size () == remove_index) {
+
137 int letter_index =
tolower (delete_string[remove_index]) - 97;
+
+
139 DeleteFrom (delete_from->english[letter_index], delete_string,
+
+
+
+
+
-
+
◆ Insert()
@@ -356,29 +444,29 @@ Here is the call graph for this function:
-
-
105 Tnode *cur_pos =
this ;
-
106 int letter_index = 0;
-
-
108 for (
auto &i : entry) {
-
-
110 letter_index =
tolower (i) - 97;
-
-
-
-
114 if (cur_pos->english[letter_index] ==
nullptr ) {
-
115 cur_pos->english[letter_index] =
new Tnode();
-
-
-
118 cur_pos = cur_pos->english[letter_index];
-
-
-
121 cur_pos->endOfWord =
true ;
-
+
+
105 Tnode *cur_pos =
this ;
+
106 int letter_index = 0;
+
+
108 for (
auto &i : entry) {
+
+
110 letter_index =
tolower (i) - 97;
+
+
+
+
114 if (cur_pos->english[letter_index] ==
nullptr ) {
+
115 cur_pos->english[letter_index] =
new Tnode();
+
+
+
118 cur_pos = cur_pos->english[letter_index];
+
+
+
121 cur_pos->endOfWord =
true ;
+
-
+
◆ numberOfChildren()
@@ -410,12 +498,11 @@ Here is the call graph for this function:
Returns count of the number of children of the given node (max 26)
-
-
70 return ENGLISH_ALPHABET_SIZE -
-
-
+
+
70 return ENGLISH_ALPHABET_SIZE -
+
+
-
Definition: avltree.cpp:13
@@ -425,7 +512,7 @@ Here is the call graph for this function:
-
+
◆ SearchFreqSuggestions()
@@ -448,56 +535,56 @@ Here is the call graph for this function:
-
-
366 Tnode *cur_pos =
nullptr , *prev_pos =
nullptr ;
-
367 cur_pos = prev_pos =
this ;
-
368 int letter_index = 0;
-
-
-
-
-
-
-
-
-
-
378 for (
auto &i : key) {
-
379 letter_index =
tolower (i) - 97;
-
-
-
-
-
-
385 if (cur_pos->english[letter_index] ==
nullptr ) {
-
-
-
-
389 std::cout <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - "
-
-
-
-
-
-
395 cur_pos = cur_pos->english[letter_index];
-
-
-
398 if (cur_pos->endOfWord) {
-
399 (cur_pos->frequency)++;
-
-
-
-
-
-
-
-
-
-
-
-
411 std::cout <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - "
-
-
-
+
+
366 Tnode *cur_pos =
nullptr , *prev_pos =
nullptr ;
+
367 cur_pos = prev_pos =
this ;
+
368 int letter_index = 0;
+
+
+
+
+
+
+
+
+
+
378 for (
auto &i : key) {
+
379 letter_index =
tolower (i) - 97;
+
+
+
+
+
+
385 if (cur_pos->english[letter_index] ==
nullptr ) {
+
+
+
+
389 std::cout <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - "
+
+
+
+
+
+
395 cur_pos = cur_pos->english[letter_index];
+
+
+
398 if (cur_pos->endOfWord) {
+
399 (cur_pos->frequency)++;
+
+
+
+
+
+
+
+
+
+
+
+
411 std::cout <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - "
+
+
+
void SuggestFreqAutocomplete(Tnode *new_root, const std::string &prefix, std::priority_queue< std::pair< int, std::string > > *suggestions)
Recursive function to suggest most frequently searched entries of trie which have a given common pref...
Definition: trie_multiple_search.cpp:337
void SelectionTop_3(std::priority_queue< std::pair< int, std::string > > *suggestions)
Function to display the 3 suggestions with highest frequency of search hits.
Definition: trie_multiple_search.cpp:317
@@ -505,13 +592,13 @@ Here is the call graph for this function:
-
+
◆ SearchPresence()
@@ -537,31 +624,31 @@ Here is the call graph for this function:
Returns true if the key is found
false if the key is not found
-
-
218 Tnode *cur_pos =
this ;
-
219 int letter_index = 0;
-
-
221 for (
auto &i : key) {
-
222 letter_index =
tolower (i) - 97;
-
-
224 if (cur_pos->english[letter_index] ==
nullptr ) {
-
-
-
227 cur_pos = cur_pos->english[letter_index];
-
-
-
-
231 if (cur_pos->endOfWord) {
-
232 (cur_pos->frequency)++;
-
-
-
-
-
+
+
218 Tnode *cur_pos =
this ;
+
219 int letter_index = 0;
+
+
221 for (
auto &i : key) {
+
222 letter_index =
tolower (i) - 97;
+
+
224 if (cur_pos->english[letter_index] ==
nullptr ) {
+
+
+
227 cur_pos = cur_pos->english[letter_index];
+
+
+
+
231 if (cur_pos->endOfWord) {
+
232 (cur_pos->frequency)++;
+
+
+
+
+
-
+
◆ SearchSuggestions()
@@ -584,56 +671,56 @@ false if the key is not found
-
-
272 Tnode *cur_pos =
nullptr , *prev_pos =
nullptr ;
-
273 cur_pos = prev_pos =
this ;
-
274 int letter_index = 0;
-
-
-
-
278 for (
auto &i : key) {
-
279 letter_index =
tolower (i) - 97;
-
-
-
-
-
-
285 if (cur_pos->english[letter_index] ==
nullptr ) {
-
-
287 std::cout <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - "
-
-
-
-
-
-
293 cur_pos = cur_pos->english[letter_index];
-
-
-
296 if (cur_pos->endOfWord) {
-
-
298 (cur_pos->frequency)++;
-
-
-
-
-
-
-
-
306 std::cout <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - "
-
-
-
+
+
272 Tnode *cur_pos =
nullptr , *prev_pos =
nullptr ;
+
273 cur_pos = prev_pos =
this ;
+
274 int letter_index = 0;
+
+
+
+
278 for (
auto &i : key) {
+
279 letter_index =
tolower (i) - 97;
+
+
+
+
+
+
285 if (cur_pos->english[letter_index] ==
nullptr ) {
+
+
287 std::cout <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - "
+
+
+
+
+
+
293 cur_pos = cur_pos->english[letter_index];
+
+
+
296 if (cur_pos->endOfWord) {
+
+
298 (cur_pos->frequency)++;
+
+
+
+
+
+
+
+
306 std::cout <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - "
+
+
+
void SuggestAutocomplete(Tnode *new_root, const std::string &prefix)
Recursive function to suggest all the entries of trie which have a given common prefix.
Definition: trie_multiple_search.cpp:246
-
+
◆ SelectionTop_3()
@@ -656,15 +743,15 @@ Here is the call graph for this function:
-
-
-
320 int n = suggestions->
size (), Top = 0;
-
-
-
-
-
-
+
+
+
320 int n = suggestions->
size (), Top = 0;
+
+
+
+
+
+
-
+
◆ SuggestAutocomplete()
@@ -710,32 +797,32 @@ Here is the call graph for this function:
-
-
-
-
-
250 for (i = 0; i < ENGLISH_ALPHABET_SIZE; i++) {
-
251 if (new_root->english[i] !=
nullptr ) {
-
-
-
254 if (new_root->english[i]->endOfWord) {
-
-
-
-
-
-
-
+
+
+
+
+
250 for (i = 0; i < ENGLISH_ALPHABET_SIZE; i++) {
+
251 if (new_root->english[i] !=
nullptr ) {
+
+
+
254 if (new_root->english[i]->endOfWord) {
+
+
+
+
+
+
+
-
+
◆ SuggestFreqAutocomplete()
@@ -776,28 +863,28 @@ Here is the call graph for this function:
-
-
-
341 for (i = 0; i < ENGLISH_ALPHABET_SIZE; i++) {
-
342 if (new_root->english[i] !=
nullptr ) {
-
-
-
345 if (new_root->english[i]->endOfWord) {
-
-
347 new_root->english[i]->frequency, prefix +
char (i + 97)));
-
-
-
-
-
-
-
+
+
+
341 for (i = 0; i < ENGLISH_ALPHABET_SIZE; i++) {
+
342 if (new_root->english[i] !=
nullptr ) {
+
+
+
345 if (new_root->english[i]->endOfWord) {
+
+
347 new_root->english[i]->frequency, prefix +
char (i + 97)));
+
+
+
+
+
+
+
-
@@ -812,7 +899,7 @@ Here is the call graph for this function:
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.js b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.js
index adf1d9b7e..73cf0637d 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.js
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.js
@@ -1,23 +1,13 @@
var classoperations__on__datastructures_1_1trie__operations_1_1_tnode =
[
- [ "Tnode", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#aef1ef6608e5876312d9ae7f36f469ba7", null ],
- [ "Tnode", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a6f73ac06a639956cdef90f8c8dbe9187", null ],
- [ "Tnode", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#abc70a8b526aff96d49daa987f00ff252", null ],
- [ "~Tnode", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a5f02156cd1a2a1ba48fb6ba2283afbf1", null ],
[ "Delete", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#aefd24626ac47277431c9b8604e064340", null ],
[ "DeleteFrom", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#adef6940391f981ab86767775176b7169", null ],
[ "Insert", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a7ecb75b985b1ffc575a880274f855b1c", null ],
[ "numberOfChildren", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#afca808362c13273ca8c8ae7d58e8eee0", null ],
- [ "operator=", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a30edc883a96fda01d596eb33a8cc6194", null ],
- [ "operator=", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#af58f175cd8a2d29d43b67e1fb7727807", null ],
[ "SearchFreqSuggestions", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a7c5ab271d8042540f64ef16d259d1503", null ],
[ "SearchPresence", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a4a624fcdf3c3beb2025d69f2cfda8023", null ],
[ "SearchSuggestions", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a18b70172ca4fb2811dbfb9a86e48b34c", null ],
[ "SelectionTop_3", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#aacafb8c9f3ebac7ac6c01d9645bb67b6", null ],
[ "SuggestAutocomplete", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a097913c4badec2b60d50a171ecc299fe", null ],
- [ "SuggestFreqAutocomplete", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a9e556f52c837190ecf4265b1f05cfe9c", null ],
- [ "endOfWord", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#afa9dab736046a4140e94bb9104074cd6", null ],
- [ "english", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#aa4aac1c6bed58a84472906b63f20da83", null ],
- [ "ENGLISH_ALPHABET_SIZE", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a0f310c3d4d7b82e5ee1036771cade702", null ],
- [ "frequency", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a7bab9bb47215cd674471c94b0b448014", null ]
+ [ "SuggestFreqAutocomplete", "d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode.html#a9e556f52c837190ecf4265b1f05cfe9c", null ]
];
\ No newline at end of file
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.map b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.map
index 38c6367a9..15cc72620 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.map
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.map
@@ -1,4 +1,4 @@
-
-
+
+
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.md5 b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.md5
index aaf542a80..92291df3e 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.md5
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.md5
@@ -1 +1 @@
-4dc362092b725827593070a06bc92802
\ No newline at end of file
+270bc1db15b7a22c08b636bad4651395
\ No newline at end of file
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.svg b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.svg
index ccd125b69..f96e25316 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.svg
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a097913c4badec2b60d50a171ecc299fe_cgraph.svg
@@ -1,14 +1,14 @@
-
-
-
+
+
operations_on_datastructures::trie_operations::Tnode::SuggestAutocomplete
-
+
Node1
@@ -20,6 +20,12 @@
+
+
+Node1->Node1
+
+
+
Node2
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.map b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.map
index f9b59105a..638036d79 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.map
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.map
@@ -1,5 +1,5 @@
-
+
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.md5 b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.md5
index 5c54470d6..efbc8ebb4 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.md5
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.md5
@@ -1 +1 @@
-1b56d965ec89882e03d1dfdfc45b1f5b
\ No newline at end of file
+c2b800c820352a7d9889647592d0345d
\ No newline at end of file
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.svg b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.svg
index d8a69ae0f..3a9f072a5 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.svg
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a18b70172ca4fb2811dbfb9a86e48b34c_cgraph.svg
@@ -1,22 +1,22 @@
-
-
-
+
+
operations_on_datastructures::trie_operations::Tnode::SearchSuggestions
-
+
Node1
-
-operations_on_datastructures
-::trie_operations::Tnode
-::SearchSuggestions
+
+operations_on_datastructures
+::trie_operations::Tnode
+::SearchSuggestions
@@ -24,16 +24,16 @@
Node2
-
-std::endl
+
+std::endl
Node1->Node2
-
-
+
+
@@ -49,14 +49,20 @@
Node1->Node3
-
-
+
+
Node3->Node2
-
-
+
+
+
+
+
+Node3->Node3
+
+
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.map b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.map
index eb8f24966..e4c60d1eb 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.map
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.map
@@ -2,6 +2,6 @@
-
-
+
+
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.md5 b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.md5
index f365f1784..3299f50ab 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.md5
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.md5
@@ -1 +1 @@
-9560fdc5328217f634d0b9e15b5d4a83
\ No newline at end of file
+84ab290794e554d0cab82e3e564daaa0
\ No newline at end of file
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.svg b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.svg
index 05cc2d2b4..b3f88623d 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.svg
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a7c5ab271d8042540f64ef16d259d1503_cgraph.svg
@@ -1,22 +1,22 @@
-
-
-
+
+
operations_on_datastructures::trie_operations::Tnode::SearchFreqSuggestions
-
+
Node1
-
-operations_on_datastructures
-::trie_operations::Tnode
-::SearchFreqSuggestions
+
+operations_on_datastructures
+::trie_operations::Tnode
+::SearchFreqSuggestions
@@ -24,33 +24,33 @@
Node2
-
-std::endl
+
+std::endl
Node1->Node2
-
-
+
+
Node3
-
-operations_on_datastructures
-::trie_operations::Tnode
-::SelectionTop_3
+
+operations_on_datastructures
+::trie_operations::Tnode
+::SelectionTop_3
Node1->Node3
-
-
+
+
@@ -66,14 +66,20 @@
Node1->Node4
-
-
+
+
Node3->Node2
-
-
+
+
+
+
+
+Node4->Node4
+
+
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.map b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.map
index 411ad3ccb..b32c7d603 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.map
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.map
@@ -1,4 +1,4 @@
-
-
+
+
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.md5 b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.md5
index 01323c329..8fe9250f7 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.md5
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.md5
@@ -1 +1 @@
-7d072479b315bff761932d5892d062f3
\ No newline at end of file
+896cfcadabf7afb2d9202c9550110287
\ No newline at end of file
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.svg b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.svg
index 105a17e81..49e0b6724 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.svg
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_a9e556f52c837190ecf4265b1f05cfe9c_cgraph.svg
@@ -1,14 +1,14 @@
-
-
-
+
+
operations_on_datastructures::trie_operations::Tnode::SuggestFreqAutocomplete
-
+
Node1
@@ -20,6 +20,12 @@
+
+
+Node1->Node1
+
+
+
Node2
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aacafb8c9f3ebac7ac6c01d9645bb67b6_cgraph.svg b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aacafb8c9f3ebac7ac6c01d9645bb67b6_cgraph.svg
index 0b5b3ab6f..dc9602046 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aacafb8c9f3ebac7ac6c01d9645bb67b6_cgraph.svg
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aacafb8c9f3ebac7ac6c01d9645bb67b6_cgraph.svg
@@ -1,7 +1,7 @@
-
-
-
+
+
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_adef6940391f981ab86767775176b7169_cgraph.md5 b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_adef6940391f981ab86767775176b7169_cgraph.md5
index aa0fabcab..3f2f8b710 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_adef6940391f981ab86767775176b7169_cgraph.md5
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_adef6940391f981ab86767775176b7169_cgraph.md5
@@ -1 +1 @@
-de89ac9917d9bdc55b999049ad92c6e6
\ No newline at end of file
+ab250400f33229485d9c85b5013a1515
\ No newline at end of file
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_adef6940391f981ab86767775176b7169_cgraph.svg b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_adef6940391f981ab86767775176b7169_cgraph.svg
index e97af6502..0f63e00a4 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_adef6940391f981ab86767775176b7169_cgraph.svg
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_adef6940391f981ab86767775176b7169_cgraph.svg
@@ -1,14 +1,14 @@
-
-
-
+
+
operations_on_datastructures::trie_operations::Tnode::DeleteFrom
-
+
Node1
@@ -20,6 +20,12 @@
+
+
+Node1->Node1
+
+
+
Node2
@@ -30,7 +36,7 @@
-
+
Node1->Node2
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.map b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.map
index b090ed02f..3f7ff412a 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.map
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.map
@@ -1,8 +1,8 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.md5 b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.md5
index 8dcc295fc..423dd7cb4 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.md5
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.md5
@@ -1 +1 @@
-be1f9f8c5aeb532103bd014af22fc6fd
\ No newline at end of file
+826521cf28b67c6d7ee998ab138e9f2a
\ No newline at end of file
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.svg b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.svg
index 590bad4c8..30a2040ce 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.svg
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_aefd24626ac47277431c9b8604e064340_cgraph.svg
@@ -1,14 +1,14 @@
-
-
-
+
+
operations_on_datastructures::trie_operations::Tnode::Delete
-
+
Node1
@@ -47,7 +47,7 @@
-
+
Node1->Node3
@@ -62,7 +62,7 @@
-
+
Node1->Node4
@@ -79,13 +79,19 @@
-
+
Node1->Node5
-
+
+Node2->Node2
+
+
+
+
+
Node2->Node3
@@ -100,7 +106,7 @@
-
+
Node5->Node6
diff --git a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_afca808362c13273ca8c8ae7d58e8eee0_cgraph.svg b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_afca808362c13273ca8c8ae7d58e8eee0_cgraph.svg
index bc7ad9b0a..d9d8909d7 100644
--- a/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_afca808362c13273ca8c8ae7d58e8eee0_cgraph.svg
+++ b/d0/d5f/classoperations__on__datastructures_1_1trie__operations_1_1_tnode_afca808362c13273ca8c8ae7d58e8eee0_cgraph.svg
@@ -1,7 +1,7 @@
-
-
-
-
+
+
Algorithms_in_C++: Member List
@@ -17,9 +17,9 @@
@@ -32,8 +32,7 @@
- Algorithms_in_C++
-
1.0.0
+
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
@@ -42,21 +41,22 @@
-
+
+/* @license-end */
+
@@ -70,7 +70,7 @@ $(function() {
@@ -90,29 +90,28 @@ $(document).ready(function(){initNavTree('dc/db5/struct_queue.html','../../'); i
This is the complete list of members for Queue , including all inherited members.
diff --git a/d0/d65/namespacedouble__hashing.html b/d0/d65/namespacedouble__hashing.html
index 4cd224d91..3af553283 100644
--- a/d0/d65/namespacedouble__hashing.html
+++ b/d0/d65/namespacedouble__hashing.html
@@ -2,8 +2,8 @@
-
-
+
+
Algorithms_in_C++: double_hashing Namespace Reference
@@ -17,9 +17,9 @@
@@ -32,8 +32,7 @@
- Algorithms_in_C++
-
1.0.0
+
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
@@ -42,21 +41,22 @@
-
+
+/* @license-end */
+
@@ -70,7 +70,7 @@ $(function() {
@@ -95,26 +95,25 @@ $(document).ready(function(){initNavTree('d0/d65/namespacedouble__hashing.html',
Typedefs |
Functions |
Variables
-
+
-
An implementation of hash table using double hashing algorithm.
+
An implementation of hash table using double hashing algorithm.
More...
-
An implementation of hash table using double hashing algorithm.
+
An implementation of hash table using double hashing algorithm.
-
+
◆ add()
@@ -181,22 +180,22 @@ bool
rehashing
-
Checks for load factor here
Parameters
+Checks for load factor here
Parameters
key key value to add to the table
-
-
-
-
-
189 table[index].key = key;
-
-
191 if (++size /
static_cast< double > (totalSize) >= 0.5) {
-
-
-
+
+
+
+
+
189 table[index].key = key;
+
+
191 if (++size /
static_cast< double > (totalSize) >= 0.5) {
+
+
+
int doubleHash(int key, bool searching)
Performs double hashing to resolve collisions.
Definition: double_hash_hash_table.cpp:71
void rehash()
Definition: double_hash_hash_table.cpp:161
-
+
◆ addInfo()
@@ -223,23 +222,23 @@ Here is the call graph for this function:
-
Information about the adding process
Parameters
+Information about the adding process
Parameters
key key value to add to table
-
-
-
-
-
-
217 << totalSize <<
" == " <<
hashFxn (key) % totalSize;
-
-
-
-
-
+
+
+
+
+
+
217 << totalSize <<
" == " <<
hashFxn (key) % totalSize;
+
+
+
+
+
size_t hashFxn(int key)
Hash a key. Uses the STL library's std::hash() function.
Definition: double_hash_hash_table.cpp:47
@@ -254,7 +253,7 @@ Here is the call graph for this function:
-
+
◆ display()
@@ -268,21 +267,21 @@ Here is the call graph for this function:
-
Displays the table
Returns None
-
-
144 for (
int i = 0; i < totalSize; i++) {
-
145 if (table[i].key == notPresent) {
-
-
147 }
else if (table[i].key == tomb) {
-
-
-
-
-
-
-
-
-
+
Displays the table
Returns None
+
+
144 for (
int i = 0; i < totalSize; i++) {
+
145 if (table[i].key == notPresent) {
+
+
147 }
else if (table[i].key == tomb) {
+
+
+
+
+
+
+
+
+
@@ -292,7 +291,7 @@ Here is the call graph for this function:
-
+
◆ doubleHash()
@@ -329,48 +328,48 @@ Here is the call graph for this function:
Returns Index of key when found
new hash if no conflicts present
-
-
72 int hash =
static_cast< int > (
hashFxn (key));
-
-
-
-
-
77 static_cast< int > (hash + (i *
otherHashFxn (key))) % totalSize;
-
-
-
80 if (entry.
key == notPresent) {
-
-
-
-
-
-
-
87 std::cout <<
"Found tombstone or equal hash, checking next"
-
-
-
-
-
-
-
-
-
-
-
98 std::cout <<
"Spot taken, looking at next (next index:"
-
-
-
-
-
-
-
-
106 if (i == totalSize * 100) {
-
-
-
-
110 }
while (entry.
key != notPresent);
-
-
+
+
72 int hash =
static_cast< int > (
hashFxn (key));
+
+
+
+
+
77 static_cast< int > (hash + (i *
otherHashFxn (key))) % totalSize;
+
+
+
80 if (entry.
key == notPresent) {
+
+
+
+
+
+
+
87 std::cout <<
"Found tombstone or equal hash, checking next"
+
+
+
+
+
+
+
+
+
+
+
98 std::cout <<
"Spot taken, looking at next (next index:"
+
+
+
+
+
+
+
+
106 if (i == totalSize * 100) {
+
+
+
+
110 }
while (entry.
key != notPresent);
+
+
bool searchingProber(const Entry &entry, int key)
Definition: double_hash_hash_table.cpp:133
size_t otherHashFxn(int key)
Used for second hash function.
Definition: double_hash_hash_table.cpp:58
bool putProber(const Entry &entry, int key)
Definition: double_hash_hash_table.cpp:120
@@ -385,7 +384,7 @@ Here is the call graph for this function:
-
+
◆ hashFxn()
@@ -409,15 +408,15 @@ Here is the call graph for this function:
Returns hash value of the key
-
-
+
◆ otherHashFxn()
@@ -441,14 +440,14 @@ Here is the call graph for this function:
Returns hash value of the key
-
-
-
60 return 1 + (7 - (hash(key) % 7));
-
+
+
+
60 return 1 + (7 - (hash(key) % 7));
+
-
+
◆ putProber()
@@ -473,7 +472,7 @@ Here is the call graph for this function:
-
Finds empty spot in a vector
Parameters
+Finds empty spot in a vector
Parameters
entry vector to search in
key key to search for
@@ -483,16 +482,16 @@ Here is the call graph for this function:
Returns true if key is not present or is a toumb
false is already occupied
-
-
121 if (entry.
key == notPresent || entry.
key == tomb) {
-
-
-
-
+
+
121 if (entry.
key == notPresent || entry.
key == tomb) {
+
+
+
+
-
+
◆ rehash()
@@ -506,27 +505,27 @@ Here is the call graph for this function:
-
Rehashes the table into a bigger table
Returns None
-
-
-
-
164 int oldSize = totalSize;
-
-
-
-
-
169 for (
int i = 0; i < oldSize; i++) {
-
170 if (oldTable[i].key != -1 && oldTable[i].key != notPresent) {
-
-
172 add (oldTable[i].key);
-
-
-
-
-
-
-
-
+
Rehashes the table into a bigger table
Returns None
+
+
+
+
164 int oldSize = totalSize;
+
+
+
+
+
169 for (
int i = 0; i < oldSize; i++) {
+
170 if (oldTable[i].key != -1 && oldTable[i].key != notPresent) {
+
+
172 add (oldTable[i].key);
+
+
+
+
+
+
+
+
@@ -537,7 +536,7 @@ Here is the call graph for this function:
-
+
◆ removalInfo()
@@ -552,23 +551,23 @@ Here is the call graph for this function:
-
Information about removal process
Parameters
+Information about removal process
Parameters
key key value to remove from table
-
-
-
-
-
-
232 << totalSize <<
" == " <<
hashFxn (key) % totalSize;
-
-
-
-
-
+
+
+
+
+
+
232 << totalSize <<
" == " <<
hashFxn (key) % totalSize;
+
+
+
+
+
void remove(int key)
Definition: double_hash_hash_table.cpp:199
@@ -579,7 +578,7 @@ Here is the call graph for this function:
-
+
◆ remove()
@@ -594,21 +593,21 @@ Here is the call graph for this function:
-
Removes key. Leaves tombstone upon removal.
Parameters
+Removes key. Leaves tombstone upon removal.
Parameters
-
-
-
201 if (index == notPresent) {
-
-
-
204 table[index].key = tomb;
-
-
-
+
+
+
201 if (index == notPresent) {
+
+
+
204 table[index].key = tomb;
+
+
+
@@ -618,7 +617,7 @@ Here is the call graph for this function:
-
+
◆ searchingProber()
@@ -643,7 +642,7 @@ Here is the call graph for this function:
-
Looks for a matching key
Parameters
+Looks for a matching key
Parameters
entry vector to search in
key key value to search
@@ -653,12 +652,12 @@ Here is the call graph for this function:
Returns true if found
false if not found
-
-
134 if (entry.
key == key) {
-
-
-
-
+
+
134 if (entry.
key == key) {
+
+
+
+
@@ -668,7 +667,7 @@ Here is the call graph for this function:
diff --git a/d0/d65/namespacedouble__hashing.js b/d0/d65/namespacedouble__hashing.js
index 6bca93436..0500a1fc0 100644
--- a/d0/d65/namespacedouble__hashing.js
+++ b/d0/d65/namespacedouble__hashing.js
@@ -1,7 +1,6 @@
var namespacedouble__hashing =
[
[ "Entry", "d9/dde/structdouble__hashing_1_1_entry.html", "d9/dde/structdouble__hashing_1_1_entry" ],
- [ "Entry", "d0/d65/namespacedouble__hashing.html#a4b68c58d0e039662991f8e220129efd9", null ],
[ "add", "d0/d65/namespacedouble__hashing.html#a79a9c914a6c68275b3640303d7faad8a", null ],
[ "addInfo", "d0/d65/namespacedouble__hashing.html#a9c652b2e467e5d250dfe3bed83b12560", null ],
[ "display", "d0/d65/namespacedouble__hashing.html#a1e901418c759627557eff359b8db38cd", null ],
@@ -12,11 +11,5 @@ var namespacedouble__hashing =
[ "rehash", "d0/d65/namespacedouble__hashing.html#af4981819aae8bc7e7beeaef02615e30d", null ],
[ "removalInfo", "d0/d65/namespacedouble__hashing.html#a5d06e4598569526294f10104875f6824", null ],
[ "remove", "d0/d65/namespacedouble__hashing.html#a28083ecac6eb94b643281875c8665931", null ],
- [ "searchingProber", "d0/d65/namespacedouble__hashing.html#a29f543e2626bad58907661e1e45028a6", null ],
- [ "notPresent", "d0/d65/namespacedouble__hashing.html#a77d33a0c49294b9ec22ad86eeff79585", null ],
- [ "rehashing", "d0/d65/namespacedouble__hashing.html#ae5d042a7f6038a2ec9e5718d0c7fb31f", null ],
- [ "size", "d0/d65/namespacedouble__hashing.html#a5f5323b52037218cf5ae888778b7f980", null ],
- [ "table", "d0/d65/namespacedouble__hashing.html#a0e2ff0f9cfc7b54e60a6561f792d8b26", null ],
- [ "tomb", "d0/d65/namespacedouble__hashing.html#a4e9a7219d34e781e4e73d74a968b26c1", null ],
- [ "totalSize", "d0/d65/namespacedouble__hashing.html#a60a52265027518b25655d730f960013a", null ]
+ [ "searchingProber", "d0/d65/namespacedouble__hashing.html#a29f543e2626bad58907661e1e45028a6", null ]
];
\ No newline at end of file
diff --git a/d0/d65/namespacedouble__hashing_a1e901418c759627557eff359b8db38cd_cgraph.svg b/d0/d65/namespacedouble__hashing_a1e901418c759627557eff359b8db38cd_cgraph.svg
index 19f16fbdc..82a585923 100644
--- a/d0/d65/namespacedouble__hashing_a1e901418c759627557eff359b8db38cd_cgraph.svg
+++ b/d0/d65/namespacedouble__hashing_a1e901418c759627557eff359b8db38cd_cgraph.svg
@@ -1,7 +1,7 @@
-
-
diff --git a/d0/d65/namespacedouble__hashing_a28083ecac6eb94b643281875c8665931_cgraph_org.svg b/d0/d65/namespacedouble__hashing_a28083ecac6eb94b643281875c8665931_cgraph_org.svg
index cc46761c5..ac5ba79f5 100644
--- a/d0/d65/namespacedouble__hashing_a28083ecac6eb94b643281875c8665931_cgraph_org.svg
+++ b/d0/d65/namespacedouble__hashing_a28083ecac6eb94b643281875c8665931_cgraph_org.svg
@@ -1,7 +1,7 @@
-
-
diff --git a/d0/d65/namespacedouble__hashing_a5d06e4598569526294f10104875f6824_cgraph_org.svg b/d0/d65/namespacedouble__hashing_a5d06e4598569526294f10104875f6824_cgraph_org.svg
index 208d8d382..38a35fb1f 100644
--- a/d0/d65/namespacedouble__hashing_a5d06e4598569526294f10104875f6824_cgraph_org.svg
+++ b/d0/d65/namespacedouble__hashing_a5d06e4598569526294f10104875f6824_cgraph_org.svg
@@ -1,7 +1,7 @@
-
-
-
-
diff --git a/d0/d65/namespacedouble__hashing_a9c652b2e467e5d250dfe3bed83b12560_cgraph_org.svg b/d0/d65/namespacedouble__hashing_a9c652b2e467e5d250dfe3bed83b12560_cgraph_org.svg
index 6408355ab..36f423863 100644
--- a/d0/d65/namespacedouble__hashing_a9c652b2e467e5d250dfe3bed83b12560_cgraph_org.svg
+++ b/d0/d65/namespacedouble__hashing_a9c652b2e467e5d250dfe3bed83b12560_cgraph_org.svg
@@ -1,7 +1,7 @@
-
-
diff --git a/d0/d65/namespacedouble__hashing_af4981819aae8bc7e7beeaef02615e30d_cgraph_org.svg b/d0/d65/namespacedouble__hashing_af4981819aae8bc7e7beeaef02615e30d_cgraph_org.svg
index 311ada952..bef64c2f5 100644
--- a/d0/d65/namespacedouble__hashing_af4981819aae8bc7e7beeaef02615e30d_cgraph_org.svg
+++ b/d0/d65/namespacedouble__hashing_af4981819aae8bc7e7beeaef02615e30d_cgraph_org.svg
@@ -1,7 +1,7 @@
-
-
-
+
+
Algorithms_in_C++: math/modular_exponentiation.cpp File Reference
@@ -17,9 +17,9 @@
@@ -32,8 +32,7 @@
- Algorithms_in_C++
-
1.0.0
+
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
@@ -42,21 +41,22 @@
-
+
+/* @license-end */
+
@@ -70,7 +70,7 @@ $(function() {
@@ -93,8 +93,7 @@ $(document).ready(function(){initNavTree('d0/d6d/modular__exponentiation_8cpp.ht
-
+
@@ -109,13 +108,13 @@ Include dependency graph for modular_exponentiation.cpp:
-C++ Program for Modular Exponentiation Iteratively.
-
The task is to calculate the value of an integer a raised to an integer exponent b under modulo c.
Note The time complexity of this approach is O(log b).
+
C++ Program for Modular Exponentiation Iteratively.
+
The task is to calculate the value of an integer a raised to an integer exponent b under modulo c.
Note The time complexity of this approach is O(log b).
Example: (4^3) % 5 (where ^ stands for exponentiation and % for modulo) (4*4*4) % 5 (4 % 5) * ( (4*4) % 5 ) 4 * (16 % 5) 4 * 1 4 We can also verify the result as 4^3 is 64 and 64 modulo 5 is 4
-
Author Shri2206
+
Author Shri2206
-
+
◆ main()
@@ -150,10 +149,10 @@ Functions
Main function.
Returns 0 on exit
-
-
-
-
+
+
+
+
static void test()
Definition: modular_exponentiation.cpp:60
@@ -164,7 +163,7 @@ Here is the call graph for this function:
-
+
◆ test()
@@ -186,28 +185,28 @@ Here is the call graph for this function:
-
Function for testing power function. test cases and assert statement.
Returns void
-
-
-
62 assert(test_case_1 == 6);
-
-
-
-
66 assert(test_case_2 == 14);
-
-
-
-
70 assert(test_case_3 == 32);
-
-
-
-
74 assert(test_case_4 == 4);
-
-
-
-
78 assert(test_case_5 == 1);
-
-
+
Function for testing power function. test cases and assert statement.
Returns void
+
+
+
62 assert(test_case_1 == 6);
+
+
+
+
66 assert(test_case_2 == 14);
+
+
+
+
70 assert(test_case_3 == 32);
+
+
+
+
74 assert(test_case_4 == 4);
+
+
+
+
78 assert(test_case_5 == 1);
+
+
uint64_t power(uint64_t a, uint64_t b, uint64_t c)
This function calculates a raised to exponent b under modulo c using modular exponentiation.
Definition: modular_exponentiation.cpp:35
@@ -226,7 +225,7 @@ Here is the call graph for this function:
diff --git a/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg
index 69306dd2b..5e94a41e9 100644
--- a/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg
+++ b/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg
@@ -1,7 +1,7 @@
-
-
-
-
+
+
Algorithms_in_C++: others Namespace Reference
@@ -17,9 +17,9 @@
@@ -32,8 +32,7 @@
- Algorithms_in_C++
-
1.0.0
+
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
@@ -42,21 +41,22 @@
-
+
+/* @license-end */
+
@@ -70,7 +70,7 @@ $(function() {
@@ -90,28 +90,27 @@ $(document).ready(function(){initNavTree('d0/d6f/namespaceothers.html','../../')
for vector
More...
-
for vector
-
Other algorithms.
-
for std::unordered_map
-
for reverse for assert for I/O operations for stack
-
Other algorithms
-
for assert for IO Operations for std::list
-
Other algorithms
+
for vector
+
Other algorithms.
+
for std::unordered_map
+
for reverse for assert for I/O operations for stack
+
Other algorithms
+
for assert for IO Operations for std::list
+
Other algorithms
diff --git a/d0/d6f/namespaceothers.js b/d0/d6f/namespaceothers.js
index 5daddf217..042dab671 100644
--- a/d0/d6f/namespaceothers.js
+++ b/d0/d6f/namespaceothers.js
@@ -1,8 +1,8 @@
var namespaceothers =
[
[ "iterative_tree_traversals", null, [
- [ "Node", "d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node.html", "d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node" ],
- [ "BinaryTree", "d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html", "d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree" ]
+ [ "BinaryTree", "d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html", "d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree" ],
+ [ "Node", "d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node.html", "d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node" ]
] ],
[ "lru_cache", null, [
[ "LRUCache", "d6/dae/classothers_1_1lru__cache_1_1_l_r_u_cache.html", "d6/dae/classothers_1_1lru__cache_1_1_l_r_u_cache" ]
diff --git a/d0/d77/linear__search_8cpp__incl.svg b/d0/d77/linear__search_8cpp__incl.svg
index 03cc5f507..a3dd2102a 100644
--- a/d0/d77/linear__search_8cpp__incl.svg
+++ b/d0/d77/linear__search_8cpp__incl.svg
@@ -1,7 +1,7 @@
-
-
-
+
+
Algorithms_in_C++: dynamic_programming/longest_palindromic_subsequence.cpp File Reference
@@ -17,9 +17,9 @@
@@ -32,8 +32,7 @@
- Algorithms_in_C++
-
1.0.0
+
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
@@ -42,21 +41,22 @@
-
+
+/* @license-end */
+
@@ -70,7 +70,7 @@ $(function() {
@@ -92,8 +92,7 @@ $(document).ready(function(){initNavTree('d0/d77/longest__palindromic__subsequen
@@ -110,7 +109,7 @@ Include dependency graph for longest_palindromic_subsequence.cpp:
-Program to find the Longest Palindormic Subsequence of a string.
-
Palindrome string sequence of characters which reads the same backward as forward Subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
-
Author Anjali Jha
+
Program to find the Longest Palindormic Subsequence of a string.
+
Palindrome string sequence of characters which reads the same backward as forward Subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
+
Author Anjali Jha
-
+
◆ lps()
@@ -139,55 +138,55 @@ Functions
-
Function that returns the longest palindromic subsequence of a string
-
-
-
-
-
-
-
-
-
-
34 for (
int i = 0; i <= m; i++) {
-
35 for (
int j = 0; j <= m; j++) {
-
36 if (i == 0 || j == 0) {
-
-
38 }
else if (a[i - 1] == b[j - 1]) {
-
39 res[i][j] = res[i - 1][j - 1] + 1;
-
-
41 res[i][j] =
std::max (res[i - 1][j], res[i][j - 1]);
-
-
-
-
-
-
-
-
-
-
-
-
53 while (i > 0 && j > 0) {
-
-
-
56 if (a[i - 1] == b[j - 1]) {
-
57 ans [idx - 1] = a[i - 1];
-
-
-
-
-
-
-
64 else if (res[i - 1][j] > res[i][j - 1]) {
-
-
-
-
-
-
-
-
+
Function that returns the longest palindromic subsequence of a string
+
+
+
+
+
+
+
+
+
+
34 for (
int i = 0; i <= m; i++) {
+
35 for (
int j = 0; j <= m; j++) {
+
36 if (i == 0 || j == 0) {
+
+
38 }
else if (a[i - 1] == b[j - 1]) {
+
39 res[i][j] = res[i - 1][j - 1] + 1;
+
+
41 res[i][j] =
std::max (res[i - 1][j], res[i][j - 1]);
+
+
+
+
+
+
+
+
+
+
+
+
53 while (i > 0 && j > 0) {
+
+
+
56 if (a[i - 1] == b[j - 1]) {
+
57 ans [idx - 1] = a[i - 1];
+
+
+
+
+
+
+
64 else if (res[i - 1][j] > res[i][j - 1]) {
+
+
+
+
+
+
+
+
@@ -204,7 +203,7 @@ Here is the call graph for this function:
-
+
◆ main()
@@ -219,11 +218,11 @@ Here is the call graph for this function:
-
Main Function
-
-
-
-
+
Main Function
+
+
+
+
void test()
Definition: longest_palindromic_subsequence.cpp:75
@@ -234,7 +233,7 @@ Here is the call graph for this function:
-
+
◆ test()
@@ -248,15 +247,15 @@ Here is the call graph for this function:
-
Test function
-
-
-
77 assert(
lps (
"radar" ) ==
"radar" );
-
-
79 assert(
lps (
"abbcbaa" ) ==
"abcba" );
-
-
81 assert(
lps (
"bbbab" ) ==
"bbbb" );
-
+
Test function
+
+
+
77 assert(
lps (
"radar" ) ==
"radar" );
+
+
79 assert(
lps (
"abbcbaa" ) ==
"abcba" );
+
+
81 assert(
lps (
"bbbab" ) ==
"bbbb" );
+
std::string lps(std::string a)
Definition: longest_palindromic_subsequence.cpp:25
@@ -273,7 +272,7 @@ Here is the call graph for this function:
diff --git a/d0/d77/longest__palindromic__subsequence_8cpp_a6f73ddd8cd83d784036f131dfc6540c4_cgraph.svg b/d0/d77/longest__palindromic__subsequence_8cpp_a6f73ddd8cd83d784036f131dfc6540c4_cgraph.svg
index 7252dd5b1..b2366e522 100644
--- a/d0/d77/longest__palindromic__subsequence_8cpp_a6f73ddd8cd83d784036f131dfc6540c4_cgraph.svg
+++ b/d0/d77/longest__palindromic__subsequence_8cpp_a6f73ddd8cd83d784036f131dfc6540c4_cgraph.svg
@@ -1,7 +1,7 @@
-
-
-
-
-
+
+
Algorithms_in_C++: Member List
@@ -17,9 +17,9 @@
@@ -32,8 +32,7 @@
- Algorithms_in_C++
-
1.0.0
+
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
@@ -42,21 +41,22 @@
-
+
+/* @license-end */
+
@@ -70,7 +70,7 @@ $(function() {
@@ -90,28 +90,27 @@ $(document).ready(function(){initNavTree('d7/d7c/classstatistics_1_1stats__compu
This is the complete list of members for statistics::stats_computer1< T > , including all inherited members.
diff --git a/d0/d83/n__queens_8cpp__incl.svg b/d0/d83/n__queens_8cpp__incl.svg
index 976a87299..28c3a73ce 100644
--- a/d0/d83/n__queens_8cpp__incl.svg
+++ b/d0/d83/n__queens_8cpp__incl.svg
@@ -1,7 +1,7 @@
-
-
-
-
+
+
Algorithms_in_C++: math/number_of_positive_divisors.cpp File Reference
@@ -17,9 +17,9 @@
@@ -32,8 +32,7 @@
- Algorithms_in_C++
-
1.0.0
+
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
@@ -42,21 +41,22 @@
-
+
+/* @license-end */
+
@@ -70,7 +70,7 @@ $(function() {
@@ -92,8 +92,7 @@ $(document).ready(function(){initNavTree('d0/da2/number__of__positive__divisors_
@@ -108,7 +107,7 @@ Include dependency graph for number_of_positive_divisors.cpp:
-C++ Program to calculate the number of positive divisors.
-
This algorithm uses the prime factorization approach. Any positive integer can be written as a product of its prime factors.
+
C++ Program to calculate the number of positive divisors.
+
This algorithm uses the prime factorization approach. Any positive integer can be written as a product of its prime factors.
Let \(N = p_1^{e_1} \times p_2^{e_2} \times\cdots\times p_k^{e_k}\) where \(p_1,\, p_2,\, \dots,\, p_k\) are distinct prime factors of \(N\) and \(e_1,\, e_2,\, \dots,\, e_k\) are respective positive integer exponents.
Each positive divisor of \(N\) is in the form \(p_1^{g_1}\times p_2^{g_2}\times\cdots\times p_k^{g_k}\) where \(0\le g_i\le e_i\) are integers for all \(1\le i\le k\).
Finally, there are \((e_1+1) \times (e_2+1)\times\cdots\times (e_k+1)\) positive divisors of \(N\) since we can choose every \(g_i\) independently.
-
Example:
+
Example:
\(N = 36 = (3^2 \cdot 2^2)\)
\(\mbox{number_of_positive_divisors}(36) = (2+1) \cdot (2+1) = 9\).
list of positive divisors of 36 = 1, 2, 3, 4, 6, 9, 12, 18, 36.
-
Similarly, for N = -36 the number of positive divisors remain same.
+
Similarly, for N = -36 the number of positive divisors remain same.
-
+
◆ main()
@@ -144,19 +143,19 @@ list of positive divisors of 36 = 1, 2, 3, 4, 6, 9, 12, 18, 36.
-
Main function
-
-
-
-
-
-
-
-
88 std::cout <<
"Number of positive divisors is : " ;
-
-
-
-
+
Main function
+
+
+
+
+
+
+
+
88 std::cout <<
"Number of positive divisors is : " ;
+
+
+
+
@@ -171,7 +170,7 @@ Here is the call graph for this function:
-
+
◆ number_of_positive_divisors()
@@ -186,50 +185,50 @@ Here is the call graph for this function:
-
Function to compute the number of positive divisors.
Parameters
+Function to compute the number of positive divisors.
Parameters
n number to compute divisors for
Returns number of positive divisors of n (or 1 if n = 0)
-
-
-
-
-
-
38 int number_of_divisors = 1;
-
-
40 for (
int i = 2; i * i <= n; i++) {
-
-
-
-
-
-
-
-
-
49 int prime_exponent = 0;
-
-
-
-
-
-
-
56 number_of_divisors *= prime_exponent + 1;
-
-
-
-
-
61 number_of_divisors *= 2;
-
-
-
64 return number_of_divisors;
-
+
+
+
+
+
+
38 int number_of_divisors = 1;
+
+
40 for (
int i = 2; i * i <= n; i++) {
+
+
+
+
+
+
+
+
+
49 int prime_exponent = 0;
+
+
+
+
+
+
+
56 number_of_divisors *= prime_exponent + 1;
+
+
+
+
+
61 number_of_divisors *= 2;
+
+
+
64 return number_of_divisors;
+
-
+
◆ tests()
@@ -243,14 +242,14 @@ Here is the call graph for this function: