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
Union
* * Union operation combines two disjoint sets to make a single set * in this union function we pass two elements and check if they are * from diff
data_structures/disjoint_set.cpp:78
↓ 1 callers
Function
Z_function
* @brief Generate the Z-function for the inputted string. * \param[in] pattern text on which to apply the Z-function * \returns the Z-function outpu
strings/z_function.cpp:29
↓ 1 callers
Method
__get_integer_from_string
* @brief Get integer from given string. * @details Create an integer from a given string * @param str integer string, can be hexadecimal (st
ciphers/uint128_t.hpp:70
↓ 1 callers
Method
abs
* \brief Member function to give the modulus of our complex number. * Member function to which gives the absolute value (modulus) of our * c
math/complex_numbers.cpp:79
↓ 1 callers
Function
add
* function to add two string numbers * \param [in] a first number in string to add * \param [in] b second number in string to add * \returns sum as
math/string_fibonacci.cpp:25
↓ 1 callers
Method
add
* @brief create and add a new node with a give value and at a given height * * @param x value at the new node * @param h height of the
hashing/chaining.cpp:45
↓ 1 callers
Method
add
dynamic_programming/catalan_numbers.cpp:32
↓ 1 callers
Function
addEdge
* \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.cpp:56
↓ 1 callers
Method
addEdge
Adds the given edge to the graph
dynamic_programming/floyd_warshall.cpp:35
↓ 1 callers
Method
addEdge
Adds the given edge to the graph
dynamic_programming/bellman_ford.cpp:27
↓ 1 callers
Function
addInfo
Information about the adding process * @param key key value to hash and add to table */
hashing/quadratic_probing_hash_table.cpp:207
↓ 1 callers
Function
addInfo
Information about the adding process * @param key key value to add to table */
hashing/double_hash_hash_table.cpp:212
↓ 1 callers
Function
addInfo
Information about the adding process * @param key key value to hash and add */
hashing/linear_probing_hash_table.cpp:186
↓ 1 callers
Method
addProcess
* @brief Adds the process to the ready queue if it isn't already there * @param id Process ID * @param arrival Arrival time of the process
cpu_scheduling_algorithms/non_preemptive_sjf_scheduling.cpp:127
↓ 1 callers
Method
addProcess
* @brief Adds the process to the ready queue if it isn't already there * @param id Process ID * @param arrival Arrival time of the process
cpu_scheduling_algorithms/fcfs_scheduling.cpp:130
↓ 1 callers
Function
addition_rule_dependent
Calculates the probability of the events A or B for dependent events * note that if value of B_given_A is unknown, use chainrule to find it * \param
probability/addition_rule.cpp:25
↓ 1 callers
Function
addition_rule_independent
* calculates the probability of the independent events A or B for independent * events * \parama [in] A probability of event A * \parama [in] B pro
probability/addition_rule.cpp:14
↓ 1 callers
Function
and_test
namespace strings * @brief A test case in which we search for every appearance of the word 'and' * @param text The text in which we search for appear
strings/boyer_moore.cpp:220
↓ 1 callers
Function
ans
! Wrapper for Fibonacci * \param[in] n \f$n^\text{th}\f$ Fibonacci number * \return \f$n^\text{th}\f$ Fibonacci number */
others/matrix_exponentiation.cpp:91
↓ 1 callers
Method
arg
* \brief Member function to give the argument of our complex number. * @return Argument of our Complex number in radians. */
math/complex_numbers.cpp:87
↓ 1 callers
Function
assign_results
games/memory_game.cpp:289
↓ 1 callers
Function
bayes_AgivenB
returns P(A|B) */
probability/bayes_theorem.cpp:14
↓ 1 callers
Function
bayes_BgivenA
returns P(B|A) */
probability/bayes_theorem.cpp:20
↓ 1 callers
Function
beadSort
function to perform the above algorithm
sorting/bead_sort.cpp:8
↓ 1 callers
Function
binExpo
Recursive function to calculate exponent in \f$O(\log(n))\f$ using binary exponent.
math/binary_exponent.cpp:28
↓ 1 callers
Function
binExpo
* @brief Calculate exponent with modulo using binary exponentiation in \f$O(\log b)\f$ time. * @param a The base * @param b The exponent * @param m
math/modular_inverse_fermat_little_theorem.cpp:67
↓ 1 callers
Function
binary_search
sorting/binary_insertion_sort.cpp:63
↓ 1 callers
Function
binomial_expected
finds the expected value of a binomial distribution * \param [in] n * \param [in] p * \returns \f$\mu=np\f$ */
probability/binomial_dist.cpp:22
↓ 1 callers
Function
binomial_range_successes
calculates the probability of a result within a range (inclusive, inclusive) * \returns \f$\displaystyle \left.P(n,p)\right|_{x_0}^{x_1} = * \sum_{i
probability/binomial_dist.cpp:74
↓ 1 callers
Function
binomial_standard_deviation
finds the standard deviation of the binomial distribution * \param [in] n * \param [in] p * \returns \f$\sigma = \sqrt{\sigma^2} = \sqrt{n\cdot p\c
probability/binomial_dist.cpp:36
↓ 1 callers
Function
binomial_x_successes
calculates the probability of exactly x successes * \returns \f$\displaystyle P(n,p,x) = {n\choose x} p^x (1-p)^{n-x}\f$ */
probability/binomial_dist.cpp:65
↓ 1 callers
Function
bitCount
* This function returns the number of set bits in the given number. * @param value the number of which we want to count the number of set bits. * @r
bit_manipulation/hamming_distance.cpp:35
↓ 1 callers
Function
bitonicMerge
It recursively sorts a bitonic sequence in ascending order, if dir = 1, and in descending order otherwise (means dir=0). The sequence to be sorted
sorting/bitonic_sort.cpp:21
↓ 1 callers
Function
bitonicSort
This function first produces a bitonic sequence by recursively sorting its two halves in opposite sorting orders, and then calls bitonicMerge
sorting/bitonic_sort.cpp:33
↓ 1 callers
Function
brute_force
* Find a pattern in a string by comparing the pattern to every substring. * @param text Any string that might contain the pattern. * @param patt
strings/brute_force_string_searching.cpp:21
↓ 1 callers
Function
bucketSort
Function to sort arr[] of size n using bucket sort
sorting/bucket_sort.cpp:7
↓ 1 callers
Function
build
* @brief function that builds the PSA * @param original_array original array of values * @returns void */
range_queries/prefix_sum_array.cpp:41
↓ 1 callers
Method
buildST
* @brief Builds the sparse table for computing min/max/gcd/lcm/...etc * for any contiguous sub-segment of the array.This is an example of *
data_structures/sparse_table.cpp:69
↓ 1 callers
Function
buildTable
range_queries/sparse_table_range_queries.cpp:56
↓ 1 callers
Function
char_to_morse
* Get the morse representation for given character. * @param c Character * @returns morse representation string of character */
ciphers/morse_code.cpp:33
↓ 1 callers
Function
check
* @brief Function that checks if the string passed in param can be * segmented from position 'pos', and then correctly go on to segment the * rest o
dynamic_programming/word_break.cpp:80
↓ 1 callers
Function
checkBipartite
* @brief function to check whether the passed graph is bipartite or not * @param graph is a 2D matrix whose rows or the first index signify the node
graph/is_graph_bipartite2.cpp:37
↓ 1 callers
Function
check_all_zeros
math/gcd_of_n_numbers.cpp:53
↓ 1 callers
Function
check_if_equal
* compare if two sub-strings are equal * \param[in] str1 string pattern to search * \param[in] str2 text in which to search * \param[in] start1,end
strings/rabin_karp.cpp:60
↓ 1 callers
Function
check_termination
* check for termination condition * \param[in] delta point at which to evaluate the polynomial * \returns `false` if termination not reached * \ret
numerical_methods/durand_kerner_roots.cpp:92
↓ 1 callers
Function
circle_area
math/area.cpp:63
↓ 1 callers
Function
circle_perimeter
math/perimeter.cpp:63
↓ 1 callers
Function
compAndSwap
The parameter dir indicates the sorting direction, ASCENDING or DESCENDING; if (a[i] > a[j]) agrees with the direction, then a[i] and a[j] are i
sorting/bitonic_sort.cpp:12
↓ 1 callers
Function
computeLogs
range_queries/sparse_table_range_queries.cpp:38
↓ 1 callers
Method
compute_next
dynamic_programming/catalan_numbers.cpp:26
↓ 1 callers
Function
cone_volume
math/volume.cpp:53
↓ 1 callers
Method
construct
* @brief Constructing the segment tree with the early passed vector. Every * call creates a node to hold the sum of the given range, set its poin
range_queries/persistent_seg_tree_lazy_prop.cpp:107
↓ 1 callers
Function
convexHull
* @brief Prints convex hull of a set of n points. * @param points vector of Point<int, int> with co-ordinates. * @param size Size of the vector. *
geometry/graham_scan_functions.hpp:139
↓ 1 callers
Function
copy_all_nodes
* @brief creates a deep copy of a list starting at the input node * @param[in] node pointer to the first node/head of the list to be copied * @re
data_structures/reverse_a_linked_list.cpp:53
↓ 1 callers
Function
countSort
sorting/counting_sort_string.cpp:6
↓ 1 callers
Function
count_paths_dfs
* @brief Helper function to perform DFS and count the number of paths from node `u` to node `v` * @param A adjacency matrix representing the grap
graph/number_of_paths.cpp:34
↓ 1 callers
Function
create_list
* The same after the remainder will be added after the same hash header * To avoid conflict, zipper method is used * Insert elements into the linked
search/hash_search.cpp:55
↓ 1 callers
Function
create_matrix
* create a symmetric square matrix of given size with random elements. A * symmetric square matrix will *always* have real eigen values. * * \param
numerical_methods/qr_eigen_values.cpp:28
↓ 1 callers
Function
create_message_schedule_array
* @brief Creates the message schedule array * @param input Input string * @param byte_num Position of the first byte of the chunk * @return std::ar
hashing/sha256.cpp:195
↓ 1 callers
Function
createlist
creating the linked list with 'n' nodes
operations_on_datastructures/selectionsortlinkedlist.cpp:26
↓ 1 callers
Function
cube_surface_area
math/area.cpp:86
↓ 1 callers
Function
cube_surface_perimeter
math/perimeter.cpp:86
↓ 1 callers
Function
cube_volume
math/volume.cpp:28
↓ 1 callers
Function
cylinder_surface_area
math/area.cpp:109
↓ 1 callers
Function
cylinder_surface_perimeter
math/perimeter.cpp:111
↓ 1 callers
Function
cylinder_volume
math/volume.cpp:103
↓ 1 callers
Method
decreaseKey
Decreases value of key at index 'i' to new_val. It is assumed that new_val * is smaller than harr[i]. */
data_structures/binaryheap.cpp:76
↓ 1 callers
Method
del
data_structures/rb_tree.cpp:135
↓ 1 callers
Function
deleteAll
greedy_algorithms/huffman.cpp:26
↓ 1 callers
Function
deleteAll
others/iterative_tree_traversals.cpp:183
↓ 1 callers
Function
deleteAll
data_structures/morrisinorder.cpp:84
↓ 1 callers
Function
deleteAllNodes
* @brief calls delete on every node * @param root of the tree */
data_structures/avltree.cpp:151
↓ 1 callers
Method
deleteKey
This function deletes key at index i. It first reduced value to minus * infinite, then calls extractMin() */
data_structures/binaryheap.cpp:105
↓ 1 callers
Method
delete_word
* @brief delete a word/string from a trie * @param word string to delete from trie */
data_structures/trie_using_hashmap.cpp:122
↓ 1 callers
Function
depth_first_search
* \brief * initiates depth first search algorithm. * * @param adj adjacency list of graph * @param start vertex from where DFS starts traversing.
graph/depth_first_search.cpp:99
↓ 1 callers
Function
depth_first_search
dynamic_programming/tree_height.cpp:32
↓ 1 callers
Method
dequeue
data_structures/queue_using_linkedlist.cpp:32
↓ 1 callers
Method
dequeue
data_structures/circular_queue_using_linked_list.cpp:43
↓ 1 callers
Method
dequeue
* @brief Remove element that is located at the first of the queue * @returns data that is deleted if queue is not empty */
data_structures/queue_using_array.cpp:76
↓ 1 callers
Function
dfs
* @brief Function to perform Depth First Search on the graph * @param v Starting vertex for depth-first search * @param visited Array representing w
graph/topological_sort.cpp:79
↓ 1 callers
Method
disp
data_structures/rb_tree.cpp:372
↓ 1 callers
Function
display
* Function to print the orthogonalised vector * * @param r number of vectors * @param c dimenaion of vectors * @param B stores orthogonalised vect
numerical_methods/gram_schmidt.cpp:101
↓ 1 callers
Method
display
* @brief A function to display the current cache * @returns Void * */
others/lru_cache.cpp:121
↓ 1 callers
Method
display
data_structures/queue_using_linkedlist.cpp:47
↓ 1 callers
Method
display
* function displays all the elements in the list * @returns 'void' */
data_structures/linked_list.cpp:181
↓ 1 callers
Method
display
* @brief Utility function to show all elements in the queue */
data_structures/queue_using_array.cpp:94
↓ 1 callers
Method
display
* @brief Display the chain */
hashing/chaining.cpp:63
↓ 1 callers
Function
displayElements
sorting/wiggle_sort.cpp:86
↓ 1 callers
Method
displayList
* Display skip list level */
data_structures/skip_list.cpp:191
↓ 1 callers
Function
display_graph
graphics/spirograph.cpp:145
↓ 1 callers
Function
double_factorial_iterative
Compute double factorial using iterative method */
math/double_factorial.cpp:18
↓ 1 callers
Function
double_factorial_recursive
Compute double factorial using resursive method. * <br/>Recursion can be costly for large numbers. */
math/double_factorial.cpp:31
↓ 1 callers
Method
draw_sample
* @brief Generates a (discrete) sample according to the geometrical * distribution * @returns A geometrically distributed number in [1,\inft
probability/geometric_dist.cpp:125
↓ 1 callers
Function
editDist
A Naive recursive C++ program to find * minimum number of operations to convert * str1 to str2. * O(3^m) */
dynamic_programming/edit_distance.cpp:26
↓ 1 callers
Function
editDistDP
A DP based program * O(m x n) */
dynamic_programming/edit_distance.cpp:48
↓ 1 callers
Function
eggDrop
dynamic_programming/egg_dropping_puzzle.cpp:11
↓ 1 callers
Function
encrypt
* @brief a1z26 encryption implementation * @param text is the plaintext input * @returns encoded string with dashes to seperate letters */
ciphers/a1z26_cipher.cpp:51
↓ 1 callers
Method
enqueue
data_structures/queue_using_linkedlist.cpp:20
↓ 1 callers
Method
enqueue
* @brief Adds new element to the end of the queue * @param ele to be added to the end of the queue */
data_structures/queue_using_array.cpp:59
↓ 1 callers
Function
eq
define \f$f(x)\f$ to find root for. * Currently defined as: * \f[ * f(x) = x^3 - 4x - 9 * \f] */
numerical_methods/newton_raphson_method.cpp:30
← previous
next →
601–700 of 2,100, ranked by callers