|
Algorithms_in_C++
1.0.0
Set of algorithms implemented in C++.
|
| ► backtracking | |
| graph_coloring.cpp | Prints the assigned colors using Graph Coloring algorithm |
| knight_tour.cpp | Knight's tour algorithm |
| minimax.cpp | Returns which is the longest/shortest number using minimax algorithm |
| n_queens.cpp | Eight Queens puzzle |
| n_queens_all_solution_optimised.cpp | N queens all optimized |
| nqueen_print_all_solutions.cpp | Eight Queens puzzle, printing all solutions |
| rat_maze.cpp | Implements Rat in a Maze algorithm |
| sudoku_solve.cpp | Sudoku Solver algorithm |
| ► ciphers | |
| caesar_cipher.cpp | Implementation of Caesar cipher algorithm |
| hill_cipher.cpp | Implementation of Hill cipher algorithm |
| morse_code.cpp | Implementation of Morse Code |
| vigenere_cipher.cpp | Implementation of Vigenère cipher algorithm |
| xor_cipher.cpp | Implementation of XOR cipher algorithm |
| ► data_structures | |
| ► cll | |
| cll.h | |
| avltree.cpp | A simple tree implementation using nodes |
| binary_search_tree.cpp | A simple tree implementation using structured nodes |
| binaryheap.cpp | A C++ program to demonstrate common Binary Heap Operations |
| disjoint_set.cpp | Disjoint Sets Data Structure (Disjoint Sets) |
| linked_list.cpp | Implementation of singly linked list algorithm |
| linkedlist_implentation_usingarray.cpp | Linked list implementation using Arrays |
| list_array.cpp | |
| queue.h | |
| queue_using_two_stacks.cpp | |
| skip_list.cpp | Data structure for fast searching and insertion in \(O(\log n)\) time |
| stack.h | This class specifies the basic operation on a stack as a linked list |
| trie_modern.cpp | A basic implementation of trie class to store only lower-case strings |
| trie_tree.cpp | Implementation of Trie data structure for English alphabets in small characters |
| ► dynamic_programming | |
| 0_1_knapsack.cpp | Implementation of 0-1 Knapsack Problem |
| cut_rod.cpp | Implementation of cutting a rod problem |
| kadane2.cpp | Implementation of Kadane Algorithm |
| palindrome_partitioning.cpp | Implements Palindrome Partitioning algorithm, giving you the minimum number of partitions you need to make |
| shortest_common_supersequence.cpp | SCS is a string Z which is the shortest supersequence of strings X and Y (may not be continuous in Z, but order is maintained) |
| word_break.cpp | Word Break Problem |
| ► geometry | |
| jarvis_algorithm.cpp | Implementation of Jarvis’s algorithm |
| line_segment_intersection.cpp | Check whether two line segments intersect each other or not |
| ► graph | |
| breadth_first_search.cpp | Breadth First Search Algorithm (Breadth First Search) |
| connected_components.cpp | Graph Connected Components (Connected Components) |
| depth_first_search.cpp | Depth First Search Algorithm (Depth First Search) |
| dijkstra.cpp | Graph Dijkstras Shortest Path Algorithm (Dijkstra's Shortest Path) |
| hamiltons_cycle.cpp | The implementation of Hamilton's cycle dynamic solution for vertices number less than 20 |
| hopcroft_karp.cpp | Implementation of Hopcroft–Karp algorithm |
| is_graph_bipartite.cpp | Algorithm to check whether a graph is bipartite |
| lowest_common_ancestor.cpp | Data structure for finding the lowest common ancestor of two vertices in a rooted tree using binary lifting |
| ► graphics | |
| spirograph.cpp | Implementation of Spirograph |
| ► greedy_algorithms | |
| jumpgame.cpp | Implementation of an algorithm to solve the jumping game problem |
| ► hashing | |
| chaining.cpp | Implementation of hash chains |
| double_hash_hash_table.cpp | Storage mechanism using double-hashed keys |
| linear_probing_hash_table.cpp | Storage mechanism using linear probing hash keys |
| quadratic_probing_hash_table.cpp | Storage mechanism using quadratic probing hash keys |
| ► machine_learning | |
| adaline_learning.cpp | Adaptive Linear Neuron (ADALINE) implementation |
| kohonen_som_topology.cpp | Kohonen self organizing map (topological map) |
| kohonen_som_trace.cpp | Kohonen self organizing map (data tracing) |
| neural_network.cpp | Implementation of Multilayer Perceptron |
| ordinary_least_squares_regressor.cpp | Linear regression example using Ordinary least squares |
| vector_ops.hpp | Various functions for vectors associated with NeuralNetwork (aka Multilayer Perceptron) |
| ► math | |
| armstrong_number.cpp | Program to check if a number is an Armstrong/Narcissistic number in decimal system |
| binary_exponent.cpp | C++ Program to find Binary Exponent Iteratively and Recursively |
| check_amicable_pair.cpp | A C++ Program to check whether a pair of number is amicable pair or not |
| check_factorial.cpp | A simple program to check if the given number is a factorial of some number or not |
| check_prime.cpp | Reduced all possibilities of a number which cannot be prime. Eg: No even number, except 2 can be a prime number, hence we will increment our loop with i+2 jumping on all odd numbers only. If number is <= 1 or if it is even except 2, break the loop and return false telling number is not prime |
| complex_numbers.cpp | An implementation of Complex Number as Objects |
| double_factorial.cpp | Compute double factorial: \(n!!\) |
| eulers_totient_function.cpp | C++ Program to find Euler's Totient function |
| extended_euclid_algorithm.cpp | GCD using extended Euclid's algorithm |
| factorial.cpp | C++ program to find factorial of given number |
| fast_power.cpp | Faster computation for \(a^b\) |
| fibonacci.cpp | Generate fibonacci sequence |
| fibonacci_fast.cpp | Faster computation of Fibonacci series |
| fibonacci_large.cpp | Computes N^th Fibonacci number given as input argument. Uses custom build arbitrary integers library to perform additions and other operations |
| gcd_iterative_euclidean.cpp | Compute the greatest common denominator of two integers using iterative form of Euclidean algorithm |
| gcd_of_n_numbers.cpp | This program aims at calculating the GCD of n numbers by division method |
| gcd_recursive_euclidean.cpp | Compute the greatest common denominator of two integers using recursive form of Euclidean algorithm |
| large_factorial.cpp | Compute factorial of any arbitratily large number/ |
| large_number.h | Library to perform arithmatic operations on arbitrarily large numbers |
| lcm_sum.cpp | An algorithm to calculate the sum of LCM: \(\mathrm{LCM}(1,n) + \mathrm{LCM}(2,n) + \ldots + \mathrm{LCM}(n,n)\) |
| least_common_multiple.cpp | |
| magic_number.cpp | A simple program to check if the given number is a magic number or not. A number is said to be a magic number, if the sum of its digits are calculated till a single digit recursively by adding the sum of the digits after every addition. If the single digit comes out to be 1,then the number is a magic number |
| miller_rabin.cpp | |
| modular_exponentiation.cpp | C++ Program for Modular Exponentiation Iteratively |
| modular_inverse_fermat_little_theorem.cpp | C++ Program to find the modular inverse using Fermat's Little Theorem |
| number_of_positive_divisors.cpp | C++ Program to calculate the number of positive divisors |
| power_for_huge_numbers.cpp | Compute powers of large numbers |
| prime_factorization.cpp | Prime factorization of positive integers |
| prime_numbers.cpp | Get list of prime numbers |
| primes_up_to_billion.cpp | Compute prime numbers upto 1 billion |
| realtime_stats.cpp | Compute statistics for data entered in rreal-time |
| sieve_of_eratosthenes.cpp | Get list of prime numbers using Sieve of Eratosthenes |
| sqrt_double.cpp | Calculate the square root of any positive real number in \(O(\log N)\) time, with precision fixed using bisection method of root-finding |
| string_fibonacci.cpp | This Programme returns the Nth fibonacci as a string |
| sum_of_binomial_coefficient.cpp | Algorithm to find sum of binomial coefficients of a given positive integer |
| sum_of_digits.cpp | A C++ Program to find the Sum of Digits of input integer |
| ► numerical_methods | |
| bisection_method.cpp | Solve the equation \(f(x)=0\) using bisection method |
| brent_method_extrema.cpp | Find real extrema of a univariate real function in a given interval using Brent's method |
| durand_kerner_roots.cpp | Compute all possible approximate roots of any given polynomial using Durand Kerner algorithm |
| false_position.cpp | Solve the equation \(f(x)=0\) using false position method, also known as the Secant method |
| gaussian_elimination.cpp | Gaussian elimination method |
| golden_search_extrema.cpp | Find extrema of a univariate real function in a given interval using golden section search algorithm |
| lu_decompose.cpp | LU decomposition of a square matrix |
| lu_decomposition.h | Functions associated with LU Decomposition of a square matrix |
| newton_raphson_method.cpp | Solve the equation \(f(x)=0\) using Newton-Raphson method for both real and complex solutions |
| ode_forward_euler.cpp | Solve a multivariable first order ordinary differential equation (ODEs) using forward Euler method |
| ode_midpoint_euler.cpp | Solve a multivariable first order ordinary differential equation (ODEs) using midpoint Euler method |
| ode_semi_implicit_euler.cpp | Solve a multivariable first order ordinary differential equation (ODEs) using semi implicit Euler method |
| qr_decompose.h | Library functions to compute QR decomposition of a given matrix |
| qr_decomposition.cpp | Program to compute the QR decomposition of a given matrix |
| qr_eigen_values.cpp | Compute real eigen values and eigen vectors of a symmetric matrix using QR decomposition method |
| successive_approximation.cpp | Method of successive approximations using fixed-point iteration method |
| ► others | |
| buzz_number.cpp | A buzz number is a number that is either divisible by 7 or has last digit as 7 |
| decimal_to_binary.cpp | Function to convert decimal number to binary representation |
| decimal_to_hexadecimal.cpp | Convert decimal number to hexadecimal representation |
| decimal_to_roman_numeral.cpp | This Programme Converts a given decimal number in the range [0,4000) to both Lower case and Upper case Roman Numeral |
| fast_integer_input.cpp | Read integers from stdin continuously as they are entered without waiting for the \n character |
| happy_number.cpp | A happy number is a number whose sum of digits is calculated until the sum is a single digit, and this sum turns out to be 1 |
| matrix_exponentiation.cpp | Matrix Exponentiation |
| palindrome_of_number.cpp | Check if a number is palindrome or not |
| paranthesis_matching.cpp | Perform paranthesis matching |
| pascal_triangle.cpp | Pascal's triangle implementation |
| postfix_evaluation.cpp | Evaluation of Postfix Expression |
| primality_test.cpp | Primality test implementation |
| smallest_circle.cpp | Get centre and radius of the smallest circle that circumscribes given set of points |
| sparse_matrix.cpp | |
| spiral_print.cpp | Print the elements of a matrix traversing it spirally |
| stairs_pattern.cpp | This program is use to print the following pattern |
| tower_of_hanoi.cpp | Solve the Tower of Hanoi problem |
| vector_important_functions.cpp | A C++ program to demonstrate working of std::sort(), std::reverse() |
| ► probability | |
| addition_rule.cpp | Addition rule of probabilities |
| bayes_theorem.cpp | Bayes' theorem |
| binomial_dist.cpp | Binomial distribution example |
| poisson_dist.cpp | Poisson statistics |
| ► range_queries | |
| fenwick_tree.cpp | Fenwick tree |
| heavy_light_decomposition.cpp | Heavy Light Decomposition implementation |
| sparse_table.cpp | Implementation of Sparse Table data structure |
| ► search | |
| binary_search.cpp | Binary search algorithm |
| exponential_search.cpp | Exponential search algorithm |
| fibonacci_search.cpp | Fibonacci search algorithm |
| hash_search.cpp | Hash Search Algorithm - Best Time Complexity Ω(1) |
| interpolation_search.cpp | Interpolation search algorithm |
| interpolation_search2.cpp | Interpolation search algorithm |
| jump_search.cpp | C++ program to implement Jump Search |
| linear_search.cpp | Linear search algorithm |
| median_search.cpp | Implementation of Median search algorithm. @cases from here |
| ternary_search.cpp | Ternary search algorithm |
| text_search.cpp | Search for words in a long textual paragraph |
| ► sorting | |
| bogo_sort.cpp | Implementation of Bogosort algorithm |
| bubble_sort.cpp | Bubble sort algorithm |
| comb_sort.cpp | Comb Sort Algorithm (Comb Sort) |
| cycle_sort.cpp | Implementation of Cycle sort algorithm |
| gnome_sort.cpp | Implementation of gnome sort algorithm |
| heap_sort.cpp | Heap Sort Algorithm (heap sort) implementation |
| insertion_sort.cpp | Insertion Sort Algorithm (Insertion Sort) |
| merge_insertion_sort.cpp | Algorithm that combines insertion sort and merge sort. Wiki link |
| merge_sort.cpp | Merege Sort Algorithm (MEREGE SORT) implementation |
| non_recursive_merge_sort.cpp | |
| pancake_sort.cpp | Pancake sort sorts a disordered stack of pancakes by flipping any number of pancakes using a spatula using minimum number of flips |
| pigeonhole_sort.cpp | Implementation of Pigeonhole Sort algorithm |
| quick_sort.cpp | Quick sort algorithm |
| quick_sort_3.cpp | Implementation Details |
| shell_sort2.cpp | Shell sort algorithm |
| strand_sort.cpp | Implementation of Strand Sort algorithm |
| wiggle_sort.cpp | Wiggle Sort Algorithm Implementation |
| ► strings | |
| brute_force_string_searching.cpp | String pattern search - brute force |
| horspool.cpp | Horspool's algorithm that finds if a string contains a substring (https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm) |
| knuth_morris_pratt.cpp | The Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text with complexity O(n + m) |
| rabin_karp.cpp | The Rabin-Karp Algorithm for finding a pattern within a piece of text with complexity O(n + m) |