MCPcopy Create free account

hub / github.com/TheAlgorithms/C-Plus-Plus / functions

Functions2,100 in github.com/TheAlgorithms/C-Plus-Plus

↓ 447 callersMethodsize
* @brief Returns the number of items present in the cache. * @return number of items in the cache */
others/lfu_cache.cpp:217
↓ 197 callersMethodpush_back
* function adds new element to the end of the list * @param new_elem to be added to the end of the list */
data_structures/linked_list.cpp:123
↓ 103 callersFunctionlog
others/lru_cache.cpp:149
↓ 93 callersFunctionfib
* @brief Function to compute the nth Fibonacci number * @param n The index of the Fibonacci number to compute * @return uint64_t The nth Fibonacci n
math/fibonacci_fast.cpp:38
↓ 60 callersMethodpush
* @brief push the node at first position in the linked list of given * frequency * @param freq the frequency mapping to the linked list wher
others/lfu_cache.cpp:88
↓ 60 callersMethodsize
* @brief Utility function to return the size of the inner array * @returns the size of inner array */
data_structures/bloom_filter.cpp:57
↓ 57 callersMethodsize
* @brief Get the matrix shape * @returns pair of integer denoting total rows and columns */
divide_and_conquer/strassen_matrix_multiplication.cpp:79
↓ 50 callersMethodpush
Add new item to the stack */
data_structures/stack.hpp:47
↓ 44 callersMethodtop
Return the top element of the stack */
data_structures/stack.hpp:56
↓ 42 callersFunctionmin
dynamic_programming/edit_distance.cpp:19
↓ 40 callersMethodimag
* \brief Member function to get imaginary value of our complex number. * Member function (getter) to access the class' im value. */
math/complex_numbers.cpp:70
↓ 38 callersMethodempty
* @brief returns true if the cache is empty, false otherwise. * @return true if the cache is empty, false otherwise. */
others/lfu_cache.cpp:229
↓ 38 callersMethodreal
* \brief Member function to get real value of our complex number. * Member function (getter) to access the class' re value. */
math/complex_numbers.cpp:64
↓ 33 callersMethodinsert
* @brief Recursive function to insert a value into the BST. * * @param node The node to search from. * @param new_value The value to in
data_structures/binary_search_tree2.cpp:90
↓ 31 callersMethodpop
* @brief pop the last node in the least frequently used linked list */
others/lfu_cache.cpp:149
↓ 27 callersFunctionfill
This functions fills a string with character c, n times and returns it * @note This can probably be replace by `memcpy` function. */
others/decimal_to_roman_numeral.cpp:15
↓ 26 callersMethodfind
* @brief Find if a value and corresponding hash exist * * @param x value to search for * @param h corresponding hash key * @return
hashing/chaining.cpp:101
↓ 24 callersMethodrefer
* @brief Refer to a page, or request a page from memory. * @param page The page that you are referring to. * @returns void * */
others/lru_cache.cpp:92
↓ 24 callersFunctionsort
Caller of bitonicSort for sorting the entire array of length N in ASCENDING order */
sorting/bitonic_sort.cpp:51
↓ 23 callersMethodGetChild
* @brief Get the child pointer at position of index * @param index index of child to get * @return the child pointer */
data_structures/tree_234.cpp:252
↓ 23 callersMethodpop
Remove the top element of the stack */
data_structures/stack.hpp:62
↓ 22 callersMethodcreateNewNode
* @brief will allocate the memory for a node and, along the data and return the * node. * @param data value that a particular node will contain. *
others/recursive_tree_traversal.cpp:118
↓ 22 callersMethodget
* @brief computes the n-th Catalan number and updates the cache. * @return the n-th Catalan number */
dynamic_programming/catalan_numbers.cpp:39
↓ 20 callersMethodfront
* @return the first element of the queue * @exception std::invalid_argument if queue is empty */
data_structures/queue.hpp:72
↓ 20 callersMethodtoVector
data_structures/stack.hpp:31
↓ 19 callersFunctionaddEdge
* @brief Function that add edge between two nodes or vertices of graph * * @param adj adjacency list of graph. * @param u any node or vertex of gra
graph/connected_components.cpp:46
↓ 17 callersMethodGetItem
* @brief Get item of the \index index * @param index the item index to get * @return the item */
data_structures/tree_234.cpp:133
↓ 17 callersMethodempty
data_structures/queue_using_two_stacks.cpp:93
↓ 17 callersMethodget_size
* @brief returns the size of the EightPuzzle (number of row / column) * @return N, the size of the puzzle. */
machine_learning/a_star_search.cpp:119
↓ 17 callersMethodinsert
* @brief Utility function that adds a new element at the end of the list * @param new_elem element be added at the end of the list */
data_structures/reverse_a_linked_list.cpp:99
↓ 17 callersMethodnum_digits
* Get number of digits in the number **/
math/large_number.h:130
↓ 17 callersMethodsize
* @brief Getting the number of versions after updates so far which is equal * to the size of the pointers vector * @returns the number of ve
range_queries/persistent_seg_tree_lazy_prop.cpp:256
↓ 17 callersMethodstartwith
* @brief search a word/string that starts with a given prefix * @param prefix string to search for * @returns `true` if found * @return
data_structures/trie_using_hashmap.cpp:107
↓ 16 callersMethodaddBinary
* @brief Adds two binary strings and returns the result as a binary string. * @param a The first binary string. * @param b The second binary
greedy_algorithms/binary_addition.cpp:40
↓ 16 callersMethodclear
Clear stack */
data_structures/stack.hpp:69
↓ 16 callersMethodunionSet
* @brief Method that combines two disjoint sets to which i and j belongs to * and make a single set having a common representative. * @param
data_structures/dsu_union_rank.cpp:76
↓ 15 callersMethodaddEdge
* @brief Function that adds an edge between two nodes or vertices of graph * @param u Start node of the edge * @param v End node of the edge
graph/topological_sort.cpp:55
↓ 15 callersMethodsearch
* @brief search a word/string inside the trie * @param word string to search for * @returns `true` if found * @returns `false` if not f
data_structures/trie_using_hashmap.cpp:82
↓ 15 callersFunctionupdate
* @brief Updates a range of the segment tree * * @param segtree the segment tree * @param lazy for lazy propagation * @param start lower i
range_queries/segtree.cpp:103
↓ 14 callersFunctionaddEdge
* @brief Function that add edge between two nodes or vertices of graph * * @param adj1 adjacency list for the direct search * @param adj2 adjacency
graph/bidirectional_dijkstra.cpp:46
↓ 14 callersFunctionaddEdge
* @brief Function that add edge between two nodes or vertices of graph * * @param u any node or vertex of graph * @param v any node or vertex of gr
graph/dijkstra.cpp:48
↓ 14 callersFunctionexp
* @brief This function calculates number raised to exponent power under modulo * mod using [Modular * Exponentiation](https://github.com/TheAlgorith
ciphers/elliptic_curve_key_exchange.cpp:78
↓ 14 callersFunctionget_shape
machine_learning/vector_ops.hpp:247
↓ 14 callersMethodinsert
data_structures/rb_tree.cpp:34
↓ 13 callersMethodaddEdge
* @brief function to add edge from u to v * @param u is the position of first vertex * @param v is the position of second vertex */
graph/hopcroft_karp.cpp:242
↓ 13 callersMethodadd_edge
* @brief Adds an edge to the graph * @param src the graph the edge should be added to * @param dst the position where the edge should be add
greedy_algorithms/dijkstra_greedy.cpp:68
↓ 13 callersFunctioninsert
operations_on_datastructures/reverse_a_linked_list_using_recusion.cpp:11
↓ 13 callersMethodinsert
* @brief insert the string into the trie * @param word string to insert in the trie */
data_structures/trie_using_hashmap.cpp:62
↓ 13 callersFunctionright_rotate
* @brief Rotates the bits of a 32-bit unsigned integer * @param n Integer to rotate * @param rotate Number of bits to rotate * @return uint32_t The
hashing/sha256.cpp:58
↓ 13 callersMethodtraverse
* @brief Utility function to find the i th element of the list * @returns the i th element of the list */
data_structures/reverse_a_linked_list.cpp:168
↓ 12 callersMethodGetCount
* @brief Get the item count that current saved in the node * @return item count */
data_structures/tree_234.cpp:50
↓ 12 callersFunctionaddEdge
* @brief * Adds and edge between two vertices of graph say u and v in this * case. * * @param adj Adjacency list representation of graph * @param
graph/depth_first_search_with_stack.cpp:64
↓ 12 callersMethodenQueue
* @brief inserts a new item into the queue */
data_structures/queue.hpp:54
↓ 12 callersFunctionget_nth_term_of_recurrence_series
math/linear_recurrence_matrix.cpp:155
↓ 12 callersFunctionhorspool
* A function that implements Horspool's algorithm. * @param text is the string that we are searching if there is a substring * @param prototype is t
strings/horspool.cpp:59
↓ 12 callersFunctionmanacher
* @brief A function that implements Manacher's algorithm * @param prototype is the string where algorithm finds a palindromic substring. * This stri
strings/manacher_algorithm.cpp:41
↓ 12 callersMethodpredict
* @brief Classify sample. * @param sample sample * @param k number of neighbors * @return int label of most frequent neighbors */
machine_learning/k_nearest_neighbors.cpp:103
↓ 11 callersMethodIs2Node
* @brief Check if node is a 2-node * @return true if node is 2-node, otherwise false */
data_structures/tree_234.cpp:79
↓ 11 callersFunction_random
* Helper function to generate a random number in a given interval. * \n Steps: * 1. `r1 = rand() % 100` gets a random number between 0 and 99 * 2.
machine_learning/kohonen_som_topology.cpp:53
↓ 11 callersFunction_random
* Helper function to generate a random number in a given interval. * \n Steps: * 1. `r1 = rand() % 100` gets a random number between 0 and 99 * 2.
machine_learning/kohonen_som_trace.cpp:46
↓ 11 callersFunctioncalculate
* @brief Function to calculate binomial coefficients * @param n first value * @param k second value * @return binomial coefficient for n and k */
math/binomial_calculate.cpp:32
↓ 11 callersFunctionfindMinimumEdge
greedy_algorithms/kruskals_minimum_spanning_tree.cpp:38
↓ 10 callersMethodadd_edge
graph/breadth_first_search.cpp:73
↓ 10 callersFunctionfactorial
* @brief function to find factorial of given number * @param n is the number which is to be factorialized * @warning Maximum value for the parameter
math/factorial.cpp:29
↓ 10 callersFunctionhamming_distance
* This function returns the hamming distance between two integers. * @param a the first number * @param b the second number * @returns the number o
bit_manipulation/hamming_distance.cpp:52
↓ 10 callersFunctionis_armstrong
dynamic_programming/armstrong_number_templated.cpp:39
↓ 10 callersFunctionis_even
* @brief Checks if a number is even or odd using bitwise AND. * @param N The number to check. * @returns "Even" if N is even, "Odd" if N is odd.
bit_manipulation/check_even_odd.cpp:55
↓ 10 callersFunctionis_prime
* @brief Function to check if the given number is prime or not. * @param num number to be checked. * @return true if number is a prime * @return fa
math/check_prime.cpp:31
↓ 10 callersFunctionprint
sorting/radix_sort.cpp:45
↓ 10 callersFunctiontrappedRainwater
* @brief Function to calculate the trapped rainwater * @param heights Array representing the heights of walls * @return The amount of trapped rainwa
dynamic_programming/trapped_rainwater2.cpp:30
↓ 10 callersFunctiontrappedRainwater
* @brief Function to calculate the trapped rainwater * @param heights Array representing the heights of walls * @return The amount of trapped rainwa
dynamic_programming/trapped_rainwater.cpp:27
↓ 9 callersMethoderase
* @brief Erase element (External method) * @param k Key to erase */
data_structures/treap.cpp:208
↓ 9 callersFunctiongcd
math/gcd_of_n_numbers.cpp:64
↓ 9 callersMethodget
* @brief prints the minimum, maximum and size of the set to which i belongs * to * @param i element of some set * @returns void */
data_structures/dsu_path_compression.cpp:136
↓ 9 callersFunctionget_char
* @brief Returns the character at pos after the input is padded * @param input Input string * @param pos Position of character to be returned * @re
hashing/sha256.cpp:170
↓ 9 callersFunctionhash
* @brief Converts the string to bytestring and calls the main algorithm * @param message Plain character message to hash * @return void* Pointer to
hashing/md5.cpp:288
↓ 9 callersMethodrange_tries
* @brief This function computes the probability to have success in a given * range of tries * @details Computes P(min_tries <= x <= max_trie
probability/geometric_dist.cpp:145
↓ 9 callersFunctionsave_nd_data
* Save a given n-dimensional data martix to file. * * \param[in] fname filename to save in (gets overwriten without confirmation) * \param[in] X ma
machine_learning/kohonen_som_trace.cpp:58
↓ 9 callersFunctionsig2hex
* @brief Transforms the 160-bit SHA-1 signature into a 40 char hex string * @param sig The SHA-1 signature (Expected 20 bytes) * @return std::string
hashing/sha1.cpp:67
↓ 9 callersFunctionsig2hex
* @brief Transforms the 128-bit MD5 signature into a 32 char hex string * @param sig The MD5 signature (Expected 16 bytes) * @return std::string The
hashing/md5.cpp:123
↓ 8 callersFunctionLenghtLine
Compute the Euclidian distance between two points \f$A\equiv(x_1,y_1)\f$ and * \f$B\equiv(x_2,y_2)\f$ using the formula: * \f[d=\sqrt{\left(x_1-x_2\
others/smallest_circle.cpp:37
↓ 8 callersFunctionLinearSearch
* \brief [Algorithm implementation for linear search] * \param [in] array array to search in * \param [in] size length of array * \param [in] key k
search/linear_search.cpp:21
↓ 8 callersMethodSetChild
* @brief Set child pointer to the position of index * @param index children index * @param child pointer to set */
data_structures/tree_234.cpp:259
↓ 8 callersFunctionadd
* @brief Adding two string * @details Adds two long integer, only used for printing numbers * @param first First integer string * @param second Sec
ciphers/uint128_t.hpp:38
↓ 8 callersMethodadd
* @brief Adds a new Node to the Binary Tree */
operations_on_datastructures/reverse_binary_tree.cpp:124
↓ 8 callersFunctioncountSetBits
* @brief The main function implements set bit count * @param n is the number whose set bit will be counted * @returns total number of set-bits in th
bit_manipulation/count_of_set_bits.cpp:38
↓ 8 callersFunctiondeleteList
* @brief This function dealocates memory related to the given list * It recursively deletes all of the nodes of the input list. * @param room the ro
search/sublist_search.cpp:101
↓ 8 callersFunctionfindEaster
* @brief Function that finds the month and day of Easter * @params param1 An int "y" of the year you want to find Easter on after * 1582 * @returns
others/easter.cpp:47
↓ 8 callersMethodget
* @brief get the value of the key-value pair if exists * @param key key of the key-value pair * @return the value mapped to the given key
others/lru_cache2.cpp:172
↓ 8 callersMethodget
* @brief get the value of the key-value pair if exists * @param key key of the key-value pair * @return the value mapped to the given key
others/lfu_cache.cpp:202
↓ 8 callersMethodinsert
* @brief Insert element (External method) * @param k Key to insert */
data_structures/treap.cpp:203
↓ 8 callersFunctionisPowerOfTwo
* @brief The main function implements check for power of 2 * @param n is the number who will be checked * @returns either true or false */
bit_manipulation/power_of_2.cpp:32
↓ 8 callersFunctionmakeLinkedList
* @brief Give a vector of data, * it adds each element of vector in the linked list and return the address of * head pointer. * @param data A vecto
search/sublist_search.cpp:74
↓ 8 callersFunctionmodular_inverse
* @brief calculates the modular inverse. * @param a Integer value for the base * @param m Integer value for modulo * @return The result that is the
math/modular_inverse_fermat_little_theorem.cpp:103
↓ 8 callersFunctionnext_higher_number
* @brief The main function implements checking the next number * @param x the number that will be calculated * @returns a number */
bit_manipulation/next_higher_number_with_same_number_of_set_bits.cpp:33
↓ 8 callersMethodsearch
search a string exists inside a given root trie * @param str string to search for * @param index start index to search from * @returns
data_structures/trie_tree.cpp:56
↓ 8 callersMethodslice
* @brief Creates a new matrix and returns a part of it. * @param row_start start of the row * @param row_end end of the row * @param co
divide_and_conquer/strassen_matrix_multiplication.cpp:106
↓ 8 callersFunctiontest
* @brief Self-test implementations * @param vals Stream of values * @param windowSize Size of sliding window */
probability/windowed_median.cpp:182
↓ 8 callersFunctionunboundedKnapsack
* @brief Wrapper function to initiate the unbounded knapsack calculation. * * @param N Number of items. * @param W Maximum weight capacity of the k
dynamic_programming/unbounded_0_1_knapsack.cpp:93
↓ 8 callersMethodupper
* @brief returns upper 128-bit integer part * @returns returns upper 128-bit integer part */
ciphers/uint256_t.hpp:175
next →1–100 of 2,100, ranked by callers