Skip to content

Commit c6afe07

Browse files
Documentation for f789e3b
1 parent 1c8c0b7 commit c6afe07

File tree

406 files changed

+3307
-2186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

406 files changed

+3307
-2186
lines changed

annotated.html

Lines changed: 39 additions & 38 deletions
Large diffs are not rendered by default.

annotated_dup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ var annotated_dup =
181181
] ],
182182
[ "binary_search_tree", "d9/dde/classbinary__search__tree.html", "d9/dde/classbinary__search__tree" ],
183183
[ "Btree", "d9/d90/struct_btree.html", null ],
184+
[ "catalan_numbers", "dc/d1f/classcatalan__numbers.html", "dc/d1f/classcatalan__numbers" ],
184185
[ "cll", "d5/d15/classcll.html", null ],
185186
[ "Compare", "de/d4a/class_compare.html", "de/d4a/class_compare" ],
186187
[ "compare", "d1/db3/structcompare.html", null ],

classes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<dd><a class="el" href="d9/dde/classbinary__search__tree.html">binary_search_tree</a></dd><dd><a class="el" href="de/dcf/classoperations__on__datastructures_1_1reverse__binary__tree_1_1_binary_tree.html">BinaryTree</a> (operations_on_datastructures::reverse_binary_tree)</dd><dd><a class="el" href="d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html">BinaryTree</a> (others::iterative_tree_traversals)</dd><dd><a class="el" href="d9/dae/classdata__structures_1_1_bitset.html">Bitset</a> (<a class="el" href="d5/d3c/namespacedata__structures.html">data_structures</a>)</dd><dd><a class="el" href="dc/dd4/classdata__structures_1_1_bloom_filter.html">BloomFilter</a> (<a class="el" href="d5/d3c/namespacedata__structures.html">data_structures</a>)</dd><dd><a class="el" href="dd/db6/structbinary__search__tree_1_1bst__node.html">binary_search_tree::bst_node</a></dd><dd><a class="el" href="dd/de1/classothers_1_1recursive__tree__traversals_1_1_b_t.html">BT</a> (others::recursive_tree_traversals)</dd><dd><a class="el" href="d9/d90/struct_btree.html">Btree</a></dd></dl>
118118
<dl class="classindex even">
119119
<dt class="alphachar"><a id="letter_C" name="letter_C">C</a></dt>
120-
<dd><a class="el" href="d8/d7c/classoperations__on__datastructures_1_1circular__linked__list_1_1_circular_linked_list.html">CircularLinkedList</a> (operations_on_datastructures::circular_linked_list)</dd><dd><a class="el" href="d5/d15/classcll.html">cll</a></dd><dd><a class="el" href="de/d4a/class_compare.html">Compare</a></dd><dd><a class="el" href="d1/db3/structcompare.html">compare</a></dd><dd><a class="el" href="d3/d2a/structmachine__learning_1_1aystar__search_1_1_ay_star_search_1_1comparison__operator.html">AyStarSearch::comparison_operator</a> (machine_learning::aystar_search)</dd><dd><a class="el" href="da/d5a/class_complex.html">Complex</a></dd><dd><a class="el" href="d4/dde/classgeometry_1_1jarvis_1_1_convexhull.html">Convexhull</a> (geometry::jarvis)</dd><dd><a class="el" href="d3/dbb/class_cycle_check.html">CycleCheck</a></dd></dl>
120+
<dd><a class="el" href="dc/d1f/classcatalan__numbers.html">catalan_numbers</a></dd><dd><a class="el" href="d8/d7c/classoperations__on__datastructures_1_1circular__linked__list_1_1_circular_linked_list.html">CircularLinkedList</a> (operations_on_datastructures::circular_linked_list)</dd><dd><a class="el" href="d5/d15/classcll.html">cll</a></dd><dd><a class="el" href="de/d4a/class_compare.html">Compare</a></dd><dd><a class="el" href="d1/db3/structcompare.html">compare</a></dd><dd><a class="el" href="d3/d2a/structmachine__learning_1_1aystar__search_1_1_ay_star_search_1_1comparison__operator.html">AyStarSearch::comparison_operator</a> (machine_learning::aystar_search)</dd><dd><a class="el" href="da/d5a/class_complex.html">Complex</a></dd><dd><a class="el" href="d4/dde/classgeometry_1_1jarvis_1_1_convexhull.html">Convexhull</a> (geometry::jarvis)</dd><dd><a class="el" href="d3/dbb/class_cycle_check.html">CycleCheck</a></dd></dl>
121121
<dl class="classindex odd">
122122
<dt class="alphachar"><a id="letter_D" name="letter_D">D</a></dt>
123123
<dd><a class="el" href="dc/d93/classmachine__learning_1_1neural__network_1_1layers_1_1_dense_layer.html">DenseLayer</a> (machine_learning::neural_network::layers)</dd><dd><a class="el" href="d9/dee/classdouble__linked__list.html">double_linked_list</a></dd><dd><a class="el" href="dd/d1f/classdsu.html">dsu</a></dd></dl>

