MCPcopy Create free account

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

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

↓ 3 callersMethod_lez
* @brief Leading zeroes in binary * @details Calculates leading zeros in 128-bit integer * @returns Integer denoting leading zeroes */
ciphers/uint128_t.hpp:140
↓ 3 callersMethod_lez
* @brief Leading zeroes in binary * @details Calculates leading zeros in 256-bit integer * @returns Integer denoting leading zeroes */
ciphers/uint256_t.hpp:123
↓ 3 callersMethoda_star_search
* Main algorithm for finding `FinalState`, given the `InitialState` * @param dist the heuristic finction, defined by the user * @param permi
machine_learning/a_star_search.cpp:431
↓ 3 callersFunctionabbreviation
* @brief * Iterative Dynamic Programming function * @details * Returns whether `s` can be converted to `t` with following rules: * a. Capitalize z
dynamic_programming/abbreviation.cpp:119
↓ 3 callersFunctionabbreviation_recursion
* @brief * Recursive Dynamic Programming function * @details * Returns whether `s` can be converted to `t` with following rules: * a. Capitalize z
dynamic_programming/abbreviation.cpp:59
↓ 3 callersMethodadd
* @brief Turn bit on position x to 1s * * @param x position to turn bit on * @returns void */
data_structures/bloom_filter.cpp:71
↓ 3 callersMethodadd_edge
* @brief Adds an undirected edge from node u to node v in the tree * @param u the node where the edge is from * @param v the node where the
range_queries/heavy_light_decomposition.cpp:159
↓ 3 callersFunctionask_data
games/memory_game.cpp:161
↓ 3 callersFunctionbinarySearch
* @brief The main function which implements binary search * @param arr vector to be searched in * @param val value to be searched * @returns @param
search/binary_search.cpp:61
↓ 3 callersMethodcapacity
* @brief Returns the total capacity of the cache * @return Total capacity of the cache */
others/lru_cache2.cpp:193
↓ 3 callersMethodcapacity
* @brief Returns the total capacity of the cache * @return Total capacity of the cache */
others/lfu_cache.cpp:223
↓ 3 callersFunctioncircle
* Find the centre and radius of a circle enclosing a set of points.\n * The function returns the radius of the circle and prints the coordinated of
others/smallest_circle.cpp:87
↓ 3 callersFunctiondegrees_to_radians
physics/ground_to_ground_projectile_motion.cpp:39
↓ 3 callersFunctiondeleteAll
others/recursive_tree_traversal.cpp:185
↓ 3 callersFunctiondoubleHash
* @brief Performs double hashing to resolve collisions * * @param key key value to apply double-hash on * @param searching `true` to check for conf
hashing/double_hash_hash_table.cpp:71
↓ 3 callersFunctionduplicateNumber
search/floyd_cycle_detection_algo.cpp:37
↓ 3 callersFunctiondurand_kerner_algo
* Implements Durand Kerner iterative algorithm to compute all roots of a * polynomial. * * \param[in] coeffs coefficients of the polynomial * \par
numerical_methods/durand_kerner_roots.cpp:110
↓ 3 callersFunctioneigen_values
Compute eigen values using iterative shifted QR decomposition algorithm as * follows: * 1. Use last diagonal element of A as eigen value approximati
numerical_methods/qr_eigen_values.cpp:98
↓ 3 callersMethodempty
* @brief returns whether the cache is empty or not * @return true if the cache is empty, false otherwise. */
others/lru_cache2.cpp:199
↓ 3 callersFunctioneq
* @brief This function gives the value of f(x) for given x. * @param x value for which we have to find value of f(x). * @return value of f(x) for gi
numerical_methods/false_position.cpp:44
↓ 3 callersFunctioneq
define \f$f(x)\f$ to find root for */
numerical_methods/bisection_method.cpp:26
↓ 3 callersFunctionfast_power_recursive
math/fast_power.cpp:26
↓ 3 callersFunctionfindParent
* @brief Recursively returns the vertex's parent at the root of the tree * @param parent the array that will be checked * @param v vertex to find pa
greedy_algorithms/boruvkas_minimum_spanning_tree.cpp:47
↓ 3 callersFunctionfind_set
* @brief Find the component where following node belongs to * @param val parent of val should be found * @return parent of val */
graph/connected_components_with_dsu.cpp:54
↓ 3 callersFunctionfit_OLS_regressor
machine_learning/ordinary_least_squares_regressor.cpp:321
↓ 3 callersMethodfull
* @brief Checks if the stack is full * * @return true if the stack is full, false otherwise */
data_structures/stack_using_array.cpp:35
↓ 3 callersMethodgenerate
* @brief wrapper interface * * @param n number of pairs of parentheses * @return all well-formed pattern of parentheses */
backtracking/generate_parentheses.cpp:70
↓ 3 callersFunctiongetBalance
* @param[in] root of the tree * @return difference between height of left and right subtree */
data_structures/avltree.cpp:49
↓ 3 callersFunctiongetConnectedComponents
* @brief Function that perfoms depth first search algorithm on graph * and calculated the number of connected components. * * @param adj adjacency
graph/connected_components.cpp:77
↓ 3 callersFunctiongetMinimum
range_queries/sparse_table_range_queries.cpp:84
↓ 3 callersFunctiongetSize
operations_on_datastructures/get_size_of_linked_list.cpp:11
↓ 3 callersFunctionget_clock_diff
* Convert clock cycle difference to time in seconds * * \param[in] start_t start clock * \param[in] end_t end clock * \returns time difference in
machine_learning/kohonen_som_topology.cpp:577
↓ 3 callersFunctionget_clock_diff
* Convert clock cycle difference to time in seconds * * \param[in] start_t start clock * \param[in] end_t end clock * \returns time difference in
machine_learning/kohonen_som_trace.cpp:452
↓ 3 callersFunctionget_minima
* @brief Get the minima of a function in the given interval. To get the maxima, * simply negate the function. The golden ratio used here is:\f[ * k=
numerical_methods/golden_search_extrema.cpp:30
↓ 3 callersFunctionget_minima
* @brief Get the real root of a function in the given interval. * * @param f function to get root for * @param lim_a lower limit of search window
numerical_methods/brent_method_extrema.cpp:36
↓ 3 callersMethodget_state
* @brief Returns the current state of the board */
machine_learning/a_star_search.cpp:113
↓ 3 callersFunctiongnomeSort
sorting/gnome_sort.cpp:34
↓ 3 callersFunctionhamilton_cycle
* The function determines if there is a hamilton's cycle in the graph * * @param routes nxn boolean matrix of \f$[i, j]\f$ where \f$[i, j]\f$ is `tr
graph/hamiltons_cycle.cpp:30
↓ 3 callersMethodhash
* @brief Compute the hash of a value for current chain * * @param x value to compute modulus of * @return modulus of `x` * @note d
hashing/chaining.cpp:91
↓ 3 callersFunctionimod
* @brief Function imod * Calculates the modular inverse of x with respect to y, x^{-1} \mod y * @param x number * @param y number * @returns the m
math/modular_inverse_simple.cpp:21
↓ 3 callersFunctioninit
games/memory_game.cpp:80
↓ 3 callersMethodinit
* @brief This function must be called after the tree adjacency list and * node values are populated The function initializes the required *
range_queries/heavy_light_decomposition.cpp:456
↓ 3 callersMethodinorder
* @brief inorder() function that will perform the inorder traversal * recursively, and return the resultant vector that contain the inorder * traver
others/recursive_tree_traversal.cpp:132
↓ 3 callersMethodinsert_tail
List insert a new value at head in list */
data_structures/cll/cll.cpp:54
↓ 3 callersFunctionintegral_monte_carlo
* @brief Compute an approximation of an integral using Monte Carlo integration * @details The integration domain [a,b] is given by the pdf. * The pd
math/integral_approximation2.cpp:112
↓ 3 callersMethodinverse_cumulative_distribution
* @brief The inverse cumulative distribution function * @details This functions answers the question: Up to how many trials are * needed to
probability/geometric_dist.cpp:116
↓ 3 callersFunctionisDigit
* This function checks if the string passed consists * of only digits. * @param s To be checked if s contains only integers * @returns true if ther
data_structures/linked_list.cpp:40
↓ 3 callersMethodisEmptyQueue
* @brief checks if the queue has no elements * @return true if the queue is empty, false otherwise */
data_structures/queue.hpp:49
↓ 3 callersFunctionis_magic
* @brief Check if the sequence is magic * @param s working memory for the sequence * @returns true if it's a magic sequence * @returns false if it'
backtracking/magic_sequence.cpp:53
↓ 3 callersFunctionis_prefix
* @brief Check if pat is prefix of str. * * @param str pointer to some part of the input text. * @param pat the searched pattern. * @param len len
strings/boyer_moore.cpp:200
↓ 3 callersFunctionkaratsuba_algorithm
* @brief The main function implements Karatsuba's algorithm for fast * multiplication * @param str1 the input string 1 * @param str2 the input stri
divide_and_conquer/karatsuba_algorithm_for_fast_multiplication.cpp:111
↓ 3 callersFunctionkohonen_som
* Apply incremental algorithm with updating neighborhood and learning * rates on all samples in the given datset. * * \param[in] X data set * \par
machine_learning/kohonen_som_topology.cpp:269
↓ 3 callersFunctionkohonen_som_tracer
* Apply incremental algorithm with updating neighborhood and learning rates * on all samples in the given datset. * * \param[in] X data set * \par
machine_learning/kohonen_som_trace.cpp:149
↓ 3 callersFunctionleftRotate32bits
* @brief Rotates the bits of a 32-bit unsigned integer * @param n Integer to rotate * @param rotate How many bits for the rotation * @return uint32
hashing/sha1.cpp:58
↓ 3 callersFunctionlevelOrder
* @brief prints given tree in the LevelOrder * @param[in] root of the tree */
data_structures/avltree.cpp:163
↓ 3 callersFunctionlinearProbe
Performs linear probing to resolve collisions * @param key key value to hash * @return hash value of the key */
hashing/linear_probing_hash_table.cpp:55
↓ 3 callersFunctionlongest_common_string_length
* @brief computes the length of the longest common string created from input * strings * @details has O(str_a.size()*str_b.size()) time and memory c
dynamic_programming/longest_common_string.cpp:28
↓ 3 callersFunctionmatrix_multiplication
math/linear_recurrence_matrix.cpp:51
↓ 3 callersFunctionmaxProfitByCuttingRod
dynamic_programming/cut_rod.cpp:45
↓ 3 callersFunctionmultiply
machine_learning/vector_ops.hpp:460
↓ 3 callersMethodnaive_multiplication
divide_and_conquer/strassen_matrix_multiplication.cpp:316
↓ 3 callersFunctionpancakeSort
sorting/pancake_sort.cpp:61
↓ 3 callersMethodpostorder
* @brief postorder function that will perform the postorder traversal * recursively, and return the result vector that contain the postorder * trave
others/recursive_tree_traversal.cpp:172
↓ 3 callersFunctionpredict_OLS_regressor
machine_learning/ordinary_least_squares_regressor.cpp:352
↓ 3 callersMethodpreorder
* @brief preorder function that will perform the preorder traversal * recursively, and return the resultant vector that contain the preorder * trave
others/recursive_tree_traversal.cpp:152
↓ 3 callersMethodprobability_density
* @brief The probability density function * @details As we use the first definition of the geometric series (1), * we are doing k - 1 failed
probability/geometric_dist.cpp:93
↓ 3 callersFunctionpush
push byte to stack variable
others/paranthesis_matching.cpp:26
↓ 3 callersFunctionquery
* @brief query function * @param beg begin of the interval to sum * @param end end of the interval to sum * @returns sum of the range [beg, end]
range_queries/prefix_sum_array.cpp:54
↓ 3 callersMethodquery
* @brief Make a range query from node label l to node label r * @param l node label where the path starts * @param r node label where the pa
range_queries/heavy_light_decomposition.cpp:309
↓ 3 callersMethodquery
* @brief Queries the sparse table for the value of the interval [l, r] * (i.e. from l to r inclusive). * @param l the left index of the rang
data_structures/sparse_table.cpp:110
↓ 3 callersFunctionrandomized_bogosort
sorting/bogo_sort.cpp:52
↓ 3 callersMethodremove
* @brief To remove the element from the list * @param val element that will be removed * @returns void */
data_structures/list_array.cpp:183
↓ 3 callersFunctionremove_from_stack
others/postfix_evaluation.cpp:81
↓ 3 callersMethodreverse
* Reverses the Binary Tree */
operations_on_datastructures/reverse_binary_tree.cpp:128
↓ 3 callersFunctionrungeKutta
* @brief the Runge Kutta method finds the value of integration of a function in * the given limits. the lower limit of integration as the initial val
numerical_methods/rungekutta.cpp:57
↓ 3 callersFunctionsample_test
* @brief Tests the sampling method of the geometric distribution * @details Draws 1000000 random samples and estimates mean and variance * These sho
probability/geometric_dist.cpp:165
↓ 3 callersFunctionsave_2d_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_topology.cpp:65
↓ 3 callersMethodset_node_val
* @brief Set the values for all the nodes * @param node_val a vector of size n, with all the node values where, n is * the number of nodes
range_queries/heavy_light_decomposition.cpp:177
↓ 3 callersFunctionshell_sort
sorting/shell_sort2.cpp:45
↓ 3 callersFunctionshow
Display the towers */
others/tower_of_hanoi.cpp:19
↓ 3 callersFunctionsieve
* @brief Function to sieve out the primes * @details * This function finds all the primes between 2 and N using the Sieve of * Eratosthenes algorit
math/sieve_of_eratosthenes.cpp:45
↓ 3 callersMethodstandard_deviation
* @brief The standard deviation of a geometrically distributed random * variable X * @returns \sigma = \sqrt{V[X]} */
probability/geometric_dist.cpp:84
↓ 3 callersFunctionstoogeSort
* @brief The stoogeSort() function is used for sorting the array. * @param L - vector of values (int) to be sorted in in place (ascending order) *
sorting/stooge_sort.cpp:28
↓ 3 callersFunctiontest
Wrapper to run tests using both recursive and iterative implementations. * The checks are only valid in debug builds due to the use of `assert()` *
math/double_factorial.cpp:43
↓ 3 callersFunctiontest_f
* Test implementation of shell_sort on float arrays by comparing results * against std::qsort. */
sorting/shell_sort2.cpp:145
↓ 3 callersFunctiontest_int
* Test implementation of shell_sort on integer arrays by comparing results * against std::qsort. */
sorting/shell_sort2.cpp:105
↓ 3 callersFunctiontopologicalSort
* @brief Function to get the topological sort of the graph * @param g Graph object * @returns A vector containing the topological order of nodes */
graph/topological_sort.cpp:95
↓ 3 callersMethodupdate
* @brief Update the value at a node * @param p the node to be udpated * @param v the update value * @returns void */
range_queries/heavy_light_decomposition.cpp:297
↓ 3 callersFunctionupdate_step
math/extended_euclid_algorithm.cpp:25
↓ 3 callersMethodval
* function returns the integer value stored in the link. * @returns the integer value stored in the link. */
data_structures/linked_list.cpp:63
↓ 3 callersFunctionvector_dot
numerical_methods/qr_decompose.h:76
↓ 3 callersFunctionwordBreak
* @brief Function that checks if the string passed in param can be * segmented into the strings present in the vector. * In others words, it checks
dynamic_programming/word_break.cpp:131
↓ 2 callersFunctionCanIMove
backtracking/n_queens_all_solution_optimised.cpp:59
↓ 2 callersFunctionCocktailSelectionSort
sorting/cocktail_selection_sort.cpp:12
↓ 2 callersFunctionConsTree
* @brief Constructs the initial segment tree * * @param arr input to construct the tree out of * @param segtree the segment tree * @param
range_queries/segtree.cpp:38
↓ 2 callersFunctionCreateTree
data_structures/tree.cpp:11
↓ 2 callersFunctionFastFourierTransform
* @brief FastFourierTransform is a recursive function which returns list of * complex numbers * @param p List of Coefficents in form of complex nu
numerical_methods/fast_fourier_transform.cpp:42
↓ 2 callersFunctionFast_InvSqrt
math/inv_sqrt.cpp:28
↓ 2 callersMethodGetLeftmostChild
* @brief Get leftmose child of the current node * @return the leftmost child */
data_structures/tree_234.cpp:271
↓ 2 callersMethodGetMaxItem
* @brief Get max item (rightmost) in the current node * @return max item */
data_structures/tree_234.cpp:120
← previousnext →301–400 of 2,100, ranked by callers