MCPcopy Create free account

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

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

↓ 5 callersFunctionnumber_of_positive_divisors
* Function to compute the number of positive divisors. * @param n number to compute divisors for * @returns number of positive divisors of n (or 1 i
math/number_of_positive_divisors.cpp:32
↓ 5 callersFunctionnumber_of_subsets
* @brief The main function implements count of subsets * @param sum is the required sum of any subset * @param in_arr is the input array * @returns
backtracking/subset_sum.cpp:34
↓ 5 callersFunctionpower
* @brief This function calculates a raised to exponent b under modulo c using * modular exponentiation. * @param a integer base * @param b unsigned
math/modular_exponentiation.cpp:35
↓ 5 callersMethodprint
* @brief Prints the values of the Circular Linked List, beginning from the * root Node * @details Goes through each Node from the root and p
operations_on_datastructures/circular_linked_list.cpp:187
↓ 5 callersFunctionquadraticEquation
* @brief Quadratic equation calculator. * @param a quadratic coefficient. * @param b linear coefficient. * @param c constant * @return Array conta
math/quadratic_equations_complex_numbers.cpp:53
↓ 5 callersMethodquery
* @brief 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 retu
range_queries/persistent_seg_tree_lazy_prop.cpp:172
↓ 5 callersFunctionquick_sort
sorting/quick_sort.cpp:98
↓ 5 callersMethodremove
* @brief Recursive function to remove a value from the BST. * * @param parent The parent node of node. * @param node The node to search
data_structures/binary_search_tree2.cpp:125
↓ 5 callersFunctionsaddleback
* This function implements [Saddleback * Algorithm](https://www.geeksforgeeks.org/saddleback-search-algorithm-in-a-2d-array), * on a sorted 2D array
search/saddleback_search.cpp:39
↓ 5 callersFunctionsearch
* @brief A function that implements Boyer-Moore's algorithm. * * @param str Text we are seatching in. * @param arg pattern structure containing the
strings/boyer_moore.cpp:165
↓ 5 callersFunctionshift_left
* @brief Shifts the given vector to the left by the shift amount and returns a * new vector with the result. The original vector is not mutated. * @
operations_on_datastructures/array_left_rotation.cpp:46
↓ 5 callersFunctionshift_right
* @brief Shifts the given vector to the right by the shift amount and returns a * new vector with the result. The original vector is not mutated. *
operations_on_datastructures/array_right_rotation.cpp:47
↓ 5 callersFunctionshow
sorting/quick_sort.cpp:135
↓ 5 callersMethodsingle_predict
* Function to get prediction of model on single sample. * @param X array of feature vectors * @return returns predictions as vector */
machine_learning/neural_network.cpp:451
↓ 5 callersFunctionsubarray_sum
* @brief The main function that implements the count of the subarrays * @param sum is the required sum of any subarrays * @param in_arr is the input
backtracking/subarray_sum.cpp:39
↓ 5 callersMethodsum_range
* @brief Returns the prefix sum in range from L to R. * @param l Left index of range. * @param r Right index of range. * @return Sum of
range_queries/fenwick_tree.cpp:106
↓ 5 callersFunctiontest_eval
* @brief Wrapper to evaluate if the approximated * value is within `.XX%` threshold of the exact value. * @param approx aprroximate value * @par
math/integral_approximation.cpp:62
↓ 5 callersMethodtop
* Returns the top most element of the stack * @returns top element of the queue */
data_structures/stack_using_queue.cpp:41
↓ 5 callersMethodvalues
* @brief Returns a std::vector of the values of the Circular Linked List * @details Starting from the root Node, appends each value of the list t
operations_on_datastructures/circular_linked_list.cpp:214
↓ 5 callersFunctionwildcard_matching
backtracking/wildcard_matching.cpp:40
↓ 4 callersFunctionBidijkstra
* @brief Function runs the dijkstra algorithm for some source vertex and * target vertex in the graph and returns the shortest distance of target *
graph/bidirectional_dijkstra.cpp:87
↓ 4 callersMethodContains
* @brief Check if item is in the node * @param item item to check * @return true if item in the node, otherwise false */
data_structures/tree_234.cpp:92
↓ 4 callersFunctionFind
* * Find operation takes a number x and returns the set to which this number * belongs to. * @param x element of some set * @return set to which x
data_structures/disjoint_set.cpp:53
↓ 4 callersMethodGetItemIndex
* @brief Get the index of the item in the node, 0-based * @param item item to check * @return 0-based index of the item in the node, if not
data_structures/tree_234.cpp:107
↓ 4 callersMethodRemoveItemByIndex
* @brief Insert a value to the index position * @param index index of the item to remove * @param keep_left which child of the item to keep,
data_structures/tree_234.cpp:217
↓ 4 callersMethodSearchSuggestions
* @brief 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 *
operations_on_datastructures/trie_multiple_search.cpp:274
↓ 4 callersFunctionTravellingSalesmanProblem
* @brief Function calculates the minimum path distance that will cover all the * cities starting from the source. * * @param cities matrix represen
graph/travelling_salesman_problem.cpp:41
↓ 4 callersFunctionaliquot_sum
* @brief to return the aliquot sum of a number * @param num The input number */
math/aliquot_sum.cpp:36
↓ 4 callersFunctionapply_function
machine_learning/vector_ops.hpp:329
↓ 4 callersMethodbreadth_first_search
* this function performs the breadth first search on graph and return a * mapping which maps the nodes to a boolean value representing whether
graph/breadth_first_search.cpp:95
↓ 4 callersFunctionchange
* @brief The change() function is used * to return the updated iterative value corresponding * to the given function * @param x is the value corres
numerical_methods/rungekutta.cpp:33
↓ 4 callersFunctioncomplex_str
* create a textual form of complex number * \param[in] x point at which to evaluate the polynomial * \returns pointer to converted string */
numerical_methods/durand_kerner_roots.cpp:77
↓ 4 callersFunctioncountInversion
sorting/count_inversions.cpp:164
↓ 4 callersFunctioncycleSort
sorting/cycle_sort.cpp:38
↓ 4 callersMethoddeQueue
* @brief removes the first element from the queue * @exception std::invalid_argument if queue is empty */
data_structures/queue.hpp:81
↓ 4 callersFunctiondeallocate
* @brief This function clears the memory allocated to entire tree recursively. * Its just for clean up the memory and not relevant to the actual topi
operations_on_datastructures/inorder_successor_of_bst.cpp:210
↓ 4 callersFunctiondfs
* * @brief * Explores the given vertex, exploring a vertex means traversing * over all the vertices which are connected to the vertex that is * cu
graph/depth_first_search_with_stack.cpp:87
↓ 4 callersMethoddigit_char
* returns i^th digit as an ASCII character **/
math/large_number.h:248
↓ 4 callersFunctiondijkstra
* @brief Function runs the dijkstra algorithm for some source vertex and * target vertex in the graph and returns the shortest distance of target *
graph/dijkstra.cpp:66
↓ 4 callersFunctiondisplay
data_structures/linkedlist_implentation_usingarray.cpp:69
↓ 4 callersFunctiondnfSort
sorting/dnf_sort.cpp:39
↓ 4 callersFunctionevaluate_by_simpson
* @fn double evaluate_by_simpson(int N, double h, double a, * std::function<double (double)> func) * @brief Calculate integral or assert if integral
numerical_methods/composite_simpson_rule.cpp:67
↓ 4 callersMethodexpected_value
* @brief The expected value of a geometrically distributed random variable * X * @returns E[X] = 1/p */
probability/geometric_dist.cpp:71
↓ 4 callersFunctionf
* @fn double f(double x) * @brief A function f(x) that will be used to test the method * @param x The independent variable xi * @returns the value
numerical_methods/composite_simpson_rule.cpp:113
↓ 4 callersFunctionfind
Get the entry instance corresponding to a key * @param key key value to search/probe * @returns if present, the entry instance * @returns if not pr
hashing/quadratic_probing_hash_table.cpp:131
↓ 4 callersFunctionfind_pat_in_text
* @brief Using Z_function to find a pattern in a text * \param[in] pattern string pattern to search * \param[in] text text in which to search * \re
strings/z_function.cpp:54
↓ 4 callersFunctiongale_shapley
* @brief The main function that finds the stable matching between two sets of * elements using the Gale-Shapley Algorithm. * @note This doesn't work
greedy_algorithms/gale_shapley.cpp:46
↓ 4 callersFunctiongcd
* algorithm */
math/gcd_iterative_euclidean.cpp:15
↓ 4 callersFunctiongcd
* algorithm */
math/gcd_recursive_euclidean.cpp:14
↓ 4 callersMethodgetHits
* @brief A function to get page hits * @returns int * */
others/lru_cache.cpp:131
↓ 4 callersFunctiongetInorderSuccessor
* @brief Inorder successor of a node is the next node in inorder traversal of * the Binary Tree. This function takes the root node and the data of th
operations_on_datastructures/inorder_successor_of_bst.cpp:176
↓ 4 callersMethodgetPageFault
* @brief A function to get page fault * @returns int * */
others/lru_cache.cpp:136
↓ 4 callersFunctionget_rand
* \brief Function to get random numbers to generate our complex numbers for * test */
math/complex_numbers.cpp:201
↓ 4 callersFunctionget_value
* This function finds value for given character (i.e.0-25) * @param c character for which we want value * @return returns co
ciphers/vigenere_cipher.cpp:61
↓ 4 callersFunctiongram_schmidt
* Function for the process of Gram Schimdt Process * @param r number of vectors * @param c dimension of vectors * @param A stores input of given LI
numerical_methods/gram_schmidt.cpp:121
↓ 4 callersMethodhopcroftKarpAlgorithm
* @brief This function counts the number of augmenting paths between left and right sides of the Bipartite graph * @returns size of maximum matching
graph/hopcroft_karp.cpp:95
↓ 4 callersFunctionhouseRobber
* @brief The main function that implements the House Robber algorithm using * dynamic programming * @param money array containing money in the ith h
dynamic_programming/house_robber.cpp:36
↓ 4 callersFunctioninsert
* @brief inserts a new element into AVL tree * @param root of the tree * @param[in] item the element to be insterted into the tree * @return root o
data_structures/avltree.cpp:92
↓ 4 callersMethodinsert_front
List insert a new value at head in list */
data_structures/cll/cll.cpp:33
↓ 4 callersFunctioninsertionSort_binsrch
sorting/binary_insertion_sort.cpp:84
↓ 4 callersMethodisEmptyStack
Determine whether the stack is empty */
data_structures/stack.hpp:44
↓ 4 callersMethodlower
* @brief returns lower 128-bit integer part * @returns returns lower 128-bit integer part */
ciphers/uint256_t.hpp:169
↓ 4 callersMethodlowest_common_ancestor
* \brief Query the structure to find the lowest common ancestor. * Assumes that the provided numbers are valid indices of vertices. * Iterat
graph/lowest_common_ancestor.cpp:164
↓ 4 callersFunctionlps
* @brief Function that returns the longest palindromic * subsequence of a string * @param a string whose longest palindromic subsequence is to be
dynamic_programming/longest_palindromic_subsequence.cpp:31
↓ 4 callersFunctionmakeBST
* @brief This function is used in test cases to quickly create BST containing * large data instead of hard coding it in code. For a given root, this
operations_on_datastructures/inorder_successor_of_bst.cpp:155
↓ 4 callersFunctionmidpoint
* @fn double midpoint(const std::int32_t N, const double h, const double a, * const std::function<double (double)>& func) * @brief Main function for
numerical_methods/midpoint_integral_method.cpp:52
↓ 4 callersFunctionmultiply
* @brief multiply Point and integer * @details Multiply Point by a scalar factor (here it is a private key p). The * multiplication is called as [do
ciphers/elliptic_curve_key_exchange.cpp:165
↓ 4 callersFunctionn_choose_r
math/n_choose_r.cpp:35
↓ 4 callersMethodnumber_of_vertices
* Function to get the number of vertices in the graph * @return the number of vertices in the graph. */
graph/lowest_common_ancestor.cpp:74
↓ 4 callersFunctionorientation
* @brief To find orientation of ordered triplet (p, q, r). * @param p Co-ordinates of Point p <int, int>. * @param q Co-ordinates of Point q <int, i
geometry/graham_scan_functions.hpp:104
↓ 4 callersMethodpop
* @brief Removes the topmost element from the stack * @returns void */
data_structures/stack_using_queue.cpp:62
↓ 4 callersFunctionpower_of_two
* @brief This function finds whether a number is power of 2 or not * @param n value for which we want to check * prints the result, as "Yes, the num
math/power_of_two.cpp:42
↓ 4 callersMethodpredict
* predict the output of the model for given set of features * \param[in] x input vector * \param[out] out optional argument to return neuron
machine_learning/adaline_learning.cpp:95
↓ 4 callersFunctionprintArray
sorting/heap_sort.cpp:37
↓ 4 callersFunctionprintInorder
* @brief Prints the BST in inorder traversal using recursion. * @param root A pointer to the root node of the BST. * @returns void * */
operations_on_datastructures/inorder_successor_of_bst.cpp:136
↓ 4 callersFunctionprofitPerUnit
greedy_algorithms/knapsack.cpp:9
↓ 4 callersMethodpush
* @brief Inserts an element to the top of the stack. * @param val the element that will be inserted into the stack * @returns void */
data_structures/stack_using_queue.cpp:48
↓ 4 callersFunctionquadraticProbe
Performs quadratic probing to resolve collisions * @param key key value to search/probe * @param searching `true` if only searching, `false1 if assi
hashing/quadratic_probing_hash_table.cpp:56
↓ 4 callersFunctionquery
* @brief Returns the sum of all elements in a range * * @param segtree the segment tree * @param lazy for lazy propagation * @param qlow l
range_queries/segtree.cpp:63
↓ 4 callersFunctionquickSortRP
sorting/random_pivot_quick_sort.cpp:130
↓ 4 callersFunctionrabin_karp
strings/rabin_karp.cpp:83
↓ 4 callersFunctionreset_data
games/memory_game.cpp:211
↓ 4 callersFunctionreverse
operations_on_datastructures/reverse_a_linked_list_using_recusion.cpp:29
↓ 4 callersFunctionroot
graph/kruskal.cpp:19
↓ 4 callersFunctionsafe_substr
* @brief Wrapper function for substr that considers leading zeros. * @param str, the binary input string. * @param x1, the substr parameter integer
divide_and_conquer/karatsuba_algorithm_for_fast_multiplication.cpp:85
↓ 4 callersFunctionselectionSort
sorting/selection_sort_iterative.cpp:48
↓ 4 callersFunctionselectionSortRecursive
sorting/selection_sort_recursive.cpp:76
↓ 4 callersFunctionsetKthBit
* @brief The main function implements set kth bit * @param N is the number whose kth bit will be set * @returns returns an integer after setting the
bit_manipulation/set_kth_bit.cpp:43
↓ 4 callersMethodsize
* @brief Returns the number of items present in the cache. * @return number of items in the cache */
others/lru_cache2.cpp:187
↓ 4 callersMethodstd
return sample standard deviation computed till last sample */
math/realtime_stats.cpp:48
↓ 4 callersFunctionsublistSearch
* @brief Main searching function * @param sublist A linked list which is supposed to be searched in mainList. * @param mainList A linked list in whi
search/sublist_search.cpp:115
↓ 4 callersFunctionsum
machine_learning/vector_ops.hpp:232
↓ 4 callersMethodtopmost
* @brief Displays the topmost element of the stack * * @return The topmost element of the stack * @throws std::out_of_range if the stac
data_structures/stack_using_array.cpp:84
↓ 4 callersMethodvariance
* @brief The variance of a geometrically distributed random variable X * @returns V[X] = (1 - p) / p^2 */
probability/geometric_dist.cpp:77
↓ 4 callersFunctionwaveSort
sorting/wave_sort.cpp:34
↓ 3 callersFunctionCombSort
Function to sort array * * @param arr array to be sorted * @param l start index of array * @param r end index of array * */
sorting/comb_sort.cpp:42
↓ 3 callersMethodGetChildIndex
* @brief Get the child's index of the children array * @param child child pointer of which to get the index * @return the index of child
data_structures/tree_234.cpp:237
↓ 3 callersMethodGetNextPossibleChild
* @brief Get next node which is possibly contains item * @param item item to search * @return the next node that possibly contains item
data_structures/tree_234.cpp:304
↓ 3 callersFunctionInsert
data_structures/binary_search_tree.cpp:29
↓ 3 callersMethodIsFull
* @brief Check if node is a full (4-node) * @return true if node is full (4-node), false otherwise */
data_structures/tree_234.cpp:73
← previousnext →201–300 of 2,100, ranked by callers