d1/d9a/hopcroft__karp_8cpp.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,22 @@
150150
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
151151
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm" target="_blank">Hopcroft–Karp</a> algorithm. </p>
152152
<p>The Hopcroft–Karp algorithm is an algorithm that takes as input a bipartite graph and produces as output a maximum cardinality matching, it runs in O(E√V) time in worst case.</p>
153-
<h3><a class="anchor" id="autotoc_md78"></a>
153+
<h3><a class="anchor" id="autotoc_md76"></a>
154154
Bipartite graph</h3>
155155
<p>A bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint and independent sets U and V such that every edge connects a vertex in U to one in V. Vertex sets U and V are usually called the parts of the graph. Equivalently, a bipartite graph is a graph that does not contain any odd-length cycles.</p>
156-
<h3><a class="anchor" id="autotoc_md79"></a>
156+
<h3><a class="anchor" id="autotoc_md77"></a>
157157
Matching and Not-Matching edges</h3>
158158
<p>Given a matching M, edges that are part of matching are called Matching edges and edges that are not part of M (or connect free nodes) are called Not-Matching edges.</p>
159-
<h3><a class="anchor" id="autotoc_md80"></a>
159+
<h3><a class="anchor" id="autotoc_md78"></a>
160160
Maximum cardinality matching</h3>
161161
<p>Given a bipartite graphs G = ( V = ( X , Y ) , E ) whose partition has the parts X and Y, with E denoting the edges of the graph, the goal is to find a matching with as many edges as possible. Equivalently, a matching that covers as many vertices as possible.</p>
162-
<h3><a class="anchor" id="autotoc_md81"></a>
162+
<h3><a class="anchor" id="autotoc_md79"></a>
163163
Augmenting paths</h3>
164164
<p>Given a matching M, an augmenting path is an alternating path that starts from and ends on free vertices. All single edge paths that start and end with free vertices are augmenting paths.</p>
165-
<h3><a class="anchor" id="autotoc_md82"></a>
165+
<h3><a class="anchor" id="autotoc_md80"></a>
166166
Concept</h3>
167167
<p>A matching M is not maximum if there exists an augmenting path. It is also true other way, i.e, a matching is maximum if no augmenting path exists.</p>
168-
<h3><a class="anchor" id="autotoc_md83"></a>
168+
<h3><a class="anchor" id="autotoc_md81"></a>
169169
Algorithm</h3>
170170
<p>1) Initialize the Maximal Matching M as empty. 2) While there exists an Augmenting Path P Remove matching edges of P from M and add not-matching edges of P to M (This increases size of M by 1 as P starts and ends with a free vertex i.e. a node that is not part of matching.) 3) Return M.</p>
171171
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/Krishnapal4050" target="_blank">Krishna Pal Deora</a> </dd></dl>

