diff --git a/annotated.html b/annotated.html index 1f3ca79a9..b34bb7447 100644 --- a/annotated.html +++ b/annotated.html @@ -3,16 +3,18 @@
- +| ►Nbacktracking | For vector container |
| ►Nbacktracking | For vector container |
| ►Nciphers | Algorithms for encryption and decryption |
| ►Nciphers | Algorithms for encryption and decryption |
| ►Ndata_structures | For IO operations |
| ►Ndata_structures | For IO operations |
| ►Ndivide_and_conquer | For std::vector |
| ►Ndivide_and_conquer | For std::vector |
| ►Ndouble_hashing | An implementation of hash table using double hashing algorithm |
| ►Ndouble_hashing | An implementation of hash table using double hashing algorithm |
| ►Ngeometry | For std::vector |
| ►Ngeometry | For std::vector |
| ►Ngraph | Graph Algorithms |
| ►Ngraph | Graph Algorithms |
| ►Ngreedy_algorithms | For std::vector |
| ►Ngreedy_algorithms | For std::vector |
| ►Nhashing | Hashing algorithms |
| ►Nhashing | Hashing algorithms |
| ►Nlinear_probing | An implementation of hash table using linear probing algorithm |
| ►Nlinear_probing | An implementation of hash table using linear probing algorithm |
| ►Nmachine_learning | A* search algorithm |
| ►Nmachine_learning | A* search algorithm |
| ►Nmath | For IO operations |
| ►Nmath | For IO operations |
| ►Noperations_on_datastructures | For std::vector |
| ►Noperations_on_datastructures | For std::vector |
| ►Nothers | For vector |
| ►Nothers | For vector |
| ►Nprobability | Probability algorithms |
| ►Nprobability | Probability algorithms |
| ►Nquadratic_probing | An implementation of hash table using quadratic probing algorithm |
| ►Nquadratic_probing | An implementation of hash table using quadratic probing algorithm |
| ►Nrange_queries | Algorithms and Data Structures that support range queries and updates |
| ►Nrange_queries | Algorithms and Data Structures that support range queries and updates |
| ►Nsearch | For std::vector |
| ►Nsearch | For std::vector |
| ►Nstatistics | Statistical algorithms |
| ►Nstatistics | Statistical algorithms |
| ►Nstd | STL namespace |
| ►Nstd | STL namespace |
| ►Nstrings | Algorithms with strings |
| ►Nstrings | Algorithms with strings |
| ►Cbinary_search_tree | The Binary Search Tree class |
| ►Cbinary_search_tree | The Binary Search Tree class |
| CBtree | |
| Ccll | |
| CNode | |
| CPoint | |
| Cquery | |
| CQueue | |
| Cqueue | |
| Cqueue | |
| CQueue | |
| CRBtree | |
| CSegmentIntersection | |
| CSolution | |
| CTestCase | Single example inputs and expected output of the function longest_common_string_length |
| CTestCases | Class encapsulating the necessary test cases |
| Ctower | |
| ►CTrie | |
| ►CTrie | |
| Cuint128_t | Class for 128-bit unsigned integer |
| Cuint256_t | Class for 256-bit unsigned integer |
Functions | |
| double | LenghtLine (const Point &A, const Point &B) |
| double | LenghtLine (const Point &A, const Point &B) |
| double | TriangleArea (const Point &A, const Point &B, const Point &C) |
| double | TriangleArea (const Point &A, const Point &B, const Point &C) |
| bool | PointInCircle (const std::vector< Point > &P, const Point &Center, double R) |
| bool | PointInCircle (const std::vector< Point > &P, const Point &Center, double R) |
| double | circle (const std::vector< Point > &P) |
| double | circle (const std::vector< Point > &P) |
| void | test () |
| void | test () |
| void | test2 () |
| void | test2 () |
| void | test3 () |
| void | test3 () |
| int | main () |
| int | main () |
Main program
Test case: result should be:
Circle with
radius 1.821078397711709
- centre at (2.142857142857143, 1.7857142857142856)
Functions | |
| void | test_function (const float *test_data, const int number_of_samples) |
| void | test_function (const float *test_data, const int number_of_samples) |
| int | main (int argc, char **argv) |
| int | main (int argc, char **argv) |
Main function
Functions for the Ground to ground projectile motion equation. -More...
+More...Functions for the Ground to ground projectile motion equation.
Functions for the Quick sort implementation in C++. -More...
+More...Functions for the Quick sort implementation in C++.
Neural Network or Multilayer Perceptron. -More...
+More...Neural Network or Multilayer Perceptron.
Trie implementation for small-case English alphabets a-z
- More...
Public Member Functions | trie ()=default |
| Class default constructor. | |
| void | insert (const std::string &str) |
| void | insert (const std::string &str) |
| bool | search (const std::string &str, int index) |
| bool | search (const std::string &str, int index) |
| bool | deleteString (const std::string &str, int index) |
| bool | deleteString (const std::string &str, int index) |
Private Member Functions | |
| uint8_t | char_to_int (const char &ch) const |
| uint8_t | char_to_int (const char &ch) const |
| Convert a character to integer for indexing. | |
| bool | search (const std::shared_ptr< trie > &root, const std::string &str, int index) |
| bool | search (const std::shared_ptr< trie > &root, const std::string &str, int index) |
Private Attributes | ||||||||||
| -std::array< std::shared_ptr< trie >, NUM_CHARS<< 1 > | arr | arr | ||||||||
| Recursive tree nodes as an array of shared-pointers. | ||||||||||
| @@ -164,8 +166,7 @@ static constexpr uint8_t | N
| uint8_t data_structures::trie::char_to_int |
( |
- const char & |
- ch | ) |
+ const char & | ch | ) |
const |
|
removes the string if it is not a prefix of any other string, if it is then just sets the ::data_structure::trie::isEndofWord to false, else removes the given string
| str | string to remove | |||||||
| void data_structures::trie::insert | ( | -const std::string & | -str | ) | +const std::string & | str | ) |
false if not found
Functions | |
| uint64_t | finding_number_of_digits_in_a_number (uint64_t n) |
| uint64_t | finding_number_of_digits_in_a_number (uint64_t n) |
| for IO operations | |
| double | finding_number_of_digits_in_a_number_using_log (double n) |
| double | finding_number_of_digits_in_a_number_using_log (double n) |
| This function finds the number of digits in constant time using logarithmic function TC: O(1) | |
| static void | first_test () |
| static void | first_test () |
| Self-test implementations. | |
| static void | second_test () |
| static void | second_test () |
| int | main () |
| int | main () |
| Main function. | |
Self-test implementations.
Typedefs | |
| -using | math::Point = { double x |
| structure of points containing two numbers, x and y, such that 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1. | |
| using | math::Point |
| structure of points containing two numbers, x and y, such that 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1. | |
Functions | |
| double | math::approximate_pi (const std::vector< Point > &pts) |
| double | math::approximate_pi (const std::vector< Point > &pts) |
| This function uses the points in a given vector 'pts' (drawn at random) to return an approximation of the number π. | |
| static void | tests () |
| static void | tests () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
-Variables | |
| -double | math::y |
Implementation to calculate an estimate of the number π (Pi).
@@ -163,8 +157,7 @@ doubleFunctions for Wiggle Sort algorithm. -More...
+More...Functions for Wiggle Sort algorithm.
Public Member Functions | |
| RootedTree (const std::vector< std::pair< int, int > > &undirected_edges, int root_) | |
| RootedTree (const std::vector< std::pair< int, int > > &undirected_edges, int root_) | |
| Constructs the tree by calculating parent for every vertex. Assumes a valid description of a tree is provided. | |
Public Member Functions inherited from graph::Graph< T > | |
Public Member Functions inherited from graph::Graph< T > | |
| void | add_edge (T u, T v, bool bidir=true) |
| std::map< T, bool > | breadth_first_search (T src) | root |
| Index of the root vertex. | |
Public Attributes inherited from graph::Graph< T > | |
Public Attributes inherited from graph::Graph< T > | |
| std::vector< std::vector< int > > | neighbors |
| for each vertex it stores a list indicies of its neighbors | root |
Protected Member Functions | |
| void | populate_parents () |
| void | populate_parents () |
| Calculate the parents for all the vertices in the tree. Implements the breadth first search algorithm starting from the root vertex searching the entire tree and labeling parents for all vertices. | |
Functions | |
| int | main () |
| int | main () |
@@ -165,8 +167,7 @@ constexpr float | data_struc
| int main |
( |
- void |
- ) |
+ void | ) |
| | |||
Class defining the structure of trie node and containing the methods to perform operations on them. - More...
+ More...Public Member Functions | |
| Tnode (const Tnode &node) | |
| Tnode (const Tnode &node) | |
| Tnode & | operator= (const Tnode &node)=default |
| Tnode & | operator= (Tnode &&)=default |
| uint8_t | numberOfChildren (Tnode *node) |
| uint8_t | numberOfChildren (Tnode *node) |
| Function to count the number of children a node in the trie has. | |
| void | Insert (const std::string &entry) |
| void | Insert (const std::string &entry) |
| Function to insert a word in the trie. | |
| void | Delete (std::string entry) |
| void | Delete (std::string entry) |
| Function to verify presence and hence delete an entry from the trie. | |
| void | DeleteFrom (Tnode *delete_from, std::string delete_string, int remove_index) |
| 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 deleted. It traverses till the end of word in a recursive fashion, from there it deletes characters one by one till it reaches back to the initial call. | |
| bool | SearchPresence (const std::string &key) |
| bool | SearchPresence (const std::string &key) |
| Function to check a word's presence in the trie (Basic) | |
| void | SuggestAutocomplete (Tnode *new_root, const std::string &prefix) |
| void | SuggestAutocomplete (Tnode *new_root, const std::string &prefix) |
| Recursive function to suggest all the entries of trie which have a given common prefix. | |
| void | SearchSuggestions (const std::string &key) |
| void | SearchSuggestions (const std::string &key) |
| Lists out all the words in trie with the longest prefix of the search key that is present in the trie. For example - if trie contains "abc", "abcde", "abcdefg", "abcddef" and if the search key is "abcdezz", then the longest common prefix is "abcde" and hence search results will be "abcde", "abcdefg". | |
| void | SuggestFreqAutocomplete (Tnode *new_root, const std::string &prefix, std::priority_queue< std::pair< int, std::string > > *suggestions) |
| 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 prefix. | |
| void | SearchFreqSuggestions (const std::string &key) |
| void | SearchFreqSuggestions (const std::string &key) |
| Lists out the most frequent words in trie with the longest prefix of the search key that is present in the trie. For example - if trie contains "abc", "abcde", "abcdefg", "abcddef" and they have been previously searched for 3, 1, 2, 4 times respectively, if the search key is "ab", then the longest common prefix is "ab" and only the top 3 frequencies among the matches would be displayed viz. "abcddef", "abc", "abcdefg". | |
| void | SelectionTop_3 (std::priority_queue< std::pair< int, std::string > > *suggestions) |
| void | SelectionTop_3 (std::priority_queue< std::pair< int, std::string > > *suggestions) |
| Function to display the 3 suggestions with highest frequency of search hits. | |
E
| operations_on_datastructures::trie_operations::Tnode::Tnode |
( |
- ) |
+ ) |
| |
An implementation of hash table using double hashing algorithm. -More...
+More...Classes |
Typedefs | |
| -using | Entry = Entry |
| +using | Entry = struct Entry |
Functions | |
| bool | putProber (const Entry &entry, int key) |
| bool | putProber (const Entry &entry, int key) |
| bool | searchingProber (const Entry &entry, int key) |
| bool | searchingProber (const Entry &entry, int key) |
| void | add (int key) |
| void | add (int key) |
| size_t | hashFxn (int key) |
| size_t | hashFxn (int key) |
Hash a key. Uses the STL library's std::hash() function. | |
| size_t | otherHashFxn (int key) |
| size_t | otherHashFxn (int key) |
| Used for second hash function. | |
| int | doubleHash (int key, bool searching) |
| int | doubleHash (int key, bool searching) |
| Performs double hashing to resolve collisions. | |
| void | display () |
| void | display () |
| void | rehash () |
| void | rehash () |
| void | remove (int key) |
| void | remove (int key) |
| void | addInfo (int key) |
| void | addInfo (int key) |
| void | removalInfo (int key) |
| void | removalInfo (int key) |
@@ -181,8 +183,7 @@ bool | rehashing | void double_hashing::add | ( | -int | -key | ) | +int | key | ) | ||
Main function.
for vector
-More...
Functions | |
| bool | are_almost_equal (double a, double b, double absolute_tolerance=0.0001) |
| bool | are_almost_equal (double a, double b, double absolute_tolerance=0.0001) |
| Compare two floating point numbers with a certain tolerance. This is needed as with some values, the result (e.g.: -196.15) might be a bit lower (in this case, -196.499999...). | |
| double | kelvin_to_celsius (double temperature_in_k) |
| double | kelvin_to_celsius (double temperature_in_k) |
| Conversion from Kelvin to Celsius algorithm. | |
0.0001 Main Function.
Functions | |
| int | number_of_positive_divisors (int n) |
| int | number_of_positive_divisors (int n) |
| void | tests () |
| void | tests () |
| int | main () |
| int | main () |
Main function
Test implementations
Functions for the Monte Carlo Integration implementation. -More...
+More...Functions for the Monte Carlo Integration implementation.
Functions | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
data_structures:
| int main |
( |
- void |
- ) |
+ void | ) |
| |
Main function.
Function for implementing Saddleback Algorithm. -More...
+More...Function for implementing Saddleback Algorithm.
Functions | |
| int | main () |
| int | main () |
Functions for Abbreviation implementation. -More...
+More...Functions for Abbreviation implementation.
Functions | |
| uint64_t | backtracking::subset_sum::number_of_subsets (int32_t sum, const std::vector< int32_t > &in_arr) |
| uint64_t | backtracking::subset_sum::number_of_subsets (int32_t sum, const std::vector< int32_t > &in_arr) |
| The main function implements count of subsets. | |
| static void | test () |
| static void | test () |
| Test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| int | main () |
| int | main () |
class for 256-bit unsigned integer - More...
+ More...#include <uint256_t.hpp>
Private Member Functions | |
| void | __get_integer_from_string (const std::string &str) |
| void | __get_integer_from_string (const std::string &str) |
| First and second half of 256 bit number. | |
Private Attributes | |
| uint128_t | f {} |
| uint128_t | f {} |
| uint128_t | s {} |
| uint128_t | s {} |
Friends | |
| std::ostream & | operator<< (std::ostream &op, uint256_t p) |
| std::ostream & | operator<< (std::ostream &op, uint256_t p) |
| operator << for printing uint256_t integer | |
| bool uint256_t::operator!= | +bool uint256_t::operator!= | ( | -const T & | -other | ) | +const T & | other | ) |
| bool uint256_t::operator!= | +bool uint256_t::operator!= | ( | -const uint256_t & | -other | ) | +const uint256_t & | other | ) |
p Functions | |
| void | tests () |
| void | tests () |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| void | range_queries::prefix_sum_array::build (std::vector< int64_t > original_array) |
| void | range_queries::prefix_sum_array::build (std::vector< int64_t > original_array) |
| function that builds the PSA | |
| int64_t | range_queries::prefix_sum_array::query (int64_t beg, int64_t end) |
| int64_t | range_queries::prefix_sum_array::query (int64_t beg, int64_t end) |
| query function | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
| void range_queries::prefix_sum_array::build | ( | -std::vector< int64_t > | -original_array | ) | +std::vector< int64_t > | original_array | ) |
Main function.
Functions | |
| double | numerical_methods::runge_kutta::rungeKutta (double init_x, const double &init_y, const double &x, const double &h) |
| double | numerical_methods::runge_kutta::rungeKutta (double init_x, const double &init_y, const double &x, const double &h) |
| the Runge Kutta method finds the value of integration of a function in the given limits. the lower limit of integration as the initial value and the upper limit is the given x | |
| static double | change (double x, double y) |
| static double | change (double x, double y) |
| for using the vector container | |
| static void | test () |
| static void | test () |
| Tests to check algorithm implementation. | |
| int | main () |
| int | main () |
| Main function. | |
for using the vector container
asserting the test functions for io operations
-The change() function is used to return the updated iterative value corresponding to the given function
The change() function is used to return the updated iterative value corresponding to the given function
| x | is the value corresponding to the x coordinate | |||||||
| y | is the value corresponding to the y coordinate | |||||||
| int main | ( | -void | -) | +void | ) |
Main function.
Public Member Functions | |
| bool | operator() (MinHeapNode *l, MinHeapNode *r) |
| bool | operator() (MinHeapNode *l, MinHeapNode *r) |
Functions for the Knight's tour algorithm. -More...
+More...Functions for the Knight's tour algorithm.
Main function.
Typedefs | |
| template<typename T > | |
| using | matrix = std::vector< std::valarray< T > > |
| template<typename T > | |
| using | matrix = std::vector<std::valarray<T>> |
Functions | |
| template<typename T > | |
| int | lu_decomposition (const matrix< T > &A, matrix< double > *L, matrix< double > *U) |
| int | lu_decomposition (const matrix< T > &A, matrix< double > *L, matrix< double > *U) |
| template<typename T > | |
| double | determinant_lu (const matrix< T > &A) |
| double | determinant_lu (const matrix< T > &A) |
Functions associated with LU Decomposition of a square matrix.
| using matrix = std::vector<std::valarray<T> > | +using matrix = std::vector<std::valarray<T>> |
for std::invalid_argument - More...
+ More...#include <stack.hpp>
Public Member Functions | |
| void | display () const |
| void | display () const |
| std::vector< value_type > | toVector () const |
| std::vector< value_type > | toVector () const |
| bool | isEmptyStack () const |
| bool | isEmptyStack () const |
| void | push (const value_type &item) |
| void | push (const value_type &item) |
| value_type | top () const |
| value_type | top () const |
| void | pop () |
| void | pop () |
| void | clear () |
| void | clear () |
Private Member Functions | |
| void | ensureNotEmpty () const |
| void | ensureNotEmpty () const |
Private Attributes | ||||||
| std::shared_ptr< Node< value_type > > | stackTop | |||||
| std::shared_ptr< Node< value_type > > | stackTop | |||||
| std::size_t | size = 0 | |||||
| void stack< ValueType >::clear | ( | -) | +) | |||
Show stack
Determine whether the stack is empty
-Remove the top element of the stack
@@ -350,8 +352,7 @@ template<class ValueType >Return the top element of the stack
@@ -418,7 +419,7 @@ template<class ValueType >Typedefs | |
| -using | linear_probing::Entry = Entry |
| +using | linear_probing::Entry = struct Entry |
Functions | |
| void | linear_probing::removalInfo (int key) |
| int | main () |
| int | main () |
@@ -197,8 +199,7 @@ bool | linear_probing::rehas
| int main |
( |
- void |
- ) |
+ void | ) |
| | |||
for assert -More...
+More...Functions | |
| double | babylonian_method (double radicand) |
| double | babylonian_method (double radicand) |
| Babylonian methods is an iterative function which returns square root of radicand. | |
| std::complex< double > * | FastFourierTransform (std::complex< double > *p, uint8_t n) |
| std::complex< double > * | FastFourierTransform (std::complex< double > *p, uint8_t n) |
| FastFourierTransform is a recursive function which returns list of complex numbers. | |
| std::complex< double > * | InverseFastFourierTransform (std::complex< double > *p, uint8_t n) |
| std::complex< double > * | InverseFastFourierTransform (std::complex< double > *p, uint8_t n) |
| InverseFastFourierTransform is a recursive function which returns list of complex numbers. | |
.XX% threshold of the exact value. Typedefs | |
| -using | probability::windowed_median::Window = std::list< int > |
| + | |
| +using | probability::windowed_median::Window = std::list<int> |
| using | probability::windowed_median::size_type = Window::size_type |
Functions | |
| static void | test (const std::vector< int > &vals, int windowSize) |
| static void | test (const std::vector< int > &vals, int windowSize) |
| Self-test implementations. | |
| int | main (int argc, const char *argv[]) |
| int | main (int argc, const char *argv[]) |
| Main function. | |
Public Member Functions | |
| list () | |
| list () | |
| bool | isEmpty () |
| bool | isEmpty () |
| void | push_back (int new_elem) |
| void | push_back (int new_elem) |
| void | push_front (int new_elem) |
| void | push_front (int new_elem) |
| void | erase (int old_elem) |
| void | erase (int old_elem) |
| void | display () |
| void | display () |
| std::shared_ptr< link > | search (int find_elem) |
| std::shared_ptr< link > | search (int find_elem) |
| void | reverse () |
| bool | isEmpty () const |
| bool | isEmpty () const |
| Utility function that checks if the list is empty. | |
| void | insert (int32_t new_elem) |
| void | insert (int32_t new_elem) |
| Utility function that adds a new element at the end of the list. | |
| void | reverseList () |
| void | reverseList () |
| Utility function for reversing a list. | |
| void | display () const |
| int32_t | top () const |
| int32_t | top () const |
| Utility function to find the top element of the list. | |
| int32_t | last () const |
| int32_t | traverse (int32_t index) const |
| int32_t | traverse (int32_t index) const |
| Utility function to find the i th element of the list. | |
| list (const list &other) | |
| list (const list &other) | |
| copy constructor creating a deep copy of every node of the input | |
| list & | operator= (const list &other) |
| list & | operator= (const list &other) |
| assignment operator creating a deep copy of every node of the input | |
Private Member Functions | |
| void | delete_all_nodes () |
| void | delete_all_nodes () |
| calls delete operator on every node in the represented list | |
| void | copy_all_nodes_from_list (const list &other) |
| void | copy_all_nodes_from_list (const list &other) |
@@ -172,7 +174,7 @@ Private Attributes | first | |||||
| link before the actual first element | ||||||
| std::shared_ptr< link > | last | |||||
| std::shared_ptr< link > | last | |||||
| last link on the list | ||||||
| @@ -194,7 +196,7 @@ Private Attributes | ||||||
| data_structures::linked_list::list::list | ( | -) | +) | |||
List constructor. Initializes the first and last link.
function displays all the elements in the list
Utility function to find the top element of the list.
Typedefs | |
| typedef struct list | node |
| typedef struct list | node |
| typedef struct list * | link |
Functions | |
| int | h (int key) |
| int | h (int key) |
| void | create_list (int key) |
| void | create_list (int key) |
| int | hash_search (int key, int *counter) |
| int | hash_search (int key, int *counter) |
| int | main () |
| int | main () |
Variables | |
| int | data [MAX] = {1, 10, 15, 5, 8, 7} |
| int | data [MAX] = {1, 10, 15, 5, 8, 7} |
| test data | |
| -node | hashtab [HASHMAX] | hashtab [HASHMAX] |
| array of nodes | |
In this algorithm, we use the method of division and reservation remainder to construct the hash function, and use the method of chain address to solve the conflict, that is, we link a chain list after the data, and store all the records whose keywords are synonyms in the same linear chain list.
n never gets freed. key for IO operations - More...
+ More...Public Member Functions | |
| EasterYearMonthDay (uint64_t newYear, uint64_t newMonth, uint64_t newDay) | |
| EasterYearMonthDay (uint64_t newYear, uint64_t newMonth, uint64_t newDay) | |
Public Member Functions | |
| MinHeap (int cap) | |
| MinHeap (int cap) | |
| void | MinHeapify (int) |
| void | MinHeapify (int) |
| int | parent (int i) |
| int | parent (int i) |
| int | left (int i) |
| int | left (int i) |
| int | right (int i) |
| int | right (int i) |
| int | extractMin () |
| int | extractMin () |
| void | decreaseKey (int i, int new_val) |
| void | decreaseKey (int i, int new_val) |
| int | getMin () |
| int | getMin () |
| void | deleteKey (int i) |
| void | deleteKey (int i) |
| void | insertKey (int k) |
| void | insertKey (int k) |
@@ -158,8 +160,7 @@ int | heap_size | MinHeap::MinHeap | ( | -int | -cap | ) | +int | cap | ) |
Decreases key value of key at index i to new_val
Decreases value of key at index 'i' to new_val. It is assumed that new_val is smaller than harr[i].
Deletes a key stored at index i
-This function deletes key at index i. It first reduced value to minus infinite, then calls extractMin()
+This function deletes key at index i. It first reduced value to minus infinite, then calls extractMin()
to extract the root which is the minimum element
Inserts a new key 'k'
to heapify a subtree with the root at given index
A recursive method to heapify a subtree with the root at given index This method assumes that the subtrees are already heapified
Our main function with example of sort method.
Functions | |
| int | jumpSearch (int arr[], int x, int n) |
| int | jumpSearch (int arr[], int x, int n) |
| int | main () |
| int | main () |
Main function.
Functions to compute QR decomposition of any rectangular matrix. -More...
+More...Functions | |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &out, std::valarray< std::valarray< T > > const &v) |
| std::ostream & | operator<< (std::ostream &out, std::valarray< std::valarray< T > > const &v) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &out, std::valarray< T > const &v) |
| std::ostream & | operator<< (std::ostream &out, std::valarray< T > const &v) |
| template<typename T > | |
| double | vector_dot (const std::valarray< T > &a, const std::valarray< T > &b) |
| double | vector_dot (const std::valarray< T > &a, const std::valarray< T > &b) |
| template<typename T > | |
| double | vector_mag (const std::valarray< T > &a) |
| double | vector_mag (const std::valarray< T > &a) |
| template<typename T > | |
| std::valarray< T > | vector_proj (const std::valarray< T > &a, const std::valarray< T > &b) |
| std::valarray< T > | vector_proj (const std::valarray< T > &a, const std::valarray< T > &b) |
| template<typename T > | |
| void | qr_decompose (const std::valarray< std::valarray< T > > &A, std::valarray< std::valarray< T > > *Q, std::valarray< std::valarray< T > > *R) |
| void | qr_decompose (const std::valarray< std::valarray< T > > &A, std::valarray< std::valarray< T > > *Q, std::valarray< std::valarray< T > > *R) |
| std::valarray< double > | eigen_values (std::valarray< std::valarray< double > > *A, bool print_intermediates=false) |
| std::valarray< double > | eigen_values (std::valarray< std::valarray< double > > *A, bool print_intermediates=false) |
false If \(\vec{a}=\left[a_0,a_1,a_2,...,a_L\right]\) then \(\left|\vec{a}\right|=\sqrt{\displaystyle\sum_{i=0}^L a_i^2}\)
check for division by zero using machine epsilon
Functions | |
| void | ConsTree (const std::vector< int64_t > &arr, std::vector< int64_t > *segtree, uint64_t low, uint64_t high, uint64_t pos) |
| void | ConsTree (const std::vector< int64_t > &arr, std::vector< int64_t > *segtree, uint64_t low, uint64_t high, uint64_t pos) |
| for std::vector | |
| int64_t | query (std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high, uint64_t pos) |
| int64_t | query (std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, uint64_t qlow, uint64_t qhigh, uint64_t low, uint64_t high, uint64_t pos) |
| Returns the sum of all elements in a range. | |
| void | update (std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, int64_t start, int64_t end, int64_t delta, uint64_t low, uint64_t high, uint64_t pos) |
| void | update (std::vector< int64_t > *segtree, std::vector< int64_t > *lazy, int64_t start, int64_t end, int64_t delta, uint64_t low, uint64_t high, uint64_t pos) |
| Updates a range of the segment tree. | |
| static void | test () |
| static void | test () |
| Self-test implementation. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
| int64_t query | +int64_t query | ( | -std::vector< int64_t > * | -segtree, | +std::vector< int64_t > * | segtree, |
| - | std::vector< int64_t > * | -lazy, | +std::vector< int64_t > * | lazy, | ||
| - | uint64_t | -qlow, | +uint64_t | qlow, | ||
| - | uint64_t | -qhigh, | +uint64_t | qhigh, | ||
| - | uint64_t | -low, | +uint64_t | low, | ||
| - | uint64_t | -high, | +uint64_t | high, | ||
| - | uint64_t | -pos | -||||
| - | ) | -+ | uint64_t | pos ) |
Main function
The Heavy-Light Decomposition class. - More...
+ More...Public Member Functions | |
| HLD (int nodes) | |
| HLD (int nodes) | |
| Class parameterized constructor. Resizes the and initilizes the data members. | |
| void | init () |
| void | init () |
| This function must be called after the tree adjacency list and node values are populated The function initializes the required parametes, and populates the segment tree. | |
| void | update (int node, X val) |
| void | update (int node, X val) |
| This function updates the value at node with val. | |
| X | query (int a, int b) |
| X | query (int a, int b) |
| This function returns the sum of node values in the simple path from from node_1 to node_2. | |
Public Member Functions inherited from range_queries::heavy_light_decomposition::Tree< X > | |
Public Member Functions inherited from range_queries::heavy_light_decomposition::Tree< X > | |
| Tree (int nodes) | |
| Class parameterized constructor, resizes the and initializes the data members. | |
Private Member Functions | |
| void | dfs_hc (int u, int p=-1) |
| void | dfs_hc (int u, int p=-1) |
| Utility function to assign heavy child to each node (-1 for a leaf node) | |
| void | dfs_par (int u, int p=-1) |
| void | dfs_par (int u, int p=-1) |
| Utility function to assign highest parent that can be reached though heavy chains. | |
| void | dfs_labels (int u, int p=-1) |
| void | dfs_labels (int u, int p=-1) |
| Utility function to lable the nodes so that heavy chains have a contigous lable. | |
| X | chain_query (int a, int b) |
| X | chain_query (int a, int b) |
| Utility function to break down a path query into two chain queries. | |
| int | label | |||||||
| utility member to assign labels in dfs_labels() | ||||||||
| utility member to assign labels in dfs_labels() | ||||||||
| std::vector< int > | h_label | |||||||
| range_queries::heavy_light_decomposition::HLD< X >::HLD | ( | -int | -nodes | ) | +int | nodes | ) | |
-1 -1 -1 for std::vector -More...
+More...Functions | |
| template<typename T > | |
| void | findMinimumEdge (const int &infinity, const std::array< std::array< T, 6 >, 6 > &graph) |
| void | findMinimumEdge (const int &infinity, const std::array< std::array< T, 6 >, 6 > &graph) |
| Finds the minimum edge of the given graph. | |
defines the structure of a node of the tree - More...
+ More...Functions to find the non repeating integer in an array of repeating integers. Single Number -More...
+More...Functions to find the non repeating integer in an array of repeating integers. Single Number
Wrapper class for storing a graph. - More...
+ More...Public Member Functions | |
| Graph (const int V) | |
| Graph (const int V) | |
| Constructs a graph. | |
| void | add_edge (int src, int dst, int weight) |
| void | add_edge (int src, int dst, int weight) |
| Adds an edge to the graph. | |
| int | vertexNum = 0 |
| std::vector< std::vector< int > > | edges {} |
| std::vector< std::vector< int > > | edges {} |
Public Member Functions | |
| void | enqueue (int) |
| void | enqueue (int) |
| int | dequeue () |
| int | dequeue () |
| void | display () |
| void | display () |
@@ -141,7 +143,7 @@ Public Attributes | ||||||
| stack_linkedList::stack_linkedList | ( | -) | +) | |||
Statistical algorithms. -More...
+More...Functions for the House Robber algorithm. -More...
+More...Functions for the House Robber algorithm.
Functions for Runge Kutta fourth order method. -More...
+More...Functions for Runge Kutta fourth order method.
Functions | |
| static void | test_1 () |
| static void | test_1 () |
| static void | test_2 () |
| static void | test_2 () |
| static void | test_3 () |
| static void | test_3 () |
| int | main () |
| int | main () |
Sample I/O at the bottom.
Sample I/O at the bottom.
Main function
no parameter) Functions | |
| void | problem (const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| void | problem (const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| Problem statement for a system with first-order differential equations. Updates the system differential variables. | |
| void | exact_solution (const double &x, std::valarray< double > *y) |
| void | exact_solution (const double &x, std::valarray< double > *y) |
| Exact solution of the problem. Used for solution comparison. | |
| void | semi_implicit_euler_step (const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| double | semi_implicit_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| Compute approximation using the semi-implicit-Euler method in the given limits. | |
| void | save_exact_solution (const double &X0, const double &X_MAX, const double &step_size, const std::valarray< double > &Y0) |
| void | save_exact_solution (const double &X0, const double &X_MAX, const double &step_size, const std::valarray< double > &Y0) |
| int | main (int argc, char *argv[]) |
| int | main (int argc, char *argv[]) |
The computation results are stored to a text file semi_implicit_euler.csv and the exact soltuion results in exact.csv for comparison.
To implement Van der Pol oscillator, change the problem function to:
To implement Van der Pol oscillator, change the problem function to:
0 Various utility functions used in Neural network. -More...
+More...Various utility functions used in Neural network.
Functions | |
| int | main () |
| int | main () |
Functions | |
| std::pair< uint32_t, uint32_t > | search::saddleback::saddleback (std::vector< std::vector< int32_t > > matrix, int32_t element) |
| std::pair< uint32_t, uint32_t > | search::saddleback::saddleback (std::vector< std::vector< int32_t > > matrix, int32_t element) |
| static void | test () |
| static void | test () |
| Test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| int | main (void) |
| int | main (void) |
Functions | |
| void | enqueue (node *n) |
| void | enqueue (node *n) |
| node * | dequeue () |
| node * | dequeue () |
| void | Insert (node *n, int x) |
| void | Insert (node *n, int x) |
| int | findMaxInLeftST (node *n) |
| int | findMaxInLeftST (node *n) |
| void | Remove (node *p, node *n, int x) |
| void | Remove (node *p, node *n, int x) |
| void | BFT (node *n) |
| void | BFT (node *n) |
| void | Pre (node *n) |
| void | Pre (node *n) |
| void | In (node *n) |
| void | In (node *n) |
| void | Post (node *n) |
| void | Post (node *n) |
| int | main () |
| int | main () |
@@ -152,7 +154,7 @@ Variables |
A simple tree implementation using structured nodes.
-Trie class, implementation of trie using hashmap in each trie node for all the characters of char16_t(UTF-16)type with methods to insert, delete, search, start with and to recommend words based on a given prefix. - More...
+ More...Private Attributes | |
| std::shared_ptr< Node > | root_node |
| std::shared_ptr< Node > | root_node |
| declaring root node of trie | |
< iteratively and recursively get the recommended words
false if not found false if not found Custom comparator for open_list. - More...
+ More...Public Member Functions | |
| bool | operator() (const std::shared_ptr< Info > &a, const std::shared_ptr< Info > &b) const |
| bool | operator() (const std::shared_ptr< Info > &a, const std::shared_ptr< Info > &b) const |
Functions | |
| std::string | strings::manacher::manacher (const std::string &prototype) |
| std::string | strings::manacher::manacher (const std::string &prototype) |
| A function that implements Manacher's algorithm. | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Driver program for above functions
Functions | |
| std::string | ciphers::XOR::encrypt (const std::string &text, const int &key) |
| std::string | ciphers::XOR::encrypt (const std::string &text, const int &key) |
| std::string | ciphers::XOR::decrypt (const std::string &text, const int &key) |
| std::string | ciphers::XOR::decrypt (const std::string &text, const int &key) |
| void | test () |
| void | test () |
| int | main () |
| int | main () |
Driver Code
Functions | |
| int | main () |
| int | main () |
Contains the Simpson's method implementation. -More...
+More...Contains the Simpson's method implementation.
Variables | |
| const std::vector< std::vector< std::string > > | test_set |
| const std::vector< std::vector< std::string > > | test_set |
Main function
Functions | |
| std::vector< uint64_t > | Z_function (const std::string &pattern) |
| std::vector< uint64_t > | Z_function (const std::string &pattern) |
| for IO operations | |
| std::vector< uint64_t > | find_pat_in_text (const std::string &pattern, const std::string &text) |
| std::vector< uint64_t > | find_pat_in_text (const std::string &pattern, const std::string &text) |
| Using Z_function to find a pattern in a text. | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| bool | dynamic_programming::word_break::exists (const std::string &str, const std::unordered_set< std::string > &strSet) |
| bool | dynamic_programming::word_break::exists (const std::string &str, const std::unordered_set< std::string > &strSet) |
| Function that checks if the string passed in param is present in the the unordered_set passed. | |
| bool | dynamic_programming::word_break::check (const std::string &s, const std::unordered_set< std::string > &strSet, int pos, std::vector< int > *dp) |
| bool | dynamic_programming::word_break::check (const std::string &s, const std::unordered_set< std::string > &strSet, int pos, std::vector< int > *dp) |
| Function that checks if the string passed in param can be segmented from position 'pos', and then correctly go on to segment the rest of the string correctly as well to reach a solution. | |
| bool | dynamic_programming::word_break::wordBreak (const std::string &s, const std::vector< std::string > &wordDict) |
| bool | dynamic_programming::word_break::wordBreak (const std::string &s, const std::vector< std::string > &wordDict) |
| Function that checks if the string passed in param can be segmented into the strings present in the vector. In others words, it checks if any permutation of strings in the vector can be concatenated to form the final string. | |
| static void | test () |
| static void | test () |
| Test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Namespace for performing strassen's multiplication. -More...
+More...Namespace for performing strassen's multiplication.
2-3-4 tree class - More...
+ More...Private Member Functions | |
| void | InsertPreSplit (int64_t item) |
| void | InsertPreSplit (int64_t item) |
| A insert implementation of pre-split. | |
| void | InsertPostMerge (int64_t item) |
| void | InsertPostMerge (int64_t item) |
| A insert implementation of post-merge. | |
| Node * | Insert (Node *tree, int64_t item) |
| Node * | Insert (Node *tree, int64_t item) |
| A helper function used by post-merge insert. | |
| Node * | MergeNode (Node *dst_node, Node *node) |
| Node * | MergeNode (Node *dst_node, Node *node) |
| A helper function used during post-merge insert. | |
| void | MergeNodeNotFull (Node *dst_node, Node *node) |
| void | MergeNodeNotFull (Node *dst_node, Node *node) |
| Merge node to a not-full target node. | |
| Node * | SplitNode (Node *node) |
| Node * | SplitNode (Node *node) |
| Split a 4-node to 1 parent and 2 children, and return the parent node. | |
| int64_t | GetTreeMaxItem (Node *tree) |
| int64_t | GetTreeMaxItem (Node *tree) |
| Get the max item of the tree. | |
| int64_t | GetTreeMinItem (Node *tree) |
| int64_t | GetTreeMinItem (Node *tree) |
| Get the min item of the tree. | |
| bool | TryLeftRotate (Node *parent, Node *to_child) |
| bool | TryLeftRotate (Node *parent, Node *to_child) |
| A handy function to try if we can do a left rotate to the target node. | |
| bool | TryRightRotate (Node *parent, Node *to_child) |
| bool | TryRightRotate (Node *parent, Node *to_child) |
| A handy function to try if we can do a right rotate to the target node. | |
| void | RightRotate (Node *parent, int8_t index) |
| void | RightRotate (Node *parent, int8_t index) |
| Do the actual right rotate operation. | |
| void | LeftRotate (Node *parent, int8_t index) |
| void | LeftRotate (Node *parent, int8_t index) |
| Do the actual left rotate operation. | |
| bool | RemovePreMerge (Node *node, int64_t item) |
| bool | RemovePreMerge (Node *node, int64_t item) |
| Main function implement the pre-merge remove operation. | |
| Node * | Merge (Node *parent, int8_t index) |
| Node * | Merge (Node *parent, int8_t index) |
| Merge the item at index of the parent node, and its left and right child. | |
| void | DeleteNode (Node *tree) |
| void | DeleteNode (Node *tree) |
| Recursive release the tree. | |
| void | Traverse (Node *tree) |
| void | Traverse (Node *tree) |
| In-order traverse the tree, print items. | |
| void | PrintNode (std::ofstream &ofs, Node *node, int64_t parent_index, int64_t index, int8_t parent_child_index) |
| void | PrintNode (std::ofstream &ofs, Node *node, int64_t parent_index, int64_t index, int8_t parent_child_index) |
| Print the tree to a dot file. You can convert it to picture with graphviz. | |
Private Attributes | |
| Node * | root_ {nullptr} |
| Node * | root_ {nullptr} |
| root node of the tree | |
Do the actual left rotate operation.
-Given parent node, and the pivot item index, the left rotate operation is uniquely identified. The function assume the requirements are fulfilled and won't do any extra check. This function is call by TryLeftRotate(), and the condition checking should be done before call it.
+Given parent node, and the pivot item index, the left rotate operation is uniquely identified. The function assume the requirements are fulfilled and won't do any extra check. This function is call by TryLeftRotate(), and the condition checking should be done before call it.
| parent | the parent node in this right rotate operation | ||||
| Node * data_structures::tree_234::Tree234::Merge | ( | -Node * | -parent, | +Node * | parent, |
| - | int8_t | -index | -|||
| - | ) | -+ | int8_t | index ) |
nullptrDo the actual right rotate operation.
-Given parent node, and the pivot item index, the right rotate operation is uniquely identified. The function assume the requirements are fulfilled and won't do any extra check. This function is call by TryRightRotate(), and the condition checking should be done before call it.
+Given parent node, and the pivot item index, the right rotate operation is uniquely identified. The function assume the requirements are fulfilled and won't do any extra check. This function is call by TryRightRotate(), and the condition checking should be done before call it.
| parent | the parent node in this right rotate operation | |||||||
| Node * data_structures::tree_234::Tree234::SplitNode | ( | -Node * | -node | ) | +Node * | node | ) |
Functions for Eight Queens puzzle. -More...
+More...Functions for Eight Queens puzzle.
struct representing a trie node. - More...
+ More...Public Attributes | |
| std::unordered_map< char16_t, std::shared_ptr< Node > > | children |
| std::unordered_map< char16_t, std::shared_ptr< Node > > | children |
| bool | word_end = false | word_end = false<
diff --git a/d5/d15/classcll.html b/d5/d15/classcll.html
index 3bfbf0d10..09f3b9054 100644
--- a/d5/d15/classcll.html
+++ b/d5/d15/classcll.html
@@ -3,16 +3,18 @@
-
+
|
Public Member Functions | |
| void | display () |
| void | display () |
| void | insert_front (int new_data) |
| void | insert_front (int new_data) |
| void | insert_tail (int new_data) |
| void | insert_tail (int new_data) |
| int | get_size () |
| int | get_size () |
| bool | find_item (int item_to_find) |
| bool | find_item (int item_to_find) |
| int | operator* () |
| int | operator* () |
| void | operator++ () |
| void | operator++ () |
@@ -146,7 +148,7 @@ int | total | |||||
| cll::cll | ( | -) | +) | |||
Main function.
Public Member Functions | |
| MinHeapNode (char data, unsigned freq) | |
| MinHeapNode (char data, unsigned freq) | |
@@ -143,19 +145,12 @@ unsigned | freq | MinHeapNode::MinHeapNode | ( | -char | -data, | +char | data, |
| - | unsigned | -freq | -|||
| - | ) | -+ | unsigned | freq ) | |
This namespace contains layers used in MLP. -More...
+More...This namespace contains layers used in MLP.
Functions | |
| double | numerical_methods::gram_schmidt::dot_product (const std::array< double, 10 > &x, const std::array< double, 10 > &y, const int &c) |
| double | numerical_methods::gram_schmidt::dot_product (const std::array< double, 10 > &x, const std::array< double, 10 > &y, const int &c) |
| double | numerical_methods::gram_schmidt::projection (const std::array< double, 10 > &x, const std::array< double, 10 > &y, const int &c) |
| double | numerical_methods::gram_schmidt::projection (const std::array< double, 10 > &x, const std::array< double, 10 > &y, const int &c) |
| void | numerical_methods::gram_schmidt::display (const int &r, const int &c, const std::array< std::array< double, 10 >, 20 > &B) |
| void | numerical_methods::gram_schmidt::display (const int &r, const int &c, const std::array< std::array< double, 10 >, 20 > &B) |
| void | numerical_methods::gram_schmidt::gram_schmidt (int r, const int &c, const std::array< std::array< double, 10 >, 20 > &A, std::array< std::array< double, 10 >, 20 > B) |
| void | numerical_methods::gram_schmidt::gram_schmidt (int r, const int &c, const std::array< std::array< double, 10 >, 20 > &A, std::array< std::array< double, 10 >, 20 > B) |
| static void | test () |
| static void | test () |
| int | main () |
| int | main () |
| Main Function. | |
take make the process numerically stable, upper bound for the dot product take 0.1
multiply that factor with every element in a 3rd vector, whose initial values are same as the 2nd vector.
Various activation functions used in Neural network. -More...
+More...Various activation functions used in Neural network.
for IO operations -More...
+More...Classes |
Functions | |
| static std::size_t | hashDJB2 (std::string const &s) |
| static std::size_t | hashDJB2 (std::string const &s) |
| Function djb2 to get hash for the given string. | |
| static std::size_t | hashStr (std::string const &s) |
| static std::size_t | hashStr (std::string const &s) |
| Hash function, to get hash for the given string. | |
| std::size_t | hashInt_1 (int x) |
| std::size_t | hashInt_1 (int x) |
| Hash function for test | |
| std::size_t | hashInt_2 (int x) |
| std::size_t | hashInt_2 (int x) |
| Hash function for test | |
PROBABILIT
| static std::size_t data_structures::hashDJB2 |
( |
- std::string const & |
- s | ) |
+ std::string const & | s | ) |
| |
Functions | |
| void | search::sublist_search::printLinkedList (Node *start) |
| void | search::sublist_search::printLinkedList (Node *start) |
| A simple function to print the linked list. | |
| Node * | search::sublist_search::makeLinkedList (const std::vector< uint64_t > &data) |
| Node * | search::sublist_search::makeLinkedList (const std::vector< uint64_t > &data) |
| Give a vector of data, it adds each element of vector in the linked list and return the address of head pointer. | |
| bool | search::sublist_search::sublistSearch (Node *sublist, Node *mainList) |
| bool | search::sublist_search::sublistSearch (Node *sublist, Node *mainList) |
| Main searching function. | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main (int argc, char *argv[]) |
| int | main (int argc, char *argv[]) |
| Main function. | |
< Main list in which sublist is to be searched
< boolean to check if the sublist exists or not
| arr | array to be sorted |
| n | size of array |
| i | node position in Binary Tress or element position in Array to be compared with it's childern |
| i | node position in Binary Tress or element position in Array to be compared with it's childern |
The merge() function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.
+The merge() function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.
| arr | - array with two halves arr[l...m] and arr[m+1...r] | ||||
| void mergeSort | ( | -int * | -arr, | +int * | arr, |
| - | int | -l, | +int | l, | |
| - | int | -r | -|||
| - | ) | -+ | int | r ) |
Merge sort is a divide and conquer algorithm, it divides the input array into two halves and calls itself for the two halves and then calls merge() to merge the two halves
+Merge sort is a divide and conquer algorithm, it divides the input array into two halves and calls itself for the two halves and then calls merge() to merge the two halves
| arr | - array to be sorted | ||||
| void show | ( | -int * | -arr, | +int * | arr, |
| - | int | -size | -|||
| - | ) | -+ | int | size ) |
class encapsulating the necessary test cases - More...
+ More...Public Member Functions | |
| void | runTests () |
| void | runTests () |
| Executes test cases. | |
| void | testCase_1 () |
| void | testCase_1 () |
| A test case contains edge case, printing inorder successor of last node. | |
| void | testCase_2 () |
| void | testCase_2 () |
| A test case which contains main list of 100 elements and sublist of 20. | |
| void | testCase_3 () |
| void | testCase_3 () |
| A test case which contains main list of 50 elements and sublist of 20. | |
| void | runTests () |
| void | runTests () |
| Executes test cases. | |
| void | testCase_1 () |
| void | testCase_1 () |
| A test case contains edge case, Only contains one element. | |
| void | testCase_2 () |
| void | testCase_2 () |
| A test case which contains main list of 100 elements and sublist of 20. | |
| void | testCase_3 () |
| void | testCase_3 () |
| A test case which contains main list of 50 elements and sublist of 20. | |
| void | runTests () |
| void | runTests () |
| Executes test cases. | |
| void | testCase_1 () |
| void | testCase_1 () |
| A test case with single input. | |
| void | testCase_2 () |
| void | testCase_2 () |
| A test case with input array of length 500. | |
| void | testCase_3 () |
| void | testCase_3 () |
| A test case with array of length 1000. | |
Private Member Functions | |
| template<typename T > | |
| void | log (T msg) |
| void | log (T msg) |
| A function to print given message on console. | |
| template<typename T > | |
| void | log (T msg) |
| void | log (T msg) |
| A function to print given message on console. | |
| template<typename T > | |
| void | log (T msg) |
| void | log (T msg) |
| A function to print64_t given message on console. | |
Executes test cases.
Executes test cases.
Executes test cases.
Functions | |
| static void | test () |
| static void | test () |
| Test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Main function.
Main function.
Functions for Palindrome Partitioning algorithm. -More...
+More...Functions for Palindrome Partitioning algorithm.
Creates an array to be used as stack for storing values. - More...
+ More...Public Attributes | |
| std::array< float, 20 > | stack {} |
| std::array< float, 20 > | stack {} |
| Array which will be used to store numbers in the input. | |
| @@ -151,7 +153,7 @@ int | stackTop = -1 | diff --git a/d5/d8a/trie__using__hashmap_8cpp.html b/d5/d8a/trie__using__hashmap_8cpp.html index 17a26f01a..99402b328 100644 --- a/d5/d8a/trie__using__hashmap_8cpp.html +++ b/d5/d8a/trie__using__hashmap_8cpp.html @@ -3,16 +3,18 @@ - +
Functions | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| int | dynamic_programming::palindrome_partitioning::pal_part (const std::string &str) |
| int | dynamic_programming::palindrome_partitioning::pal_part (const std::string &str) |
| static void | test () |
| static void | test () |
| Test Function. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
for working with vectors -More...
+More...Functions | |
| template<class T > | |
| int64_t | binary_search (std::vector< T > &arr, T val, int64_t low, int64_t high) |
| int64_t | binary_search (std::vector< T > &arr, T val, int64_t low, int64_t high) |
| Binary search function to find the most suitable pace for an element. | |
| template<typename T > | |
| void | insertionSort_binsrch (std::vector< T > &arr) |
| void | insertionSort_binsrch (std::vector< T > &arr) |
| Insertion sort function to sort the vector. | |
| template<typename T , size_t N> | |
| std::array< T, N > | shuffle (std::array< T, N > arr) |
| std::array< T, N > | shuffle (std::array< T, N > arr) |
| template<typename T , size_t N> | |
| std::array< T, N > | randomized_bogosort (std::array< T, N > arr) |
| std::array< T, N > | randomized_bogosort (std::array< T, N > arr) |
| template<typename T > | |
| void | gnomeSort (T *arr, int size) |
| void | gnomeSort (T *arr, int size) |
| template<typename T , size_t size> | |
| std::array< T, size > | gnomeSort (std::array< T, size > arr) |
| std::array< T, size > | gnomeSort (std::array< T, size > arr) |
| template<typename T > | |
| void | insertionSort (T *arr, int n) |
| void | insertionSort (T *arr, int n) |
| Insertion Sort Function. | |
| template<typename T > | |
| void | insertionSort (std::vector< T > *arr) |
| void | insertionSort (std::vector< T > *arr) |
| template<class Iterator > | |
| void | merge (Iterator l, Iterator r, const Iterator e, char b[]) |
| void | merge (Iterator l, Iterator r, const Iterator e, char b[]) |
| merges 2 sorted adjacent segments into a larger sorted segment | |
| template<class Iterator > | |
| void | non_recursive_merge_sort (const Iterator first, const Iterator last, const size_t n) |
| void | non_recursive_merge_sort (const Iterator first, const Iterator last, const size_t n) |
| bottom-up merge sort which sorts elements in a non-decreasing order | |
| template<class Iterator > | |
| void | non_recursive_merge_sort (const Iterator first, const size_t n) |
| void | non_recursive_merge_sort (const Iterator first, const size_t n) |
| bottom-up merge sort which sorts elements in a non-decreasing order | |
| template<class Iterator > | |
| void | non_recursive_merge_sort (const Iterator first, const Iterator last) |
| void | non_recursive_merge_sort (const Iterator first, const Iterator last) |
| bottom-up merge sort which sorts elements in a non-decreasing order | |
| template<std::size_t N> | |
| std::array< int, N > | pigeonSort (std::array< int, N > arr) |
| std::array< int, N > | pigeonSort (std::array< int, N > arr) |
| template<typename T > | |
| void | quicksort (std::vector< T > *arr, int32_t low, int32_t high) |
| void | quicksort (std::vector< T > *arr, int32_t low, int32_t high) |
| template<typename T > | |
| std::vector< T > | quicksort (std::vector< T > arr, int32_t low, int32_t high) |
| std::vector< T > | quicksort (std::vector< T > arr, int32_t low, int32_t high) |
| template<typename T > | |
| void | recursive_bubble_sort (std::vector< T > *nums, uint64_t n) |
| void | recursive_bubble_sort (std::vector< T > *nums, uint64_t n) |
This is an implementation of the recursive_bubble_sort. A vector is passed to the function which is then dereferenced, so that the changes are reflected in the original vector. It also accepts a second parameter of type int and name n, which is the size of the array. | |
| std::vector< uint64_t > | selectionSort (const std::vector< uint64_t > &arr, uint64_t len) |
| std::vector< uint64_t > | selectionSort (const std::vector< uint64_t > &arr, uint64_t len) |
| template<typename T > | |
| void | shell_sort (T *arr, size_t LEN) |
| void | shell_sort (T *arr, size_t LEN) |
| template<typename T , size_t N> | |
| void | shell_sort (T(&arr)[N]) |
| void | shell_sort (T(&arr)[N]) |
| template<typename T > | |
| void | shell_sort (std::vector< T > *arr) |
| void | shell_sort (std::vector< T > *arr) |
function overload - when input array is of type std::vector, simply send the data content and the data length to the above function.
function overload - when input array is of a known length array type
Struct representation of the treap. - More...
+ More...Public Member Functions | |
| Treap () | |
| Treap () | |
| Initialization. | |
| void | update (int x) |
| void | update (int x) |
| Update the subtree size of the node. | |
| void | rotate (int &x, int t) |
| void | rotate (int &x, int t) |
| Rotate without breaking the property of BST. | |
| void | _insert (int &x, int k) |
| void | _insert (int &x, int k) |
| Insert a value into the specified subtree (internal method) | |
| void | _erase (int &x, int k) |
| void | _erase (int &x, int k) |
| Erase a value from the specified subtree (internal method) | |
| int | _get_k_th (int &x, int k) |
| int | _get_k_th (int &x, int k) |
| Find the KTH largest value (internal method) | |
| int | _get_rank (int x, int k) |
| int | _get_rank (int x, int k) |
| Query the rank of specified element (internal method) | |
| int | get_predecessor (int k) |
| int | get_predecessor (int k) |
| Get the predecessor node of element k. | |
| int | get_next (int k) |
| int | get_next (int k) |
| Get the successor node of element k. | |
| void | insert (int k) |
| void | insert (int k) |
| Insert element (External method) | |
| void | erase (int k) |
| void | erase (int k) |
| Erase element (External method) | |
| int | get_k_th (int k) |
| int | get_k_th (int k) |
| Get the KTH largest value (External method) | |
| int | get_rank (int k) |
| int | get_rank (int k) |
| Get the rank of specified element (External method) | |
| root = 0 | inttreapCnt = 0 |
| Total number of current nodes in the treap. | |
| std::array< int, maxNode > | key = {} |
| std::array< int, maxNode > | key = {} |
| Node identifier. | |
| std::array< int, maxNode > | priority = {} |
| std::array< int, maxNode > | priority = {} |
| Random priority. | |
| std::array< std::array< int, 2 >, maxNode > | childs |
| std::array< std::array< int, 2 >, maxNode > | childs |
| std::array< int, maxNode > | cnt |
| std::array< int, maxNode > | cnt |
| Maintains the subtree size for ranking query. | |
| std::array< int, maxNode > | size = {} |
| std::array< int, maxNode > | size = {} |
| The number of copies per node. | |
Initialization.
-Functions | |
| uint32_t | hashing::md5::leftRotate32bits (uint32_t n, std::size_t rotate) |
| uint32_t | hashing::md5::leftRotate32bits (uint32_t n, std::size_t rotate) |
| Rotates the bits of a 32-bit unsigned integer. | |
| bool | hashing::md5::isBigEndian () |
| bool | hashing::md5::isBigEndian () |
| Checks whether integers are stored as big endian or not. | |
| uint32_t | hashing::md5::toLittleEndian32 (uint32_t n) |
| uint32_t | hashing::md5::toLittleEndian32 (uint32_t n) |
| Sets 32-bit integer to little-endian if needed. | |
| uint64_t | hashing::md5::toLittleEndian64 (uint64_t n) |
| uint64_t | hashing::md5::toLittleEndian64 (uint64_t n) |
| Sets 64-bit integer to little-endian if needed. | |
| std::string | hashing::md5::sig2hex (void *sig) |
| std::string | hashing::md5::sig2hex (void *sig) |
| Transforms the 128-bit MD5 signature into a 32 char hex string. | |
| void * | hashing::md5::hash_bs (const void *input_bs, uint64_t input_size) |
| void * | hashing::md5::hash_bs (const void *input_bs, uint64_t input_size) |
| The MD5 algorithm itself, taking in a bytestring. | |
| void * | hashing::md5::hash (const std::string &message) |
| void * | hashing::md5::hash (const std::string &message) |
| Converts the string to bytestring and calls the main algorithm. | |
| static void | test () |
| static void | test () |
| Self-test implementations of well-known MD5 hashes. | |
| static void | interactive () |
| static void | interactive () |
| Puts user in a loop where inputs can be given and MD5 hash will be computed and printed. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Public Member Functions | |
| node (int d) | |
| node (int d) | |
@@ -164,8 +166,7 @@ char | color | |||||||
| node::node | ( | -int | -d | ) | +int | d | ) | |
Functions for Jarvis’s algorithm. -More...
+More...Functions for Jarvis’s algorithm.
Structure of List with supporting methods. - More...
+ More...Public Member Functions | |
| uint64_t | BinarySearch (const std::array< uint64_t, N > &dataArr, const uint64_t &first, const uint64_t &last, const uint64_t &val) |
| uint64_t | BinarySearch (const std::array< uint64_t, N > &dataArr, const uint64_t &first, const uint64_t &last, const uint64_t &val) |
| Search an element in the list using binarySearch. | |
| uint64_t | LinearSearch (const std::array< uint64_t, N > &dataArr, const uint64_t &val) const |
| uint64_t | LinearSearch (const std::array< uint64_t, N > &dataArr, const uint64_t &val) const |
| Search an element using linear search. | |
| uint64_t | search (const uint64_t &val) |
| uint64_t | search (const uint64_t &val) |
| void | sort () |
| void | sort () |
| Sort the list. | |
| void | insert (const uint64_t &val) |
| void | insert (const uint64_t &val) |
| Insert the new element in the list. | |
| void | remove (const uint64_t &val) |
| void | remove (const uint64_t &val) |
| To remove the element from the list. | |
| void | show () |
| void | show () |
| Utility function to print array. | |
Public Attributes | |||||
| std::array< uint64_t, N > | data {} | ||||
| std::array< uint64_t, N > | data {} | ||||
| uint64_t | top = 0 | ||||
| uint64_t data_structures::list_array::list< N >::BinarySearch | ( | -const std::array< uint64_t, N > & | -dataArr, | +const std::array< uint64_t, N > & | dataArr, |
| - | const uint64_t & | -first, | +const uint64_t & | first, | |
| - | const uint64_t & | -last, | +const uint64_t & | last, | |
| - | const uint64_t & | -val | -|||
| - | ) | -+ | const uint64_t & | val ) | |
Functions | |
| void | test1 (double eta=0.01) |
| void | test1 (double eta=0.01) |
| void | test2 (double eta=0.01) |
| void | test2 (double eta=0.01) |
| void | test3 (double eta=0.01) |
| void | test3 (double eta=0.01) |
| int | main (int argc, char **argv) |
| int | main (int argc, char **argv) |
@@ -170,19 +172,12 @@ Variables | |||||
| int main | ( | -int | -argc, | +int | argc, |
| - | char ** | -argv | -|||
| - | ) | -+ | char ** | argv ) | |
0.010.010.01Main function.
Queue_Array class containing the main data and also index of head and tail of the array. - More...
+ More...Public Member Functions | |
| void | enqueue (const int16_t &) |
| void | enqueue (const int16_t &) |
| Add element to the first of the queue. | |
| int | dequeue () |
| int | dequeue () |
| Delete element from back of the queue. | |
| void | display () const |
| void | display () const |
| Show all saved data. | |
Private Attributes | |
| int8_t | front {-1} |
| int8_t | front {-1} |
| Index of head of the array. | |
| int8_t | rear {-1} |
| int8_t | rear {-1} |
| Index of tail of the array. | |
| std::array< int16_t, max_size > | arr {} |
| std::array< int16_t, max_size > | arr {} |
| All stored data. | |
Show all saved data.
Utility function to show all elements in the queue.
Functions | |
| Node * | data_structures::linked_list::copy_all_nodes (const Node *const node) |
| Node * | data_structures::linked_list::copy_all_nodes (const Node *const node) |
| creates a deep copy of a list starting at the input node | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| void | test_copy_constructor () |
| void | test_copy_constructor () |
| void | test_assignment_operator () |
| void | test_assignment_operator () |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Hashing algorithms. -More...
+More...Hashing algorithms.
For std::vector.
@@ -116,7 +118,7 @@ $(document).ready(function(){initNavTree('d6/d0c/namespacehashing.html','../../' diff --git a/d6/d10/cut__rod_8cpp.html b/d6/d10/cut__rod_8cpp.html index c4ed8720c..39935689f 100644 --- a/d6/d10/cut__rod_8cpp.html +++ b/d6/d10/cut__rod_8cpp.html @@ -3,16 +3,18 @@ - +Main function.
Implementation of Hill Cipher algorithm. - More...
+ More...Static Public Member Functions | |
| static matrix< int > | generate_encryption_key (size_t size, int limit1=0, int limit2=10) |
| static matrix< int > | generate_encryption_key (size_t size, int limit1=0, int limit2=10) |
| Generate encryption matrix of a given size. Larger size matrices are difficult to generate but provide more security. Important conditions are: | |
| static matrix< int > | generate_decryption_key (matrix< int > const &encrypt_key) |
| static matrix< int > | generate_decryption_key (matrix< int > const &encrypt_key) |
| Generate decryption matrix from an encryption matrix key. | |
| static std::pair< matrix< int >, matrix< int > > | generate_keys (size_t size, int limit1=0, int limit2=10) |
| static std::pair< matrix< int >, matrix< int > > | generate_keys (size_t size, int limit1=0, int limit2=10) |
| Generate encryption and decryption key pair. | |
| static const std::string | encrypt_text (const std::string &text, const matrix< int > &encrypt_key) |
| static const std::string | encrypt_text (const std::string &text, const matrix< int > &encrypt_key) |
| Encrypt a given text using a given key. | |
| static const std::string | decrypt_text (const std::string &text, const matrix< int > &decrypt_key) |
| static const std::string | decrypt_text (const std::string &text, const matrix< int > &decrypt_key) |
| Decrypt a given text using a given key. | |
Static Private Member Functions | |
| template<typename T1 , typename T2 > | |
| static const T2 | rand_range (T1 a, T1 b) |
| static const T2 | rand_range (T1 a, T1 b) |
| Function to generate a random integer in a given interval. | |
| template<typename T1 , typename T2 > | |
| static double | rand_range (matrix< T2 > *M, T1 a, T1 b) |
| static double | rand_range (matrix< T2 > *M, T1 a, T1 b) |
| Function overload to fill a matrix with random integers in a given interval. | |
| template<typename T > | |
| static const T | gcd (T a, T b) |
| static const T | gcd (T a, T b) |
| Compute GCD of two integers using Euler's algorithm. | |
| static const std::valarray< uint8_t > | mat_mul (const std::valarray< uint8_t > &vector, const matrix< int > &key) |
| static const std::valarray< uint8_t > | mat_mul (const std::valarray< uint8_t > &vector, const matrix< int > &key) |
| helper function to perform vector multiplication with encryption or decryption matrix | |
| static char | get_idx_char (const uint8_t idx) |
| static char | get_idx_char (const uint8_t idx) |
| Get the character at a given index in the STRKEY. | |
| static uint8_t | get_char_idx (const char ch) |
| static uint8_t | get_char_idx (const char ch) |
| Get the index of a character in the STRKEY. | |
| static const std::string | codec (const std::string &text, const matrix< int > &key) |
| static const std::string | codec (const std::string &text, const matrix< int > &key) |
| Convenience function to perform block cipher operations. The operations are identical for both encryption and decryption. | |
| template<typename T > | |
| static matrix< double > | get_inverse (matrix< T > const &A) |
| static matrix< double > | get_inverse (matrix< T > const &A) |
| static int | modulo (int a, int b) |
| static int | modulo (int a, int b) |
| static matrix< int > ciphers::HillCipher::generate_decryption_key | +static matrix< int > ciphers::HillCipher::generate_decryption_key | ( | -matrix< int > const & | -encrypt_key | ) | +matrix< int > const & | encrypt_key | ) |
| static matrix< int > ciphers::HillCipher::generate_encryption_key | +static matrix< int > ciphers::HillCipher::generate_encryption_key | ( | -size_t | -size, | +size_t | size, |
| - | int | -limit1 = 0, |
+ int | limit1 = 0, | ||
| - | int | -limit2 = 10 |
- ||||
| - | ) | -+ | int | limit2 = 10 ) |
| static std::pair< matrix< int >, matrix< int > > ciphers::HillCipher::generate_keys | +static std::pair< matrix< int >, matrix< int > > ciphers::HillCipher::generate_keys | ( | -size_t | -size, | +size_t | size, |
| - | int | -limit1 = 0, |
+ int | limit1 = 0, | ||
| - | int | -limit2 = 10 |
- ||||
| - | ) | -+ | int | limit2 = 10 ) |
| static matrix< double > ciphers::HillCipher::get_inverse | +static matrix< double > ciphers::HillCipher::get_inverse | ( | -matrix< T > const & | -A | ) | +matrix< T > const & | A | ) |
Functions | |
| std::uint32_t | dynamic_programming::house_robber::houseRobber (const std::vector< uint32_t > &money, const uint32_t &n) |
| std::uint32_t | dynamic_programming::house_robber::houseRobber (const std::vector< uint32_t > &money, const uint32_t &n) |
| The main function that implements the House Robber algorithm using dynamic programming. | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| std::string | ciphers::caesar::encrypt (const std::string &text, const int &shift) |
| std::string | ciphers::caesar::encrypt (const std::string &text, const int &shift) |
| std::string | ciphers::caesar::decrypt (const std::string &text, const int &shift) |
| std::string | ciphers::caesar::decrypt (const std::string &text, const int &shift) |
| void | test () |
| void | test () |
| int | main () |
| int | main () |
Driver Code
Functions | |
| uint64_t | imod (uint64_t x, uint64_t y) |
| uint64_t | imod (uint64_t x, uint64_t y) |
| for IO operations | |
| static void | test () |
| static void | test () |
| self-test implementations | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| static void | tests () |
| static void | tests () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Public Member Functions | |
| adaline (int num_features, const double eta=0.01f, const double accuracy=1e-5) | |
| adaline (int num_features, const double eta=0.01f, const double accuracy=1e-5) | |
| int | predict (const std::vector< double > &x, double *out=nullptr) |
| int | predict (const std::vector< double > &x, double *out=nullptr) |
| double | fit (const std::vector< double > &x, const int &y) |
| double | fit (const std::vector< double > &x, const int &y) |
| template<size_t N> | |
| void | fit (std::array< std::vector< double >, N > const &X, std::array< int, N > const &Y) |
| void | fit (std::array< std::vector< double >, N > const &X, std::array< int, N > const &Y) |
| int | activation (double x) |
| int | activation (double x) |
Private Member Functions | |
| bool | check_size_match (const std::vector< double > &x) |
| bool | check_size_match (const std::vector< double > &x) |
@@ -148,7 +150,7 @@ const double | accuracy< | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const adaline &ada) |
| std::ostream & | operator<< (std::ostream &out, const adaline &ada) |
0.01f, 1e-5 false size does not match nullptr Operator to print the weights of the model
Functions | |
| int64_t | bit_manipulation::find_non_repeating_integer::find_non_repeating_integer (const std::vector< int > &nums) |
| int64_t | bit_manipulation::find_non_repeating_integer::find_non_repeating_integer (const std::vector< int > &nums) |
| The main function implements find single number. | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main (int argc, char *argv[]) |
| int | main (int argc, char *argv[]) |
| Main function. | |
Variables | ||||||||||||||||||
| constexpr uint32_t | data_structures::sparse_table::N = 12345 | |||||||||||||||||
| constexpr uint32_t | data_structures::sparse_table::N = 12345 | |||||||||||||||||
A struct to represent sparse table for min() as their invariant function, for the given array A. The answer to queries are stored in the array ST. | ||||||||||||||||||
| @@ -155,7 +157,7 @@ constexpr uint8_t | data_str
Sparse Table is a data structure, that allows answering range queries. It can answer most range queries in O(logn), but its true power is answering range minimum queries (or equivalent range maximum queries). For those queries it can compute the answer in O(1) time. The only drawback of this data structure is, that it can only be used on immutable arrays. This means, that the array cannot be changed between two queries. If any element in the array changes, the complete data structure has to be recomputed. -
Function Documentation@@ -167,19 +169,12 @@ constexpr uint8_t | data_str
| int main |
( |
- int |
- argc, |
+ int | argc, |
|
- | char * |
- argv[] |
-
- | ) |
-
+ | char * | argv[] ) |
| |
Main function
Functions for testing the miller_rabin_primality_test() function with some assert statements.
+Functions for testing the miller_rabin_primality_test() function with some assert statements.
Definition of struct Point. - More...
+ More...Public Member Functions | |
| bool | operator== (const Point &p) |
| bool | operator== (const Point &p) |
| x and y co-ordinates | |
Friends | |
| std::ostream & | operator<< (std::ostream &op, const Point &p) |
| std::ostream & | operator<< (std::ostream &op, const Point &p) |
| ostream operator for printing Point | |
Functions | |
| double | addition_rule_independent (double A, double B) |
| double | addition_rule_independent (double A, double B) |
| double | addition_rule_dependent (double A, double B, double B_given_A) |
| double | addition_rule_dependent (double A, double B, double B_given_A) |
| int | main () |
| int | main () |
Algorithms for encryption and decryption. -More...
+More...Namespaces |
Variables | |
| static const char * | STRKEY |
| static const char * | STRKEY |
Functions for Word Break problem. -More...
+More...Functions for Word Break problem.
main function
Functions | |
| void | forward_euler_step (const double dx, const double x, std::valarray< double > *y, std::valarray< double > *dy) |
| void | forward_euler_step (const double dx, const double x, std::valarray< double > *y, std::valarray< double > *dy) |
| Compute next step approximation using the forward-Euler method. | |
| double | forward_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| double | forward_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| Compute approximation using the forward-Euler method in the given limits. | |
| void | midpoint_euler_step (const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| void | midpoint_euler_step (const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| Compute next step approximation using the midpoint-Euler method. | |
| double | midpoint_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| double | midpoint_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| Compute approximation using the midpoint-Euler method in the given limits. | |
| void | semi_implicit_euler_step (const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| void | semi_implicit_euler_step (const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| Compute next step approximation using the semi-implicit-Euler method. | |
| double | semi_implicit_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| double | semi_implicit_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| Compute approximation using the semi-implicit-Euler method in the given limits. | |
Integration functions for implementations with solving ordinary differential equations (ODEs) of any order and and any number of independent variables.
+Integration functions for implementations with solving ordinary differential equations (ODEs) of any order and and any number of independent variables.
false false false Functions for Kadane algorithm. -More...
+More...Functions for Kadane algorithm.
Functions | |
| double | get_minima (const std::function< double(double)> &f, double lim_a, double lim_b) |
| double | get_minima (const std::function< double(double)> &f, double lim_a, double lim_b) |
| Get the minima of a function in the given interval. To get the maxima, simply negate the function. The golden ratio used here is: | |
| void | test1 () |
| void | test1 () |
| Test function to find minima for the function \(f(x)= (x-2)^2\) in the interval \([1,5]\) Expected result = 2. | |
| void | test2 () |
| void | test2 () |
| Test function to find maxima for the function \(f(x)= x^{\frac{1}{x}}\) in the interval \([-2,10]\) Expected result: \(e\approx 2.71828182845904509\). | |
| void | test3 () |
| void | test3 () |
| Test function to find maxima for the function \(f(x)= \cos x\) in the interval \([0,12]\) Expected result: \(\pi\approx 3.14159265358979312\). | |
| int | main () |
| int | main () |
Typedefs | |
| -using | double_hashing::Entry = Entry |
| +using | double_hashing::Entry = struct Entry |
Functions | |
| void | double_hashing::removalInfo (int key) |
| int | main () |
| int | main () |
@@ -202,8 +204,7 @@ bool | double_hashing::rehas
| int main |
( |
- void |
- ) |
+ void | ) |
| | |||
Functions | |
| bool | dynamic_programming::subset_sum::subset_sum_recursion (const std::vector< int > &arr, int targetSum, std::vector< std::unordered_map< int, bool > > *dp, int index=0) |
| bool | dynamic_programming::subset_sum::subset_sum_recursion (const std::vector< int > &arr, int targetSum, std::vector< std::unordered_map< int, bool > > *dp, int index=0) |
| bool | dynamic_programming::subset_sum::subset_sum_problem (const std::vector< int > &arr, const int targetSum) |
| bool | dynamic_programming::subset_sum::subset_sum_problem (const std::vector< int > &arr, const int targetSum) |
| static void | test () |
| static void | test () |
| Test Function. | |
| int | main () |
| int | main () |
| Main function. | |
0 Contains hash array and functions to update it and convert it to a hexadecimal string. - More...
+ More...Public Member Functions | |
| void | update (const std::array< uint32_t, 64 > &blocks) |
| void | update (const std::array< uint32_t, 64 > &blocks) |
| Updates the hash array. | |
| std::string | to_string () const |
| std::string | to_string () const |
| Convert the hash to a hexadecimal string. | |
Private Attributes | |
| std::array< uint32_t, 8 > | hash |
| std::array< uint32_t, 8 > | hash |
Functions for [Morse Code] (https://en.wikipedia.org/wiki/Morse_code). -More...
+More...Functions for [Morse Code] (https://en.wikipedia.org/wiki/Morse_code).
Functions | |
| bool | test1 () |
| bool | test1 () |
| bool | test2 () |
| bool | test2 () |
| int | main (int argc, char *argv[]) |
| int | main (int argc, char *argv[]) |
Functions for vigenère cipher algorithm. -More...
+More...Functions for vigenère cipher algorithm.
LRU cache class. - More...
+ More...Public Member Functions | |
| LRUCache (uint64_t pf) | |
| LRUCache (uint64_t pf) | |
| Constructor, Initialize thee LRU class with page frame. | |
| void | refer (uint64_t page) |
| void | refer (uint64_t page) |
| Refer to a page, or request a page from memory. | |
| void | display () |
| void | display () |
| A function to display the current cache. | |
| uint64_t | getHits () const |
| uint64_t | getHits () const |
| A function to get page hits. | |
| uint64_t | getPageFault () const |
| uint64_t | getPageFault () const |
| A function to get page fault. | |
| pageFrame | std::unordered_map< uint64_t, std::list< uint64_t >::iterator >pageMap |
| Hash map containing pages and their addresses. | |
| uint64_t | hits |
| uint64_t | hits |
| was found in cache. | |
| uint64_t | pageFault = 0 |
| uint64_t | pageFault = 0 |
A function to get page hits.
A function to get page fault.
< Increase the page fault by one.
Functions | |
| double | binomial_expected (double n, double p) |
| double | binomial_expected (double n, double p) |
| double | binomial_variance (double n, double p) |
| double | binomial_variance (double n, double p) |
| double | binomial_standard_deviation (double n, double p) |
| double | binomial_standard_deviation (double n, double p) |
| double | nCr (double n, double r) |
| double | nCr (double n, double r) |
| double | binomial_x_successes (double n, double p, double x) |
| double | binomial_x_successes (double n, double p, double x) |
| double | binomial_range_successes (double n, double p, double lower_bound, double upper_bound) |
| double | binomial_range_successes (double n, double p, double lower_bound, double upper_bound) |
| int | main () |
| int | main () |
calculates the probability of exactly x successes
main function
Main function.
Class which contains all methods required for calculating nCr mod p. - More...
+ More...Public Member Functions | |
| NCRModuloP (const uint64_t &size, const uint64_t &mod) | |
| NCRModuloP (const uint64_t &size, const uint64_t &mod) | |
| the p from (nCr % p) | |
| uint64_t | gcdExtended (const uint64_t &a, const uint64_t &b, int64_t *x, int64_t *y) |
| uint64_t | gcdExtended (const uint64_t &a, const uint64_t &b, int64_t *x, int64_t *y) |
| int64_t | modInverse (const uint64_t &a, const uint64_t &m) |
| int64_t | modInverse (const uint64_t &a, const uint64_t &m) |
| int64_t | ncr (const uint64_t &n, const uint64_t &r, const uint64_t &p) |
| int64_t | ncr (const uint64_t &n, const uint64_t &r, const uint64_t &p) |
Private Attributes | |||||
| std::vector< uint64_t > | fac {} | ||||
| std::vector< uint64_t > | fac {} | ||||
| uint64_t | p = 0 | p = 0 | math::ncr_modulo_p::NCRModuloP::NCRModuloP | ( | -const uint64_t & | -size, | +const uint64_t & | size, |
| - | const uint64_t & | -mod | -|||
| - | ) | -+ | const uint64_t & | mod ) | |
Constructor which precomputes the values of n! % mod from n=0 to size and stores them in vector 'fac' @params[in] the numbers 'size', 'mod'
@params[in] the numbers 'a' and 'm' from above equation
Main function
Functions | |
| void | problem (const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| void | problem (const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| Problem statement for a system with first-order differential equations. Updates the system differential variables. | |
| void | exact_solution (const double &x, std::valarray< double > *y) |
| void | exact_solution (const double &x, std::valarray< double > *y) |
| Exact solution of the problem. Used for solution comparison. | |
| void | midpoint_euler_step (const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| double | midpoint_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| Compute approximation using the midpoint-Euler method in the given limits. | |
| void | save_exact_solution (const double &X0, const double &X_MAX, const double &step_size, const std::valarray< double > &Y0) |
| void | save_exact_solution (const double &X0, const double &X_MAX, const double &step_size, const std::valarray< double > &Y0) |
| int | main (int argc, char *argv[]) |
| int | main (int argc, char *argv[]) |
The computation results are stored to a text file midpoint_euler.csv and the exact soltuion results in exact.csv for comparison.
To implement Van der Pol oscillator, change the problem function to:
To implement Van der Pol oscillator, change the problem function to:
Functions | |
| static void | test () |
| static void | test () |
| int | main () |
| int | main () |
Main function
Testing
Functions | |
| static void | test () |
| static void | test () |
| Test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| void | graph::bidirectional_dijkstra::addEdge (std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj1, std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj2, uint64_t u, uint64_t v, uint64_t w) |
| void | graph::bidirectional_dijkstra::addEdge (std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj1, std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj2, uint64_t u, uint64_t v, uint64_t w) |
| Function that add edge between two nodes or vertices of graph. | |
| uint64_t | graph::bidirectional_dijkstra::Shortest_Path_Distance (const std::vector< uint64_t > &workset_, const std::vector< std::vector< uint64_t > > &distance_) |
| uint64_t | graph::bidirectional_dijkstra::Shortest_Path_Distance (const std::vector< uint64_t > &workset_, const std::vector< std::vector< uint64_t > > &distance_) |
| This function returns the shortest distance from the source to the target if there is path between vertices 's' and 't'. | |
| int | graph::bidirectional_dijkstra::Bidijkstra (std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj1, std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj2, uint64_t s, uint64_t t) |
| int | graph::bidirectional_dijkstra::Bidijkstra (std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj1, std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj2, uint64_t s, uint64_t t) |
| Function runs the dijkstra algorithm for some source vertex and target vertex in the graph and returns the shortest distance of target from the source. | |
| static void | tests () |
| static void | tests () |
| Function to test the provided algorithm above. | |
| int | main () |
| int | main () |
| Main function. | |
Variables | |
| constexpr int64_t | INF = std::numeric_limits<int64_t>::max() |
| constexpr int64_t | INF = std::numeric_limits<int64_t>::max() |
| for store the graph, the distances, and the path | |
Main function.
Functions for the Graph Coloring algorithm,. -More...
+More...Functions for the Graph Coloring algorithm,.
Functions for Trie data structure using hashmap implementation. -More...
+More...Functions for Trie data structure using hashmap implementation.
@@ -161,8 +163,7 @@ constexpr int64_t | INF | |||||||
| int main | ( | -void | -) | +void | ) | |||
Main function
Macros | |
| #define | ll int64_t |
| #define | ll int64_t |
| #define | endl std::endl |
| #define | endl std::endl |
| #define | pb push_back |
| #define | pb push_back |
| #define | MOD 1000000007 |
Functions | |
| vector< vector< ll > > | multiply (const vector< vector< ll > > &A, const vector< vector< ll > > &B) |
| vector< vector< ll > > | multiply (const vector< vector< ll > > &A, const vector< vector< ll > > &B) |
| vector< vector< ll > > | power (const vector< vector< ll > > &A, ll p) |
| vector< vector< ll > > | power (const vector< vector< ll > > &A, ll p) |
| ll | ans (ll n) |
| ll | ans (ll n) |
| int | main () |
| int | main () |
Variables | |
| ll | mat_size |
| ll | mat_size |
| vector< ll > | fib_b |
| vector< ll > | fib_b |
| -vector< ll > | fib_c | fib_c |
| ll ans | +ll ans | ( | -ll | -n | ) | +ll | n | ) |
| vector< vector< ll > > multiply | +vector< vector< ll > > multiply | ( | -const vector< vector< ll > > & | -A, | +const vector< vector< ll > > & | A, |
| - | const vector< vector< ll > > & | -B | -||||
| - | ) | -+ | const vector< vector< ll > > & | B ) |
| vector< vector< ll > > power | +vector< vector< ll > > power | ( | -const vector< vector< ll > > & | -A, | +const vector< vector< ll > > & | A, |
| - | ll | -p | -||||
| - | ) | -+ | ll | p ) |
global vector variables used in the ans function.
global vector variables used in the ans function.
global variable mat_size
global variable mat_size
Functions for the Travelling Salesman Bitmask implementation. -More...
+More...Functions for the Travelling Salesman Bitmask implementation.
Functions for XOR cipher algorithm. -More...
+More...Functions for XOR cipher algorithm.
Functions for the [K-Nearest Neighbors algorithm] (https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm) implementation. -More...
+More...Functions for the [K-Nearest Neighbors algorithm] (https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm) implementation.
Functions | |
| std::uint64_t | bit_manipulation::count_bits_flip::countBitsFlip (std::int64_t A, std::int64_t B) |
| std::uint64_t | bit_manipulation::count_bits_flip::countBitsFlip (std::int64_t A, std::int64_t B) |
| The main function implements count of bits flip required. | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions | |
| std::string | dynamic_programming::shortest_common_supersequence::scs (const std::string &str1, const std::string &str2) |
| std::string | dynamic_programming::shortest_common_supersequence::scs (const std::string &str1, const std::string &str2) |
| static void | test () |
| static void | test () |
| int | main () |
| int | main () |
Macros | |
| -#define | EPSILON 1e-6 |
| #define | EPSILON 1e-6 |
| #define | MAX_ITERATIONS 50000 |
Functions | |
| static double | eq (double i) |
| static double | eq (double i) |
| template<typename T > | |
| int | sgn (T val) |
| int | sgn (T val) |
| int | main () |
| int | main () |
For the next iteration, the interval is selected as: \([a,x]\) if \(x>0\) or \([x,b]\) if \(x<0\). The Process is continued till a close enough approximation is achieved.
| #define EPSILON 1e-6 | +
Functions | |
| bool | dynamic_programming::abbreviation::abbreviation_recursion (std::vector< std::vector< bool > > *memo, std::vector< std::vector< bool > > *visited, const std::string &str, const std::string &result, uint32_t str_idx=0, uint32_t result_idx=0) |
| bool | dynamic_programming::abbreviation::abbreviation_recursion (std::vector< std::vector< bool > > *memo, std::vector< std::vector< bool > > *visited, const std::string &str, const std::string &result, uint32_t str_idx=0, uint32_t result_idx=0) |
| Recursive Dynamic Programming function. | |
| bool | dynamic_programming::abbreviation::abbreviation (const std::string &str, const std::string &result) |
| bool | dynamic_programming::abbreviation::abbreviation (const std::string &str, const std::string &result) |
| Iterative Dynamic Programming function. | |
| static void | test () |
| static void | test () |
| Self test-implementations. | |
| int | main () |
| int | main () |
| Main function. | |
0, 0 Main function.
Functions | |
| void | others::postfix_expression::push (float operand, Stack *stack) |
| void | others::postfix_expression::push (float operand, Stack *stack) |
| Pushing operand, also called the number in the array to the stack. | |
| float | others::postfix_expression::pop (Stack *stack) |
| float | others::postfix_expression::pop (Stack *stack) |
| Popping operand, also called the number from the stack. | |
| bool | others::postfix_expression::is_number (const std::string &s) |
| bool | others::postfix_expression::is_number (const std::string &s) |
| Checks if scanned string is a number. | |
| void | others::postfix_expression::evaluate (float a, float b, const std::string &operation, Stack *stack) |
| void | others::postfix_expression::evaluate (float a, float b, const std::string &operation, Stack *stack) |
| Evaluate answer using given last two operands from and operation. | |
| template<std::size_t N> | |
| float | others::postfix_expression::postfix_evaluation (std::array< std::string, N > input) |
| float | others::postfix_expression::postfix_evaluation (std::array< std::string, N > input) |
| Postfix Evaluation algorithm to compute the value from given input array. | |
| static void | test_function_1 () |
| static void | test_function_1 () |
| Test function 1 with input array {'2', '3', '1', '*', '+', '9', '-'}. | |
| static void | test_function_2 () |
| static void | test_function_2 () |
| Test function 2 with input array {'1', '2', '+', '2', '/', '5', '*', '7', '+'}. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
@@ -156,19 +158,12 @@ unsigned int | dest | ||||
| Edge::Edge | ( | -unsigned int | -source, | +unsigned int | source, |
| - | unsigned int | -destination | -|||
| - | ) | -+ | unsigned int | destination ) | |
Functions for Binomial coefficients implementation. -More...
+More...Functions for Binomial coefficients implementation.
Public Member Functions | |
| void | new_val (T x) |
| void | new_val (T x) |
| double | mean () const |
| double | mean () const |
| double | variance () const |
| double | variance () const |
| double | std () const |
| double | std () const |
@@ -139,7 +141,7 @@ T | K | |
Friends | |
| std::istream & | operator>> (std::istream &input, stats_computer1 &stat) |
| std::istream & | operator>> (std::istream &input, stats_computer1 &stat) |
return sample standard deviation computed till last sample
-Prime Factorization is a very important and useful technique to factorize any number into its prime factors. It has various applications in the field of number theory.
+Prime Factorization is a very important and useful technique to factorize any number into its prime factors. It has various applications in the field of number theory.
The method of prime factorization involves two function calls. First: Calculating all the prime number up till a certain range using the standard Sieve of Eratosthenes.
Second: Using the prime numbers to reduce the the given number and thus find all its prime factors.
The complexity of the solution involves approx. O(n logn) in calculating sieve of eratosthenes O(log n) in calculating the prime factors of the number. So in total approx. O(n logn).
@@ -111,7 +113,7 @@ $(document).ready(function(){initNavTree('d7/d7f/section.html','../../'); initRe diff --git a/d7/d81/namespacebit__manipulation.html b/d7/d81/namespacebit__manipulation.html index 49f24c990..150406f21 100644 --- a/d7/d81/namespacebit__manipulation.html +++ b/d7/d81/namespacebit__manipulation.html @@ -3,16 +3,18 @@ - +for IO operations -More...
+More...Functions | |
| uint64_t | next_higher_number (uint64_t x) |
| uint64_t | next_higher_number (uint64_t x) |
| The main function implements checking the next number. | |
| bool | isPowerOfTwo (std ::int64_t n) |
| bool | isPowerOfTwo (std ::int64_t n) |
| The main function implements check for power of 2. | |
Functions | |
| static void | test () |
| static void | test () |
| Testing function. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Range sum queries using prefix-sum-array. -More...
+More...Range sum queries using prefix-sum-array.
Functions | |
| uint64_t | double_factorial_iterative (uint64_t n) |
| uint64_t | double_factorial_iterative (uint64_t n) |
| uint64_t | double_factorial_recursive (uint64_t n) |
| uint64_t | double_factorial_recursive (uint64_t n) |
| void | test (uint64_t n, uint64_t expected) |
| void | test (uint64_t n, uint64_t expected) |
| void | tests () |
| void | tests () |
| int | main () |
| int | main () |
Main function
for IO operations - More...
+ More...Public Attributes | |
| int | val {0} |
| int | val {0} |
| the value stored in the node | |
| ListNode * | next {nullptr} |
| ListNode * | next {nullptr} |
| pointer to the next node | |
Implementation of 0-1 Knapsack problem. -More...
+More...Implementation of 0-1 Knapsack problem.
@@ -164,7 +166,7 @@ Variables | ||||||||
| int main | ( | -void | -) | +void | ) | |||
Functions | |
| static void | test () |
| static void | test () |
| Function to test a simple search before and after deleting an entry. And to test out the multiple variants of search. | |
| int | main (int argc, char const *argv[]) |
| int | main (int argc, char const *argv[]) |
| Main function. | |
Functions | |
| int | main () |
| int | main () |
Functions for Eight Queens puzzle optimized. -More...
+More...Functions for Eight Queens puzzle optimized.
Functions for Strand Sort algorithm. -More...
+More...Functions for Strand Sort algorithm.
Range query here is range sum, but the code can be modified to make different queries like range max or min. - More...
+ More...Public Member Functions | |
| void | construct (const std::vector< int64_t > &vec) |
| void | construct (const std::vector< int64_t > &vec) |
| Constructing the segment tree with the values in the passed vector. Returned root pointer is pushed in the pointers vector to have access to the original version if the segment tree is updated. | |
| void | update (const uint32_t &l, const uint32_t &r, const int64_t &value) |
| void | update (const uint32_t &l, const uint32_t &r, const int64_t &value) |
| Doing range update by passing the left and right indexes of the range as well as the value to be added. | |
| int64_t | query (const uint32_t &l, const uint32_t &r, const uint32_t &version) |
| int64_t | query (const uint32_t &l, const uint32_t &r, const uint32_t &version) |
| Querying the range from index l to index r, getting the sum of the elements whose index x satisfies l<=x<=r. | |
| uint32_t | size () |
| uint32_t | size () |
| Getting the number of versions after updates so far which is equal to the size of the pointers vector. | |
Private Member Functions | |
| std::shared_ptr< Node > | newKid (std::shared_ptr< Node > const &curr) |
| std::shared_ptr< Node > | newKid (std::shared_ptr< Node > const &curr) |
| Creating a new node with the same values of curr node. | |
| void | lazy (const uint32_t &i, const uint32_t &j, std::shared_ptr< Node > const &curr) |
| void | lazy (const uint32_t &i, const uint32_t &j, std::shared_ptr< Node > const &curr) |
| If there is some value to be propagated to the passed node, value is added to the node and the children of the node, if exist, are copied and the propagated value is also added to them. | |
| std::shared_ptr< Node > | construct (const uint32_t &i, const uint32_t &j) |
| std::shared_ptr< Node > | construct (const uint32_t &i, const uint32_t &j) |
| Constructing the segment tree with the early passed vector. Every call creates a node to hold the sum of the given range, set its pointers to the children, and set its value to the sum of the children's values. | |
| std::shared_ptr< Node > | update (const uint32_t &i, const uint32_t &j, const uint32_t &l, const uint32_t &r, const int64_t &value, std::shared_ptr< Node > const &curr) |
| std::shared_ptr< Node > | update (const uint32_t &i, const uint32_t &j, const uint32_t &l, const uint32_t &r, const int64_t &value, std::shared_ptr< Node > const &curr) |
| Doing range update, checking at every node if it has some value to be propagated. All nodes affected by the update are copied and propagation value is added to the leaf of them. | |
| int64_t | query (const uint32_t &i, const uint32_t &j, const uint32_t &l, const uint32_t &r, std::shared_ptr< Node > const &curr) |
| int64_t | query (const uint32_t &i, const uint32_t &j, const uint32_t &l, const uint32_t &r, std::shared_ptr< Node > const &curr) |
| Querying the range from index l to index r, checking at every node if it has some value to be propagated. Current node's value is returned if its range is completely inside the wanted range, else 0 is returned. | |
| uint32_t | n = 0 |
| std::vector< std::shared_ptr< Node > > | ptrs {} |
| std::vector< std::shared_ptr< Node > > | ptrs {} |
| number of elements/leaf nodes in the segment tree | |
| std::vector< int64_t > | vec {} |
| std::vector< int64_t > | vec {} |
Getting the number of versions after updates so far which is equal to the size of the pointers vector.
Functions for A1Z26 encryption and decryption implementation. -More...
+More...Functions for A1Z26 encryption and decryption implementation.
Implementation of cutting a rod problem. -More...
+More...Implementation of cutting a rod problem.
Functions | |
| int64_t | binExpo (int64_t a, int64_t b, int64_t m) |
| int64_t | binExpo (int64_t a, int64_t b, int64_t m) |
| bool | isPrime (int64_t m) |
| bool | isPrime (int64_t m) |
| int | main () |
| int | main () |
Functions | |
| std::vector< uint64_t > | sorting::radix_sort::step_ith (uint16_t cur_digit, const std::vector< uint64_t > &ar) |
| std::vector< uint64_t > | sorting::radix_sort::step_ith (uint16_t cur_digit, const std::vector< uint64_t > &ar) |
| Function to sort vector according to current digit using stable sorting. | |
| std::vector< uint64_t > | sorting::radix_sort::radix (const std::vector< uint64_t > &ar) |
| std::vector< uint64_t > | sorting::radix_sort::radix (const std::vector< uint64_t > &ar) |
| Function to sort vector digit by digit. | |
| static void | tests () |
| static void | tests () |
| Function to test the above algorithm. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Functions for the [Borůvkas Algorithm](https://en.wikipedia.org/wiki/Borůvka's_algorithm) implementation. -More...
+More...Functions for the [Borůvkas Algorithm](https://en.wikipedia.org/wiki/Borůvka's_algorithm) implementation.
Represents Bipartite graph for Hopcroft Karp implementation. - More...
+ More...Private Attributes | |||||
| int | m {} | ||||
| int | m {} | ||||
| m is the number of vertices on left side of Bipartite Graph | |||||
| int | n {} | ||||
| int | n {} | ||||
| n is the number of vertices on right side of Bipartite Graph | |||||
| const int | NIL {0} | ||||
| const int | NIL {0} | ||||
| const int | INF {INT_MAX} | ||||
| const int | INF {INT_MAX} | ||||
| std::vector< std::list< int > > | adj | ||||
| graph::HKGraph::HKGraph | ( | -int | -m, | +int | m, |
| - | int | -n | -|||
| - | ) | -+ | int | n ) | |
Functions | |
| int | main () |
| int | main () |
Public Member Functions | |
| void | insert () |
| void | insert () |
| void | insertfix (node *) |
| void | insertfix (node *) |
| void | leftrotate (node *) |
| void | leftrotate (node *) |
| void | rightrotate (node *) |
| void | rightrotate (node *) |
| void | del () |
| void | del () |
| node * | successor (node *) |
| node * | successor (node *) |
| void | delfix (node *) |
| void | delfix (node *) |
| void | disp () |
| void | disp () |
| void | display (node *) |
| void | display (node *) |
| void | search () |
| void | search () |
@@ -155,7 +157,7 @@ Private Attributes | ||||||
| RBtree::RBtree | ( | -) | +) | |||
Functions | |
| std::string | ciphers::morse::char_to_morse (const char &c) |
| std::string | ciphers::morse::char_to_morse (const char &c) |
| char | ciphers::morse::morse_to_char (const std::string &s) |
| char | ciphers::morse::morse_to_char (const std::string &s) |
| std::string | ciphers::morse::encrypt (const std::string &text) |
| std::string | ciphers::morse::encrypt (const std::string &text) |
| std::string | ciphers::morse::decrypt (const std::string &text) |
| std::string | ciphers::morse::decrypt (const std::string &text) |
| static void | test () |
| static void | test () |
| Function to test above algorithm. | |
| int | main () |
| int | main () |
| Main function. | |
Classes |
Functions | |
| int | save_u_matrix (const char *fname, const std::vector< std::vector< std::valarray< double > > > &W) |
| int | save_u_matrix (const char *fname, const std::vector< std::vector< std::valarray< double > > > &W) |
| double | update_weights (const std::valarray< double > &X, std::vector< std::vector< std::valarray< double > > > *W, std::vector< std::valarray< double > > *D, double alpha, int R) |
| double | update_weights (const std::valarray< double > &X, std::vector< std::vector< std::valarray< double > > > *W, std::vector< std::valarray< double > > *D, double alpha, int R) |
| void | kohonen_som (const std::vector< std::valarray< double > > &X, std::vector< std::vector< std::valarray< double > > > *W, double alpha_min) |
| void | kohonen_som (const std::vector< std::valarray< double > > &X, std::vector< std::vector< std::valarray< double > > > *W, double alpha_min) |
| void | update_weights (const std::valarray< double > &x, std::vector< std::valarray< double > > *W, std::valarray< double > *D, double alpha, int R) |
| void | update_weights (const std::valarray< double > &x, std::vector< std::valarray< double > > *W, std::valarray< double > *D, double alpha, int R) |
| void | kohonen_som_tracer (const std::vector< std::valarray< double > > &X, std::vector< std::valarray< double > > *W, double alpha_min) |
| void | kohonen_som_tracer (const std::vector< std::valarray< double > > &X, std::vector< std::valarray< double > > *W, double alpha_min) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &out, std::vector< std::valarray< T > > const &A) |
| std::ostream & | operator<< (std::ostream &out, std::vector< std::valarray< T > > const &A) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &out, const std::pair< T, T > &A) |
| std::ostream & | operator<< (std::ostream &out, const std::pair< T, T > &A) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &out, const std::valarray< T > &A) |
| std::ostream & | operator<< (std::ostream &out, const std::valarray< T > &A) |
| template<typename T > | |
| std::valarray< T > | insert_element (const std::valarray< T > &A, const T &ele) |
| std::valarray< T > | insert_element (const std::valarray< T > &A, const T &ele) |
| template<typename T > | |
| std::valarray< T > | pop_front (const std::valarray< T > &A) |
| std::valarray< T > | pop_front (const std::valarray< T > &A) |
| template<typename T > | |
| std::valarray< T > | pop_back (const std::valarray< T > &A) |
| std::valarray< T > | pop_back (const std::valarray< T > &A) |
| template<typename T > | |
| void | equal_shuffle (std::vector< std::vector< std::valarray< T > > > &A, std::vector< std::vector< std::valarray< T > > > &B) |
| void | equal_shuffle (std::vector< std::vector< std::valarray< T > > > &A, std::vector< std::vector< std::valarray< T > > > &B) |
| template<typename T > | |
| void | uniform_random_initialization (std::vector< std::valarray< T > > &A, const std::pair< size_t, size_t > &shape, const T &low, const T &high) |
| void | uniform_random_initialization (std::vector< std::valarray< T > > &A, const std::pair< size_t, size_t > &shape, const T &low, const T &high) |
| template<typename T > | |
| void | unit_matrix_initialization (std::vector< std::valarray< T > > &A, const std::pair< size_t, size_t > &shape) |
| void | unit_matrix_initialization (std::vector< std::valarray< T > > &A, const std::pair< size_t, size_t > &shape) |
| template<typename T > | |
| void | zeroes_initialization (std::vector< std::valarray< T > > &A, const std::pair< size_t, size_t > &shape) |
| void | zeroes_initialization (std::vector< std::valarray< T > > &A, const std::pair< size_t, size_t > &shape) |
| template<typename T > | |
| T | sum (const std::vector< std::valarray< T > > &A) |
| T | sum (const std::vector< std::valarray< T > > &A) |
| template<typename T > | |
| std::pair< size_t, size_t > | get_shape (const std::vector< std::valarray< T > > &A) |
| std::pair< size_t, size_t > | get_shape (const std::vector< std::valarray< T > > &A) |
| template<typename T > | |
| std::vector< std::vector< std::valarray< T > > > | minmax_scaler (const std::vector< std::vector< std::valarray< T > > > &A, const T &low, const T &high) |
| std::vector< std::vector< std::valarray< T > > > | minmax_scaler (const std::vector< std::vector< std::valarray< T > > > &A, const T &low, const T &high) |
| template<typename T > | |
| size_t | argmax (const std::vector< std::valarray< T > > &A) |
| size_t | argmax (const std::vector< std::valarray< T > > &A) |
| template<typename T > | |
| std::vector< std::valarray< T > > | apply_function (const std::vector< std::valarray< T > > &A, T(*func)(const T &)) |
| std::vector< std::valarray< T > > | apply_function (const std::vector< std::valarray< T > > &A, T(*func)(const T &)) |
| template<typename T > | |
| std::vector< std::valarray< T > > | operator* (const std::vector< std::valarray< T > > &A, const T &val) |
| std::vector< std::valarray< T > > | operator* (const std::vector< std::valarray< T > > &A, const T &val) |
| template<typename T > | |
| std::vector< std::valarray< T > > | operator/ (const std::vector< std::valarray< T > > &A, const T &val) |
| std::vector< std::valarray< T > > | operator/ (const std::vector< std::valarray< T > > &A, const T &val) |
| template<typename T > | |
| std::vector< std::valarray< T > > | transpose (const std::vector< std::valarray< T > > &A) |
| std::vector< std::valarray< T > > | transpose (const std::vector< std::valarray< T > > &A) |
| template<typename T > | |
| std::vector< std::valarray< T > > | operator+ (const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B) |
| std::vector< std::valarray< T > > | operator+ (const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B) |
| template<typename T > | |
| std::vector< std::valarray< T > > | operator- (const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B) |
| std::vector< std::valarray< T > > | operator- (const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B) |
| template<typename T > | |
| std::vector< std::valarray< T > > | multiply (const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B) |
| std::vector< std::valarray< T > > | multiply (const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B) |
| template<typename T > | |
| std::vector< std::valarray< T > > | hadamard_product (const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B) |
| std::vector< std::valarray< T > > | hadamard_product (const std::vector< std::valarray< T > > &A, const std::vector< std::valarray< T > > &B) |
Variables | |
| constexpr double | MIN_DISTANCE = 1e-4 |
| constexpr double | MIN_DISTANCE = 1e-4 |
Functions | |
| uint32_t | hashing::sha1::leftRotate32bits (uint32_t n, std::size_t rotate) |
| uint32_t | hashing::sha1::leftRotate32bits (uint32_t n, std::size_t rotate) |
| Rotates the bits of a 32-bit unsigned integer. | |
| std::string | hashing::sha1::sig2hex (void *sig) |
| std::string | hashing::sha1::sig2hex (void *sig) |
| Transforms the 160-bit SHA-1 signature into a 40 char hex string. | |
| void * | hashing::sha1::hash_bs (const void *input_bs, uint64_t input_size) |
| void * | hashing::sha1::hash_bs (const void *input_bs, uint64_t input_size) |
| The SHA-1 algorithm itself, taking in a bytestring. | |
| void * | hashing::sha1::hash (const std::string &message) |
| void * | hashing::sha1::hash (const std::string &message) |
| Converts the string to bytestring and calls the main algorithm. | |
| static void | test () |
| static void | test () |
| Self-test implementations of well-known SHA-1 hashes. | |
| static void | interactive () |
| static void | interactive () |
| Puts user in a loop where inputs can be given and SHA-1 hash will be computed and printed. | |
| int | main () |
| int | main () |
| Main function. | |
Main function.
A class that implements a Circular Linked List. - More...
+ More...Public Member Functions | |
| CircularLinkedList () | |
| CircularLinkedList () | |
| Creates an empty CircularLinkedList. | |
| CircularLinkedList (const CircularLinkedList ©) | |
| CircularLinkedList (const CircularLinkedList ©) | |
| Copy constructor for CircularLinkedList. | |
| CircularLinkedList (CircularLinkedList &&source) noexcept | |
| CircularLinkedList (CircularLinkedList &&source) noexcept | |
| Move constructor for CircularLinkedList. | |
| CircularLinkedList & | operator= (const CircularLinkedList &other) |
| CircularLinkedList & | operator= (const CircularLinkedList &other) |
| Copy assignment operator. | |
| CircularLinkedList & | operator= (CircularLinkedList &&other) noexcept |
| CircularLinkedList & | operator= (CircularLinkedList &&other) noexcept |
| Move assignment operator. | |
| ~CircularLinkedList () | |
| ~CircularLinkedList () | |
| Cleans up memory when destroyed. | |
| void | erase () |
| void | erase () |
| void | insert (const std::vector< int64_t > &values) |
| void | insert (const std::vector< int64_t > &values) |
| Inserts all the values from a vector into the Circular Linked List. | |
| void | insert (int64_t data) |
| void | insert (int64_t data) |
| Inserts a single value into the Circular Linked List. | |
| void | insert (Node *node) |
| void | insert (Node *node) |
| Inserts a given Node into the Circular Linked List. | |
| void | print () |
| void | print () |
| Prints the values of the Circular Linked List, beginning from the root Node. | |
| void | print (Node *root) |
| void | print (Node *root) |
| Prints the values of the Circular Linked List, beginning from a given Node to be used as the root. | |
| std::vector< int64_t > | values () |
| std::vector< int64_t > | values () |
| Returns a std::vector of the values of the Circular Linked List. | |
| std::vector< int64_t > | values (Node *root) |
| std::vector< int64_t > | values (Node *root) |
| Returns a std::vector of the values of the Circular Linked List, beginning from a given Node. | |
| root | |
| Pointer to the root Node. | |
| Node * | end {} |
| Node * | end {} |
| Pointer to the last Node. | |
Creates an empty CircularLinkedList.
Copy constructor for CircularLinkedList.
Cleans up memory when destroyed.
-Iteratively frees each node in the Circular Linked List from the heap
< Set the next value to the root
< Make end point to node
Prints the values of the Circular Linked List, beginning from the root Node.
Goes through each Node from the root and prints them out in order
Returns a std::vector of the values of the Circular Linked List.
Starting from the root Node, appends each value of the list to a std::vector and returns it
< Return empty vector
Functions for the [From the right, set the Kth bit in the binary representation of N] (https://practice.geeksforgeeks.org/problems/set-kth-bit3724/1/) implementation. -More...
+More...Functions for the [From the right, set the Kth bit in the binary representation of N] (https://practice.geeksforgeeks.org/problems/set-kth-bit3724/1/) implementation.
An implementation of hash table using linear probing algorithm. -More...
+More...Classes |
Typedefs | |
| -using | Entry = Entry |
| +using | Entry = struct Entry |
Functions | |
| bool | putProber (const Entry &entry, int key) |
| bool | putProber (const Entry &entry, int key) |
| bool | searchingProber (const Entry &entry, int key) |
| bool | searchingProber (const Entry &entry, int key) |
| void | add (int key) |
| void | add (int key) |
| size_t | hashFxn (int key) |
| size_t | hashFxn (int key) |
Hash a key. Uses the STL library's std::hash() function. | |
| int | linearProbe (int key, bool searching) |
| int | linearProbe (int key, bool searching) |
| void | display () |
| void | display () |
| void | rehash () |
| void | rehash () |
| void | remove (int key) |
| void | remove (int key) |
| void | addInfo (int key) |
| void | addInfo (int key) |
| void | removalInfo (int key) |
| void | removalInfo (int key) |
@@ -177,8 +179,7 @@ bool | rehashing | void linear_probing::add | ( | -int | -key | ) | +int | key | ) | ||
Binary Search Algorithm (used by struzik_search)
+
Binary Search Algorithm (used by struzik_search)
Typedefs | |
| using | node = node { int data |
| for std::queue | |
| using | node |
| for std::queue | |
Functions | |
| node * | createNode (int data) |
| node * | createNode (int data) |
| creates and returns a new node | |
| int | height (node *root) |
| int | height (node *root) |
| int | getBalance (node *root) |
| int | getBalance (node *root) |
| node * | rightRotate (node *root) |
| node * | rightRotate (node *root) |
| node * | leftRotate (node *root) |
| node * | leftRotate (node *root) |
| node * | minValue (node *root) |
| node * | minValue (node *root) |
| node * | insert (node *root, int item) |
| node * | insert (node *root, int item) |
| inserts a new element into AVL tree | |
| node * | deleteNode (node *root, int element) |
| node * | deleteNode (node *root, int element) |
| removes a given element from AVL tree | |
| void | deleteAllNodes (const node *const root) |
| void | deleteAllNodes (const node *const root) |
| calls delete on every node | |
| void | levelOrder (node *root) |
| void | levelOrder (node *root) |
| prints given tree in the LevelOrder | |
| int | main () |
| int | main () |
| Main function. | |
-Variables | |
| -int | height |
| -struct node * | left |
| -struct node * | right |
A simple tree implementation using nodes.
-for std::queue
- +defines the functions associated with the binary tree - More...
+ More...Public Member Functions | |
| Node * | createNewNode (int64_t) |
| Node * | createNewNode (int64_t) |
| function that will create new node for insertion. | |
| std::vector< int64_t > | preOrderIterative (Node *) |
| preOrderIterative() function that will perform the preorder traversal iteratively, and return the result array that contain the preorder traversal of a tree. | |
| std::vector< int64_t > | preOrderIterative (Node *) |
| preOrderIterative() function that will perform the preorder traversal iteratively, and return the result array that contain the preorder traversal of a tree. | |
| std::vector< int64_t > | postOrderIterative (Node *) |
| postOrderIterative() function that will perform the postorder traversal iteratively, and return the result array that contain the postorder traversal of a tree. | |
| std::vector< int64_t > | postOrderIterative (Node *) |
| postOrderIterative() function that will perform the postorder traversal iteratively, and return the result array that contain the postorder traversal of a tree. | |
| std::vector< int64_t > | inOrderIterative (Node *) |
| inOrderIterative() function that will perform the inorder traversal iteratively, and return the result array that contain the inorder traversal of a tree. | |
| std::vector< int64_t > | inOrderIterative (Node *) |
| inOrderIterative() function that will perform the inorder traversal iteratively, and return the result array that contain the inorder traversal of a tree. | |
inOrderIterative() function that will perform the inorder traversal iteratively, and return the result array that contain the inorder traversal of a tree.
+inOrderIterative() function that will perform the inorder traversal iteratively, and return the result array that contain the inorder traversal of a tree.
function that takes root of the tree as an argument, and returns its inorder traversal.
| std::vector< int64_t > others::iterative_tree_traversals::BinaryTree::postOrderIterative | ( | -Node * | -root | ) | +Node * | root | ) |
postOrderIterative() function that will perform the postorder traversal iteratively, and return the result array that contain the postorder traversal of a tree.
+postOrderIterative() function that will perform the postorder traversal iteratively, and return the result array that contain the postorder traversal of a tree.
function that takes root of the tree as an argument, and returns its postorder traversal.
| std::vector< int64_t > others::iterative_tree_traversals::BinaryTree::preOrderIterative | ( | -Node * | -root | ) | +Node * | root | ) |
preOrderIterative() function that will perform the preorder traversal iteratively, and return the result array that contain the preorder traversal of a tree.
+preOrderIterative() function that will perform the preorder traversal iteratively, and return the result array that contain the preorder traversal of a tree.
function that takes root of the tree as an argument, and returns its preorder traversal.
Functions for counting inversions using Merge Sort algorithm. -More...
+More...Functions for counting inversions using Merge Sort algorithm.
main function
Functions for the Wave sort implementation. -More...
+More...Functions for the Wave sort implementation.
Public Member Functions | |
| LowestCommonAncestor (const RootedTree &tree_) | |
| LowestCommonAncestor (const RootedTree &tree_) | |
| Stores the tree and precomputs "up lifts". | |
| int | lowest_common_ancestor (int u, int v) const |
| int | lowest_common_ancestor (int u, int v) const |
| Query the structure to find the lowest common ancestor. Assumes that the provided numbers are valid indices of vertices. Iterativelly modifies ("lifts") u an v until it finnds their lowest common ancestor. | |
Protected Member Functions | |
| void | populate_up () |
| void | populate_up () |
Populate the "up" structure. See above.
Functions | |
| double | poisson_rate (double events, double timeframe) |
| double | poisson_rate (double events, double timeframe) |
| double | poisson_expected (double rate, double time) |
| double | poisson_expected (double rate, double time) |
| double | fact (double x) |
| double | fact (double x) |
| double | poisson_x_successes (double expected, double x) |
| double | poisson_x_successes (double expected, double x) |
| double | poisson_range_successes (double expected, double lower, double upper) |
| double | poisson_range_successes (double expected, double lower, double upper) |
| int | main () |
| int | main () |
main function
Functions for Dynamic Array algorithm. -More...
+More...Functions for Dynamic Array algorithm.
Functions | |
| double | physics::ground_to_ground_projectile_motion::degrees_to_radians (double radian, double PI=3.14) |
| double | physics::ground_to_ground_projectile_motion::degrees_to_radians (double radian, double PI=3.14) |
| Convert radians to degrees. | |
| template<typename T > | |
| T | physics::ground_to_ground_projectile_motion::time_of_flight (T initial_velocity, T angle, double gravity=9.81) |
| T | physics::ground_to_ground_projectile_motion::time_of_flight (T initial_velocity, T angle, double gravity=9.81) |
| Calculate the time of flight. | |
| template<typename T > | |
| T | physics::ground_to_ground_projectile_motion::horizontal_range (T initial_velocity, T angle, T time) |
| T | physics::ground_to_ground_projectile_motion::horizontal_range (T initial_velocity, T angle, T time) |
| Calculate the horizontal distance that the projectile travels. | |
| template<typename T > | |
| T | physics::ground_to_ground_projectile_motion::max_height (T initial_velocity, T angle, double gravity=9.81) |
| T | physics::ground_to_ground_projectile_motion::max_height (T initial_velocity, T angle, double gravity=9.81) |
| Calculate the max height of the projectile. | |
| static void | test () |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| int | main () |
| Main function. | |
3.14 Main function.
9.81 9.81 Main function.
Segment Tree, to store heavy chains. - More...
+ More...Private Member Functions | |
| X | combine (X lhs, X rhs) |
| X | combine (X lhs, X rhs) |
| Function that specifies the type of operation involved when segments are combined. | |
| SG (int size) | |
| SG (int size) | |
| Class parameterized constructor. Resizes the and initilizes the data members. | |
| void | update (int p, X v) |
| void | update (int p, X v) |
| Update the value at a node. | |
| X | query (int l, int r) |
| X | query (int l, int r) |
| Make a range query from node label l to node label r. | |
| void | set_sret_init (X new_sret_init) |
| void | set_sret_init (X new_sret_init) |
| Set the initialization for the query data type, based on requirement. | |
Private Attributes | ||||||||
| std::vector< X > | s_tree | |||||||
| std::vector< X > | s_tree | |||||||
| Everything here is private, and can only be accessed through the methods, in the derived class (HLD) | ||||||||
| @@ -182,8 +184,7 @@ template<typename X > | ||||||||
| range_queries::heavy_light_decomposition::SG< X >::SG | ( | -int | -size | ) | +int | size | ) | |
Main function.
Public Member Functions | |
| Node (int key, int level, void *value=nullptr) | |
| Node (int key, int level, void *value=nullptr) | |
@@ -145,25 +147,17 @@ void * | value | ||||
| data_structures::Node::Node | ( | -int | -key, | +int | key, |
| - | int | -level, | +int | level, | |
| - | void * | -value = nullptr |
- |||
| - | ) | -+ | void * | value = nullptr ) | |
Functions for Implementation of Sparse Table -More...
+More...Functions for Implementation of Sparse Table
Range queries using sparse-tables.
@@ -112,7 +114,7 @@ $(document).ready(function(){initNavTree('d9/d55/namespacesparse__table.html','. diff --git a/d9/d58/classdata__structures_1_1linked__list_1_1list-members.html b/d9/d58/classdata__structures_1_1linked__list_1_1list-members.html index 0602f266d..32b037d0b 100644 --- a/d9/d58/classdata__structures_1_1linked__list_1_1list-members.html +++ b/d9/d58/classdata__structures_1_1linked__list_1_1list-members.html @@ -3,16 +3,18 @@ - +Functions for Rat in a Maze algorithm. -More...
+More...Functions for Rat in a Maze algorithm.
@@ -113,7 +115,7 @@ solve-a-rat-in-a-maze-c-java-pytho/" target="_blank">Rat in a Maze algorithm diff --git a/d9/d66/group__machine__learning.html b/d9/d66/group__machine__learning.html index e4fbdd4e3..f79896a4f 100644 --- a/d9/d66/group__machine__learning.html +++ b/d9/d66/group__machine__learning.html @@ -3,16 +3,18 @@ - +Functions | |
| double | _random (double a, double b) |
| double | _random (double a, double b) |
| int | save_2d_data (const char *fname, const std::vector< std::valarray< double > > &X) |
| int | save_2d_data (const char *fname, const std::vector< std::valarray< double > > &X) |
| void | get_min_2d (const std::vector< std::valarray< double > > &X, double *val, int *x_idx, int *y_idx) |
| void | get_min_2d (const std::vector< std::valarray< double > > &X, double *val, int *x_idx, int *y_idx) |
| int | save_nd_data (const char *fname, const std::vector< std::valarray< double > > &X) |
| int | save_nd_data (const char *fname, const std::vector< std::valarray< double > > &X) |
Variables | |
| constexpr int | MAX_ITER = 500 |
| constexpr int | MAX_ITER = 500 |
Functions | |
| int | search::median_search::median_of_medians (const std::vector< int > &A, const int &idx) |
| int | search::median_search::median_of_medians (const std::vector< int > &A, const int &idx) |
| void | test () |
| void | test () |
| int | main () |
| int | main () |
Main function
Functions for [Queue using Array] (https://www.geeksforgeeks.org/array-implementation-of-queue-simple/) implementation. -More...
+More...Functions for [Queue using Array] (https://www.geeksforgeeks.org/array-implementation-of-queue-simple/) implementation.
Functions for the DNF sort implementation. -More...
+More...Functions for the DNF sort implementation.
Functions | |
| uint64_t | fibonacci (uint64_t n) |
| uint64_t | fibonacci (uint64_t n) |
| static void | test () |
| static void | test () |
| int | main () |
| int | main () |
| Main function. | |
Main function.
Function for testing the fibonacci() function with a few test cases and assert statement.
void Function for testing the fibonacci() function with a few test cases and assert statement.
void Functions | |
| int | main () |
| int | main () |
Functions for the Midpoint Integral method implementation. -More...
+More...Functions for the Midpoint Integral method implementation.
Simple bitset implementation for bloom filter. - More...
+ More...Public Member Functions | |
| Bitset (std::size_t) | |
| Bitset (std::size_t) | |
| BitSet class constructor. | |
| std::size_t | size () |
| std::size_t | size () |
| Utility function to return the size of the inner array. | |
| void | add (std::size_t) |
| void | add (std::size_t) |
| Turn bit on position x to 1s. | |
| bool | contains (std::size_t) |
| bool | contains (std::size_t) |
| Doest bitset contains element x. | |
Static Private Attributes | |
| static const std::size_t | blockSize |
| static const std::size_t | blockSize |
Utility function to return the size of the inner array.
Functions for Base64 Encoding and Decoding implementation. -More...
+More...Functions for Base64 Encoding and Decoding implementation.
for std::vector -More...
+More...for std::vector
Search algorithms.
@@ -119,7 +121,7 @@ $(document).ready(function(){initNavTree('d9/dca/namespacesearch.html','../../') diff --git a/d9/dd1/namespacelinear__recurrence__matrix.html b/d9/dd1/namespacelinear__recurrence__matrix.html index 36327fb69..3253cd327 100644 --- a/d9/dd1/namespacelinear__recurrence__matrix.html +++ b/d9/dd1/namespacelinear__recurrence__matrix.html @@ -3,16 +3,18 @@ - +Functions for Linear Recurrence Matrix implementation. -More...
+More...Functions for Linear Recurrence Matrix implementation.
The Binary Search Tree class. - More...
+ More...@@ -123,69 +125,69 @@ Classes |
Public Member Functions | |
| binary_search_tree () | |
| binary_search_tree () | |
| Construct a new Binary Search Tree object. | |
| bool | insert (T new_value) |
| bool | insert (T new_value) |
| Insert a new value into the BST. | |
| bool | remove (T rm_value) |
| bool | remove (T rm_value) |
| Remove a specified value from the BST. | |
| bool | contains (T value) |
| bool | contains (T value) |
| Check if a value is in the BST. | |
| bool | find_min (T &ret_value) |
| bool | find_min (T &ret_value) |
| Find the smallest value in the BST. | |
| bool | find_max (T &ret_value) |
| bool | find_max (T &ret_value) |
| Find the largest value in the BST. | |
| std::size_t | size () |
| std::size_t | size () |
| Get the number of values in the BST. | |
| std::vector< T > | get_elements_inorder () |
| std::vector< T > | get_elements_inorder () |
| Get all values of the BST in in-order order. | |
| std::vector< T > | get_elements_preorder () |
| std::vector< T > | get_elements_preorder () |
| Get all values of the BST in pre-order order. | |
| std::vector< T > | get_elements_postorder () |
| std::vector< T > | get_elements_postorder () |
| Get all values of the BST in post-order order. | |
Private Member Functions | |
| bool | find_max (std::unique_ptr< bst_node > &node, T &ret_value) |
| bool | find_max (std::unique_ptr< bst_node > &node, T &ret_value) |
| Recursive function to find the maximum value in the BST. | |
| bool | find_min (std::unique_ptr< bst_node > &node, T &ret_value) |
| bool | find_min (std::unique_ptr< bst_node > &node, T &ret_value) |
| Recursive function to find the minimum value in the BST. | |
| bool | insert (std::unique_ptr< bst_node > &node, T new_value) |
| bool | insert (std::unique_ptr< bst_node > &node, T new_value) |
| Recursive function to insert a value into the BST. | |
| bool | remove (std::unique_ptr< bst_node > &parent, std::unique_ptr< bst_node > &node, T rm_value) |
| bool | remove (std::unique_ptr< bst_node > &parent, std::unique_ptr< bst_node > &node, T rm_value) |
| Recursive function to remove a value from the BST. | |
| bool | contains (std::unique_ptr< bst_node > &node, T value) |
| bool | contains (std::unique_ptr< bst_node > &node, T value) |
| Recursive function to check if a value is in the BST. | |
| void | traverse_inorder (std::function< void(T)> callback, std::unique_ptr< bst_node > &node) |
| void | traverse_inorder (std::function< void(T)> callback, std::unique_ptr< bst_node > &node) |
| Recursive function to traverse the tree in in-order order. | |
| void | traverse_preorder (std::function< void(T)> callback, std::unique_ptr< bst_node > &node) |
| void | traverse_preorder (std::function< void(T)> callback, std::unique_ptr< bst_node > &node) |
| Recursive function to traverse the tree in pre-order order. | |
| void | traverse_postorder (std::function< void(T)> callback, std::unique_ptr< bst_node > &node) |
| void | traverse_postorder (std::function< void(T)> callback, std::unique_ptr< bst_node > &node) |
| Recursive function to traverse the tree in post-order order. | |
Private Attributes | |
| std::unique_ptr< bst_node > | root_ |
| std::unique_ptr< bst_node > | root_ |
| std::size_t | size_ = 0 |
| std::size_t | size_ = 0 |
Construct a new Binary Search Tree object.
@@ -248,19 +250,12 @@ template<class T >Get the number of values in the BST.
| key | diff --git a/d9/dee/classdouble__linked__list.html b/d9/dee/classdouble__linked__list.html index 7bdcff0c1..d9a536168 100644 --- a/d9/dee/classdouble__linked__list.html +++ b/d9/dee/classdouble__linked__list.html @@ -3,16 +3,18 @@ - +
Public Member Functions | |
| void | insert (int x) |
| void | insert (int x) |
| void | remove (int x) |
| void | remove (int x) |
| void | search (int x) |
| void | search (int x) |
| void | show () |
| void | show () |
| void | reverseShow () |
| void | reverseShow () |
Functions for the Sublist Search implementation. -More...
+More...Functions for the Sublist Search implementation.
Functions | |
| void | fastinput (int *number) |
| void | fastinput (int *number) |
| int | main () |
| int | main () |
Main function
Testcases to check Union of Two Arrays. -More...
+More...Functions | |
| void | test1 () |
| void | test1 () |
| A Test to check an simple case. | |
| void | test2 () |
| void | test2 () |
| A Test to check an empty vector. | |
| void | test3 () |
| void | test3 () |
| A Test to check an invalid shift value. | |
| void | test4 () |
| void | test4 () |
| A Test to check a very large input. | |
| void | test5 () |
| void | test5 () |
| A Test to check a shift of zero. | |
| void | test6 () |
| void | test6 () |
| A Test to check correct functionality with an array sorted using std::sort. | |
The structure to hold Nodes of the tree. - More...
+ More...Functions | |
| int | FindNextGap (int gap) |
| int | FindNextGap (int gap) |
| void | CombSort (int *arr, int l, int r) |
| void | CombSort (int *arr, int l, int r) |
| void | tests () |
| void | tests () |
| int | main () |
| int | main () |
For user interaction
A class defining A* search algorithm. for some initial state and final state. - More...
+ More...Public Types | |
| -using | MapOfPuzzleInfoWithPuzzleInfo = std::map< std::shared_ptr< Info >, std::shared_ptr< Info >, comparison_operator > |
| -using | MapOfPuzzleInfoWithInteger = std::map< std::shared_ptr< Info >, uint32_t, comparison_operator > |
| -using | SetOfPuzzleInfo = std::set< std::shared_ptr< Info >, comparison_operator > |
| using | MapOfPuzzleInfoWithPuzzleInfo |
| using | MapOfPuzzleInfoWithInteger |
| using | SetOfPuzzleInfo |
Public Member Functions | |
| AyStarSearch (const Puzzle &initial, const Puzzle &final) | |
| AyStarSearch (const Puzzle &initial, const Puzzle &final) | |
| Parameterized constructor for AyStarSearch. | |
| std::vector< Puzzle > | Solution (std::shared_ptr< Info > FinalState, const MapOfPuzzleInfoWithPuzzleInfo &parent_of) |
| std::vector< Puzzle > | Solution (std::shared_ptr< Info > FinalState, const MapOfPuzzleInfoWithPuzzleInfo &parent_of) |
| A helper solution: launches when a solution for AyStarSearch is found. | |
| std::vector< Puzzle > | a_star_search (const std::function< uint32_t(const Puzzle &, const Puzzle &)> &dist, const uint32_t permissible_depth=30) |
| std::vector< Puzzle > | a_star_search (const std::function< uint32_t(const Puzzle &, const Puzzle &)> &dist, const uint32_t permissible_depth=30) |
Private Types | |
| -typedef struct machine_learning::aystar_search::AyStarSearch::Info | Info | Info |
| Struct that handles all the information related to the current state. | |
| using machine_learning::aystar_search::AyStarSearch< Puzzle >::MapOfPuzzleInfoWithInteger | +
| using machine_learning::aystar_search::AyStarSearch< Puzzle >::MapOfPuzzleInfoWithPuzzleInfo | +
| using machine_learning::aystar_search::AyStarSearch< Puzzle >::SetOfPuzzleInfo | +
30 contains the definition of the function longest_common_string_length +
contains the definition of the function longest_common_string_length More...
#include <cassert>#include <iostream>Functions | |
| std::size_t | longest_common_string_length (const std::string &string_a, const std::string &string_b) |
| std::size_t | longest_common_string_length (const std::string &string_a, const std::string &string_b) |
| for std::vector | |
| std::vector< TestCase > | get_test_cases () |
| std::vector< TestCase > | get_test_cases () |
| template<typename TestCases > | |
| static void | test_longest_common_string_length (const TestCases &test_cases) |
| checks the function longest_common_string_length agains example data | |
| static void | test_longest_common_string_length (const TestCases &test_cases) |
| checks the function longest_common_string_length agains example data | |
| template<typename TestCases > | |
| static void | test_longest_common_string_length_is_symmetric (const TestCases &test_cases) |
| checks if the function longest_common_string_length returns the same result when its argument are flipped | |
| static void | test_longest_common_string_length_is_symmetric (const TestCases &test_cases) |
| checks if the function longest_common_string_length returns the same result when its argument are flipped | |
| std::string | reverse_str (const std::string &in_str) |
| std::string | reverse_str (const std::string &in_str) |
| reverses a given string | |
| template<typename TestCases > | |
| static void | test_longest_common_string_length_for_reversed_inputs (const TestCases &test_cases) |
| checks if the function longest_common_string_length returns the same result when its inputs are reversed | |
| static void | test_longest_common_string_length_for_reversed_inputs (const TestCases &test_cases) |
| checks if the function longest_common_string_length returns the same result when its inputs are reversed | |
| static void | tests () |
| runs all tests for longest_common_string_length funcion | |
| static void | tests () |
| runs all tests for longest_common_string_length funcion | |
| int | main () |
| int | main () |
| Main function. | |
contains the definition of the function longest_common_string_length
-the function longest_common_string_length computes the length of the longest common string which can be created of two input strings by removing characters from them
+contains the definition of the function longest_common_string_length
+the function longest_common_string_length computes the length of the longest common string which can be created of two input strings by removing characters from them
@@ -168,12 +170,12 @@ FunctionsMain function.
checks the function longest_common_string_length agains example data
+checks the function longest_common_string_length agains example data
checks if the function longest_common_string_length returns the same result when its inputs are reversed
+checks if the function longest_common_string_length returns the same result when its inputs are reversed
checks if the function longest_common_string_length returns the same result when its argument are flipped
+checks if the function longest_common_string_length returns the same result when its argument are flipped
runs all tests for longest_common_string_length funcion
+runs all tests for longest_common_string_length funcion
A Node struct that represents a single Node in a Binary Tree. - More...
+ More...Public Member Functions | |
| Node (int64_t _data) | |
| Node (int64_t _data) | |
| Creates a new Node with some initial data. | |
| Node (int64_t _data, Node *_next) | |
| Node (int64_t _data, Node *_next) | |
| Creates a new Node with initial data and a successor. | |
| data | ||||||||
| operations_on_datastructures::circular_linked_list::Node::Node | ( | -int64_t | -_data | ) | +int64_t | _data | ) |
< Set value of Node data
< Initialize successor
< Set value of Node data
< Initialize successor
10 Main function.
A class to model the geometric distribution. - More...
+ More...Public Member Functions | |
| geometric_distribution (const float &p) | |
| geometric_distribution (const float &p) | |
| Constructor for the geometric distribution. | |
| float | expected_value () const |
| float | expected_value () const |
| The expected value of a geometrically distributed random variable X. | |
| float | variance () const |
| float | variance () const |
| The variance of a geometrically distributed random variable X. | |
| float | standard_deviation () const |
| float | standard_deviation () const |
| The standard deviation of a geometrically distributed random variable X. | |
| float | probability_density (const uint32_t &k) const |
| float | probability_density (const uint32_t &k) const |
| The probability density function. | |
| float | cumulative_distribution (const uint32_t &k) const |
| float | cumulative_distribution (const uint32_t &k) const |
| The cumulative distribution function. | |
| float | inverse_cumulative_distribution (const float &cdf) const |
| float | inverse_cumulative_distribution (const float &cdf) const |
| The inverse cumulative distribution function. | |
| uint32_t | draw_sample () const |
| uint32_t | draw_sample () const |
| Generates a (discrete) sample according to the geometrical distribution. | |
| float | range_tries (const uint32_t &min_tries=1, const uint32_t &max_tries=std::numeric_limits< uint32_t >::max()) const |
| float | range_tries (const uint32_t &min_tries=1, const uint32_t &max_tries=std::numeric_limits< uint32_t >::max()) const |
| This function computes the probability to have success in a given range of tries. | |
| p | ||||||||
| probability::geometric_dist::geometric_distribution::geometric_distribution | ( | -const float & | -p | ) | +const float & | p | ) |
The expected value of a geometrically distributed random variable X.
1, std::numeric_limits<uint32_t>::max() The standard deviation of a geometrically distributed random variable X.
The variance of a geometrically distributed random variable X.
Functions | |
| double | Sqrt (double a) |
| double | Sqrt (double a) |
| int | main () |
| int | main () |
Bisection method implemented for the function \(x^2-a=0\) whose roots are \(\pm\sqrt{a}\) and only the positive root is returned.
Public Member Functions | |
| int64_t | query (int64_t l, int64_t r) |
| int64_t | query (int64_t l, int64_t r) |
| Queries the sparse table for the value of the interval [l, r] (i.e. from l to r inclusive). | |
| n = 0 | |
| size of input array. | |
| std::array< int64_t, N > | A = {} |
| std::array< int64_t, N > | A = {} |
| input array to perform RMQ. | |
| std::array< std::array< int64_t, N >, M > | ST {} |
| std::array< std::array< int64_t, N >, M > | ST {} |
the sparse table storing min() values for given interval. | |
| std::array< int64_t, N > | LOG = {} |
| std::array< int64_t, N > | LOG = {} |
| where floor(log2(i)) are precomputed. | |
< represents minimum value over the range [g, r - pow(2,g) + 1]
< represents minimum value over the whole range [l,r]
Main function.