Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/TheAlgorithms/C-Plus-Plus
/ functions
Functions
2,100 in github.com/TheAlgorithms/C-Plus-Plus
⨍
Functions
2,100
◇
Types & classes
164
↓ 1 callers
Function
eq
equation 1 * \f[f(y) = 3y - \cos y -2\f] */
numerical_methods/successive_approximation.cpp:12
↓ 1 callers
Function
eq_der
define the derivative function \f$f'(x)\f$ * For the current problem, it is: * \f[ * f'(x) = 3x^2 - 4 * \f] */
numerical_methods/newton_raphson_method.cpp:40
↓ 1 callers
Function
eqd
equation 2 * \f[f(y) = \frac{\cos y+2}{2}\f] */
numerical_methods/successive_approximation.cpp:17
↓ 1 callers
Method
erase
* function erases old element from the list * @param old_elem to be erased from the list */
data_structures/linked_list.cpp:152
↓ 1 callers
Function
euclidean_distance
machine_learning/k_nearest_neighbors.cpp:43
↓ 1 callers
Function
evaluate
* @brief Evaluate answer using given last two operands from and operation * @param a second last added operand which will be used for evaluation * @
others/postfix_evaluation.cpp:49
↓ 1 callers
Method
evaluate
* Function to evaluate model on supplied data * @param X array of feature vectors (input data) * @param Y array of target values (label)
machine_learning/neural_network.cpp:606
↓ 1 callers
Function
exact_solution
* @brief Exact solution of the problem. Used for solution comparison. * * @param[in] x independent variable * @param[in,out] y dependent varia
numerical_methods/ode_midpoint_euler.cpp:66
↓ 1 callers
Function
exact_solution
* @brief Exact solution of the problem. Used for solution comparison. * * @param[in] x independent variable * @param[in,out] y dependent varia
numerical_methods/ode_forward_euler.cpp:67
↓ 1 callers
Function
exact_solution
* @brief Exact solution of the problem. Used for solution comparison. * * @param[in] x independent variable * @param[in,out] y dependent varia
numerical_methods/ode_semi_implicit_euler.cpp:66
↓ 1 callers
Function
example
* @brief example showing the usage of the math::ncr_modulo_p::NCRModuloP class */
math/ncr_modulo_p.cpp:175
↓ 1 callers
Function
exists
* @brief Function that checks if the string passed in param is present in * the the unordered_set passed * * @param str the string to be searched
dynamic_programming/word_break.cpp:60
↓ 1 callers
Function
explore
* @brief Utility function for depth first seach algorithm * this function explores the vertex which is passed into. * * @param adj adjacency list o
graph/connected_components.cpp:59
↓ 1 callers
Function
explore
* * \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.cpp:80
↓ 1 callers
Function
extendedEuclid
math/extended_euclid_algorithm.cpp:71
↓ 1 callers
Function
extendedEuclid_1
math/extended_euclid_algorithm.cpp:42
↓ 1 callers
Method
extractMin
Method to remove minimum element (or root) from min heap
data_structures/binaryheap.cpp:85
↓ 1 callers
Function
fact
* Compute factorial of a given number */
probability/poisson_dist.cpp:30
↓ 1 callers
Function
fastinput
Function to read the number from stdin. The function reads input until a non * numeric character is entered. */
others/fast_integer_input.cpp:11
↓ 1 callers
Function
fib
dynamic_programming/fibonacci_bottom_up.cpp:3
↓ 1 callers
Function
fib_Accurate
Fibonacci iterator * \param [in] n n^th Fibonacci number */
math/string_fibonacci.cpp:69
↓ 1 callers
Function
filtering
* @brief Sub-solutions filtering * @param s working memory for the sequence * @param depth current depth in tree * @returns true if the sub-solutio
backtracking/magic_sequence.cpp:69
↓ 1 callers
Function
findMaxInLeftST
data_structures/binary_search_tree.cpp:53
↓ 1 callers
Function
findMinCoins
Function to find the Minimum number of coins required to get Sum S
dynamic_programming/coin_change.cpp:7
↓ 1 callers
Function
findMinIndex
sorting/selection_sort_recursive.cpp:56
↓ 1 callers
Function
findMinNode
* @brief Finds and return the minimum node in BST. * @param root A pointer to root node. * @returns Node* Pointer to the found node * */
operations_on_datastructures/inorder_successor_of_bst.cpp:121
↓ 1 callers
Function
findPartiion
* @brief Returns true if arr can be partitioned in two subsets of equal sum, * otherwise false * @param arr vector containing elements * @param siz
dynamic_programming/partition_problem.cpp:54
↓ 1 callers
Function
findShiftTable
* A function that finds the shift table of the given prototype string that we need in Horpool's algorithm. * @param prototype is the substring that w
strings/horspool.cpp:26
↓ 1 callers
Function
first_test
* @brief Self-test implementations * @returns void */
math/finding_number_of_digits_in_a_number.cpp:74
↓ 1 callers
Method
fit
* Function to fit model on supplied data * @param X array of feature vectors * @param Y array of target values * @param epochs number o
machine_learning/neural_network.cpp:485
↓ 1 callers
Method
fit_from_csv
* Function to fit model on data stored in csv file * @param file_name csv file name * @param last_label flag for whether label is in first o
machine_learning/neural_network.cpp:587
↓ 1 callers
Method
ford_fulkerson
graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp:61
↓ 1 callers
Function
forward_euler
* @brief Compute approximation using the forward-Euler * method in the given limits. * @param[in] dx step size * @param[in] x0 initial val
numerical_methods/ode_forward_euler.cpp:102
↓ 1 callers
Function
forward_euler_step
\addtogroup ode Ordinary Differential Equations * Integration functions for implementations with solving [ordinary differential * equations](https:/
numerical_methods/ode_forward_euler.cpp:86
↓ 1 callers
Function
gcd
* Function for finding greatest common divisor of two numbers. * @params two integers x and y whose gcd we want to find. * @return greatest common d
math/least_common_multiple.cpp:16
↓ 1 callers
Function
gcdExtended
* @brief finds the values x and y such that a*x + b*y = gcd(a,b) * * @param[in] a the first input of the gcd * @param[in] a the second input of the
math/ncr_modulo_p.cpp:44
↓ 1 callers
Function
gcd_two
* @brief Function to compute GCD of 2 numbers x and y * @param x First number * @param y Second number * @return GCD of x and y via recursion */
math/gcd_of_n_numbers.cpp:35
↓ 1 callers
Function
genArray
Arrange sequence of numbers from '1' in a matrix form * \param [out] a matrix to fill * \param [in] r number of rows * \param [in] c number of colu
others/spiral_print.cpp:12
↓ 1 callers
Method
generate_possible_moves
* @brief Find all possible states after processing all possible * moves, given the current state of the puzzle * @returns list of vector con
machine_learning/a_star_search.cpp:178
↓ 1 callers
Function
generate_samples
* @brief Generate samples according to some pdf * @details This function uses Metropolis-Hastings to generate random numbers. * It generates a seque
math/integral_approximation2.cpp:64
↓ 1 callers
Function
generate_uniform
* @brief Returns a random number between [0,1] * @returns A uniformly distributed random number between 0 (included) and 1 * (included) */
probability/geometric_dist.cpp:48
↓ 1 callers
Method
getConvexHull
* Creates convex hull of a set of n points. * There must be 3 points at least for the convex hull to exist * *
geometry/jarvis_algorithm.cpp:78
↓ 1 callers
Function
getFailureArray
* @brief Generate the partial match table aka failure function for a pattern to * search. * @param pattern text for which to create the partial matc
strings/knuth_morris_pratt.cpp:32
↓ 1 callers
Method
getMedian
* @brief Gets the median of the values in the sliding window * @return Median of sliding window. For even window size return the average * b
probability/windowed_median.cpp:148
↓ 1 callers
Method
getMedianNaive
* @brief A naive and inefficient method to obtain the median of the sliding * window. Used for testing! * @return Median of sliding window.
probability/windowed_median.cpp:161
↓ 1 callers
Function
getNode
* @brief Searches the given data in BST and returns the pointer to the node * containing that data. * @param root Pointer to the root node of the BS
operations_on_datastructures/inorder_successor_of_bst.cpp:100
↓ 1 callers
Method
getNumNodes
* @brief Get the number of nodes in the graph * @returns The number of nodes */
graph/topological_sort.cpp:69
↓ 1 callers
Function
getRandomIndex
* @brief Takes the start and end indices of an array and returns a random * int64_teger between the range of those two for selecting pivot element.
sorting/random_pivot_quick_sort.cpp:88
↓ 1 callers
Method
get_elements_inorder
* @brief Get all values of the BST in in-order order. * * @return std::vector<T> List of values, sorted in in-order order. */
data_structures/binary_search_tree2.cpp:321
↓ 1 callers
Method
get_elements_postorder
* @brief Get all values of the BST in post-order order. * * @return std::vector<T> List of values, sorted in post-order order. */
data_structures/binary_search_tree2.cpp:345
↓ 1 callers
Method
get_elements_preorder
* @brief Get all values of the BST in pre-order order. * * @return std::vector<T> List of values, sorted in pre-order order. */
data_structures/binary_search_tree2.cpp:333
↓ 1 callers
Function
get_input
* get_input function is to receive input from standard IO * @todo @christianbender Get input from STDIO or write input to memory as done * above. *
search/ternary_search.cpp:36
↓ 1 callers
Function
get_min_2d
* Get minimum value and index of the value in a matrix * \param[in] X matrix to search * \param[in] N number of points in the vector * \param[out]
machine_learning/kohonen_som_topology.cpp:105
↓ 1 callers
Method
get_next
* @brief Get the successor node of element k * @param k The queried element * @return The successor */
data_structures/treap.cpp:188
↓ 1 callers
Function
get_test_cases
* @return example data used in the tests of ::longest_common_string_length */
dynamic_programming/longest_common_string.cpp:69
↓ 1 callers
Function
get_transpose
machine_learning/ordinary_least_squares_regressor.cpp:300
↓ 1 callers
Function
hadamard_product
machine_learning/vector_ops.hpp:494
↓ 1 callers
Function
hash_bs
* @brief The SHA-1 algorithm itself, taking in a bytestring * @param input_bs The bytestring to hash * @param input_size The size (in BYTES) of the
hashing/sha1.cpp:84
↓ 1 callers
Function
hash_bs
* @brief The MD5 algorithm itself, taking in a bytestring * @param input_bs The bytestring to hash * @param input_size The size (in BYTES) of the in
hashing/md5.cpp:139
↓ 1 callers
Function
hash_search
* Input the key to be searched, and get the hash header position through the H * (int key) function, then one-dimensional linear search. If found @re
search/hash_search.cpp:76
↓ 1 callers
Function
hemi_sphere_surface_area
math/area.cpp:121
↓ 1 callers
Function
horizontal_range
physics/ground_to_ground_projectile_motion.cpp:64
↓ 1 callers
Function
init_bad_char
* @brief A function that preprocess the bad char table * * @param str The string being preprocessed * @param arg The bad char table * @returns voi
strings/boyer_moore.cpp:138
↓ 1 callers
Function
init_good_suffix
* @brief A function that preprocess the good suffix thable * * @param str The string being preprocessed * @param arg The good suffix table * @retu
strings/boyer_moore.cpp:89
↓ 1 callers
Function
initial
graph/kruskal.cpp:13
↓ 1 callers
Function
initialise_list
data_structures/linkedlist_implentation_usingarray.cpp:23
↓ 1 callers
Function
initilize
greedy_algorithms/prims_minimum_spanning_tree.cpp:17
↓ 1 callers
Function
insert
data_structures/morrisinorder.cpp:16
↓ 1 callers
Method
insert
data_structures/doubly_linked_list.cpp:21
↓ 1 callers
Function
insertAtTheBeginning
The function will insert the given data * into the front of the linked list. */
data_structures/linkedlist_implentation_usingarray.cpp:50
↓ 1 callers
Function
insertAtTheEnd
data_structures/linkedlist_implentation_usingarray.cpp:57
↓ 1 callers
Method
insertElement
* Inserts elements with given key and value; * It's level is computed by randomLevel() function. * @param key is number that is used for com
data_structures/skip_list.cpp:90
↓ 1 callers
Function
insert_element
machine_learning/vector_ops.hpp:85
↓ 1 callers
Function
insertionSort
this function sorts array from left index to to right index which is of size atmost RUN
sorting/tim_sort.cpp:11
↓ 1 callers
Function
interactive
* @brief Puts user in a loop where inputs can be given and SHA-1 hash will be * computed and printed * @returns void */
hashing/sha1.cpp:275
↓ 1 callers
Function
interactive
* @brief Puts user in a loop where inputs can be given and MD5 hash will be * computed and printed * @returns void */
hashing/md5.cpp:352
↓ 1 callers
Function
interpolationSearch
* @brief The main function which implements interpolation search * @param arr vector to be searched in * @param number value to be searched * @retu
search/interpolation_search.cpp:58
↓ 1 callers
Method
intersect
geometry/line_segment_intersection.cpp:23
↓ 1 callers
Function
isPrime
* @brief Check if an integer is a prime number in \f$O(\sqrt{m})\f$ time. * @param m An intger to check for primality * @return true if the number i
math/modular_inverse_fermat_little_theorem.cpp:86
↓ 1 callers
Function
is_happy
others/happy_number.cpp:14
↓ 1 callers
Function
is_number
* @brief Checks if scanned string is a number * @param s scanned string * @returns bool boolean value if string is number */
others/postfix_evaluation.cpp:37
↓ 1 callers
Function
is_square
machine_learning/ordinary_least_squares_regressor.cpp:59
↓ 1 callers
Function
is_zero_matrix
math/linear_recurrence_matrix.cpp:82
↓ 1 callers
Function
it_ternary_search
* This is the iterative method of the ternary search which returns the index of * the element. * \param[in] left lower interval limit * \param[in]
search/ternary_search.cpp:48
↓ 1 callers
Function
join
graph/kruskal.cpp:27
↓ 1 callers
Function
jumpSearch
jump search implementation */
search/jump_search.cpp:12
↓ 1 callers
Function
kosaraju
function/method to implement Kosaraju's Algorithm: * Info about the method * @param V vertices in graph * @param adj array of vectors that represent a
graph/kosaraju.cpp:76
↓ 1 callers
Function
kruskal
graph/kruskal.cpp:33
↓ 1 callers
Function
lcs
dynamic_programming/longest_common_subsequence.cpp:20
↓ 1 callers
Function
leftRotate32bits
* @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/md5.cpp:67
↓ 1 callers
Function
librarySort
sorting/library_sort.cpp:4
↓ 1 callers
Function
makeNode
* @brief Allocates a new node in heap for given data and returns it's pointer. * @param data Data for the node. * @returns A pointer to the newly al
operations_on_datastructures/inorder_successor_of_bst.cpp:68
↓ 1 callers
Function
make_set
size of each set * @brief function the initialize every node as it's own parent * @returns void */
graph/connected_components_with_dsu.cpp:43
↓ 1 callers
Function
match
games/memory_game.cpp:235
↓ 1 callers
Function
matrix_exponentiation
math/linear_recurrence_matrix.cpp:104
↓ 1 callers
Function
max_height
physics/ground_to_ground_projectile_motion.cpp:77
↓ 1 callers
Function
merge
* * 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
sorting/merge_sort.cpp:37
↓ 1 callers
Function
merge
merge function merges the sorted runs
sorting/tim_sort.cpp:24
↓ 1 callers
Function
merge
sorting/merge_insertion_sort.cpp:67
↓ 1 callers
Function
merge
sorting/count_inversions.cpp:85
← previous
next →
701–800 of 2,100, ranked by callers