d1/ded/windowed__median_8cpp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
164164
<div class="textblock"><p>An implementation of a median calculation of a sliding window along a data stream. </p>
165165
<p>Given a stream of integers, the algorithm calculates the median of a fixed size window at the back of the stream. The leading time complexity of this algorithm is O(log(N), and it is inspired by the known algorithm to [find median from (infinite) data stream](<a href="https://www.tutorialcup.com/interview/algorithm/find-median-from-data-stream.htm">https://www.tutorialcup.com/interview/algorithm/find-median-from-data-stream.htm</a>), with the proper modifications to account for the finite window size for which the median is requested</p>
166-
<h3><a class="anchor" id="autotoc_md103"></a>
166+
<h3><a class="anchor" id="autotoc_md101"></a>
167167
Algorithm</h3>
168168
<p>The sliding window is managed by a list, which guarantees O(1) for both pushing and popping. Each new value is pushed to the window back, while a value from the front of the window is popped. In addition, the algorithm manages a multi-value binary search tree (BST), implemented by <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/multiset.html">std::multiset</a>. For each new value that is inserted into the window, it is also inserted to the BST. When a value is popped from the window, it is also erased from the BST. Both insertion and erasion to/from the BST are O(logN) in time, with N the size of the window. Finally, the algorithm keeps a pointer to the root of the BST, and updates its position whenever values are inserted or erased to/from BST. The root of the tree is the median! Hence, median retrieval is always O(1)</p>
169169
<p>Time complexity: O(logN). Space complexity: O(N). N - size of window </p><dl class="section author"><dt>Author</dt><dd><a href="https://github.com/YanivHollander" target="_blank">Yaniv Hollander</a> </dd></dl>

d2/d26/count__inversions_8cpp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
<p>two elements a[i] and a[j] form an inversion if <code>a[i]</code> &gt; <code>a[j]</code> and i &lt; j</p>
165165
<p>Time Complexity --&gt; <code>O(n.log n)</code></p>
166166
<p>Space Complexity --&gt; <code>O(n)</code> ; additional array <code>temp[1..n]</code> </p>
167-
<h3><a class="anchor" id="autotoc_md112"></a>
167+
<h3><a class="anchor" id="autotoc_md110"></a>
168168
Algorithm</h3>
169169
<ol type="1">
170170
<li>The idea is similar to merge sort, divide the array into two equal or almost equal halves in each step until the base case is reached.</li>

d3/db3/lru__cache_8cpp.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@
163163
</table>
164164
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
165165
<div class="textblock"><p>An implementation of <a href="https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)" target="_blank">LRU Cache</a>. Lru is a part of cache algorithms (also frequently called cache replacement algorithms or cache replacement policies). </p>
166-
<h3><a class="anchor" id="autotoc_md97"></a>
166+
<h3><a class="anchor" id="autotoc_md95"></a>
167167
Logic</h3>
168168
<ul>
169169
<li>Discards the least recently used items first.</li>
170170
<li>This algorithm requires keeping track of what was used when, which is expensive if one wants to make sure the algorithm always discards the least recently used item.</li>
171171
<li>General implementations of this technique require keeping "age bits" for cache-lines and track the "Least Recently Used" cache-line based on age-bits.</li>
172172
<li>In such an implementation, every time a cache-line is used, the age of all other cache-lines changes</li>
173173
</ul>
174-
<h3><a class="anchor" id="autotoc_md98"></a>
174+
<h3><a class="anchor" id="autotoc_md96"></a>
175175
Algorithm explanation</h3>
176176
<p>For a cache of page frame x:</p><ul>
177177
<li>Check if the page is present in cache.</li>
@@ -183,7 +183,7 @@ <h3><a class="anchor" id="autotoc_md98"></a>
183183
</li>
184184
</ul>
185185
<p>Every time a requested page is not found in cache, that is a miss or page fault, and if the page is present in cache, then its a hit.</p>
186-
<h2><a class="anchor" id="autotoc_md99"></a>
186+
<h2><a class="anchor" id="autotoc_md97"></a>
187187
Data Structure used</h2>
188188
<ul>
189189
<li>In the algorithm below we used two different data structure, one is linked list and other one is a hash map</li>

d3/df9/recursive__bubble__sort_8cpp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
<dl class="section author"><dt>Author</dt><dd><a href="https://adityaprakash.tech" target="_blank">Aditya Prakash</a> </dd></dl>
149149
<p>The working principle of the Bubble sort algorithm.</p>
150150
<p>Bubble sort is a simple sorting algorithm used to rearrange a set of ascending or descending order elements. Bubble sort gets its name from the fact that data "bubbles" to the top of the dataset.</p>
151-
<h3><a class="anchor" id="autotoc_md113"></a>
151+
<h3><a class="anchor" id="autotoc_md111"></a>
152152
Algorithm</h3>
153153
<p>What is Swap?</p>
154154
<p>Swapping two numbers means that we interchange their values. Often, an additional variable is required for this operation. This is further illustrated in the following:</p>

d4/d32/inorder__successor__of__bst_8cpp.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,21 @@
176176
</table>
177177
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
178178
<div class="textblock"><p>An implementation for finding the <a href="https://www.youtube.com/watch?v=5cPbNCrdotA" target="_blank">Inorder successor of a binary search tree</a> Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in Inorder traversal. </p>
179-
<h3><a class="anchor" id="autotoc_md90"></a>
179+
<h3><a class="anchor" id="autotoc_md88"></a>
180180
Case 1: The given node has the right node/subtree</h3>
181181
<pre class="fragment"> * In this case, the left-most deepest node in the right subtree will
182182
</pre><p> come just after the given node as we go to left deep in inorder.</p><ul>
183183
<li>Go deep to left most node in right subtree. OR, we can also say in case if BST, find the minimum of the subtree for a given node.</li>
184184
</ul>
185-
<h3><a class="anchor" id="autotoc_md91"></a>
185+
<h3><a class="anchor" id="autotoc_md89"></a>
186186
Case 2: The given node does not have a right node/subtree</h3>
187-
<h4><a class="anchor" id="autotoc_md92"></a>
187+
<h4><a class="anchor" id="autotoc_md90"></a>
188188
Method 1: Use parent pointer (store the address of parent nodes)</h4>
189189
<ul>
190190
<li>If a node does not have the right subtree, and we already visited the node itself, then the next node will be its parent node according to inorder traversal, and if we are going to parent from left, then the parent would be unvisited.</li>
191191
<li>In other words, go to the nearest ancestor for which given node would be in left subtree.</li>
192192
</ul>
193-
<h4><a class="anchor" id="autotoc_md93"></a>
193+
<h4><a class="anchor" id="autotoc_md91"></a>
194194
Method 2: Search from the root node</h4>
195195
<ul>
196196
<li>In case if there is no link from a child node to the parent node, we need to walk down the tree starting from the root node to the given node, by doing so, we are visiting every ancestor of the given node.</li>

d4/d38/power__of__two_8cpp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
146146
<div class="textblock"><p>Implementation to check whether a number is a power of 2 or not. </p>
147147
<p>This algorithm uses bit manipulation to check if a number is a power of 2 or not.</p>
148-
<h3><a class="anchor" id="autotoc_md87"></a>
148+
<h3><a class="anchor" id="autotoc_md85"></a>
149149
Algorithm</h3>
150150
<p>Let the input number be n, then the bitwise and between n and n-1 will let us know whether the number is power of 2 or not</p>
151151
<p>For Example, If N= 32 then N-1 is 31, if we perform bitwise and of these two numbers then the result will be zero, which indicates that it is the power of 2 If N=23 then N-1 is 22, if we perform bitwise and of these two numbers then the result will not be zero , which indicates that it is not the power of 2 </p><dl class="section note"><dt>Note</dt><dd>This implementation is better than naive recursive or iterative approach.</dd></dl>

d4/d8d/jarvis__algorithm_8cpp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
150150
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/Gift_wrapping_algorithm" target="_blank">Jarvis’s</a> algorithm. </p>
151151
<p>Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of it.</p>
152-
<h3><a class="anchor" id="autotoc_md76"></a>
152+
<h3><a class="anchor" id="autotoc_md74"></a>
153153
Algorithm</h3>
154154
<p>The idea of Jarvis’s Algorithm is simple, we start from the leftmost point (or point with minimum x coordinate value) and we keep wrapping points in counterclockwise direction.</p>
155155
<p>The idea is to use orientation() here. Next point is selected as the point that beats all other points at counterclockwise orientation, i.e., next point is q if for any other point r, we have “orientation(p, q, r) = counterclockwise”.</p>

d4/d9f/selection__sort__recursive_8cpp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
153153
<div class="textblock"><p>Implementation of the <a href="https://en.wikipedia.org/wiki/Selection_sort" target="_blank">Selection sort</a> implementation using recursion. </p>
154154
<p>The selection sort algorithm divides the input list into two parts: a sorted sublist of items which is built up from left to right at the front (left) of the list, and a sublist of the remaining unsorted items that occupy the rest of the list. Initially, the sorted sublist is empty, and the unsorted sublist is the entire input list. The algorithm proceeds by finding the smallest (or largest, depending on the sorting order) element in the unsorted sublist, exchanging (swapping) it with the leftmost unsorted element (putting it in sorted order), and moving the sublist boundaries one element to the right.</p>
155-
<h3><a class="anchor" id="autotoc_md114"></a>
155+
<h3><a class="anchor" id="autotoc_md112"></a>
156156
Implementation</h3>
157157
<p>FindMinIndex This function finds the minimum element of the array(list) recursively by simply comparing the minimum element of array reduced size by 1 and compares it to the last element of the array to find the minimum of the whole array.</p>
158158
<p>SelectionSortRecursive Just like selection sort, it divides the list into two parts (i.e.: sorted and unsorted) and finds the minimum of the unsorted array. By calling the <code>FindMinIndex</code> function, it swaps the minimum element with the first element of the list, and then solves recursively for the remaining unsorted list. </p><dl class="section author"><dt>Author</dt><dd><a href="https://github.com/Tushar-K24" target="_blank">Tushar Khanduri</a> </dd></dl>

d5/d33/gram__schmidt_8cpp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
153153
<div class="textblock"><p><a href="https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process" target="_blank">Gram Schmidt Orthogonalisation Process</a> </p>
154154
<p>Takes the input of Linearly Independent Vectors, returns vectors orthogonal to each other.</p>
155-
<h3><a class="anchor" id="autotoc_md89"></a>
155+
<h3><a class="anchor" id="autotoc_md87"></a>
156156
Algorithm</h3>
157157
<p>Take the first vector of given LI vectors as first vector of Orthogonal vectors. Take projection of second input vector on the first vector of Orthogonal vector and subtract it from the 2nd LI vector. Take projection of third vector on the second vector of Othogonal vectors and subtract it from the 3rd LI vector. Keep repeating the above process until all the vectors in the given input array are exhausted.</p>
158158
<p>For Example: In R2, Input LI Vectors={(3,1),(2,2)} then Orthogonal Vectors= {(3, 1),(-0.4, 1.2)}</p>

d5/d45/sublist__search_8cpp.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@
163163
</table>
164164
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
165165
<div class="textblock"><p>Implementation of the <a href="https://www.geeksforgeeks.org/sublist-search-search-a-linked-list-in-another-list" target="_blank">Sublist Search Algorithm</a> </p>
166-
<h3><a class="anchor" id="autotoc_md109"></a>
166+
<h3><a class="anchor" id="autotoc_md107"></a>
167167
Algorithm</h3>
168168
<ul>
169169
<li>Sublist search is used to detect a presence of one list in another list.</li>
170170
<li>Suppose we have a single-node list (let's say the first list), and we want to ensure that the list is present in another list (let's say the second list), then we can perform the sublist search to find it.</li>
171171
<li>For instance, the first list contains these elements: 23 -&gt; 30 -&gt; 41, and the second list contains these elements: 10 -&gt; 15 -&gt; 23 -&gt; 30 -&gt; 41 -&gt; 49. At a glance, we see that the first list presents in the second list.</li>
172172
</ul>
173-
<h3><a class="anchor" id="autotoc_md110"></a>
173+
<h3><a class="anchor" id="autotoc_md108"></a>
174174
Working</h3>
175175
<ul>
176176
<li>The sublist search algorithm works by comparing the first element of the first list with the first element of the second list.</li>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<map id="catalan_numbers" name="catalan_numbers">
2+
<area shape="rect" id="Node000001" title="computes and caches Catalan numbers" alt="" coords="35,183,155,208"/>
3+
<area shape="rect" id="Node000002" href="/Users/runner/work/TheAlgorithms-C-Plus-Plus/TheAlgorithms-C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/vector.html" title=" " alt="" coords="5,94,185,120"/>
4+
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="98,135,98,182,92,182,92,135"/>
5+
<area shape="rect" id="Node000003" href="/Users/runner/work/TheAlgorithms-C-Plus-Plus/TheAlgorithms-C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/types/integer.html" title=" " alt="" coords="48,5,142,31"/>
6+
<area shape="poly" id="edge2_Node000002_Node000003" title=" " alt="" coords="98,47,98,94,92,94,92,47"/>
7+
</map>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9c439c5569d9f0e8dd64941ccb1756a2

0 commit comments

Comments
 (0)