From fb1d00ead72c0c026f3ff34f64bc628f8faa4b69 Mon Sep 17 00:00:00 2001 From: realstealthninja Date: Mon, 4 Nov 2024 12:10:37 +0000 Subject: [PATCH] Documentation for c6af94350830a38824fb69ca21b8b4bb111a1f49 --- annotated.html | 10 +- .../fast__fourier__transform_8cpp__incl.map | 18 +- .../fast__fourier__transform_8cpp__incl.md5 | 2 +- .../fast__fourier__transform_8cpp__incl.svg | 56 +- ...ast__fourier__transform_8cpp__incl_org.svg | 56 +- d0/d3e/classdata__structures_1_1trie.html | 2 +- ...umber__of__digits__in__a__number_8cpp.html | 125 +- ...4c15b7f1aedd4419a65cd49562cc300_cgraph.map | 2 +- ...4c15b7f1aedd4419a65cd49562cc300_cgraph.md5 | 2 +- ...4c15b7f1aedd4419a65cd49562cc300_cgraph.svg | 2 +- ...b7f1aedd4419a65cd49562cc300_cgraph_org.svg | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 2 +- ...b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg | 2 +- d0/d51/approximate__pi_8cpp.html | 2 +- d0/d65/namespacedouble__hashing.html | 4 +- d0/d6d/modular__exponentiation_8cpp.html | 5 +- d0/d6f/namespaceothers.html | 4 +- d0/da1/string__fibonacci_8cpp__incl.map | 12 +- d0/da1/string__fibonacci_8cpp__incl.md5 | 2 +- d0/da1/string__fibonacci_8cpp__incl.svg | 42 +- d0/da1/string__fibonacci_8cpp__incl_org.svg | 42 +- d0/db1/check__factorial_8cpp__incl.map | 12 +- d0/db1/check__factorial_8cpp__incl.md5 | 2 +- d0/db1/check__factorial_8cpp__incl.svg | 42 +- d0/db1/check__factorial_8cpp__incl_org.svg | 42 +- d0/dcc/modular__division_8cpp__incl.map | 12 +- d0/dcc/modular__division_8cpp__incl.md5 | 2 +- d0/dcc/modular__division_8cpp__incl.svg | 42 +- d0/dcc/modular__division_8cpp__incl_org.svg | 42 +- d0/dd2/treap_8cpp.html | 71 +- d0/dd3/modular__exponentiation_8cpp__incl.map | 12 +- d0/dd3/modular__exponentiation_8cpp__incl.md5 | 2 +- d0/dd3/modular__exponentiation_8cpp__incl.svg | 42 +- ...modular__exponentiation_8cpp__incl_org.svg | 42 +- d0/df1/z__function_8cpp__incl.map | 20 +- d0/df1/z__function_8cpp__incl.md5 | 2 +- d0/df1/z__function_8cpp__incl.svg | 58 +- d0/df1/z__function_8cpp__incl_org.svg | 58 +- d0/dfe/backtracking_2subset__sum_8cpp.html | 129 +- d1/d11/gcd__of__n__numbers_8cpp.html | 4 +- d1/d21/quick__sort_8cpp.html | 281 +- ...__of__digits__in__a__number_8cpp__incl.map | 12 +- ...__of__digits__in__a__number_8cpp__incl.md5 | 2 +- ...__of__digits__in__a__number_8cpp__incl.svg | 44 +- ...__digits__in__a__number_8cpp__incl_org.svg | 44 +- d1/d52/lcm__sum_8cpp__incl.map | 14 +- d1/d52/lcm__sum_8cpp__incl.md5 | 2 +- d1/d52/lcm__sum_8cpp__incl.svg | 46 +- d1/d52/lcm__sum_8cpp__incl_org.svg | 46 +- d1/d6d/lru__cache_8cpp__incl.map | 18 +- d1/d6d/lru__cache_8cpp__incl.md5 | 2 +- d1/d6d/lru__cache_8cpp__incl.svg | 54 +- d1/d6d/lru__cache_8cpp__incl_org.svg | 54 +- d1/d6d/queue__using__array_8cpp__incl.map | 12 +- d1/d6d/queue__using__array_8cpp__incl.md5 | 2 +- d1/d6d/queue__using__array_8cpp__incl.svg | 44 +- d1/d6d/queue__using__array_8cpp__incl_org.svg | 44 +- d1/d83/classuint256__t.html | 12 +- d1/d90/subarray__sum_8cpp__incl.map | 18 +- d1/d90/subarray__sum_8cpp__incl.md5 | 2 +- d1/d90/subarray__sum_8cpp__incl.svg | 56 +- d1/d90/subarray__sum_8cpp__incl_org.svg | 56 +- d1/da6/rungekutta_8cpp.html | 13 +- ...b9f40c7b5e9749cc550f19be3dc8856_cgraph.map | 2 +- ...b9f40c7b5e9749cc550f19be3dc8856_cgraph.md5 | 2 +- ...b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg | 2 +- ...0c7b5e9749cc550f19be3dc8856_cgraph_org.svg | 2 +- d1/dbb/n__choose__r_8cpp.html | 5 +- ...__ciphers__in__factorial__n_8cpp__incl.map | 10 +- ...__ciphers__in__factorial__n_8cpp__incl.md5 | 2 +- ...__ciphers__in__factorial__n_8cpp__incl.svg | 42 +- ...phers__in__factorial__n_8cpp__incl_org.svg | 42 +- d1/dbe/lu__decomposition_8h.html | 2 +- d1/dc7/linear__probing__hash__table_8cpp.html | 2 +- d1/dcc/wiggle__sort_8cpp.html | 41 +- d1/de0/namespacenumerical__methods.html | 226 +- d1/de9/integral__approximation_8cpp.html | 119 +- d1/df6/bidirectional__dijkstra_8cpp__incl.map | 26 +- d1/df6/bidirectional__dijkstra_8cpp__incl.md5 | 2 +- d1/df6/bidirectional__dijkstra_8cpp__incl.svg | 72 +- ...bidirectional__dijkstra_8cpp__incl_org.svg | 72 +- d1/df6/class_easter_year_month_day.html | 22 +- d2/d0b/fast__power_8cpp.html | 2 +- ...iptic__curve__key__exchange_8cpp__incl.map | 22 +- ...iptic__curve__key__exchange_8cpp__incl.md5 | 2 +- ...iptic__curve__key__exchange_8cpp__incl.svg | 70 +- ...c__curve__key__exchange_8cpp__incl_org.svg | 70 +- d2/d90/namespacegreedy__algorithms.html | 5 +- d3/d1a/hill__cipher_8cpp__incl.map | 44 +- d3/d1a/hill__cipher_8cpp__incl.md5 | 2 +- d3/d1a/hill__cipher_8cpp__incl.svg | 142 +- d3/d1a/hill__cipher_8cpp__incl_org.svg | 144 +- d3/d22/saddleback__search_8cpp.html | 134 +- ...ures_1_1trie__using__hashmap_1_1_trie.html | 2 +- d3/d28/wiggle__sort_8cpp__incl.map | 20 +- d3/d28/wiggle__sort_8cpp__incl.md5 | 2 +- d3/d28/wiggle__sort_8cpp__incl.svg | 58 +- d3/d28/wiggle__sort_8cpp__incl_org.svg | 58 +- d3/d39/manacher__algorithm_8cpp.html | 249 +- d3/d4c/sha1_8cpp__incl.map | 24 +- d3/d4c/sha1_8cpp__incl.md5 | 2 +- d3/d4c/sha1_8cpp__incl.svg | 129 +- d3/d4c/sha1_8cpp__incl_org.svg | 68 +- ...oyd__cycle__detection__algo_8cpp__incl.map | 14 +- ...oyd__cycle__detection__algo_8cpp__incl.md5 | 2 +- ...oyd__cycle__detection__algo_8cpp__incl.svg | 48 +- ..._cycle__detection__algo_8cpp__incl_org.svg | 48 +- d3/d80/z__function_8cpp.html | 113 +- d3/dae/dsu__path__compression_8cpp.html | 81 +- d3/db3/lru__cache_8cpp.html | 173 +- d3/dbb/class_cycle_check.html | 224 +- d3/dbb/kadanes3_8cpp__incl.map | 14 +- d3/dbb/kadanes3_8cpp__incl.md5 | 2 +- d3/dbb/kadanes3_8cpp__incl.svg | 46 +- d3/dbb/kadanes3_8cpp__incl_org.svg | 46 +- d3/dcc/count__bits__flip_8cpp__incl.map | 10 +- d3/dcc/count__bits__flip_8cpp__incl.md5 | 2 +- d3/dcc/count__bits__flip_8cpp__incl.svg | 40 +- d3/dcc/count__bits__flip_8cpp__incl_org.svg | 40 +- d3/df9/recursive__bubble__sort_8cpp.html | 112 +- d3/dfe/perimeter_8cpp.html | 2 +- d4/d08/sha256_8cpp.html | 2 +- d4/d18/composite__simpson__rule_8cpp.html | 2 +- d4/d26/durand__kerner__roots_8cpp__incl.map | 32 +- d4/d26/durand__kerner__roots_8cpp__incl.md5 | 2 +- d4/d26/durand__kerner__roots_8cpp__incl.svg | 82 +- .../durand__kerner__roots_8cpp__incl_org.svg | 84 +- d4/d2f/fcfs__scheduling_8cpp__incl.map | 36 +- d4/d2f/fcfs__scheduling_8cpp__incl.md5 | 2 +- d4/d2f/fcfs__scheduling_8cpp__incl.svg | 90 +- d4/d2f/fcfs__scheduling_8cpp__incl_org.svg | 92 +- d4/d38/power__of__two_8cpp.html | 4 +- d4/d48/hamming__distance_8cpp.html | 107 +- d4/d8d/jarvis__algorithm_8cpp.html | 2 +- ...lesman__using__bit__manipulation_8cpp.html | 141 +- .../sum__of__binomial__coefficient_8cpp.html | 59 +- d4/d9f/selection__sort__recursive_8cpp.html | 119 +- d4/dd2/namespacequadratic__probing.html | 4 +- d4/def/kohonen__som__topology_8cpp.html | 2 +- ...ith__same__number__of__set__bits_8cpp.html | 57 +- d5/d3c/namespacedata__structures.html | 7 +- .../selection__sort__recursive_8cpp__incl.map | 16 +- .../selection__sort__recursive_8cpp__incl.md5 | 2 +- .../selection__sort__recursive_8cpp__incl.svg | 52 +- ...ection__sort__recursive_8cpp__incl_org.svg | 52 +- d5/d45/sublist__search_8cpp.html | 249 +- d5/d4c/group__sorting.html | 72 +- d5/d58/class_test_cases.html | 294 +- d5/d5f/namespacegeometry.html | 6 +- d5/d67/complex__numbers_8cpp.html | 2 +- d5/d7a/largest__power_8cpp.html | 68 +- d5/d83/lcm__sum_8cpp.html | 69 +- d5/d91/namespacesorting.html | 90 +- d5/d95/n__bonacci_8cpp__incl.map | 14 +- d5/d95/n__bonacci_8cpp__incl.md5 | 2 +- d5/d95/n__bonacci_8cpp__incl.svg | 46 +- d5/d95/n__bonacci_8cpp__incl_org.svg | 46 +- ...ctdata__structures_1_1treap_1_1_treap.html | 252 +- d5/d96/md5_8cpp.html | 557 ++-- ...ta__structures_1_1list__array_1_1list.html | 246 +- d5/dad/magic__number_8cpp__incl.map | 12 +- d5/dad/magic__number_8cpp__incl.md5 | 2 +- d5/dad/magic__number_8cpp__incl.svg | 42 +- d5/dad/magic__number_8cpp__incl_org.svg | 42 +- d5/db0/adaline__learning_8cpp.html | 6 +- d5/db5/set__kth__bit_8cpp.html | 61 +- d5/dc3/integral__approximation_8cpp__incl.map | 16 +- d5/dc3/integral__approximation_8cpp__incl.md5 | 2 +- d5/dc3/integral__approximation_8cpp__incl.svg | 50 +- ...integral__approximation_8cpp__incl_org.svg | 50 +- d5/df6/check__amicable__pair_8cpp.html | 2 +- ...queue__using__array_1_1_queue___array.html | 78 +- d6/d0c/namespacehashing.html | 11 +- d6/d1a/dnf__sort_8cpp.html | 131 +- d6/d26/classciphers_1_1_hill_cipher.html | 498 ++-- d6/d2d/modular__inverse__simple_8cpp.html | 77 +- ...8dca7b867074164d5f45b0f3851269d_cgraph.map | 2 +- ...8dca7b867074164d5f45b0f3851269d_cgraph.md5 | 2 +- ...8dca7b867074164d5f45b0f3851269d_cgraph.svg | 2 +- ...7b867074164d5f45b0f3851269d_cgraph_org.svg | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 2 +- ...b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg | 2 +- d6/d30/classmachine__learning_1_1adaline.html | 2 +- d6/d38/find__non__repeating__number_8cpp.html | 2 +- d6/d38/newton__raphson__method_8cpp__incl.map | 18 +- d6/d38/newton__raphson__method_8cpp__incl.md5 | 2 +- d6/d38/newton__raphson__method_8cpp__incl.svg | 56 +- ...newton__raphson__method_8cpp__incl_org.svg | 56 +- .../data__structures_2sparse__table_8cpp.html | 67 +- d6/d42/miller__rabin_8cpp.html | 2 +- d6/d4b/hamming__distance_8cpp__incl.map | 12 +- d6/d4b/hamming__distance_8cpp__incl.md5 | 2 +- d6/d4b/hamming__distance_8cpp__incl.svg | 44 +- d6/d4b/hamming__distance_8cpp__incl_org.svg | 44 +- ...ath_2iterative_factorial_8cpp-example.html | 2 +- ...avelling__salesman__problem_8cpp__incl.map | 20 +- ...avelling__salesman__problem_8cpp__incl.md5 | 2 +- ...avelling__salesman__problem_8cpp__incl.svg | 60 +- ...ling__salesman__problem_8cpp__incl_org.svg | 60 +- d6/d7a/golden__search__extrema_8cpp.html | 209 +- d6/d80/double__hash__hash__table_8cpp.html | 2 +- ...ynamic__programming_2subset__sum_8cpp.html | 2 +- d6/d9d/large__factorial_8cpp.html | 4 +- ...sothers_1_1lru__cache_1_1_l_r_u_cache.html | 76 +- d6/db8/inv__sqrt_8cpp.html | 11 +- ...8dca7b867074164d5f45b0f3851269d_cgraph.map | 2 +- ...8dca7b867074164d5f45b0f3851269d_cgraph.md5 | 2 +- ...8dca7b867074164d5f45b0f3851269d_cgraph.svg | 2 +- ...7b867074164d5f45b0f3851269d_cgraph_org.svg | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 2 +- ...b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg | 2 +- d6/df6/n__choose__r_8cpp__incl.map | 10 +- d6/df6/n__choose__r_8cpp__incl.md5 | 2 +- d6/df6/n__choose__r_8cpp__incl.svg | 38 +- d6/df6/n__choose__r_8cpp__incl_org.svg | 38 +- d7/d00/list__array_8cpp.html | 97 +- d7/d07/bidirectional__dijkstra_8cpp.html | 432 +-- d7/d4a/fibonacci__sum_8cpp__incl.map | 14 +- d7/d4a/fibonacci__sum_8cpp__incl.md5 | 2 +- d7/d4a/fibonacci__sum_8cpp__incl.svg | 46 +- d7/d4a/fibonacci__sum_8cpp__incl_org.svg | 46 +- d7/d53/inv__sqrt_8cpp__incl.map | 16 +- d7/d53/inv__sqrt_8cpp__incl.md5 | 2 +- d7/d53/inv__sqrt_8cpp__incl.svg | 50 +- d7/d53/inv__sqrt_8cpp__incl_org.svg | 50 +- d7/d56/count__bits__flip_8cpp.html | 75 +- ...longest__increasing__subsequence_8cpp.html | 2 +- d7/d73/abbreviation_8cpp.html | 2 +- d7/d77/class_edge.html | 2 +- d7/d81/namespacebit__manipulation.html | 103 +- d7/d89/double__factorial_8cpp.html | 79 +- d7/d92/sublist__search_8cpp__incl.map | 14 +- d7/d92/sublist__search_8cpp__incl.md5 | 2 +- d7/d92/sublist__search_8cpp__incl.svg | 46 +- d7/d92/sublist__search_8cpp__incl_org.svg | 46 +- d7/da6/eratosthenes_8cpp.html | 2 +- d7/db9/hill__cipher_8cpp.html | 171 +- d7/dda/dsu__union__rank_8cpp__incl.map | 14 +- d7/dda/dsu__union__rank_8cpp__incl.md5 | 2 +- d7/dda/dsu__union__rank_8cpp__incl.svg | 48 +- d7/dda/dsu__union__rank_8cpp__incl_org.svg | 48 +- ...inverse__fermat__little__theorem_8cpp.html | 2 +- d8/d61/radix__sort2_8cpp.html | 117 +- d8/d69/classgraph_1_1_h_k_graph.html | 2 +- d8/d7a/sha1_8cpp.html | 443 +-- d8/d89/namespacelinear__probing.html | 2 +- d8/d8a/exponential__search_8cpp.html | 4 +- d8/d90/iterative__tree__traversals_8cpp.html | 6 +- ...connected__components__with__dsu_8cpp.html | 117 +- d8/d9a/fast__fourier__transform_8cpp.html | 115 +- d8/db1/binomial__calculate_8cpp.html | 4 +- d8/dd5/check__factorial_8cpp.html | 37 +- d8/ddf/sieve__of__eratosthenes_8cpp.html | 118 +- d8/de0/radix__sort2_8cpp__incl.map | 16 +- d8/de0/radix__sort2_8cpp__incl.md5 | 2 +- d8/de0/radix__sort2_8cpp__incl.svg | 50 +- d8/de0/radix__sort2_8cpp__incl_org.svg | 50 +- d8/df0/queue__using__array_8cpp.html | 77 +- d8/dfa/median__search2_8cpp.html | 2 +- d9/d00/factorial_8cpp.html | 5 +- d9/d0e/brent__method__extrema_8cpp__incl.map | 20 +- d9/d0e/brent__method__extrema_8cpp__incl.md5 | 2 +- d9/d0e/brent__method__extrema_8cpp__incl.svg | 60 +- .../brent__method__extrema_8cpp__incl_org.svg | 60 +- ...ive__tree__traversals_1_1_binary_tree.html | 2 +- d9/d31/recursive__bubble__sort_8cpp__incl.map | 24 +- d9/d31/recursive__bubble__sort_8cpp__incl.md5 | 2 +- d9/d31/recursive__bubble__sort_8cpp__incl.svg | 68 +- ...recursive__bubble__sort_8cpp__incl_org.svg | 68 +- ...nverse__fast__fourier__transform_8cpp.html | 111 +- d9/d43/set__kth__bit_8cpp__incl.map | 10 +- d9/d43/set__kth__bit_8cpp__incl.md5 | 2 +- d9/d43/set__kth__bit_8cpp__incl.svg | 40 +- d9/d43/set__kth__bit_8cpp__incl_org.svg | 40 +- d9/d44/magic__number_8cpp.html | 59 +- d9/d49/kohonen__som__trace_8cpp.html | 2 +- d9/d69/median__search_8cpp.html | 2 +- d9/d78/factorial_8cpp__incl.map | 10 +- d9/d78/factorial_8cpp__incl.md5 | 2 +- d9/d78/factorial_8cpp__incl.svg | 38 +- d9/d78/factorial_8cpp__incl_org.svg | 38 +- d9/d89/fibonacci_8cpp.html | 57 +- d9/d94/golden__search__extrema_8cpp__incl.map | 20 +- d9/d94/golden__search__extrema_8cpp__incl.md5 | 2 +- d9/d94/golden__search__extrema_8cpp__incl.svg | 60 +- ...golden__search__extrema_8cpp__incl_org.svg | 60 +- d9/dca/namespacesearch.html | 13 +- d9/dde/classbinary__search__tree.html | 2 +- d9/deb/cycle__sort_8cpp__incl.map | 16 +- d9/deb/cycle__sort_8cpp__incl.md5 | 2 +- d9/deb/cycle__sort_8cpp__incl.svg | 50 +- d9/deb/cycle__sort_8cpp__incl_org.svg | 50 +- ...same__number__of__set__bits_8cpp__incl.map | 12 +- ...same__number__of__set__bits_8cpp__incl.md5 | 2 +- ...same__number__of__set__bits_8cpp__incl.svg | 46 +- ...__number__of__set__bits_8cpp__incl_org.svg | 46 +- d9/df4/namespacetests.html | 2 +- d9/dfd/uint128__t_8hpp__incl.map | 18 +- d9/dfd/uint128__t_8hpp__incl.md5 | 2 +- d9/dfd/uint128__t_8hpp__incl.svg | 54 +- d9/dfd/uint128__t_8hpp__incl_org.svg | 54 +- ...tic__equations__complex__numbers_8cpp.html | 2 +- da/d23/eulers__totient__function_8cpp.html | 43 +- da/d35/sieve__of__eratosthenes_8cpp__incl.map | 16 +- da/d35/sieve__of__eratosthenes_8cpp__incl.md5 | 2 +- da/d35/sieve__of__eratosthenes_8cpp__incl.svg | 50 +- ...sieve__of__eratosthenes_8cpp__incl_org.svg | 50 +- ...es_1_1sparse__table_1_1_sparse__table.html | 34 +- da/d39/volume_8cpp.html | 2 +- da/d41/uint128__t_8hpp.html | 142 +- da/d41/uint128__t_8hpp_source.html | 2603 +++++++++-------- ...eedy__algorithms_1_1_digit_separation.html | 2 +- ...iling__ciphers__in__factorial__n_8cpp.html | 103 +- da/d5a/class_complex.html | 2 +- ...uctsearch_1_1sublist__search_1_1_node.html | 2 +- ...cted__components__with__dsu_8cpp__incl.map | 16 +- ...cted__components__with__dsu_8cpp__incl.md5 | 2 +- ...cted__components__with__dsu_8cpp__incl.svg | 52 +- ...__components__with__dsu_8cpp__incl_org.svg | 52 +- da/d9a/class_graph.html | 60 +- da/da3/uint256__t_8hpp.html | 2 +- da/da3/uint256__t_8hpp_source.html | 12 +- da/db8/count__of__set__bits_8cpp.html | 81 +- ...ibonacci__matrix__exponentiation_8cpp.html | 193 +- .../fibonacci__matrix__exponentiation_8cpp.js | 2 +- ...dca7b867074164d5f45b0f3851269d_cgraph.map} | 0 ...dca7b867074164d5f45b0f3851269d_cgraph.md5} | 0 ...dca7b867074164d5f45b0f3851269d_cgraph.svg} | 0 ...b867074164d5f45b0f3851269d_cgraph_org.svg} | 0 ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 2 +- ...b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg | 2 +- ...rithm__for__fast__multiplication_8cpp.html | 2 +- da/de6/treap_8cpp__incl.map | 12 +- da/de6/treap_8cpp__incl.md5 | 2 +- da/de6/treap_8cpp__incl.svg | 42 +- da/de6/treap_8cpp__incl_org.svg | 42 +- da/df2/durand__kerner__roots_8cpp.html | 497 ++-- db/d01/brent__method__extrema_8cpp.html | 333 +-- db/d0d/prime__factorization_8cpp.html | 2 +- .../modular__inverse__simple_8cpp__incl.map | 10 +- .../modular__inverse__simple_8cpp__incl.md5 | 2 +- .../modular__inverse__simple_8cpp__incl.svg | 40 +- ...odular__inverse__simple_8cpp__incl_org.svg | 40 +- db/d27/n__bonacci_8cpp.html | 5 +- db/d40/integral__approximation2_8cpp.html | 2 +- db/d4a/aliquot__sum_8cpp__incl.map | 10 +- db/d4a/aliquot__sum_8cpp__incl.md5 | 2 +- db/d4a/aliquot__sum_8cpp__incl.svg | 38 +- db/d4a/aliquot__sum_8cpp__incl_org.svg | 38 +- ...ures_1_1stack__using__queue_1_1_stack.html | 42 +- .../quadratic__probing__hash__table_8cpp.html | 2 +- db/d80/gale__shapley_8cpp.html | 74 +- db/d82/classlarge__number.html | 2 +- .../backtracking_2subset__sum_8cpp__incl.map | 14 +- .../backtracking_2subset__sum_8cpp__incl.md5 | 2 +- .../backtracking_2subset__sum_8cpp__incl.svg | 48 +- ...cktracking_2subset__sum_8cpp__incl_org.svg | 48 +- db/d93/check__prime_8cpp.html | 2 +- db/d9a/classuint128__t.html | 776 ++--- db/d9f/iterative__factorial_8cpp.html | 2 +- db/dbc/tree__234_8cpp.html | 2 +- db/dc0/namespacebacktracking.html | 5 +- .../floyd__cycle__detection__algo_8cpp.html | 5 +- db/dca/kadane2_8cpp.html | 2 +- db/de3/dsu__path__compression_8cpp__incl.map | 14 +- db/de3/dsu__path__compression_8cpp__incl.md5 | 2 +- db/de3/dsu__path__compression_8cpp__incl.svg | 48 +- .../dsu__path__compression_8cpp__incl_org.svg | 48 +- ...1strassens__multiplication_1_1_matrix.html | 2 +- dc/d14/wildcard__matching_8cpp.html | 211 +- ...inary__least__squares__regressor_8cpp.html | 4 +- ...e__fast__fourier__transform_8cpp__incl.map | 18 +- ...e__fast__fourier__transform_8cpp__incl.md5 | 2 +- ...e__fast__fourier__transform_8cpp__incl.svg | 56 +- ...ast__fourier__transform_8cpp__incl_org.svg | 56 +- dc/d6d/power__of__2_8cpp.html | 55 +- dc/d7e/largest__power_8cpp__incl.map | 12 +- dc/d7e/largest__power_8cpp__incl.md5 | 2 +- dc/d7e/largest__power_8cpp__incl.svg | 42 +- dc/d7e/largest__power_8cpp__incl_org.svg | 42 +- dc/d82/area_8cpp.html | 2 +- ...ical_methods_2rungekutta_8cpp-example.html | 6 +- dc/dc7/rungekutta_8cpp__incl.map | 14 +- dc/dc7/rungekutta_8cpp__incl.md5 | 2 +- dc/dc7/rungekutta_8cpp__incl.svg | 46 +- dc/dc7/rungekutta_8cpp__incl_org.svg | 46 +- dc/dd9/strand__sort_8cpp.html | 2 +- dc/dfb/atbash__cipher_8cpp.html | 2 +- dc/dfe/ternary__search_8cpp.html | 2 +- dd/d05/manacher__algorithm_8cpp__incl.map | 18 +- dd/d05/manacher__algorithm_8cpp__incl.md5 | 2 +- dd/d05/manacher__algorithm_8cpp__incl.svg | 54 +- dd/d05/manacher__algorithm_8cpp__incl_org.svg | 54 +- dd/d0d/insertion__sort_8cpp.html | 2 +- dd/d0e/double__factorial_8cpp__incl.map | 12 +- dd/d0e/double__factorial_8cpp__incl.md5 | 2 +- dd/d0e/double__factorial_8cpp__incl.svg | 42 +- dd/d0e/double__factorial_8cpp__incl_org.svg | 42 +- dd/d0f/md5_8cpp__incl.map | 24 +- dd/d0f/md5_8cpp__incl.md5 | 2 +- dd/d0f/md5_8cpp__incl.svg | 129 +- dd/d0f/md5_8cpp__incl_org.svg | 68 +- dd/d1f/classdsu.html | 278 +- dd/d24/namespacedynamic__programming.html | 3 +- dd/d43/uint256__t_8hpp__incl.map | 22 +- dd/d43/uint256__t_8hpp__incl.md5 | 2 +- dd/d43/uint256__t_8hpp__incl.svg | 70 +- dd/d43/uint256__t_8hpp__incl_org.svg | 70 +- dd/d47/namespacemath.html | 276 +- dd/d4d/list__array_8cpp__incl.map | 16 +- dd/d4d/list__array_8cpp__incl.md5 | 2 +- dd/d4d/list__array_8cpp__incl.svg | 52 +- dd/d4d/list__array_8cpp__incl_org.svg | 52 +- dd/d89/insertion__sort__recursive_8cpp.html | 2 +- ...reedy__algorithms_1_1stable__matching.html | 108 +- ...ng_1_1aystar__search_1_1_eight_puzzle.html | 2 +- dd/d9f/count__of__set__bits_8cpp__incl.map | 10 +- dd/d9f/count__of__set__bits_8cpp__incl.md5 | 2 +- dd/d9f/count__of__set__bits_8cpp__incl.svg | 40 +- .../count__of__set__bits_8cpp__incl_org.svg | 40 +- dd/dab/gale__shapley_8cpp__incl.map | 18 +- dd/dab/gale__shapley_8cpp__incl.md5 | 2 +- dd/dab/gale__shapley_8cpp__incl.svg | 42 +- dd/dab/gale__shapley_8cpp__incl_org.svg | 42 +- ...us_2sorting_2wiggle_sort_8cpp-example.html | 5 +- dd/dca/class_f_c_f_s.html | 122 +- ...cci__matrix__exponentiation_8cpp__incl.map | 16 +- ...cci__matrix__exponentiation_8cpp__incl.md5 | 2 +- ...cci__matrix__exponentiation_8cpp__incl.svg | 52 +- ..._matrix__exponentiation_8cpp__incl_org.svg | 52 +- de/d07/cycle__sort_8cpp.html | 171 +- de/d24/power__of__2_8cpp__incl.map | 10 +- de/d24/power__of__2_8cpp__incl.md5 | 2 +- de/d24/power__of__2_8cpp__incl.svg | 40 +- de/d24/power__of__2_8cpp__incl_org.svg | 40 +- de/d47/string__fibonacci_8cpp.html | 129 +- de/d4a/class_compare.html | 22 +- de/d4c/saddleback__search_8cpp__incl.map | 14 +- de/d4c/saddleback__search_8cpp__incl.md5 | 2 +- de/d4c/saddleback__search_8cpp__incl.svg | 46 +- de/d4c/saddleback__search_8cpp__incl_org.svg | 46 +- ...__of__binomial__coefficient_8cpp__incl.map | 10 +- ...__of__binomial__coefficient_8cpp__incl.md5 | 2 +- ...__of__binomial__coefficient_8cpp__incl.svg | 40 +- ...__binomial__coefficient_8cpp__incl_org.svg | 40 +- .../eulers__totient__function_8cpp__incl.map | 12 +- .../eulers__totient__function_8cpp__incl.md5 | 2 +- .../eulers__totient__function_8cpp__incl.svg | 44 +- ...lers__totient__function_8cpp__incl_org.svg | 44 +- de/d75/qr__eigen__values_8cpp.html | 4 +- .../travelling__salesman__problem_8cpp.html | 67 +- .../graham__scan__functions_8hpp_source.html | 347 +-- de/d99/aliquot__sum_8cpp.html | 41 +- de/dab/ncr__modulo__p_8cpp.html | 2 +- de/db2/quick__sort_8cpp__incl.map | 20 +- de/db2/quick__sort_8cpp__incl.md5 | 2 +- de/db2/quick__sort_8cpp__incl.svg | 58 +- de/db2/quick__sort_8cpp__incl_org.svg | 58 +- de/db6/a1z26__cipher_8cpp.html | 2 +- de/dc3/fibonacci__sum_8cpp.html | 147 +- de/dcd/kadanes3_8cpp.html | 3 +- de/dd3/newton__raphson__method_8cpp.html | 71 +- de/de4/fibonacci__large_8cpp.html | 4 +- ...reedy__algorithms_1_1_binary_addition.html | 2 +- df/d0f/fibonacci_8cpp__incl.map | 12 +- df/d0f/fibonacci_8cpp__incl.md5 | 2 +- df/d0f/fibonacci_8cpp__incl.svg | 42 +- df/d0f/fibonacci_8cpp__incl_org.svg | 42 +- df/d11/midpoint__integral__method_8cpp.html | 2 +- df/d14/dnf__sort_8cpp__incl.map | 16 +- df/d14/dnf__sort_8cpp__incl.md5 | 2 +- df/d14/dnf__sort_8cpp__incl.svg | 50 +- df/d14/dnf__sort_8cpp__incl_org.svg | 50 +- df/d28/dsu__union__rank_8cpp.html | 103 +- .../elliptic__curve__key__exchange_8cpp.html | 4 +- df/d3c/exponential__search_8cpp__incl.map | 14 +- df/d3c/exponential__search_8cpp__incl.md5 | 2 +- df/d3c/exponential__search_8cpp__incl.svg | 34 +- df/d3c/exponential__search_8cpp__incl_org.svg | 34 +- df/d47/fcfs__scheduling_8cpp.html | 141 +- df/d66/vector__cross__product_8cpp.html | 2 +- ...ers_1_1elliptic__curve__key__exchange.html | 2 +- df/d72/modular__division_8cpp.html | 99 +- ...__structures_2sparse__table_8cpp__incl.map | 12 +- ...__structures_2sparse__table_8cpp__incl.md5 | 2 +- ...__structures_2sparse__table_8cpp__incl.svg | 44 +- ...ructures_2sparse__table_8cpp__incl_org.svg | 44 +- df/d92/wildcard__matching_8cpp__incl.map | 14 +- df/d92/wildcard__matching_8cpp__incl.md5 | 2 +- df/d92/wildcard__matching_8cpp__incl.svg | 48 +- df/d92/wildcard__matching_8cpp__incl_org.svg | 48 +- df/d94/subarray__sum_8cpp.html | 141 +- ...n__using__bit__manipulation_8cpp__incl.map | 20 +- ...n__using__bit__manipulation_8cpp__incl.md5 | 2 +- ...n__using__bit__manipulation_8cpp__incl.svg | 60 +- ...sing__bit__manipulation_8cpp__incl_org.svg | 60 +- df/dcb/namespacestrings.html | 4 +- ...quations_complex_numbers_8cpp-example.html | 2 +- df/dce/namespacegraph.html | 166 +- doxygen_crawl.html | 2 +- globals_func_t.html | 2 +- globals_t.html | 2 +- hierarchy.html | 2 +- inherit_graph_35.map | 2 +- inherit_graph_35.md5 | 2 +- inherit_graph_35.svg | 2 +- namespaces.html | 10 +- navtreeindex10.js | 2 +- search/all_19.js | 2 +- search/functions_14.js | 2 +- 518 files changed, 13882 insertions(+), 10974 deletions(-) rename da/dc9/{fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map => fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map} (100%) rename da/dc9/{fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 => fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5} (100%) rename da/dc9/{fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg => fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg} (100%) rename da/dc9/{fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg => fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg} (100%) diff --git a/annotated.html b/annotated.html index 991e7992f..bc026981d 100644 --- a/annotated.html +++ b/annotated.html @@ -148,7 +148,7 @@ $(function(){initNavTree('annotated.html',''); initResizable(true); });  CMatrixMatrix class  Ndouble_hashingAn implementation of hash table using double hashing algorithm  CEntry - NgeometryFor std::vector + NgeometryFor std::swap  Ngrahamscan  CPoint  Njarvis @@ -168,7 +168,7 @@ $(function(){initNavTree('annotated.html',''); initResizable(true); });  CGraphWrapper class for storing a graph  CBinaryAdditionA class to perform binary addition of two binary strings  CDigitSeparationA class that provides methods to separate the digits of a large positive number - NhashingHashing algorithms + NhashingUsed for assert  Nsha256  CHashContains hash array and functions to update it and convert it to a hexadecimal string  Nlinear_probingAn implementation of hash table using linear probing algorithm @@ -186,7 +186,7 @@ $(function(){initNavTree('annotated.html',''); initResizable(true); });  CDenseLayer  CNeuralNetwork  Cadaline - NmathFor IO operations + NmathFor assert  Nncr_modulo_p  CNCRModuloPClass which contains all methods required for calculating nCr mod p  Noperations_on_datastructuresFor std::vector @@ -230,7 +230,7 @@ $(function(){initNavTree('annotated.html',''); initResizable(true); });  Cfenwick_treeThe class that initializes the Fenwick Tree  CperSegTreeRange query here is range sum, but the code can be modified to make different queries like range max or min  CNode - NsearchFor std::vector + NsearchFor std::assert  Nsublist_search  CNodeA Node structure representing a single link Node in a linked list  NstatisticsStatistical algorithms @@ -257,7 +257,7 @@ $(function(){initNavTree('annotated.html',''); initResizable(true); });  CCycleCheck  Cdouble_linked_list  CdsuDisjoint sets union data structure, class based representation - CEasterYearMonthDayFor IO operations + CEasterYearMonthDayFor assert  CEdge  CFCFSClass which implements the FCFS scheduling algorithm  CGraph diff --git a/d0/d15/fast__fourier__transform_8cpp__incl.map b/d0/d15/fast__fourier__transform_8cpp__incl.map index b7dc56771..bf4147b75 100644 --- a/d0/d15/fast__fourier__transform_8cpp__incl.map +++ b/d0/d15/fast__fourier__transform_8cpp__incl.map @@ -1,13 +1,15 @@ - + - + - + - - - - - + + + + + + + diff --git a/d0/d15/fast__fourier__transform_8cpp__incl.md5 b/d0/d15/fast__fourier__transform_8cpp__incl.md5 index efdd41077..dc4bfad54 100644 --- a/d0/d15/fast__fourier__transform_8cpp__incl.md5 +++ b/d0/d15/fast__fourier__transform_8cpp__incl.md5 @@ -1 +1 @@ -686048b0d6dfe64be6ab4e2c80508de2 \ No newline at end of file +ec312679357f32a18e418e285334fcef \ No newline at end of file diff --git a/d0/d15/fast__fourier__transform_8cpp__incl.svg b/d0/d15/fast__fourier__transform_8cpp__incl.svg index a16833192..ea262c582 100644 --- a/d0/d15/fast__fourier__transform_8cpp__incl.svg +++ b/d0/d15/fast__fourier__transform_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -numerical_methods/fast -_fourier_transform.cpp + +numerical_methods/fast +_fourier_transform.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -iostream + +cstdint @@ -96,8 +96,8 @@ Node1->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -vector + +iostream @@ -114,8 +114,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/d0/d15/fast__fourier__transform_8cpp__incl_org.svg b/d0/d15/fast__fourier__transform_8cpp__incl_org.svg index 28610dfa4..ad9315528 100644 --- a/d0/d15/fast__fourier__transform_8cpp__incl_org.svg +++ b/d0/d15/fast__fourier__transform_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + numerical_methods/fast_fourier_transform.cpp Node1 - -numerical_methods/fast -_fourier_transform.cpp + +numerical_methods/fast +_fourier_transform.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -iostream + +cstdint @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -vector + +iostream @@ -103,8 +103,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/d0/d3e/classdata__structures_1_1trie.html b/d0/d3e/classdata__structures_1_1trie.html index d17df5877..87e68ad33 100644 --- a/d0/d3e/classdata__structures_1_1trie.html +++ b/d0/d3e/classdata__structures_1_1trie.html @@ -415,7 +415,7 @@ Here is the call graph for this function:
67 }
68 return search(root->arr[j], str, index + 1);
69 }
-
for std::vector
Definition binary_search.cpp:46
+
for std::assert
Definition binary_search.cpp:47
Here is the call graph for this function:
diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp.html b/d0/d46/finding__number__of__digits__in__a__number_8cpp.html index 4e46f6662..2a7ecb041 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp.html +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d0/d46/finding__number__of__digits__in__a__number_8cpp More...

#include <cassert>
#include <cmath>
+#include <cstdint>
#include <iostream>
Include dependency graph for finding_number_of_digits_in_a_number.cpp:
-
+
- + @@ -159,8 +160,8 @@ the number of digits in a number.md" target="_blank">Algorithms-Explanation

Functions

uint64_t finding_number_of_digits_in_a_number (uint64_t n)
 for IO operations
 for log calculation
 
double finding_number_of_digits_in_a_number_using_log (double n)
 This function finds the number of digits in constant time using logarithmic function TC: O(1)
-

for IO operations

-

for assert for log calculation

+

for log calculation

+

for assert for IO operations

The main function that checks the number of digits in a number. TC : O(number of digits)

Parameters
@@ -169,21 +170,21 @@ the number of digits in a number.md" target="_blank">Algorithms-Explanation
Returns
the digits count

< the variable used for the digits count

-
30 {
-
31 uint64_t count = 0; ///< the variable used for the digits count
-
32
-
33 // iterate until `n` becomes 0
-
34 // remove last digit from `n` in each iteration
-
35 // increase `count` by 1 in each iteration
-
36 while (n != 0) {
-
37 // we can also use `n = n / 10`
-
38 n /= 10;
-
39 // each time the loop is running, `count` will be incremented by 1.
-
40 ++count;
-
41 }
-
42
-
43 return count;
-
44}
+
31 {
+
32 uint64_t count = 0; ///< the variable used for the digits count
+
33
+
34 // iterate until `n` becomes 0
+
35 // remove last digit from `n` in each iteration
+
36 // increase `count` by 1 in each iteration
+
37 while (n != 0) {
+
38 // we can also use `n = n / 10`
+
39 n /= 10;
+
40 // each time the loop is running, `count` will be incremented by 1.
+
41 ++count;
+
42 }
+
43
+
44 return count;
+
45}
@@ -210,21 +211,21 @@ the number of digits in a number.md" target="_blank">Algorithms-Explanation
Returns
the digits count
-
53 {
-
54 // log(0) is undefined
-
55 if (n == 0) {
-
56 return 0;
-
57 }
-
58
-
59 // to handle the negative numbers
-
60 if (n < 0) {
-
61 n = -n;
-
62 }
-
63
-
64 double count = floor(log10(n) + 1);
-
65
-
66 return count;
-
67}
+
54 {
+
55 // log(0) is undefined
+
56 if (n == 0) {
+
57 return 0;
+
58 }
+
59
+
60 // to handle the negative numbers
+
61 if (n < 0) {
+
62 n = -n;
+
63 }
+
64
+
65 double count = floor(log10(n) + 1);
+
66
+
67 return count;
+
68}
T floor(T... args)
T log10(T... args)
@@ -255,16 +256,16 @@ the number of digits in a number.md" target="_blank">Algorithms-Explanation

Self-test implementations.

Returns
void
-
73 {
-
74 assert(finding_number_of_digits_in_a_number(5492) == 4);
- -
76 assert(finding_number_of_digits_in_a_number(10000) == 5);
- -
78 assert(finding_number_of_digits_in_a_number(100000) == 6);
- - -
81}
-
uint64_t finding_number_of_digits_in_a_number(uint64_t n)
for IO operations
Definition finding_number_of_digits_in_a_number.cpp:30
+
74 {
+
75 assert(finding_number_of_digits_in_a_number(5492) == 4);
+ +
77 assert(finding_number_of_digits_in_a_number(10000) == 5);
+ +
79 assert(finding_number_of_digits_in_a_number(100000) == 6);
+ + +
82}
+
uint64_t finding_number_of_digits_in_a_number(uint64_t n)
for log calculation
Definition finding_number_of_digits_in_a_number.cpp:31
Here is the call graph for this function:
@@ -290,15 +291,15 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
96 {
-
97 // run self-test implementations
-
98 first_test();
-
99 second_test();
-
100 std::cout << "All tests have successfully passed!\n";
-
101 return 0;
-
102}
+
97 {
+
98 // run self-test implementations
+
99 first_test();
+
100 second_test();
+
101 std::cout << "All tests have successfully passed!\n";
+
102 return 0;
+
103}
-
static void first_test()
Self-test implementations.
Definition finding_number_of_digits_in_a_number.cpp:73
+
static void first_test()
Self-test implementations.
Definition finding_number_of_digits_in_a_number.cpp:74
Here is the call graph for this function:
@@ -329,16 +330,16 @@ Here is the call graph for this function:
nthe number to check its digits
-
83 {
- - - - - - - -
91}
-
double finding_number_of_digits_in_a_number_using_log(double n)
This function finds the number of digits in constant time using logarithmic function TC: O(1)
Definition finding_number_of_digits_in_a_number.cpp:53
+
84 {
+ + + + + + + +
92}
+
double finding_number_of_digits_in_a_number_using_log(double n)
This function finds the number of digits in constant time using logarithmic function TC: O(1)
Definition finding_number_of_digits_in_a_number.cpp:54
diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.map b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.map index 5789e40ea..42f293293 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.map +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.map @@ -1,5 +1,5 @@ - + diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.md5 b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.md5 index f3b827d02..3a1236cb1 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.md5 +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.md5 @@ -1 +1 @@ -3531f7362357ba2048cf757e66bfbd46 \ No newline at end of file +5ad9fc7e13e0f0dc5673de02235e03df \ No newline at end of file diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.svg b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.svg index 00ddb2fdf..6099ad2c9 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.svg +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph.svg @@ -31,7 +31,7 @@ Node2 - + finding_number_of_digits _in_a_number diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph_org.svg b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph_org.svg index 23edd63fd..22b1eb3be 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph_org.svg +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ab4c15b7f1aedd4419a65cd49562cc300_cgraph_org.svg @@ -20,7 +20,7 @@ Node2 - + finding_number_of_digits _in_a_number diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index bd3e1ce37..755e15691 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -2,6 +2,6 @@ - + diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index 2fa3731f2..bf4c3bf86 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -bee79590a2d72cd2365743e7c4c8b9e0 \ No newline at end of file +cf8cf0ca556d01b11a9915d07f3e320f \ No newline at end of file diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index 50eda117b..4a72e4779 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -49,7 +49,7 @@ Node3 - + finding_number_of_digits _in_a_number diff --git a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index 342b648da..3234a8788 100644 --- a/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d0/d46/finding__number__of__digits__in__a__number_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -38,7 +38,7 @@ Node3 - + finding_number_of_digits _in_a_number diff --git a/d0/d51/approximate__pi_8cpp.html b/d0/d51/approximate__pi_8cpp.html index 1b54a8633..3febc347e 100644 --- a/d0/d51/approximate__pi_8cpp.html +++ b/d0/d51/approximate__pi_8cpp.html @@ -127,7 +127,7 @@ Include dependency graph for approximate_pi.cpp:

Namespaces

namespace  math - for IO operations
+ for assert
 

Detailed Description

for string class

for uint32_t

-

for assert

+

Greedy Algorithms.

For std::vector to store separated digits.

for std::vector

for reverse function for tests for input and outputs

@@ -155,8 +155,7 @@ Functions

Greedy Algorithms

For reveresing the vector For assert() function to check for errors For abs() function For int64_t data type to handle large numbers For input/output operations

Greedy Algorithms

-

for std::u32int_t for std::vector for std::find

-

Greedy Algorithms

+

for std::find for assert for std::uint32_t for std::vector

for assert for std::cout

Greedy Algorithms

for array for IO operations for numeric limits

diff --git a/d3/d1a/hill__cipher_8cpp__incl.map b/d3/d1a/hill__cipher_8cpp__incl.map index 465258e06..cd8a24867 100644 --- a/d3/d1a/hill__cipher_8cpp__incl.map +++ b/d3/d1a/hill__cipher_8cpp__incl.map @@ -1,26 +1,28 @@ - + - + - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/d3/d1a/hill__cipher_8cpp__incl.md5 b/d3/d1a/hill__cipher_8cpp__incl.md5 index ade3652eb..8059bc422 100644 --- a/d3/d1a/hill__cipher_8cpp__incl.md5 +++ b/d3/d1a/hill__cipher_8cpp__incl.md5 @@ -1 +1 @@ -770c77c44a8202fdf083ac3e26375873 \ No newline at end of file +5f39a4538d52363e8eade1e12188ed5e \ No newline at end of file diff --git a/d3/d1a/hill__cipher_8cpp__incl.svg b/d3/d1a/hill__cipher_8cpp__incl.svg index 9bc54e7db..4391da34b 100644 --- a/d3/d1a/hill__cipher_8cpp__incl.svg +++ b/d3/d1a/hill__cipher_8cpp__incl.svg @@ -47,7 +47,7 @@ @@ -59,8 +59,8 @@ var sectionId = 'dynsection-0'; Node1 - -ciphers/hill_cipher.cpp + +ciphers/hill_cipher.cpp @@ -77,8 +77,8 @@ var sectionId = 'dynsection-0'; Node1->Node2 - - + + @@ -95,8 +95,8 @@ var sectionId = 'dynsection-0'; Node1->Node3 - - + + @@ -105,7 +105,7 @@ var sectionId = 'dynsection-0'; Node4 -cstring +cstdint @@ -113,8 +113,8 @@ var sectionId = 'dynsection-0'; Node1->Node4 - - + + @@ -122,8 +122,8 @@ var sectionId = 'dynsection-0'; Node5 - -ctime + +cstring @@ -131,8 +131,8 @@ var sectionId = 'dynsection-0'; Node1->Node5 - - + + @@ -140,8 +140,8 @@ var sectionId = 'dynsection-0'; Node6 - -fstream + +ctime @@ -149,8 +149,8 @@ var sectionId = 'dynsection-0'; Node1->Node6 - - + + @@ -158,8 +158,8 @@ var sectionId = 'dynsection-0'; Node7 - -iomanip + +fstream @@ -167,8 +167,8 @@ var sectionId = 'dynsection-0'; Node1->Node7 - - + + @@ -176,8 +176,8 @@ var sectionId = 'dynsection-0'; Node8 - -iostream + +iomanip @@ -185,8 +185,8 @@ var sectionId = 'dynsection-0'; Node1->Node8 - - + + @@ -194,8 +194,8 @@ var sectionId = 'dynsection-0'; Node9 - -string + +iostream @@ -203,18 +203,17 @@ var sectionId = 'dynsection-0'; Node1->Node9 - - + + Node10 - - -../numerical_methods -/lu_decomposition.h + + +string @@ -222,35 +221,36 @@ var sectionId = 'dynsection-0'; Node1->Node10 - - - - - - - -Node10->Node8 - - - + + Node11 - - -valarray + + +../numerical_methods +/lu_decomposition.h - - -Node10->Node11 - - - + + +Node1->Node11 + + + + + + + + +Node11->Node9 + + + @@ -258,17 +258,35 @@ var sectionId = 'dynsection-0'; Node12 - -vector + +valarray - - -Node10->Node12 - - - + + +Node11->Node12 + + + + + + + + +Node13 + + +vector + + + + + +Node11->Node13 + + + diff --git a/d3/d1a/hill__cipher_8cpp__incl_org.svg b/d3/d1a/hill__cipher_8cpp__incl_org.svg index 3b894166c..a758ebcd9 100644 --- a/d3/d1a/hill__cipher_8cpp__incl_org.svg +++ b/d3/d1a/hill__cipher_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + ciphers/hill_cipher.cpp Node1 - -ciphers/hill_cipher.cpp + +ciphers/hill_cipher.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -58,7 +58,7 @@ Node4 -cstring +cstdint @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -ctime + +cstring @@ -84,8 +84,8 @@ Node1->Node5 - - + + @@ -93,8 +93,8 @@ Node6 - -fstream + +ctime @@ -102,8 +102,8 @@ Node1->Node6 - - + + @@ -111,8 +111,8 @@ Node7 - -iomanip + +fstream @@ -120,8 +120,8 @@ Node1->Node7 - - + + @@ -129,8 +129,8 @@ Node8 - -iostream + +iomanip @@ -138,8 +138,8 @@ Node1->Node8 - - + + @@ -147,8 +147,8 @@ Node9 - -string + +iostream @@ -156,18 +156,17 @@ Node1->Node9 - - + + Node10 - - -../numerical_methods -/lu_decomposition.h + + +string @@ -175,35 +174,36 @@ Node1->Node10 - - - - - - - -Node10->Node8 - - - + + Node11 - - -valarray + + +../numerical_methods +/lu_decomposition.h - - -Node10->Node11 - - - + + +Node1->Node11 + + + + + + + + +Node11->Node9 + + + @@ -211,17 +211,35 @@ Node12 - -vector + +valarray - - -Node10->Node12 - - - + + +Node11->Node12 + + + + + + + + +Node13 + + +vector + + + + + +Node11->Node13 + + + diff --git a/d3/d22/saddleback__search_8cpp.html b/d3/d22/saddleback__search_8cpp.html index 4a491ee6f..28ea0bb0f 100644 --- a/d3/d22/saddleback__search_8cpp.html +++ b/d3/d22/saddleback__search_8cpp.html @@ -114,18 +114,19 @@ $(function(){initNavTree('d3/d22/saddleback__search_8cpp.html','../../'); initRe

Implementation of Saddleback Algorithm for 2D arrays. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for saddleback_search.cpp:
-
+

diff --git a/d0/d65/namespacedouble__hashing.html b/d0/d65/namespacedouble__hashing.html index 86c4458bc..c546fc7e8 100644 --- a/d0/d65/namespacedouble__hashing.html +++ b/d0/d65/namespacedouble__hashing.html @@ -253,7 +253,7 @@ Here is the call graph for this function:
T endl(T... args)
size_t hashFxn(int key)
Hash a key. Uses the STL library's std::hash() function.
Definition double_hash_hash_table.cpp:47
-
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:37
+
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:38
Here is the call graph for this function:
@@ -371,7 +371,7 @@ new hash if no conflicts present
110 } while (entry.key != notPresent);
111 return notPresent;
112}
-
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:287
+
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:288
size_t otherHashFxn(int key)
Used for second hash function.
Definition double_hash_hash_table.cpp:58
bool putProber(const Entry &entry, int key)
Definition double_hash_hash_table.cpp:120
Definition double_hash_hash_table.cpp:36
diff --git a/d0/d6d/modular__exponentiation_8cpp.html b/d0/d6d/modular__exponentiation_8cpp.html index 1a5aa533b..db31bec30 100644 --- a/d0/d6d/modular__exponentiation_8cpp.html +++ b/d0/d6d/modular__exponentiation_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d0/d6d/modular__exponentiation_8cpp.html','../../'); i

C++ Program for Modular Exponentiation Iteratively. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for modular_exponentiation.cpp:
-
+
- +

Namespaces

namespace  math
 for IO operations
 for assert
 

Detailed Description

for vector

for vector

-

for std::unordered_map

+

for assert

Other algorithms.

for IO operations

for reverse for assert for I/O operations for stack

Other algorithms

for assert for std::abs

Other algorithms

-

for assert for IO Operations for std::list

+

for IO Operations for std::list for std::unordered_map

Other algorithms

for assert for std::uint64_t for I/O operations

Other algorithms

diff --git a/d0/da1/string__fibonacci_8cpp__incl.map b/d0/da1/string__fibonacci_8cpp__incl.map index 26d5760ee..8ab37a878 100644 --- a/d0/da1/string__fibonacci_8cpp__incl.map +++ b/d0/da1/string__fibonacci_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/d0/da1/string__fibonacci_8cpp__incl.md5 b/d0/da1/string__fibonacci_8cpp__incl.md5 index 5c6a29327..090503e85 100644 --- a/d0/da1/string__fibonacci_8cpp__incl.md5 +++ b/d0/da1/string__fibonacci_8cpp__incl.md5 @@ -1 +1 @@ -91f66c6a83b62bb31cdaf0b177487d90 \ No newline at end of file +472a574060438df56dd3d29800fc44bd \ No newline at end of file diff --git a/d0/da1/string__fibonacci_8cpp__incl.svg b/d0/da1/string__fibonacci_8cpp__incl.svg index c02ba50a0..d79a9a423 100644 --- a/d0/da1/string__fibonacci_8cpp__incl.svg +++ b/d0/da1/string__fibonacci_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/string_fibonacci.cpp + +math/string_fibonacci.cpp @@ -32,8 +32,8 @@ Node2 - -iostream + +cstdint @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -cstring + +iostream @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +cstring + + + + + +Node1->Node4 + + + diff --git a/d0/da1/string__fibonacci_8cpp__incl_org.svg b/d0/da1/string__fibonacci_8cpp__incl_org.svg index d04b11bca..dbff7ccb4 100644 --- a/d0/da1/string__fibonacci_8cpp__incl_org.svg +++ b/d0/da1/string__fibonacci_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/string_fibonacci.cpp Node1 - -math/string_fibonacci.cpp + +math/string_fibonacci.cpp @@ -21,8 +21,8 @@ Node2 - -iostream + +cstdint @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -cstring + +iostream @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +cstring + + + + + +Node1->Node4 + + + diff --git a/d0/db1/check__factorial_8cpp__incl.map b/d0/db1/check__factorial_8cpp__incl.map index ab6292a28..7d0e22ae2 100644 --- a/d0/db1/check__factorial_8cpp__incl.map +++ b/d0/db1/check__factorial_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/d0/db1/check__factorial_8cpp__incl.md5 b/d0/db1/check__factorial_8cpp__incl.md5 index 847e53b37..5bb732f67 100644 --- a/d0/db1/check__factorial_8cpp__incl.md5 +++ b/d0/db1/check__factorial_8cpp__incl.md5 @@ -1 +1 @@ -ce993e6191805088d1c0e0df9b45b52d \ No newline at end of file +1763e785f48d6b780da6f140dd8f244c \ No newline at end of file diff --git a/d0/db1/check__factorial_8cpp__incl.svg b/d0/db1/check__factorial_8cpp__incl.svg index 55c0f098d..0d45580a2 100644 --- a/d0/db1/check__factorial_8cpp__incl.svg +++ b/d0/db1/check__factorial_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/check_factorial.cpp + +math/check_factorial.cpp @@ -32,8 +32,8 @@ Node2 - -cassert + +cassert @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d0/db1/check__factorial_8cpp__incl_org.svg b/d0/db1/check__factorial_8cpp__incl_org.svg index 810c1492a..241155cc1 100644 --- a/d0/db1/check__factorial_8cpp__incl_org.svg +++ b/d0/db1/check__factorial_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/check_factorial.cpp Node1 - -math/check_factorial.cpp + +math/check_factorial.cpp @@ -21,8 +21,8 @@ Node2 - -cassert + +cassert @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d0/dcc/modular__division_8cpp__incl.map b/d0/dcc/modular__division_8cpp__incl.map index 8bb875ccf..e03eb709a 100644 --- a/d0/dcc/modular__division_8cpp__incl.map +++ b/d0/dcc/modular__division_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/d0/dcc/modular__division_8cpp__incl.md5 b/d0/dcc/modular__division_8cpp__incl.md5 index b5fd90542..cfc8145a2 100644 --- a/d0/dcc/modular__division_8cpp__incl.md5 +++ b/d0/dcc/modular__division_8cpp__incl.md5 @@ -1 +1 @@ -209bdacba764cf7ffcdc62bae9c43f05 \ No newline at end of file +43d56bf914600fadeb35acf5f74a6e7f \ No newline at end of file diff --git a/d0/dcc/modular__division_8cpp__incl.svg b/d0/dcc/modular__division_8cpp__incl.svg index 70ad0469d..718364b92 100644 --- a/d0/dcc/modular__division_8cpp__incl.svg +++ b/d0/dcc/modular__division_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/modular_division.cpp + +math/modular_division.cpp @@ -32,8 +32,8 @@ Node2 - -cassert + +cassert @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d0/dcc/modular__division_8cpp__incl_org.svg b/d0/dcc/modular__division_8cpp__incl_org.svg index aa4d564a7..17a3f32a9 100644 --- a/d0/dcc/modular__division_8cpp__incl_org.svg +++ b/d0/dcc/modular__division_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/modular_division.cpp Node1 - -math/modular_division.cpp + +math/modular_division.cpp @@ -21,8 +21,8 @@ Node2 - -cassert + +cassert @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d0/dd2/treap_8cpp.html b/d0/dd2/treap_8cpp.html index f016adff6..9dd329021 100644 --- a/d0/dd2/treap_8cpp.html +++ b/d0/dd2/treap_8cpp.html @@ -117,11 +117,12 @@ $(function(){initNavTree('d0/dd2/treap_8cpp.html','../../'); initResizable(true) More...

#include <array>
#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for treap.cpp:
-
+

diff --git a/d0/d6f/namespaceothers.html b/d0/d6f/namespaceothers.html index 62715466a..f0522f0cf 100644 --- a/d0/d6f/namespaceothers.html +++ b/d0/d6f/namespaceothers.html @@ -132,14 +132,14 @@ Functions

@@ -179,11 +180,11 @@ const int 

data_structures:

Main function.

Returns
0 on exit
-
256 {
-
257 test(); // run self-test implementations
-
258 return 0;
-
259}
-
static void test()
Self-test implementations.
Definition treap.cpp:230
+
255 {
+
256 test(); // run self-test implementations
+
257 return 0;
+
258}
+
static void test()
Self-test implementations.
Definition treap.cpp:229
Here is the call graph for this function:
@@ -218,36 +219,36 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void

< Treap object instance

-
230 {
-
231 data_structures::treap::Treap mTreap; ///< Treap object instance
-
232
-
233 mTreap.insert(1);
-
234 mTreap.insert(2);
-
235 mTreap.insert(3);
-
236 assert(mTreap.get_k_th(2) == 2);
-
237 mTreap.insert(4);
-
238 mTreap.insert(5);
-
239 mTreap.insert(6);
-
240 assert(mTreap.get_next(4) == 5);
-
241 mTreap.insert(7);
-
242 assert(mTreap.get_predecessor(7) == 6);
-
243 mTreap.erase(4);
-
244 assert(mTreap.get_k_th(4) == 5);
-
245 assert(mTreap.get_rank(5) == 4);
-
246 mTreap.insert(10);
-
247 assert(mTreap.get_rank(10) == 7);
-
248 assert(mTreap.get_predecessor(10) == 7);
-
249
-
250 std::cout << "All tests have successfully passed!\n";
-
251}
+
229 {
+
230 data_structures::treap::Treap mTreap; ///< Treap object instance
+
231
+
232 mTreap.insert(1);
+
233 mTreap.insert(2);
+
234 mTreap.insert(3);
+
235 assert(mTreap.get_k_th(2) == 2);
+
236 mTreap.insert(4);
+
237 mTreap.insert(5);
+
238 mTreap.insert(6);
+
239 assert(mTreap.get_next(4) == 5);
+
240 mTreap.insert(7);
+
241 assert(mTreap.get_predecessor(7) == 6);
+
242 mTreap.erase(4);
+
243 assert(mTreap.get_k_th(4) == 5);
+
244 assert(mTreap.get_rank(5) == 4);
+
245 mTreap.insert(10);
+
246 assert(mTreap.get_rank(10) == 7);
+
247 assert(mTreap.get_predecessor(10) == 7);
+
248
+
249 std::cout << "All tests have successfully passed!\n";
+
250}
-
Struct representation of the treap.
Definition treap.cpp:39
-
void insert(int k)
Insert element (External method)
Definition treap.cpp:204
-
int get_next(int k)
Get the successor node of element k.
Definition treap.cpp:189
-
void erase(int k)
Erase element (External method)
Definition treap.cpp:209
-
int get_k_th(int k)
Get the KTH largest value (External method)
Definition treap.cpp:215
-
int get_predecessor(int k)
Get the predecessor node of element k.
Definition treap.cpp:173
-
int get_rank(int k)
Get the rank of specified element (External method)
Definition treap.cpp:221
+
Struct representation of the treap.
Definition treap.cpp:40
+
void insert(int k)
Insert element (External method)
Definition treap.cpp:203
+
int get_next(int k)
Get the successor node of element k.
Definition treap.cpp:188
+
void erase(int k)
Erase element (External method)
Definition treap.cpp:208
+
int get_k_th(int k)
Get the KTH largest value (External method)
Definition treap.cpp:214
+
int get_predecessor(int k)
Get the predecessor node of element k.
Definition treap.cpp:172
+
int get_rank(int k)
Get the rank of specified element (External method)
Definition treap.cpp:220
Here is the call graph for this function:
diff --git a/d0/dd3/modular__exponentiation_8cpp__incl.map b/d0/dd3/modular__exponentiation_8cpp__incl.map index cdabaddc1..638ed49bf 100644 --- a/d0/dd3/modular__exponentiation_8cpp__incl.map +++ b/d0/dd3/modular__exponentiation_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/d0/dd3/modular__exponentiation_8cpp__incl.md5 b/d0/dd3/modular__exponentiation_8cpp__incl.md5 index 30b3bf26d..3a97900b9 100644 --- a/d0/dd3/modular__exponentiation_8cpp__incl.md5 +++ b/d0/dd3/modular__exponentiation_8cpp__incl.md5 @@ -1 +1 @@ -218641b5418032e7f34c496b3c99272f \ No newline at end of file +06b438f6a023265ca37996eab7a0616f \ No newline at end of file diff --git a/d0/dd3/modular__exponentiation_8cpp__incl.svg b/d0/dd3/modular__exponentiation_8cpp__incl.svg index 72b22a2b6..47556fdf5 100644 --- a/d0/dd3/modular__exponentiation_8cpp__incl.svg +++ b/d0/dd3/modular__exponentiation_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/modular_exponentiation.cpp + +math/modular_exponentiation.cpp @@ -32,8 +32,8 @@ Node2 - -cassert + +cassert @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d0/dd3/modular__exponentiation_8cpp__incl_org.svg b/d0/dd3/modular__exponentiation_8cpp__incl_org.svg index 8cae3add1..285f7ac07 100644 --- a/d0/dd3/modular__exponentiation_8cpp__incl_org.svg +++ b/d0/dd3/modular__exponentiation_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/modular_exponentiation.cpp Node1 - -math/modular_exponentiation.cpp + +math/modular_exponentiation.cpp @@ -21,8 +21,8 @@ Node2 - -cassert + +cassert @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d0/df1/z__function_8cpp__incl.map b/d0/df1/z__function_8cpp__incl.map index 08222fbe6..ea85609dd 100644 --- a/d0/df1/z__function_8cpp__incl.map +++ b/d0/df1/z__function_8cpp__incl.map @@ -1,11 +1,13 @@ - - - - - - - - - + + + + + + + + + + + diff --git a/d0/df1/z__function_8cpp__incl.md5 b/d0/df1/z__function_8cpp__incl.md5 index 402b806f0..0b64a3a87 100644 --- a/d0/df1/z__function_8cpp__incl.md5 +++ b/d0/df1/z__function_8cpp__incl.md5 @@ -1 +1 @@ -e4aee95fdf3da288634fa92783a86aaa \ No newline at end of file +96ff757de14aaee5f772802250236036 \ No newline at end of file diff --git a/d0/df1/z__function_8cpp__incl.svg b/d0/df1/z__function_8cpp__incl.svg index 344bbd6e4..d01c8ad05 100644 --- a/d0/df1/z__function_8cpp__incl.svg +++ b/d0/df1/z__function_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -strings/z_function.cpp + +strings/z_function.cpp @@ -32,8 +32,8 @@ Node2 - -iostream + +cstdint @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -cstring + +iostream @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -cassert + +cstring @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -vector + +cassert @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d0/df1/z__function_8cpp__incl_org.svg b/d0/df1/z__function_8cpp__incl_org.svg index 974b5ff08..ce67f618f 100644 --- a/d0/df1/z__function_8cpp__incl_org.svg +++ b/d0/df1/z__function_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + strings/z_function.cpp Node1 - -strings/z_function.cpp + +strings/z_function.cpp @@ -21,8 +21,8 @@ Node2 - -iostream + +cstdint @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -cstring + +iostream @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -cassert + +cstring @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -vector + +cassert @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d0/dfe/backtracking_2subset__sum_8cpp.html b/d0/dfe/backtracking_2subset__sum_8cpp.html index 89a011743..282d8e86a 100644 --- a/d0/dfe/backtracking_2subset__sum_8cpp.html +++ b/d0/dfe/backtracking_2subset__sum_8cpp.html @@ -114,12 +114,13 @@ $(function(){initNavTree('d0/dfe/backtracking_2subset__sum_8cpp.html','../../');

Implementation of the Subset Sum problem. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for subset_sum.cpp:
-
+

Main function.

Returns
0 on exit
-
103 {
-
104 test(); // run self-test implementations
-
105 return 0;
-
106}
-
static void test()
Test implementations.
Definition subset_sum.cpp:57
+
104 {
+
105 test(); // run self-test implementations
+
106 return 0;
+
107}
+
static void test()
Test implementations.
Definition subset_sum.cpp:58
Here is the call graph for this function:
@@ -205,23 +206,23 @@ Here is the call graph for this function:
Returns
count of the number of subsets with required sum
-
33 {
-
34 int32_t nelement = in_arr.size();
-
35 uint64_t count_of_subset = 0;
-
36
-
37 for (int32_t i = 0; i < (1 << (nelement)); i++) {
-
38 int32_t check = 0;
-
39 for (int32_t j = 0; j < nelement; j++) {
-
40 if (i & (1 << j)) {
-
41 check += (in_arr[j]);
-
42 }
-
43 }
-
44 if (check == sum) {
-
45 count_of_subset++;
-
46 }
-
47 }
-
48 return count_of_subset;
-
49}
+
34 {
+
35 int32_t nelement = in_arr.size();
+
36 uint64_t count_of_subset = 0;
+
37
+
38 for (int32_t i = 0; i < (1 << (nelement)); i++) {
+
39 int32_t check = 0;
+
40 for (int32_t j = 0; j < nelement; j++) {
+
41 if (i & (1 << j)) {
+
42 check += (in_arr[j]);
+
43 }
+
44 }
+
45 if (check == sum) {
+
46 count_of_subset++;
+
47 }
+
48 }
+
49 return count_of_subset;
+
50}
T size(T... args)
bool check(const std::string &s, const std::unordered_set< std::string > &strSet, int pos, std::vector< int > *dp)
Function that checks if the string passed in param can be segmented from position 'pos',...
Definition word_break.cpp:80
@@ -257,47 +258,47 @@ Here is the call graph for this function:

Test implementations.

Returns
void
-
57 {
-
58 // 1st test
-
59 std::cout << "1st test ";
-
60 std::vector<int32_t> array1 = {-7, -3, -2, 5, 8}; // input array
-
61 assert(backtracking::subset_sum::number_of_subsets(0, array1) ==
-
62 2); // first argument in subset_sum function is the required sum and
-
63 // second is the input array
-
64 std::cout << "passed" << std::endl;
-
65
-
66 // 2nd test
-
67 std::cout << "2nd test ";
-
68 std::vector<int32_t> array2 = {1, 2, 3, 3};
-
69 assert(backtracking::subset_sum::number_of_subsets(6, array2) ==
-
70 3); // here we are expecting 3 subsets which sum up to 6 i.e.
-
71 // {(1,2,3),(1,2,3),(3,3)}
-
72 std::cout << "passed" << std::endl;
-
73
-
74 // 3rd test
-
75 std::cout << "3rd test ";
-
76 std::vector<int32_t> array3 = {1, 1, 1, 1};
-
77 assert(backtracking::subset_sum::number_of_subsets(1, array3) ==
-
78 4); // here we are expecting 4 subsets which sum up to 1 i.e.
-
79 // {(1),(1),(1),(1)}
-
80 std::cout << "passed" << std::endl;
-
81
-
82 // 4th test
-
83 std::cout << "4th test ";
-
84 std::vector<int32_t> array4 = {3, 3, 3, 3};
-
85 assert(backtracking::subset_sum::number_of_subsets(6, array4) ==
-
86 6); // here we are expecting 6 subsets which sum up to 6 i.e.
-
87 // {(3,3),(3,3),(3,3),(3,3),(3,3),(3,3)}
-
88 std::cout << "passed" << std::endl;
-
89
-
90 // Test 5
-
91 std::cout << "5th test ";
-
92 std::vector<int32_t> array5 = {};
-
93 assert(backtracking::subset_sum::number_of_subsets(6, array5) ==
-
94 0); // here we are expecting 0 subsets which sum up to 6 i.e. we
-
95 // cannot select anything from an empty array
-
96 std::cout << "passed" << std::endl;
-
97}
+
58 {
+
59 // 1st test
+
60 std::cout << "1st test ";
+
61 std::vector<int32_t> array1 = {-7, -3, -2, 5, 8}; // input array
+
62 assert(backtracking::subset_sum::number_of_subsets(0, array1) ==
+
63 2); // first argument in subset_sum function is the required sum and
+
64 // second is the input array
+
65 std::cout << "passed" << std::endl;
+
66
+
67 // 2nd test
+
68 std::cout << "2nd test ";
+
69 std::vector<int32_t> array2 = {1, 2, 3, 3};
+
70 assert(backtracking::subset_sum::number_of_subsets(6, array2) ==
+
71 3); // here we are expecting 3 subsets which sum up to 6 i.e.
+
72 // {(1,2,3),(1,2,3),(3,3)}
+
73 std::cout << "passed" << std::endl;
+
74
+
75 // 3rd test
+
76 std::cout << "3rd test ";
+
77 std::vector<int32_t> array3 = {1, 1, 1, 1};
+
78 assert(backtracking::subset_sum::number_of_subsets(1, array3) ==
+
79 4); // here we are expecting 4 subsets which sum up to 1 i.e.
+
80 // {(1),(1),(1),(1)}
+
81 std::cout << "passed" << std::endl;
+
82
+
83 // 4th test
+
84 std::cout << "4th test ";
+
85 std::vector<int32_t> array4 = {3, 3, 3, 3};
+
86 assert(backtracking::subset_sum::number_of_subsets(6, array4) ==
+
87 6); // here we are expecting 6 subsets which sum up to 6 i.e.
+
88 // {(3,3),(3,3),(3,3),(3,3),(3,3),(3,3)}
+
89 std::cout << "passed" << std::endl;
+
90
+
91 // Test 5
+
92 std::cout << "5th test ";
+
93 std::vector<int32_t> array5 = {};
+
94 assert(backtracking::subset_sum::number_of_subsets(6, array5) ==
+
95 0); // here we are expecting 0 subsets which sum up to 6 i.e. we
+
96 // cannot select anything from an empty array
+
97 std::cout << "passed" << std::endl;
+
98}
T endl(T... args)
diff --git a/d1/d11/gcd__of__n__numbers_8cpp.html b/d1/d11/gcd__of__n__numbers_8cpp.html index 346066d97..9e101f4de 100644 --- a/d1/d11/gcd__of__n__numbers_8cpp.html +++ b/d1/d11/gcd__of__n__numbers_8cpp.html @@ -126,7 +126,7 @@ Include dependency graph for gcd_of_n_numbers.cpp:
- + @@ -238,7 +238,7 @@ template< 77 }
79}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
int gcd_two(int x, int y)
Function to compute GCD of 2 numbers x and y.
Definition gcd_of_n_numbers.cpp:35
bool check_all_zeros(const std::array< int, n > &a)
Function to check if all elements in the array are 0.
Definition gcd_of_n_numbers.cpp:53
diff --git a/d1/d21/quick__sort_8cpp.html b/d1/d21/quick__sort_8cpp.html index 837f4f86a..d9498c525 100644 --- a/d1/d21/quick__sort_8cpp.html +++ b/d1/d21/quick__sort_8cpp.html @@ -115,13 +115,14 @@ $(function(){initNavTree('d1/d21/quick__sort_8cpp.html','../../'); initResizable More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <ctime>
#include <iostream>
#include <vector>
Include dependency graph for quick_sort.cpp:
-
+

@@ -164,11 +165,11 @@ Functions

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  gcd_of_n_numbers
 Compute GCD of numbers in an array.

Main function.

Returns
0 on exit
-
201 {
-
202 int choice = 0;
-
203
-
204 std::cout << "\tAvailable modes\t\n\n";
-
205 std::cout << "1. Self-tests mode\n2. Interactive mode";
-
206
-
207 std::cout << "\nChoose a mode: ";
-
208 std::cin >> choice;
-
209 std::cout << "\n";
-
210
-
211 while ((choice != 1) && (choice != 2)) {
-
212 std::cout << "Invalid option. Choose between the valid modes: ";
-
213 std::cin >> choice;
-
214 }
-
215
-
216 if (choice == 1) {
-
217 std::srand(std::time(nullptr));
-
218 tests(); // run self-test implementations
-
219 } else if (choice == 2) {
-
220 int size = 0;
-
221 std::cout << "\nEnter the number of elements: ";
-
222
-
223 std::cin >> size;
-
224 std::vector<float> arr(size);
-
225
- -
227 << "\nEnter the unsorted elements (can be negative/decimal): ";
-
228
-
229 for (int i = 0; i < size; ++i) {
-
230 std::cout << "\n";
-
231 std::cin >> arr[i];
-
232 }
-
233 sorting::quick_sort::quick_sort(&arr, 0, size - 1);
-
234 std::cout << "\nSorted array: \n";
-
235 sorting::quick_sort::show(arr, size);
-
236 }
-
237 return 0;
-
238}
+
202 {
+
203 int choice = 0;
+
204
+
205 std::cout << "\tAvailable modes\t\n\n";
+
206 std::cout << "1. Self-tests mode\n2. Interactive mode";
+
207
+
208 std::cout << "\nChoose a mode: ";
+
209 std::cin >> choice;
+
210 std::cout << "\n";
+
211
+
212 while ((choice != 1) && (choice != 2)) {
+
213 std::cout << "Invalid option. Choose between the valid modes: ";
+
214 std::cin >> choice;
+
215 }
+
216
+
217 if (choice == 1) {
+
218 std::srand(std::time(nullptr));
+
219 tests(); // run self-test implementations
+
220 } else if (choice == 2) {
+
221 int size = 0;
+
222 std::cout << "\nEnter the number of elements: ";
+
223
+
224 std::cin >> size;
+
225 std::vector<float> arr(size);
+
226
+ +
228 << "\nEnter the unsorted elements (can be negative/decimal): ";
+
229
+
230 for (int i = 0; i < size; ++i) {
+
231 std::cout << "\n";
+
232 std::cin >> arr[i];
+
233 }
+
234 sorting::quick_sort::quick_sort(&arr, 0, size - 1);
+
235 std::cout << "\nSorted array: \n";
+
236 sorting::quick_sort::show(arr, size);
+
237 }
+
238 return 0;
+
239}
-
static void tests()
Self-test implementations.
Definition quick_sort.cpp:135
-
void quick_sort(std::vector< T > *arr, const int &low, const int &high)
the main function that implements Quick Sort.
Definition quick_sort.cpp:86
-
void show(const std::vector< T > &arr, const int &size)
Utility function to print the array contents.
Definition quick_sort.cpp:123
+
static void tests()
Self-test implementations.
Definition quick_sort.cpp:136
+
void quick_sort(std::vector< T > *arr, const int &low, const int &high)
the main function that implements Quick Sort.
Definition quick_sort.cpp:87
+
void show(const std::vector< T > &arr, const int &size)
Utility function to print the array contents.
Definition quick_sort.cpp:124
T srand(T... args)
T time(T... args)
@@ -287,22 +288,22 @@ template<typename T >
Returns
index of the smaller element
-
58 {
-
59 T pivot = (*arr)[high]; // taking the last element as pivot
-
60 int i = (low - 1); // Index of smaller element
-
61
-
62 for (int j = low; j < high; j++) {
-
63 // If current element is smaller than or
-
64 // equal to pivot
-
65 if ((*arr)[j] <= pivot) {
-
66 i++; // increment index of smaller element
-
67 std::swap((*arr)[i], (*arr)[j]);
-
68 }
-
69 }
-
70
-
71 std::swap((*arr)[i + 1], (*arr)[high]);
-
72 return (i + 1);
-
73}
+
59 {
+
60 T pivot = (*arr)[high]; // taking the last element as pivot
+
61 int i = (low - 1); // Index of smaller element
+
62
+
63 for (int j = low; j < high; j++) {
+
64 // If current element is smaller than or
+
65 // equal to pivot
+
66 if ((*arr)[j] <= pivot) {
+
67 i++; // increment index of smaller element
+
68 std::swap((*arr)[i], (*arr)[j]);
+
69 }
+
70 }
+
71
+
72 std::swap((*arr)[i + 1], (*arr)[high]);
+
73 return (i + 1);
+
74}
T swap(T... args)
Here is the call graph for this function:
@@ -353,14 +354,14 @@ template<typename T >

@@ -191,49 +192,49 @@ Functions

-
86 {
-
87 if (low < high) {
-
88 int p = partition(arr, low, high);
-
89
-
90 quick_sort(arr, low, p - 1);
-
91 quick_sort(arr, p + 1, high);
-
92 }
-
93}
+
87 {
+
88 if (low < high) {
+
89 int p = partition(arr, low, high);
+
90
+
91 quick_sort(arr, low, p - 1);
+
92 quick_sort(arr, p + 1, high);
+
93 }
+
94}
Functions for the Quick sort implementation in C++.
T partition(T... args)
@@ -407,15 +408,15 @@ template<typename T >
-
106 {
-
107 if (low < high) {
-
108 int p = partition(&arr, low, high);
-
109
-
110 quick_sort(&arr, low, p - 1);
-
111 quick_sort(&arr, p + 1, high);
-
112 }
-
113 return arr;
-
114}
+
107 {
+
108 if (low < high) {
+
109 int p = partition(&arr, low, high);
+
110
+
111 quick_sort(&arr, low, p - 1);
+
112 quick_sort(&arr, p + 1, high);
+
113 }
+
114 return arr;
+
115}
@@ -449,10 +450,10 @@ template<typename T >
Returns
void
-
123 {
-
124 for (int i = 0; i < size; i++) std::cout << arr[i] << " ";
-
125 std::cout << "\n";
-
126}
+
124 {
+
125 for (int i = 0; i < size; i++) std::cout << arr[i] << " ";
+
126 std::cout << "\n";
+
127}
@@ -481,67 +482,67 @@ template<typename T >

Self-test implementations.

Returns
void
-
135 {
-
136 // 1st test (normal numbers)
-
137 std::vector<uint64_t> arr = {5, 3, 8, 12, 14, 16, 28, 96, 2, 5977};
- -
139 arr, 0, int(std::end(arr) - std::begin(arr)) - 1);
-
140
-
141 assert(std::is_sorted(std::begin(arr_sorted), std::end(arr_sorted)));
-
142 std::cout << "\n1st test: passed!\n";
-
143
-
144 // 2nd test (normal and negative numbers)
-
145 std::vector<int64_t> arr2 = {9, 15, 28, 96, 500, -4, -58,
-
146 -977, -238, -800, -21, -53, -55};
- -
148 arr2, 0, std::end(arr2) - std::begin(arr2));
-
149
-
150 assert(std::is_sorted(std::begin(arr_sorted2), std::end(arr_sorted2)));
-
151 std::cout << "2nd test: passed!\n";
-
152
-
153 // 3rd test (decimal and normal numbers)
-
154 std::vector<double> arr3 = {29, 36, 1100, 0, 77, 1,
-
155 6.7, 8.97, 1.74, 950.10, -329.65};
- -
157 arr3, 0, int(std::end(arr3) - std::begin(arr3)) - 1);
-
158
-
159 assert(std::is_sorted(std::begin(arr_sorted3), std::end(arr_sorted3)));
-
160 std::cout << "3rd test: passed!\n";
-
161
-
162 // 4th test (random decimal and negative numbers)
-
163 size_t size = std::rand() % 750 + 100;
-
164
-
165 std::vector<float> arr4(size);
-
166 for (uint64_t i = 0; i < size; i++) {
-
167 arr4[i] = static_cast<float>(std::rand()) /
-
168 static_cast<float>(RAND_MAX / 999.99 - 0.99) -
-
169 250;
-
170 }
-
171
- -
173 arr4, 0, int(std::end(arr4) - std::begin(arr4)) - 1);
-
174 assert(std::is_sorted(std::begin(arr4_sorted), std::end(arr4_sorted)));
-
175
-
176 std::cout << "4th test: passed!\n";
-
177
-
178 // Printing all sorted arrays
-
179 std::cout << "\n\tPrinting all sorted arrays:\t\n";
-
180
-
181 std::cout << "1st array:\n";
-
182 sorting::quick_sort::show(arr_sorted, std::end(arr) - std::begin(arr));
- -
184 std::cout << "2nd array:\n";
-
185 sorting::quick_sort::show(arr_sorted2, std::end(arr2) - std::begin(arr2));
- -
187 std::cout << "3rd array:\n";
-
188 sorting::quick_sort::show(arr_sorted3,
-
189 int(std::end(arr3) - std::begin(arr3)) - 1);
- -
191 std::cout << "Start: 4th array:\n\n";
- -
193 arr4_sorted, int(std::end(arr4_sorted) - std::begin(arr4_sorted)) - 1);
-
194 std::cout << "\nEnd: 4th array.\n";
-
195}
+
136 {
+
137 // 1st test (normal numbers)
+
138 std::vector<uint64_t> arr = {5, 3, 8, 12, 14, 16, 28, 96, 2, 5977};
+ +
140 arr, 0, int(std::end(arr) - std::begin(arr)) - 1);
+
141
+
142 assert(std::is_sorted(std::begin(arr_sorted), std::end(arr_sorted)));
+
143 std::cout << "\n1st test: passed!\n";
+
144
+
145 // 2nd test (normal and negative numbers)
+
146 std::vector<int64_t> arr2 = {9, 15, 28, 96, 500, -4, -58,
+
147 -977, -238, -800, -21, -53, -55};
+ +
149 arr2, 0, std::end(arr2) - std::begin(arr2));
+
150
+
151 assert(std::is_sorted(std::begin(arr_sorted2), std::end(arr_sorted2)));
+
152 std::cout << "2nd test: passed!\n";
+
153
+
154 // 3rd test (decimal and normal numbers)
+
155 std::vector<double> arr3 = {29, 36, 1100, 0, 77, 1,
+
156 6.7, 8.97, 1.74, 950.10, -329.65};
+ +
158 arr3, 0, int(std::end(arr3) - std::begin(arr3)) - 1);
+
159
+
160 assert(std::is_sorted(std::begin(arr_sorted3), std::end(arr_sorted3)));
+
161 std::cout << "3rd test: passed!\n";
+
162
+
163 // 4th test (random decimal and negative numbers)
+
164 size_t size = std::rand() % 750 + 100;
+
165
+
166 std::vector<float> arr4(size);
+
167 for (uint64_t i = 0; i < size; i++) {
+
168 arr4[i] = static_cast<float>(std::rand()) /
+
169 static_cast<float>(RAND_MAX / 999.99 - 0.99) -
+
170 250;
+
171 }
+
172
+ +
174 arr4, 0, int(std::end(arr4) - std::begin(arr4)) - 1);
+
175 assert(std::is_sorted(std::begin(arr4_sorted), std::end(arr4_sorted)));
+
176
+
177 std::cout << "4th test: passed!\n";
+
178
+
179 // Printing all sorted arrays
+
180 std::cout << "\n\tPrinting all sorted arrays:\t\n";
+
181
+
182 std::cout << "1st array:\n";
+
183 sorting::quick_sort::show(arr_sorted, std::end(arr) - std::begin(arr));
+ +
185 std::cout << "2nd array:\n";
+
186 sorting::quick_sort::show(arr_sorted2, std::end(arr2) - std::begin(arr2));
+ +
188 std::cout << "3rd array:\n";
+
189 sorting::quick_sort::show(arr_sorted3,
+
190 int(std::end(arr3) - std::begin(arr3)) - 1);
+ +
192 std::cout << "Start: 4th array:\n\n";
+ +
194 arr4_sorted, int(std::end(arr4_sorted) - std::begin(arr4_sorted)) - 1);
+
195 std::cout << "\nEnd: 4th array.\n";
+
196}
T begin(T... args)
T end(T... args)
T endl(T... args)
diff --git a/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.map b/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.map index 99907dbc6..962604da7 100644 --- a/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.map +++ b/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.map @@ -1,9 +1,11 @@ - + - + - - - + + + + + diff --git a/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.md5 b/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.md5 index 8f1ab821f..64bb7e26f 100644 --- a/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.md5 +++ b/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.md5 @@ -1 +1 @@ -9c441d6a0fda75c68b16e66fb18d3339 \ No newline at end of file +5c4a79803d5f0019f7ba1641fd3c9829 \ No newline at end of file diff --git a/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.svg b/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.svg index 98d2685ae..234713b51 100644 --- a/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.svg +++ b/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -math/finding_number -_of_digits_in_a_number.cpp + +math/finding_number +_of_digits_in_a_number.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -iostream + +cstdint @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + diff --git a/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl_org.svg b/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl_org.svg index a7c504fc7..530b1a208 100644 --- a/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl_org.svg +++ b/d1/d4a/finding__number__of__digits__in__a__number_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + math/finding_number_of_digits_in_a_number.cpp Node1 - -math/finding_number -_of_digits_in_a_number.cpp + +math/finding_number +_of_digits_in_a_number.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -iostream + +cstdint @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + diff --git a/d1/d52/lcm__sum_8cpp__incl.map b/d1/d52/lcm__sum_8cpp__incl.map index 041734fcc..899cdb405 100644 --- a/d1/d52/lcm__sum_8cpp__incl.map +++ b/d1/d52/lcm__sum_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/d1/d52/lcm__sum_8cpp__incl.md5 b/d1/d52/lcm__sum_8cpp__incl.md5 index 6707b5deb..5f2cc3632 100644 --- a/d1/d52/lcm__sum_8cpp__incl.md5 +++ b/d1/d52/lcm__sum_8cpp__incl.md5 @@ -1 +1 @@ -4a99b4a56038d8d25d4576b7319cbb44 \ No newline at end of file +f21a252dc95d134985a3ab1932dec617 \ No newline at end of file diff --git a/d1/d52/lcm__sum_8cpp__incl.svg b/d1/d52/lcm__sum_8cpp__incl.svg index db73e8ed6..3c31462a7 100644 --- a/d1/d52/lcm__sum_8cpp__incl.svg +++ b/d1/d52/lcm__sum_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/lcm_sum.cpp + +math/lcm_sum.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -vector + +iostream @@ -77,8 +77,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d1/d52/lcm__sum_8cpp__incl_org.svg b/d1/d52/lcm__sum_8cpp__incl_org.svg index b04ccd6a9..cb5923077 100644 --- a/d1/d52/lcm__sum_8cpp__incl_org.svg +++ b/d1/d52/lcm__sum_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/lcm_sum.cpp Node1 - -math/lcm_sum.cpp + +math/lcm_sum.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -vector + +iostream @@ -66,8 +66,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d1/d6d/lru__cache_8cpp__incl.map b/d1/d6d/lru__cache_8cpp__incl.map index ceb1abc99..1a7881153 100644 --- a/d1/d6d/lru__cache_8cpp__incl.map +++ b/d1/d6d/lru__cache_8cpp__incl.map @@ -1,11 +1,13 @@ - + - - - - - - - + + + + + + + + + diff --git a/d1/d6d/lru__cache_8cpp__incl.md5 b/d1/d6d/lru__cache_8cpp__incl.md5 index 0f171a5b7..8cf07012a 100644 --- a/d1/d6d/lru__cache_8cpp__incl.md5 +++ b/d1/d6d/lru__cache_8cpp__incl.md5 @@ -1 +1 @@ -93f607fc0d8f90649a473581ddc9cada \ No newline at end of file +1955796432c1f82975231f7d84f00bdc \ No newline at end of file diff --git a/d1/d6d/lru__cache_8cpp__incl.svg b/d1/d6d/lru__cache_8cpp__incl.svg index a74742c91..13ac33535 100644 --- a/d1/d6d/lru__cache_8cpp__incl.svg +++ b/d1/d6d/lru__cache_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -others/lru_cache.cpp + +others/lru_cache.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -list + +iostream @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -unordered_map + +list @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +unordered_map + + + + + +Node1->Node6 + + + diff --git a/d1/d6d/lru__cache_8cpp__incl_org.svg b/d1/d6d/lru__cache_8cpp__incl_org.svg index b1b65db7e..01b3500f7 100644 --- a/d1/d6d/lru__cache_8cpp__incl_org.svg +++ b/d1/d6d/lru__cache_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + others/lru_cache.cpp Node1 - -others/lru_cache.cpp + +others/lru_cache.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -list + +iostream @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -unordered_map + +list @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +unordered_map + + + + + +Node1->Node6 + + + diff --git a/d1/d6d/queue__using__array_8cpp__incl.map b/d1/d6d/queue__using__array_8cpp__incl.map index d748d6644..398e5c8d5 100644 --- a/d1/d6d/queue__using__array_8cpp__incl.map +++ b/d1/d6d/queue__using__array_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/d1/d6d/queue__using__array_8cpp__incl.md5 b/d1/d6d/queue__using__array_8cpp__incl.md5 index 8e3acfa92..dbe3a27f1 100644 --- a/d1/d6d/queue__using__array_8cpp__incl.md5 +++ b/d1/d6d/queue__using__array_8cpp__incl.md5 @@ -1 +1 @@ -cea65214278f629616d43fee58840a95 \ No newline at end of file +30f99179f4d4f2fc8b5d1498d2152969 \ No newline at end of file diff --git a/d1/d6d/queue__using__array_8cpp__incl.svg b/d1/d6d/queue__using__array_8cpp__incl.svg index 4534fe66a..616de331c 100644 --- a/d1/d6d/queue__using__array_8cpp__incl.svg +++ b/d1/d6d/queue__using__array_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -data_structures/queue -_using_array.cpp + +data_structures/queue +_using_array.cpp @@ -33,8 +33,8 @@ Node2 - -array + +array @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d1/d6d/queue__using__array_8cpp__incl_org.svg b/d1/d6d/queue__using__array_8cpp__incl_org.svg index 8f04b28e8..974ed9b8f 100644 --- a/d1/d6d/queue__using__array_8cpp__incl_org.svg +++ b/d1/d6d/queue__using__array_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + data_structures/queue_using_array.cpp Node1 - -data_structures/queue -_using_array.cpp + +data_structures/queue +_using_array.cpp @@ -22,8 +22,8 @@ Node2 - -array + +array @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d1/d83/classuint256__t.html b/d1/d83/classuint256__t.html index f7c81fb4b..354ec40da 100644 --- a/d1/d83/classuint256__t.html +++ b/d1/d83/classuint256__t.html @@ -702,7 +702,7 @@ Here is the call graph for this function:
60 }
61 }
62 }
-
class for 128-bit unsigned integer
Definition uint128_t.hpp:59
+
class for 128-bit unsigned integer
Definition uint128_t.hpp:60
T size(T... args)
Here is the call graph for this function:
@@ -743,7 +743,7 @@ Here is the call graph for this function:
126 }
127 return 128 + s._lez();
128 }
-
uint32_t _lez()
Leading zeroes in binary.
Definition uint128_t.hpp:139
+
uint32_t _lez()
Leading zeroes in binary.
Definition uint128_t.hpp:140
Here is the call graph for this function:
@@ -783,7 +783,7 @@ Here is the call graph for this function:
138 }
139 return 128 + f._trz();
140 }
-
uint32_t _trz()
Trailing zeroes in binary.
Definition uint128_t.hpp:162
+
uint32_t _trz()
Trailing zeroes in binary.
Definition uint128_t.hpp:163
Here is the call graph for this function:
@@ -1641,8 +1641,8 @@ template<typename T , typename = typename std::enable_if<
380 return {f * p.s + s * p.f + fi + se.upper() + th.upper() + cc,
381 tmp + fo};
382 }
-
uint64_t upper() const
returns upper 64-bit integer part
Definition uint128_t.hpp:207
-
uint64_t lower() const
returns lower 64-bit integer part
Definition uint128_t.hpp:201
+
uint64_t upper() const
returns upper 64-bit integer part
Definition uint128_t.hpp:208
+
uint64_t lower() const
returns lower 64-bit integer part
Definition uint128_t.hpp:202
Here is the call graph for this function:
@@ -3706,7 +3706,7 @@ template<typename T , typename = typename std::enable_if<
970 return op;
971 }
-
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:37
+
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:38
diff --git a/d1/d90/subarray__sum_8cpp__incl.map b/d1/d90/subarray__sum_8cpp__incl.map index 4c40fa55d..64696dd2f 100644 --- a/d1/d90/subarray__sum_8cpp__incl.map +++ b/d1/d90/subarray__sum_8cpp__incl.map @@ -1,11 +1,13 @@ - + - - - - - - - + + + + + + + + + diff --git a/d1/d90/subarray__sum_8cpp__incl.md5 b/d1/d90/subarray__sum_8cpp__incl.md5 index 920a642fd..690e437b8 100644 --- a/d1/d90/subarray__sum_8cpp__incl.md5 +++ b/d1/d90/subarray__sum_8cpp__incl.md5 @@ -1 +1 @@ -dd22fd53e398dcb4e97a448841b8187c \ No newline at end of file +2cb101dd6d9b1917890c6f1d725e2f88 \ No newline at end of file diff --git a/d1/d90/subarray__sum_8cpp__incl.svg b/d1/d90/subarray__sum_8cpp__incl.svg index dba925c79..011046e57 100644 --- a/d1/d90/subarray__sum_8cpp__incl.svg +++ b/d1/d90/subarray__sum_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -backtracking/subarray -_sum.cpp + +backtracking/subarray +_sum.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -unordered_map + +iostream @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -vector + +unordered_map @@ -96,8 +96,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d1/d90/subarray__sum_8cpp__incl_org.svg b/d1/d90/subarray__sum_8cpp__incl_org.svg index 6fb399106..d354c0b59 100644 --- a/d1/d90/subarray__sum_8cpp__incl_org.svg +++ b/d1/d90/subarray__sum_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + backtracking/subarray_sum.cpp Node1 - -backtracking/subarray -_sum.cpp + +backtracking/subarray +_sum.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -unordered_map + +iostream @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -vector + +unordered_map @@ -85,8 +85,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d1/da6/rungekutta_8cpp.html b/d1/da6/rungekutta_8cpp.html index ce18bec74..9056a1e46 100644 --- a/d1/da6/rungekutta_8cpp.html +++ b/d1/da6/rungekutta_8cpp.html @@ -114,12 +114,13 @@ $(function(){initNavTree('d1/da6/rungekutta_8cpp.html','../../'); initResizable(

Runge Kutta fourth order method implementation More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for rungekutta.cpp:
-
+
- + @@ -179,9 +180,9 @@ Functions

@@ -138,7 +139,7 @@ Functions

 
static double change (double x, double y)
 for using the vector container
 asserting the test functions
 
static void test ()
 Tests to check algorithm implementation.
-

for using the vector container

-

asserting the test functions for io operations

-

The change() function is used to return the updated iterative value corresponding to the given function

Parameters
+

asserting the test functions

+

for io operations for using the vector container

+

The change() function is used to return the updated iterative value corresponding to the given function

Parameters
@@ -304,7 +305,7 @@ Here is the call graph for this function:
92}
double k(double x)
Another test function.
Definition composite_simpson_rule.cpp:117
int h(int key)
Definition hash_search.cpp:45
-
static double change(double x, double y)
for using the vector container
Definition rungekutta.cpp:33
+
static double change(double x, double y)
asserting the test functions
Definition rungekutta.cpp:33
Here is the call graph for this function:
diff --git a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.map b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.map index 0b97a9d9d..9ddff3647 100644 --- a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.map +++ b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.map @@ -1,7 +1,7 @@ - + diff --git a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.md5 b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.md5 index 90a4e9a63..8712c43d7 100644 --- a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.md5 +++ b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.md5 @@ -1 +1 @@ -b68d09b4cab566fa4f24c9171718ede9 \ No newline at end of file +4b166e3b126e619907528809ca5c64cc \ No newline at end of file diff --git a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg index 7aa5661b6..e072d070c 100644 --- a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg +++ b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph.svg @@ -41,7 +41,7 @@ Node2 - + change diff --git a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph_org.svg b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph_org.svg index 95a6b86c5..a7499ccf3 100644 --- a/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph_org.svg +++ b/d1/da6/rungekutta_8cpp_a7b9f40c7b5e9749cc550f19be3dc8856_cgraph_org.svg @@ -30,7 +30,7 @@ Node2 - + change diff --git a/d1/dbb/n__choose__r_8cpp.html b/d1/dbb/n__choose__r_8cpp.html index 4b0ee36a4..845cd5e1b 100644 --- a/d1/dbb/n__choose__r_8cpp.html +++ b/d1/dbb/n__choose__r_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d1/dbb/n__choose__r_8cpp.html','../../'); initResizabl

Combinations n choose r function implementation More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for n_choose_r.cpp:
-
+
xis the value corresponding to the x coordinate
yis the value corresponding to the y coordinate
- +

Namespaces

namespace  math
 for IO operations
 for assert
 

diff --git a/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.map b/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.map index 9e73f91e4..16bfb72a3 100644 --- a/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.map +++ b/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.md5 b/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.md5 index 8b85869a3..a992500b7 100644 --- a/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.md5 +++ b/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.md5 @@ -1 +1 @@ -eef4ce09391d4a1658d19d115dfff32f \ No newline at end of file +e7916529463e7769c3ee8bc6ee71d962 \ No newline at end of file diff --git a/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.svg b/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.svg index e02c34add..15adae8fa 100644 --- a/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.svg +++ b/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,10 +23,10 @@ Node1 - -bit_manipulation/count -_of_trailing_ciphers_in -_factorial_n.cpp + +bit_manipulation/count +_of_trailing_ciphers_in +_factorial_n.cpp @@ -43,8 +43,8 @@ Node1->Node2 - - + + @@ -52,8 +52,8 @@ Node3 - -iostream + +cstdint @@ -61,8 +61,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl_org.svg b/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl_org.svg index d14c1df82..3c41ba21f 100644 --- a/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl_org.svg +++ b/d1/dbe/count__of__trailing__ciphers__in__factorial__n_8cpp__incl_org.svg @@ -4,18 +4,18 @@ - + bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Node1 - -bit_manipulation/count -_of_trailing_ciphers_in -_factorial_n.cpp + +bit_manipulation/count +_of_trailing_ciphers_in +_factorial_n.cpp @@ -32,8 +32,8 @@ Node1->Node2 - - + + @@ -41,8 +41,8 @@ Node3 - -iostream + +cstdint @@ -50,8 +50,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d1/dbe/lu__decomposition_8h.html b/d1/dbe/lu__decomposition_8h.html index 8ca3607f8..8f51f4bbf 100644 --- a/d1/dbe/lu__decomposition_8h.html +++ b/d1/dbe/lu__decomposition_8h.html @@ -209,7 +209,7 @@ template<typename T >
100 }
101 return result;
102}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
int lu_decomposition(const matrix< T > &A, matrix< double > *L, matrix< double > *U)
Definition lu_decomposition.h:29
T size(T... args)
diff --git a/d1/dc7/linear__probing__hash__table_8cpp.html b/d1/dc7/linear__probing__hash__table_8cpp.html index 798775e75..4b521aac3 100644 --- a/d1/dc7/linear__probing__hash__table_8cpp.html +++ b/d1/dc7/linear__probing__hash__table_8cpp.html @@ -260,7 +260,7 @@ bool 

linear_probing::rehas
T endl(T... args)
-
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:287
+
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:288
void addInfo(int key)
Definition linear_probing_hash_table.cpp:186
size_t hashFxn(int key)
Hash a key. Uses the STL library's std::hash() function.
Definition linear_probing_hash_table.cpp:46
int linearProbe(int key, bool searching)
Definition linear_probing_hash_table.cpp:55
diff --git a/d1/dcc/wiggle__sort_8cpp.html b/d1/dcc/wiggle__sort_8cpp.html index db99d461a..57cd53c61 100644 --- a/d1/dcc/wiggle__sort_8cpp.html +++ b/d1/dcc/wiggle__sort_8cpp.html @@ -115,13 +115,14 @@ $(function(){initNavTree('d1/dcc/wiggle__sort_8cpp.html','../../'); initResizabl More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <ctime>
#include <iostream>
#include <vector>
Include dependency graph for wiggle_sort.cpp:
-
+

for assert

Numerical Methods.

for std::map container

-

for std::vector

+

for storing points and coefficents

for io operations

for math functions

for IO operations

@@ -138,7 +138,7 @@ Functions

Numerical algorithms/methods

for math operations

Numerical methods

-

for assert for mathematical-related functions for storing points and coefficents for IO operations

+

for assert for mathematical-related functions for IO operations for std::vector

Numerical algorithms/methods

for std::array for assert for fabs

Numerical Methods algorithms

@@ -251,61 +251,61 @@ y if n!=1

Updating the last n/2 elements

Deleting dynamic array ye

Deleting dynamic array yo

-
41 {
-
42 if (n == 1) {
-
43 return p; /// Base Case To return
-
44 }
-
45
-
46 double pi = 2 * asin(1.0); /// Declaring value of pi
-
47
- -
49 cos(2 * pi / n), sin(2 * pi / n)); /// Calculating value of omega
-
50
-
51 auto *pe = new std::complex<double>[n / 2]; /// Coefficients of even power
-
52
-
53 auto *po = new std::complex<double>[n / 2]; /// Coefficients of odd power
-
54
-
55 int k1 = 0, k2 = 0;
-
56 for (int j = 0; j < n; j++) {
-
57 if (j % 2 == 0) {
-
58 pe[k1++] = p[j]; /// Assigning values of even Coefficients
-
59
-
60 } else {
-
61 po[k2++] = p[j]; /// Assigning value of odd Coefficients
-
62 }
-
63 }
-
64
- -
66 FastFourierTransform(pe, n / 2); /// Recursive Call
-
67
- -
69 FastFourierTransform(po, n / 2); /// Recursive Call
-
70
-
71 auto *y = new std::complex<double>[n]; /// Final value representation list
-
72
-
73 k1 = 0, k2 = 0;
-
74
-
75 for (int i = 0; i < n / 2; i++) {
-
76 y[i] =
-
77 ye[k1] + pow(om, i) * yo[k2]; /// Updating the first n/2 elements
-
78 y[i + n / 2] =
-
79 ye[k1] - pow(om, i) * yo[k2]; /// Updating the last n/2 elements
-
80
-
81 k1++;
-
82 k2++;
-
83 }
-
84
-
85 if (n != 2) {
-
86 delete[] pe;
-
87 delete[] po;
-
88 }
-
89
-
90 delete[] ye; /// Deleting dynamic array ye
-
91 delete[] yo; /// Deleting dynamic array yo
-
92 return y;
-
93}
+
42 {
+
43 if (n == 1) {
+
44 return p; /// Base Case To return
+
45 }
+
46
+
47 double pi = 2 * asin(1.0); /// Declaring value of pi
+
48
+ +
50 cos(2 * pi / n), sin(2 * pi / n)); /// Calculating value of omega
+
51
+
52 auto *pe = new std::complex<double>[n / 2]; /// Coefficients of even power
+
53
+
54 auto *po = new std::complex<double>[n / 2]; /// Coefficients of odd power
+
55
+
56 int k1 = 0, k2 = 0;
+
57 for (int j = 0; j < n; j++) {
+
58 if (j % 2 == 0) {
+
59 pe[k1++] = p[j]; /// Assigning values of even Coefficients
+
60
+
61 } else {
+
62 po[k2++] = p[j]; /// Assigning value of odd Coefficients
+
63 }
+
64 }
+
65
+ +
67 FastFourierTransform(pe, n / 2); /// Recursive Call
+
68
+ +
70 FastFourierTransform(po, n / 2); /// Recursive Call
+
71
+
72 auto *y = new std::complex<double>[n]; /// Final value representation list
+
73
+
74 k1 = 0, k2 = 0;
+
75
+
76 for (int i = 0; i < n / 2; i++) {
+
77 y[i] =
+
78 ye[k1] + pow(om, i) * yo[k2]; /// Updating the first n/2 elements
+
79 y[i + n / 2] =
+
80 ye[k1] - pow(om, i) * yo[k2]; /// Updating the last n/2 elements
+
81
+
82 k1++;
+
83 k2++;
+
84 }
+
85
+
86 if (n != 2) {
+
87 delete[] pe;
+
88 delete[] po;
+
89 }
+
90
+
91 delete[] ye; /// Deleting dynamic array ye
+
92 delete[] yo; /// Deleting dynamic array yo
+
93 return y;
+
94}
-
std::complex< double > * FastFourierTransform(std::complex< double > *p, uint8_t n)
FastFourierTransform is a recursive function which returns list of complex numbers.
Definition fast_fourier_transform.cpp:41
+
std::complex< double > * FastFourierTransform(std::complex< double > *p, uint8_t n)
FastFourierTransform is a recursive function which returns list of complex numbers.
Definition fast_fourier_transform.cpp:42
T pow(T... args)
Here is the call graph for this function:
@@ -361,64 +361,64 @@ y if n!=1

Updating the last n/2 elements

Deleting dynamic array ye

Deleting dynamic array yo

-
34 {
-
35 if (n == 1) {
-
36 return p; /// Base Case To return
-
37 }
-
38
-
39 double pi = 2 * asin(1.0); /// Declaring value of pi
-
40
- -
42 cos(2 * pi / n), sin(2 * pi / n)); /// Calculating value of omega
-
43
-
44 om.real(om.real() / n); /// One change in comparison with DFT
-
45 om.imag(om.imag() / n); /// One change in comparison with DFT
-
46
-
47 auto *pe = new std::complex<double>[n / 2]; /// Coefficients of even power
-
48
-
49 auto *po = new std::complex<double>[n / 2]; /// Coefficients of odd power
-
50
-
51 int k1 = 0, k2 = 0;
-
52 for (int j = 0; j < n; j++) {
-
53 if (j % 2 == 0) {
-
54 pe[k1++] = p[j]; /// Assigning values of even Coefficients
-
55
-
56 } else {
-
57 po[k2++] = p[j]; /// Assigning value of odd Coefficients
-
58 }
-
59 }
-
60
- -
62 InverseFastFourierTransform(pe, n / 2); /// Recursive Call
-
63
- -
65 InverseFastFourierTransform(po, n / 2); /// Recursive Call
-
66
-
67 auto *y = new std::complex<double>[n]; /// Final value representation list
-
68
-
69 k1 = 0, k2 = 0;
-
70
-
71 for (int i = 0; i < n / 2; i++) {
-
72 y[i] =
-
73 ye[k1] + pow(om, i) * yo[k2]; /// Updating the first n/2 elements
-
74 y[i + n / 2] =
-
75 ye[k1] - pow(om, i) * yo[k2]; /// Updating the last n/2 elements
-
76
-
77 k1++;
-
78 k2++;
-
79 }
-
80
-
81 if (n != 2) {
-
82 delete[] pe;
-
83 delete[] po;
-
84 }
-
85
-
86 delete[] ye; /// Deleting dynamic array ye
-
87 delete[] yo; /// Deleting dynamic array yo
-
88 return y;
-
89}
+
35 {
+
36 if (n == 1) {
+
37 return p; /// Base Case To return
+
38 }
+
39
+
40 double pi = 2 * asin(1.0); /// Declaring value of pi
+
41
+ +
43 cos(2 * pi / n), sin(2 * pi / n)); /// Calculating value of omega
+
44
+
45 om.real(om.real() / n); /// One change in comparison with DFT
+
46 om.imag(om.imag() / n); /// One change in comparison with DFT
+
47
+
48 auto *pe = new std::complex<double>[n / 2]; /// Coefficients of even power
+
49
+
50 auto *po = new std::complex<double>[n / 2]; /// Coefficients of odd power
+
51
+
52 int k1 = 0, k2 = 0;
+
53 for (int j = 0; j < n; j++) {
+
54 if (j % 2 == 0) {
+
55 pe[k1++] = p[j]; /// Assigning values of even Coefficients
+
56
+
57 } else {
+
58 po[k2++] = p[j]; /// Assigning value of odd Coefficients
+
59 }
+
60 }
+
61
+ +
63 InverseFastFourierTransform(pe, n / 2); /// Recursive Call
+
64
+ +
66 InverseFastFourierTransform(po, n / 2); /// Recursive Call
+
67
+
68 auto *y = new std::complex<double>[n]; /// Final value representation list
+
69
+
70 k1 = 0, k2 = 0;
+
71
+
72 for (int i = 0; i < n / 2; i++) {
+
73 y[i] =
+
74 ye[k1] + pow(om, i) * yo[k2]; /// Updating the first n/2 elements
+
75 y[i + n / 2] =
+
76 ye[k1] - pow(om, i) * yo[k2]; /// Updating the last n/2 elements
+
77
+
78 k1++;
+
79 k2++;
+
80 }
+
81
+
82 if (n != 2) {
+
83 delete[] pe;
+
84 delete[] po;
+
85 }
+
86
+
87 delete[] ye; /// Deleting dynamic array ye
+
88 delete[] yo; /// Deleting dynamic array yo
+
89 return y;
+
90}
T imag(T... args)
-
std::complex< double > * InverseFastFourierTransform(std::complex< double > *p, uint8_t n)
InverseFastFourierTransform is a recursive function which returns list of complex numbers.
Definition inverse_fast_fourier_transform.cpp:33
+
std::complex< double > * InverseFastFourierTransform(std::complex< double > *p, uint8_t n)
InverseFastFourierTransform is a recursive function which returns list of complex numbers.
Definition inverse_fast_fourier_transform.cpp:34
T real(T... args)
Here is the call graph for this function:
diff --git a/d1/de9/integral__approximation_8cpp.html b/d1/de9/integral__approximation_8cpp.html index d03f41c7b..3c3c043d2 100644 --- a/d1/de9/integral__approximation_8cpp.html +++ b/d1/de9/integral__approximation_8cpp.html @@ -115,18 +115,19 @@ $(function(){initNavTree('d1/de9/integral__approximation_8cpp.html','../../'); i More...

#include <cassert>
#include <cmath>
+#include <cstdint>
#include <functional>
#include <iostream>
Include dependency graph for integral_approximation.cpp:
-
+

@@ -180,25 +181,25 @@ template<typename T >
Examples
/Users/runner/work/C-Plus-Plus/C-Plus-Plus/sorting/wiggle_sort.cpp.
-
53 {
-
54 uint32_t size = arr.size();
-
55
- -
57 arr); // create a copy of input vector. this way, the original input
-
58 // vector does not get modified. a sorted array is is returned.
-
59
-
60 for (int i = 0; i < size; i += 2) {
-
61 if (i > 0 && out[i - 1] > out[i]) {
-
62 std::swap(out[i], out[i - 1]); // swapping the two values
-
63 }
-
64
-
65 if (i < size - 1 && out[i] < out[i + 1]) {
-
66 std::swap(out[i], out[i + 1]); // swapping the two values
-
67 }
-
68 }
-
69
-
70 return out; // returns the sorted vector
-
71}
+
54 {
+
55 uint32_t size = arr.size();
+
56
+ +
58 arr); // create a copy of input vector. this way, the original input
+
59 // vector does not get modified. a sorted array is is returned.
+
60
+
61 for (int i = 0; i < size; i += 2) {
+
62 if (i > 0 && out[i - 1] > out[i]) {
+
63 std::swap(out[i], out[i - 1]); // swapping the two values
+
64 }
+
65
+
66 if (i < size - 1 && out[i] < out[i + 1]) {
+
67 std::swap(out[i], out[i + 1]); // swapping the two values
+
68 }
+
69 }
+
70
+
71 return out; // returns the sorted vector
+
72}
T size(T... args)
T swap(T... args)
diff --git a/d1/de0/namespacenumerical__methods.html b/d1/de0/namespacenumerical__methods.html index 371b253d6..afbc1f73b 100644 --- a/d1/de0/namespacenumerical__methods.html +++ b/d1/de0/namespacenumerical__methods.html @@ -129,7 +129,7 @@ Functions

- +

Namespaces

namespace  math
 for IO operations
 for assert
 

Main function.

Returns
0 on exit
-
122 {
-
123 test(); // run self-test implementations
-
124 return 0;
-
125}
+
133 {
+
134 test(); // run self-test implementations
+
135 return 0;
+
136}
void test()
Definition caesar_cipher.cpp:100
Here is the call graph for this function:
@@ -201,59 +202,59 @@ Here is the call graph for this function:

@@ -166,10 +167,10 @@ Functions

-
64 {
- -
66 3.24, 7.56, [](const double x) { return log(x) + exp(x) + x; });
-
67 std::cout << "Test Case 1" << std::endl;
-
68 std::cout << "function: log(x) + e^x + x" << std::endl;
-
69 std::cout << "range: [3.24, 7.56]" << std::endl;
-
70 std::cout << "value: " << test_1 << std::endl;
-
71 math::test_eval(test_1, 1924.80384023549, .001);
-
72 std::cout << "Test 1 Passed!" << std::endl;
-
73 std::cout << "=====================" << std::endl;
-
74
-
75 double test_2 = math::integral_approx(0.023, 3.69, [](const double x) {
-
76 return x * x + cos(x) + exp(x) + log(x) * log(x);
-
77 });
-
78 std::cout << "Test Case 2" << std::endl;
-
79 std::cout << "function: x^2 + cos(x) + e^x + log^2(x)" << std::endl;
-
80 std::cout << "range: [.023, 3.69]" << std::endl;
-
81 std::cout << "value: " << test_2 << std::endl;
-
82 math::test_eval(test_2, 58.71291345202729, .001);
-
83 std::cout << "Test 2 Passed!" << std::endl;
+
75 {
+ +
77 3.24, 7.56, [](const double x) { return log(x) + exp(x) + x; });
+
78 std::cout << "Test Case 1" << std::endl;
+
79 std::cout << "function: log(x) + e^x + x" << std::endl;
+
80 std::cout << "range: [3.24, 7.56]" << std::endl;
+
81 std::cout << "value: " << test_1 << std::endl;
+
82 math::test_eval(test_1, 1924.80384023549, .001);
+
83 std::cout << "Test 1 Passed!" << std::endl;
84 std::cout << "=====================" << std::endl;
85
- -
87 10.78, 24.899, [](const double x) { return x * x * x - x * x + 378; });
-
88 std::cout << "Test Case 3" << std::endl;
-
89 std::cout << "function: x^3 - x^2 + 378" << std::endl;
-
90 std::cout << "range: [10.78, 24.899]" << std::endl;
-
91 std::cout << "value: " << test_3 << std::endl;
-
92 math::test_eval(test_3, 93320.65915078377, .001);
-
93 std::cout << "Test 3 Passed!" << std::endl;
-
94 std::cout << "=====================" << std::endl;
-
95
-
96 double test_4 = math::integral_approx(
-
97 .101, .505,
-
98 [](const double x) { return cos(x) * tan(x) * x * x + exp(x); },
-
99 .00001);
-
100 std::cout << "Test Case 4" << std::endl;
-
101 std::cout << "function: cos(x)*tan(x)*x^2 + e^x" << std::endl;
-
102 std::cout << "range: [.101, .505]" << std::endl;
-
103 std::cout << "value: " << test_4 << std::endl;
-
104 math::test_eval(test_4, 0.566485986311631, .001);
-
105 std::cout << "Test 4 Passed!" << std::endl;
-
106 std::cout << "=====================" << std::endl;
-
107
-
108 double test_5 = math::integral_approx(
-
109 -1, 1, [](const double x) { return exp(-1 / (x * x)); });
-
110 std::cout << "Test Case 5" << std::endl;
-
111 std::cout << "function: e^(-1/x^2)" << std::endl;
-
112 std::cout << "range: [-1, 1]" << std::endl;
-
113 std::cout << "value: " << test_5 << std::endl;
-
114 math::test_eval(test_5, 0.1781477117815607, .001);
-
115 std::cout << "Test 5 Passed!" << std::endl;
-
116}
+
86 double test_2 = math::integral_approx(0.023, 3.69, [](const double x) {
+
87 return x * x + cos(x) + exp(x) + log(x) * log(x);
+
88 });
+
89 std::cout << "Test Case 2" << std::endl;
+
90 std::cout << "function: x^2 + cos(x) + e^x + log^2(x)" << std::endl;
+
91 std::cout << "range: [.023, 3.69]" << std::endl;
+
92 std::cout << "value: " << test_2 << std::endl;
+
93 math::test_eval(test_2, 58.71291345202729, .001);
+
94 std::cout << "Test 2 Passed!" << std::endl;
+
95 std::cout << "=====================" << std::endl;
+
96
+ +
98 10.78, 24.899, [](const double x) { return x * x * x - x * x + 378; });
+
99 std::cout << "Test Case 3" << std::endl;
+
100 std::cout << "function: x^3 - x^2 + 378" << std::endl;
+
101 std::cout << "range: [10.78, 24.899]" << std::endl;
+
102 std::cout << "value: " << test_3 << std::endl;
+
103 math::test_eval(test_3, 93320.65915078377, .001);
+
104 std::cout << "Test 3 Passed!" << std::endl;
+
105 std::cout << "=====================" << std::endl;
+
106
+
107 double test_4 = math::integral_approx(
+
108 .101, .505,
+
109 [](const double x) { return cos(x) * tan(x) * x * x + exp(x); },
+
110 .00001);
+
111 std::cout << "Test Case 4" << std::endl;
+
112 std::cout << "function: cos(x)*tan(x)*x^2 + e^x" << std::endl;
+
113 std::cout << "range: [.101, .505]" << std::endl;
+
114 std::cout << "value: " << test_4 << std::endl;
+
115 math::test_eval(test_4, 0.566485986311631, .001);
+
116 std::cout << "Test 4 Passed!" << std::endl;
+
117 std::cout << "=====================" << std::endl;
+
118
+
119 double test_5 = math::integral_approx(
+
120 -1, 1, [](const double x) { return exp(-1 / (x * x)); });
+
121 std::cout << "Test Case 5" << std::endl;
+
122 std::cout << "function: e^(-1/x^2)" << std::endl;
+
123 std::cout << "range: [-1, 1]" << std::endl;
+
124 std::cout << "value: " << test_5 << std::endl;
+
125 math::test_eval(test_5, 0.1781477117815607, .001);
+
126 std::cout << "Test 5 Passed!" << std::endl;
+
127}
T cos(T... args)
T endl(T... args)
@@ -262,8 +263,8 @@ Here is the call graph for this function:
static void test_2()
Definition heavy_light_decomposition.cpp:549
static void test_3()
Definition heavy_light_decomposition.cpp:592
T log(T... args)
-
void test_eval(double approx, double expected, double threshold)
Wrapper to evaluate if the approximated value is within .XX% threshold of the exact value.
Definition integral_approximation.cpp:51
-
double integral_approx(double lb, double ub, const std::function< double(double)> &func, double delta=.0001)
Computes integral approximation.
Definition integral_approximation.cpp:31
+
void test_eval(double approx, double expected, double threshold)
Wrapper to evaluate if the approximated value is within .XX% threshold of the exact value.
Definition integral_approximation.cpp:62
+
double integral_approx(double lb, double ub, const std::function< double(double)> &func, double delta=.0001)
Computes integral approximation.
Definition integral_approximation.cpp:42
T tan(T... args)
diff --git a/d1/df6/bidirectional__dijkstra_8cpp__incl.map b/d1/df6/bidirectional__dijkstra_8cpp__incl.map index c9040f355..15b6e8f69 100644 --- a/d1/df6/bidirectional__dijkstra_8cpp__incl.map +++ b/d1/df6/bidirectional__dijkstra_8cpp__incl.map @@ -1,15 +1,17 @@ - + - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/d1/df6/bidirectional__dijkstra_8cpp__incl.md5 b/d1/df6/bidirectional__dijkstra_8cpp__incl.md5 index debad54e7..b4994c5f2 100644 --- a/d1/df6/bidirectional__dijkstra_8cpp__incl.md5 +++ b/d1/df6/bidirectional__dijkstra_8cpp__incl.md5 @@ -1 +1 @@ -49b4542a7433fd42322940a1995b914f \ No newline at end of file +09f3002d75836610aacd6e3b362db261 \ No newline at end of file diff --git a/d1/df6/bidirectional__dijkstra_8cpp__incl.svg b/d1/df6/bidirectional__dijkstra_8cpp__incl.svg index aafa41cd2..8f8f4bb81 100644 --- a/d1/df6/bidirectional__dijkstra_8cpp__incl.svg +++ b/d1/df6/bidirectional__dijkstra_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -graph/bidirectional -_dijkstra.cpp + +graph/bidirectional +_dijkstra.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -limits + +iostream @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -queue + +limits @@ -96,8 +96,8 @@ Node1->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -utility + +queue @@ -114,8 +114,8 @@ Node1->Node6 - - + + @@ -123,8 +123,8 @@ Node7 - -vector + +utility @@ -132,8 +132,26 @@ Node1->Node7 - - + + + + + + + +Node8 + + +vector + + + + + +Node1->Node8 + + + diff --git a/d1/df6/bidirectional__dijkstra_8cpp__incl_org.svg b/d1/df6/bidirectional__dijkstra_8cpp__incl_org.svg index 6e7dfe0c1..323f1bcb3 100644 --- a/d1/df6/bidirectional__dijkstra_8cpp__incl_org.svg +++ b/d1/df6/bidirectional__dijkstra_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + graph/bidirectional_dijkstra.cpp Node1 - -graph/bidirectional -_dijkstra.cpp + +graph/bidirectional +_dijkstra.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -limits + +iostream @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -queue + +limits @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -utility + +queue @@ -103,8 +103,8 @@ Node1->Node6 - - + + @@ -112,8 +112,8 @@ Node7 - -vector + +utility @@ -121,8 +121,26 @@ Node1->Node7 - - + + + + + + + +Node8 + + +vector + + + + + +Node1->Node8 + + + diff --git a/d1/df6/class_easter_year_month_day.html b/d1/df6/class_easter_year_month_day.html index d21aacb91..28dd80a78 100644 --- a/d1/df6/class_easter_year_month_day.html +++ b/d1/df6/class_easter_year_month_day.html @@ -112,7 +112,7 @@ $(function(){initNavTree('d1/df6/class_easter_year_month_day.html','../../'); in
-

for IO operations +

for assert More...

@@ -136,8 +136,8 @@ uint64_t 

day
 

Detailed Description

-

for IO operations

-

for assert

+

for assert

+

for IO operations

Constructor & Destructor Documentation

◆ EasterYearMonthDay()

@@ -170,14 +170,14 @@ uint64_t 
day
-
32 {
-
33 year = newYear; // Assigns year to class
-
34 month = newMonth;
-
35 day = newDay;
-
36 }
-
uint64_t month
month Easter is on
Definition easter.cpp:29
-
uint64_t year
year Easter is on
Definition easter.cpp:28
-
uint64_t day
day Easter is on
Definition easter.cpp:30
+
33 {
+
34 year = newYear; // Assigns year to class
+
35 month = newMonth;
+
36 day = newDay;
+
37 }
+
uint64_t month
month Easter is on
Definition easter.cpp:30
+
uint64_t year
year Easter is on
Definition easter.cpp:29
+
uint64_t day
day Easter is on
Definition easter.cpp:31
diff --git a/d2/d0b/fast__power_8cpp.html b/d2/d0b/fast__power_8cpp.html index 0728ecaad..ff04594a2 100644 --- a/d2/d0b/fast__power_8cpp.html +++ b/d2/d0b/fast__power_8cpp.html @@ -180,7 +180,7 @@ template<typename T >
62 return result;
63}
double fast_power_linear(T a, T b)
Definition fast_power.cpp:50
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/d2/d83/elliptic__curve__key__exchange_8cpp__incl.map b/d2/d83/elliptic__curve__key__exchange_8cpp__incl.map index 937f24acf..a1f0406d4 100644 --- a/d2/d83/elliptic__curve__key__exchange_8cpp__incl.map +++ b/d2/d83/elliptic__curve__key__exchange_8cpp__incl.map @@ -6,16 +6,18 @@ - - - - + + + + - - - - - - + + + + + + + + diff --git a/d2/d83/elliptic__curve__key__exchange_8cpp__incl.md5 b/d2/d83/elliptic__curve__key__exchange_8cpp__incl.md5 index 03c5673ac..bdfaf2a13 100644 --- a/d2/d83/elliptic__curve__key__exchange_8cpp__incl.md5 +++ b/d2/d83/elliptic__curve__key__exchange_8cpp__incl.md5 @@ -1 +1 @@ -680c89ff1455d253239449d3217622e7 \ No newline at end of file +18a8583b1488dd2c3047454e772a75a4 \ No newline at end of file diff --git a/d2/d83/elliptic__curve__key__exchange_8cpp__incl.svg b/d2/d83/elliptic__curve__key__exchange_8cpp__incl.svg index 378237b60..56caab7fc 100644 --- a/d2/d83/elliptic__curve__key__exchange_8cpp__incl.svg +++ b/d2/d83/elliptic__curve__key__exchange_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -87,8 +87,8 @@ Node5 - -string + +string @@ -96,8 +96,8 @@ Node4->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -utility + +utility @@ -114,8 +114,8 @@ Node4->Node6 - - + + @@ -138,20 +138,20 @@ - + Node7->Node5 - - - + + + - + Node7->Node6 - - - + + + @@ -159,8 +159,8 @@ Node8 - -algorithm + +algorithm @@ -168,8 +168,8 @@ Node7->Node8 - - + + @@ -177,8 +177,8 @@ Node9 - -ostream + +cstdint @@ -186,8 +186,26 @@ Node7->Node9 - - + + + + + + + +Node10 + + +ostream + + + + + +Node7->Node10 + + + diff --git a/d2/d83/elliptic__curve__key__exchange_8cpp__incl_org.svg b/d2/d83/elliptic__curve__key__exchange_8cpp__incl_org.svg index 8b200de70..67a3ca084 100644 --- a/d2/d83/elliptic__curve__key__exchange_8cpp__incl_org.svg +++ b/d2/d83/elliptic__curve__key__exchange_8cpp__incl_org.svg @@ -4,8 +4,8 @@ - + ciphers/elliptic_curve_key_exchange.cpp @@ -76,8 +76,8 @@ Node5 - -string + +string @@ -85,8 +85,8 @@ Node4->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -utility + +utility @@ -103,8 +103,8 @@ Node4->Node6 - - + + @@ -127,20 +127,20 @@ - + Node7->Node5 - - - + + + - + Node7->Node6 - - - + + + @@ -148,8 +148,8 @@ Node8 - -algorithm + +algorithm @@ -157,8 +157,8 @@ Node7->Node8 - - + + @@ -166,8 +166,8 @@ Node9 - -ostream + +cstdint @@ -175,8 +175,26 @@ Node7->Node9 - - + + + + + + + +Node10 + + +ostream + + + + + +Node7->Node10 + + + diff --git a/d2/d90/namespacegreedy__algorithms.html b/d2/d90/namespacegreedy__algorithms.html index 1f8027ade..b4bf9b671 100644 --- a/d2/d90/namespacegreedy__algorithms.html +++ b/d2/d90/namespacegreedy__algorithms.html @@ -146,7 +146,7 @@ Functions

- + @@ -164,11 +165,11 @@ Functions

Main function.

Returns
0 on exit
-
103 {
-
104 test(); // execute the tests
-
105 return 0;
-
106}
-
static void test()
Test implementations.
Definition saddleback_search.cpp:70
+
112 {
+
113 test(); // execute the tests
+
114 return 0;
+
115}
+
static void test()
Test implementations.
Definition saddleback_search.cpp:78
Here is the call graph for this function:
@@ -205,35 +206,37 @@ Here is the call graph for this function:
Returns
An std::pair of with row and column populated within it, if the element is present.
An std::pair with (0, 0), if the element is not present.
-
34 {
-
35 uint32_t left_index = 0;
-
36 uint32_t right_index = matrix[0].size() - 1; // Start from top right corner
-
37 while (left_index < matrix.size()) { // Exit once the value of indexes get out of range.
-
38 if (element ==
-
39 matrix[left_index]
-
40 [right_index]) { // If value on this position of matrix is
-
41 // equal to element, return (row, column).
-
42 return std::make_pair(left_index+1, right_index+1);
-
43 } else if (element >
-
44 matrix[left_index]
-
45 [right_index]) { // Else if value on this position of
-
46 // matrix is less than the element,
-
47 // move left.
-
48 ++left_index;
-
49 } else if (element <
-
50 matrix[left_index]
-
51 [right_index]) { // Else if value on this position of
-
52 // matrix is greater than the
-
53 // element, move down.
-
54 if(!right_index)
-
55 break;
-
56 else --right_index;
-
57 }
-
58 }
-
59 return std::make_pair(
-
60 0, 0); // If the program reaches here, that means one of the index
-
61 // went out of index, hence no element present.
-
62}
+
40 {
+
41 uint32_t left_index = 0;
+
42 uint32_t right_index = matrix[0].size() - 1; // Start from top right corner
+
43 while (left_index <
+
44 matrix.size()) { // Exit once the value of indexes get out of range.
+
45 if (element ==
+
46 matrix[left_index]
+
47 [right_index]) { // If value on this position of matrix is
+
48 // equal to element, return (row, column).
+
49 return std::make_pair(left_index + 1, right_index + 1);
+
50 } else if (element >
+
51 matrix[left_index]
+
52 [right_index]) { // Else if value on this position of
+
53 // matrix is less than the element,
+
54 // move left.
+
55 ++left_index;
+
56 } else if (element <
+
57 matrix[left_index]
+
58 [right_index]) { // Else if value on this position of
+
59 // matrix is greater than the
+
60 // element, move down.
+
61 if (!right_index)
+
62 break;
+
63 else
+
64 --right_index;
+
65 }
+
66 }
+
67 return std::make_pair(
+
68 0, 0); // If the program reaches here, that means one of the index
+
69 // went out of index, hence no element present.
+
70}
T make_pair(T... args)
T size(T... args)
@@ -270,36 +273,37 @@ Here is the call graph for this function:

Test implementations.

Returns
void
-
70 {
-
71 std::vector<std::vector<int32_t>> matrix = {{1, 10, 100, 1000, 10000},
-
72 {2, 20, 200, 2000, 20000},
-
73 {3, 30, 300, 3000, 30000},
-
74 {4, 40, 400, 4000, 40000},
-
75 {5, 50, 500, 5000, 50000}};
-
76
- - -
79 // Test 1
- -
81 assert(not_found == answer1);
-
82 // Test 2
- -
84 assert(not_found == answer1);
-
85 // Test 3
- -
87 test_answer = std::make_pair(1, 1);
-
88 assert(test_answer == answer1);
-
89 // Test 4
-
90 answer1 = search::saddleback::saddleback(matrix, 50000);
-
91 test_answer = std::make_pair(5, 5);
-
92 assert(test_answer == answer1);
-
93 // Test 5
- -
95 test_answer = std::make_pair(3, 3);
-
96 assert(test_answer == answer1);
-
97}
+
78 {
+
79 std::vector<std::vector<int32_t>> matrix = {{1, 10, 100, 1000, 10000},
+
80 {2, 20, 200, 2000, 20000},
+
81 {3, 30, 300, 3000, 30000},
+
82 {4, 40, 400, 4000, 40000},
+
83 {5, 50, 500, 5000, 50000}};
+
84
+ + +
87 // Test 1
+ + +
90 assert(not_found == answer1);
+
91 // Test 2
+ +
93 assert(not_found == answer1);
+
94 // Test 3
+ +
96 test_answer = std::make_pair(1, 1);
+
97 assert(test_answer == answer1);
+
98 // Test 4
+
99 answer1 = search::saddleback::saddleback(matrix, 50000);
+
100 test_answer = std::make_pair(5, 5);
+
101 assert(test_answer == answer1);
+
102 // Test 5
+ +
104 test_answer = std::make_pair(3, 3);
+
105 assert(test_answer == answer1);
+
106}
-
std::pair< uint32_t, uint32_t > saddleback(std::vector< std::vector< int32_t > > matrix, int32_t element)
Definition saddleback_search.cpp:33
+
std::pair< uint32_t, uint32_t > saddleback(std::vector< std::vector< int32_t > > matrix, int32_t element)
Definition saddleback_search.cpp:39
Here is the call graph for this function:
diff --git a/d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html b/d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html index 2a030a951..a1ce70fe2 100644 --- a/d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html +++ b/d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html @@ -418,7 +418,7 @@ Here is the call graph for this function:
210
211 return result;
212 }
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/d3/d28/wiggle__sort_8cpp__incl.map b/d3/d28/wiggle__sort_8cpp__incl.map index bb993afc8..196256496 100644 --- a/d3/d28/wiggle__sort_8cpp__incl.map +++ b/d3/d28/wiggle__sort_8cpp__incl.map @@ -1,13 +1,15 @@ - + - + - - - - - - - + + + + + + + + + diff --git a/d3/d28/wiggle__sort_8cpp__incl.md5 b/d3/d28/wiggle__sort_8cpp__incl.md5 index 4fc113a63..6cf6bd131 100644 --- a/d3/d28/wiggle__sort_8cpp__incl.md5 +++ b/d3/d28/wiggle__sort_8cpp__incl.md5 @@ -1 +1 @@ -d77d9a15db4b2cc46df759ac220e1367 \ No newline at end of file +4b656474ef6a70465ad4fb6a648ac076 \ No newline at end of file diff --git a/d3/d28/wiggle__sort_8cpp__incl.svg b/d3/d28/wiggle__sort_8cpp__incl.svg index 050573b87..aac580741 100644 --- a/d3/d28/wiggle__sort_8cpp__incl.svg +++ b/d3/d28/wiggle__sort_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -sorting/wiggle_sort.cpp + +sorting/wiggle_sort.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -ctime + +cstdint @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -iostream + +ctime @@ -95,8 +95,8 @@ Node1->Node5 - - + + @@ -104,8 +104,8 @@ Node6 - -vector + +iostream @@ -113,8 +113,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/d3/d28/wiggle__sort_8cpp__incl_org.svg b/d3/d28/wiggle__sort_8cpp__incl_org.svg index 0d9b3f3ee..af1fb203c 100644 --- a/d3/d28/wiggle__sort_8cpp__incl_org.svg +++ b/d3/d28/wiggle__sort_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + sorting/wiggle_sort.cpp Node1 - -sorting/wiggle_sort.cpp + +sorting/wiggle_sort.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -ctime + +cstdint @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -iostream + +ctime @@ -84,8 +84,8 @@ Node1->Node5 - - + + @@ -93,8 +93,8 @@ Node6 - -vector + +iostream @@ -102,8 +102,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/d3/d39/manacher__algorithm_8cpp.html b/d3/d39/manacher__algorithm_8cpp.html index ea7e34774..84b16f558 100644 --- a/d3/d39/manacher__algorithm_8cpp.html +++ b/d3/d39/manacher__algorithm_8cpp.html @@ -114,13 +114,14 @@ $(function(){initNavTree('d3/d39/manacher__algorithm_8cpp.html','../../'); initR

Implementation of Manacher's Algorithm More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
#include <cstring>
Include dependency graph for manacher_algorithm.cpp:
-
+

Namespaces

namespace  search
 for std::vector
 for std::assert
 
namespace  saddleback
 Function for implementing Saddleback Algorithm.

Main function.

Returns
0 on exit
-
171 {
-
172 test(); // run self-test implementations
-
173 return 0;
-
174}
-
static void test()
Self-test implementations.
Definition manacher_algorithm.cpp:150
+
172 {
+
173 test(); // run self-test implementations
+
174 return 0;
+
175}
+
static void test()
Self-test implementations.
Definition manacher_algorithm.cpp:151
Here is the call graph for this function:
@@ -201,108 +202,108 @@ Here is the call graph for this function:
Returns
the largest palindromic substring
-
40 {
-
41 if (prototype.size() > 0) {
-
42 // stuffing characters between the input string to handle cases with
-
43 // even length palindrome
-
44 std::string stuffed_string = "";
-
45 for (auto str : prototype) {
-
46 stuffed_string += str;
-
47 stuffed_string += "#";
-
48 }
-
49 stuffed_string = "@#" + stuffed_string + "&";
-
50
-
51 std::vector<uint64_t> palindrome_max_half_length(
-
52 stuffed_string.size(),
-
53 0); // this array will consist of largest possible half length of
-
54 // palindrome centered at index (say i with respect to the
-
55 // stuffed string). This value will be lower bound of half
-
56 // length since single character is a palindrome in itself.
-
57
-
58 uint64_t bigger_center =
-
59 0; // this is the index of the center of palindromic
-
60 // substring which would be considered as the larger
-
61 // palindrome, having symmetric halves
-
62
-
63 uint64_t right = 0; // this is the maximum length of the palindrome
-
64 // from 'bigger_center' to the rightmost end
-
65
-
66 // i is considered as center lying within one half of the palindrone
-
67 // which is centered at 'bigger_center'
-
68 for (uint64_t i = 1; i < stuffed_string.size() - 1; i++) {
-
69 if (i < right) { // when i is before right end, considering
-
70 // 'bigger_center' as center of palindrome
-
71 uint64_t opposite_to_i =
-
72 2 * bigger_center -
-
73 i; // this is the opposite end of string, if
-
74 // centered at center, and having one end as i
-
75
-
76 // finding the minimum possible half length among
-
77 // the palindrome on having center at opposite end,
-
78 // and the string between i and right end,
-
79 // considering 'bigger_center' as center of palindrome
-
80 palindrome_max_half_length[i] = std::min(
-
81 palindrome_max_half_length[opposite_to_i], right - i);
-
82 }
-
83
-
84 // expanding the palindrome across the maximum stored length in the
-
85 // array, centered at i
-
86 while (stuffed_string[i + (palindrome_max_half_length[i] + 1)] ==
-
87 stuffed_string[i - (palindrome_max_half_length[i] + 1)]) {
-
88 palindrome_max_half_length[i]++;
-
89 }
-
90
-
91 // if palindrome centered at i exceeds the rightmost end of
-
92 // palindrome centered at 'bigger_center', then i will be made the
-
93 // 'bigger_center' and right value will also be updated with respect
-
94 // to center i
-
95 if (i + palindrome_max_half_length[i] > right) {
-
96 bigger_center = i;
-
97 right = i + palindrome_max_half_length[i];
-
98 }
-
99 }
-
100
-
101 // now extracting the first largest palindrome
-
102 uint64_t half_length = 0; // half length of the largest palindrome
-
103 uint64_t center_index = 0; // index of center of the largest palindrome
-
104
-
105 for (uint64_t i = 1; i < stuffed_string.size() - 1; i++) {
-
106 if (palindrome_max_half_length[i] > half_length) {
-
107 half_length = palindrome_max_half_length[i];
-
108 center_index = i;
-
109 }
-
110 }
-
111
-
112 std::string palindromic_substring =
-
113 ""; // contains the resulting largest palindrome
-
114
-
115 if (half_length > 0) {
-
116 // extra information: when '#' is the center, then palindromic
-
117 // substring will have even length, else palindromic substring will
-
118 // have odd length
-
119
-
120 uint64_t start =
-
121 center_index - half_length +
-
122 1; // index of first character of palindromic substring
-
123 uint64_t end =
-
124 center_index + half_length -
-
125 1; // index of last character of palindromic substring
-
126 for (uint64_t index = start; index <= end; index += 2) {
-
127 palindromic_substring += stuffed_string[index];
-
128 }
-
129 } else {
-
130 // if length = 0, then there does not exist any palindrome of length
-
131 // > 1 so we can assign any character of length 1 from string as the
-
132 // palindromic substring
-
133 palindromic_substring = prototype[0];
-
134 }
-
135 return palindromic_substring;
-
136
-
137 } else {
-
138 // handling case when string is empty
-
139 return "";
-
140 }
-
141}
+
41 {
+
42 if (prototype.size() > 0) {
+
43 // stuffing characters between the input string to handle cases with
+
44 // even length palindrome
+
45 std::string stuffed_string = "";
+
46 for (auto str : prototype) {
+
47 stuffed_string += str;
+
48 stuffed_string += "#";
+
49 }
+
50 stuffed_string = "@#" + stuffed_string + "&";
+
51
+
52 std::vector<uint64_t> palindrome_max_half_length(
+
53 stuffed_string.size(),
+
54 0); // this array will consist of largest possible half length of
+
55 // palindrome centered at index (say i with respect to the
+
56 // stuffed string). This value will be lower bound of half
+
57 // length since single character is a palindrome in itself.
+
58
+
59 uint64_t bigger_center =
+
60 0; // this is the index of the center of palindromic
+
61 // substring which would be considered as the larger
+
62 // palindrome, having symmetric halves
+
63
+
64 uint64_t right = 0; // this is the maximum length of the palindrome
+
65 // from 'bigger_center' to the rightmost end
+
66
+
67 // i is considered as center lying within one half of the palindrone
+
68 // which is centered at 'bigger_center'
+
69 for (uint64_t i = 1; i < stuffed_string.size() - 1; i++) {
+
70 if (i < right) { // when i is before right end, considering
+
71 // 'bigger_center' as center of palindrome
+
72 uint64_t opposite_to_i =
+
73 2 * bigger_center -
+
74 i; // this is the opposite end of string, if
+
75 // centered at center, and having one end as i
+
76
+
77 // finding the minimum possible half length among
+
78 // the palindrome on having center at opposite end,
+
79 // and the string between i and right end,
+
80 // considering 'bigger_center' as center of palindrome
+
81 palindrome_max_half_length[i] = std::min(
+
82 palindrome_max_half_length[opposite_to_i], right - i);
+
83 }
+
84
+
85 // expanding the palindrome across the maximum stored length in the
+
86 // array, centered at i
+
87 while (stuffed_string[i + (palindrome_max_half_length[i] + 1)] ==
+
88 stuffed_string[i - (palindrome_max_half_length[i] + 1)]) {
+
89 palindrome_max_half_length[i]++;
+
90 }
+
91
+
92 // if palindrome centered at i exceeds the rightmost end of
+
93 // palindrome centered at 'bigger_center', then i will be made the
+
94 // 'bigger_center' and right value will also be updated with respect
+
95 // to center i
+
96 if (i + palindrome_max_half_length[i] > right) {
+
97 bigger_center = i;
+
98 right = i + palindrome_max_half_length[i];
+
99 }
+
100 }
+
101
+
102 // now extracting the first largest palindrome
+
103 uint64_t half_length = 0; // half length of the largest palindrome
+
104 uint64_t center_index = 0; // index of center of the largest palindrome
+
105
+
106 for (uint64_t i = 1; i < stuffed_string.size() - 1; i++) {
+
107 if (palindrome_max_half_length[i] > half_length) {
+
108 half_length = palindrome_max_half_length[i];
+
109 center_index = i;
+
110 }
+
111 }
+
112
+
113 std::string palindromic_substring =
+
114 ""; // contains the resulting largest palindrome
+
115
+
116 if (half_length > 0) {
+
117 // extra information: when '#' is the center, then palindromic
+
118 // substring will have even length, else palindromic substring will
+
119 // have odd length
+
120
+
121 uint64_t start =
+
122 center_index - half_length +
+
123 1; // index of first character of palindromic substring
+
124 uint64_t end =
+
125 center_index + half_length -
+
126 1; // index of last character of palindromic substring
+
127 for (uint64_t index = start; index <= end; index += 2) {
+
128 palindromic_substring += stuffed_string[index];
+
129 }
+
130 } else {
+
131 // if length = 0, then there does not exist any palindrome of length
+
132 // > 1 so we can assign any character of length 1 from string as the
+
133 // palindromic substring
+
134 palindromic_substring = prototype[0];
+
135 }
+
136 return palindromic_substring;
+
137
+
138 } else {
+
139 // handling case when string is empty
+
140 return "";
+
141 }
+
142}
T end(T... args)
T right(T... args)
@@ -342,22 +343,22 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
150 {
-
151 assert(strings::manacher::manacher("") == "");
-
152 assert(strings::manacher::manacher("abababc") == "ababa");
-
153 assert(strings::manacher::manacher("cbaabd") == "baab");
-
154 assert(strings::manacher::manacher("DedzefDeD") == "DeD");
-
155 assert(strings::manacher::manacher("XZYYXXYZXX") == "YXXY");
-
156 assert(strings::manacher::manacher("1sm222m10abc") == "m222m");
-
157 assert(strings::manacher::manacher("798989591") == "98989");
-
158 assert(strings::manacher::manacher("xacdedcax") == "xacdedcax");
-
159 assert(strings::manacher::manacher("xaccax") == "xaccax");
-
160 assert(strings::manacher::manacher("a") == "a");
-
161 assert(strings::manacher::manacher("xy") == "x");
-
162 assert(strings::manacher::manacher("abced") == "a");
-
163
-
164 std::cout << "All tests have passed!" << std::endl;
-
165}
+
151 {
+
152 assert(strings::manacher::manacher("") == "");
+
153 assert(strings::manacher::manacher("abababc") == "ababa");
+
154 assert(strings::manacher::manacher("cbaabd") == "baab");
+
155 assert(strings::manacher::manacher("DedzefDeD") == "DeD");
+
156 assert(strings::manacher::manacher("XZYYXXYZXX") == "YXXY");
+
157 assert(strings::manacher::manacher("1sm222m10abc") == "m222m");
+
158 assert(strings::manacher::manacher("798989591") == "98989");
+
159 assert(strings::manacher::manacher("xacdedcax") == "xacdedcax");
+
160 assert(strings::manacher::manacher("xaccax") == "xaccax");
+
161 assert(strings::manacher::manacher("a") == "a");
+
162 assert(strings::manacher::manacher("xy") == "x");
+
163 assert(strings::manacher::manacher("abced") == "a");
+
164
+
165 std::cout << "All tests have passed!" << std::endl;
+
166}
T endl(T... args)
diff --git a/d3/d4c/sha1_8cpp__incl.map b/d3/d4c/sha1_8cpp__incl.map index 0b08612fb..f12a798b7 100644 --- a/d3/d4c/sha1_8cpp__incl.map +++ b/d3/d4c/sha1_8cpp__incl.map @@ -1,17 +1,19 @@ - + - + - + - + - - - - - - - + + + + + + + + + diff --git a/d3/d4c/sha1_8cpp__incl.md5 b/d3/d4c/sha1_8cpp__incl.md5 index b8c1e2c2b..7ee2ba9e5 100644 --- a/d3/d4c/sha1_8cpp__incl.md5 +++ b/d3/d4c/sha1_8cpp__incl.md5 @@ -1 +1 @@ -413100f5e1fded24a8424dd9bc7a640b \ No newline at end of file +cb136bed87111bc762bd3c424fcef672 \ No newline at end of file diff --git a/d3/d4c/sha1_8cpp__incl.svg b/d3/d4c/sha1_8cpp__incl.svg index adb610f2e..909ec265e 100644 --- a/d3/d4c/sha1_8cpp__incl.svg +++ b/d3/d4c/sha1_8cpp__incl.svg @@ -4,10 +4,9 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + hashing/sha1.cpp Node1 - -hashing/sha1.cpp + +hashing/sha1.cpp @@ -41,8 +77,8 @@ Node1->Node2 - - + + @@ -59,8 +95,8 @@ Node1->Node3 - - + + @@ -77,8 +113,8 @@ Node1->Node4 - - + + @@ -87,7 +123,7 @@ Node5 -cstring +cstdint @@ -95,8 +131,8 @@ Node1->Node5 - - + + @@ -104,8 +140,8 @@ Node6 - -iostream + +cstring @@ -113,8 +149,8 @@ Node1->Node6 - - + + @@ -122,8 +158,8 @@ Node7 - -string + +iostream @@ -131,8 +167,8 @@ Node1->Node7 - - + + @@ -140,8 +176,8 @@ Node8 - -vector + +string @@ -149,13 +185,52 @@ Node1->Node8 - - + + + + + + + +Node9 + + +vector + + + + + +Node1->Node9 + + + + + + + + + + + + + + + + + + + + +

The Z function for finding occurences of a pattern within a piece of text with time and space complexity O(n + m) More...

-
#include <iostream>
+
#include <cstdint>
+#include <iostream>
#include <cstring>
#include <cassert>
#include <vector>
Include dependency graph for z_function.cpp:
-
+

@@ -165,11 +166,11 @@ Functions

Returns
a vector of starting indexes where pattern is found in the text
-
54 {
-
55 uint64_t text_length = text.size(), pattern_length = pattern.size();
-
56 std::vector<uint64_t> z = Z_function(pattern + '#' + text);
-
57 std::vector<uint64_t> matching_indexes;
-
58
-
59 for (uint64_t i = 0; i < text_length; i++) {
-
60 if (z[i + pattern_length + 1] == pattern_length) {
-
61 matching_indexes.push_back(i);
-
62 }
-
63 }
-
64 return matching_indexes;
-
65}
+
55 {
+
56 uint64_t text_length = text.size(), pattern_length = pattern.size();
+
57 std::vector<uint64_t> z = Z_function(pattern + '#' + text);
+
58 std::vector<uint64_t> matching_indexes;
+
59
+
60 for (uint64_t i = 0; i < text_length; i++) {
+
61 if (z[i + pattern_length + 1] == pattern_length) {
+
62 matching_indexes.push_back(i);
+
63 }
+
64 }
+
65 return matching_indexes;
+
66}
T push_back(T... args)
T size(T... args)
-
std::vector< uint64_t > Z_function(const std::string &pattern)
for IO operations
Definition z_function.cpp:28
+
std::vector< uint64_t > Z_function(const std::string &pattern)
for IO operations
Definition z_function.cpp:29
Here is the call graph for this function:
@@ -214,11 +215,11 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
93 {
-
94 test(); // run self-test implementations
-
95 return 0;
-
96}
-
static void test()
Self-test implementations.
Definition z_function.cpp:71
+
94 {
+
95 test(); // run self-test implementations
+
96 return 0;
+
97}
+
static void test()
Self-test implementations.
Definition z_function.cpp:72
Here is the call graph for this function:
@@ -252,25 +253,25 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
71 {
-
72 // usual case
-
73 std::string text1 = "alskfjaldsabc1abc1abcbksbcdnsdabcabc";
-
74 std::string pattern1 = "abc";
-
75
-
76 // matching_indexes1 gets the indexes where pattern1 exists in text1
-
77 std::vector<uint64_t> matching_indexes1 = find_pat_in_text(pattern1, text1);
-
78 assert((matching_indexes1 == std::vector<uint64_t>{10, 14, 18, 30, 33}));
-
79
-
80 // corner case
-
81 std::string text2 = "greengrass";
-
82 std::string pattern2 = "abc";
-
83
-
84 // matching_indexes2 gets the indexes where pattern2 exists in text2
-
85 std::vector<uint64_t> matching_indexes2 = find_pat_in_text(pattern2, text2);
-
86 assert((matching_indexes2 == std::vector<uint64_t>{}));
-
87}
+
72 {
+
73 // usual case
+
74 std::string text1 = "alskfjaldsabc1abc1abcbksbcdnsdabcabc";
+
75 std::string pattern1 = "abc";
+
76
+
77 // matching_indexes1 gets the indexes where pattern1 exists in text1
+
78 std::vector<uint64_t> matching_indexes1 = find_pat_in_text(pattern1, text1);
+
79 assert((matching_indexes1 == std::vector<uint64_t>{10, 14, 18, 30, 33}));
+
80
+
81 // corner case
+
82 std::string text2 = "greengrass";
+
83 std::string pattern2 = "abc";
+
84
+
85 // matching_indexes2 gets the indexes where pattern2 exists in text2
+
86 std::vector<uint64_t> matching_indexes2 = find_pat_in_text(pattern2, text2);
+
87 assert((matching_indexes2 == std::vector<uint64_t>{}));
+
88}
-
std::vector< uint64_t > find_pat_in_text(const std::string &pattern, const std::string &text)
Using Z_function to find a pattern in a text.
Definition z_function.cpp:53
+
std::vector< uint64_t > find_pat_in_text(const std::string &pattern, const std::string &text)
Using Z_function to find a pattern in a text.
Definition z_function.cpp:54
Here is the call graph for this function:
@@ -303,24 +304,24 @@ Here is the call graph for this function:
Returns
the Z-function output as a vector array
-
28 {
-
29 uint64_t pattern_length = pattern.size();
-
30 std::vector<uint64_t> z(pattern_length, 0);
-
31
-
32 for (uint64_t i = 1, l = 0, r = 0; i < pattern_length; i++) {
-
33 if (i <= r) {
-
34 z[i] = std::min(r - i + 1, z[i - l]);
-
35 }
-
36 while (i + z[i] < pattern_length &&
-
37 pattern[z[i]] == pattern[i + z[i]]) {
-
38 z[i]++;
-
39 }
-
40 if (i + z[i] - 1 > r) {
-
41 r = i + z[i] - 1;
-
42 }
-
43 }
-
44 return z;
-
45}
+
29 {
+
30 uint64_t pattern_length = pattern.size();
+
31 std::vector<uint64_t> z(pattern_length, 0);
+
32
+
33 for (uint64_t i = 1, l = 0, r = 0; i < pattern_length; i++) {
+
34 if (i <= r) {
+
35 z[i] = std::min(r - i + 1, z[i - l]);
+
36 }
+
37 while (i + z[i] < pattern_length &&
+
38 pattern[z[i]] == pattern[i + z[i]]) {
+
39 z[i]++;
+
40 }
+
41 if (i + z[i] - 1 > r) {
+
42 r = i + z[i] - 1;
+
43 }
+
44 }
+
45 return z;
+
46}
T min(T... args)
Here is the call graph for this function:
diff --git a/d3/dae/dsu__path__compression_8cpp.html b/d3/dae/dsu__path__compression_8cpp.html index 0f6d4db7c..27184a475 100644 --- a/d3/dae/dsu__path__compression_8cpp.html +++ b/d3/dae/dsu__path__compression_8cpp.html @@ -114,12 +114,13 @@ $(function(){initNavTree('d3/dae/dsu__path__compression_8cpp.html','../../'); in

DSU (Disjoint sets) More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for dsu_path_compression.cpp:
-
+

@@ -173,22 +174,22 @@ Functions

Returns
true if a cycle is detected, else false.
-
249 {
-
250 auto graphAjdList = graph.getAdjList();
-
251 auto vertices = graph.getVertices();
-
252
-
253 std::vector<unsigned int> indegree(vertices, 0);
-
254 // Calculate the indegree i.e. the number of incident edges to the node.
-
255 for (auto const& list : graphAjdList) {
-
256 auto children = list.second;
-
257 for (auto const& child : children) {
-
258 indegree[child]++;
-
259 }
-
260 }
-
261
-
262 std::queue<unsigned int> can_be_solved;
-
263 for (unsigned int node = 0; node < vertices; node++) {
-
264 // If a node doesn't have any input edges, then that node will
-
265 // definately not result in a cycle and can be visited safely.
-
266 if (!indegree[node]) {
-
267 can_be_solved.emplace(node);
-
268 }
-
269 }
-
270
-
271 // Vertices that need to be traversed.
-
272 auto remain = vertices;
-
273 // While there are safe nodes that we can visit.
-
274 while (!can_be_solved.empty()) {
-
275 auto solved = can_be_solved.front();
-
276 // Visit the node.
-
277 can_be_solved.pop();
-
278 // Decrease number of nodes that need to be traversed.
-
279 remain--;
-
280
-
281 // Visit all the children of the visited node.
-
282 auto it = graphAjdList.find(solved);
-
283 if (it != graphAjdList.end()) {
-
284 for (auto child : it->second) {
-
285 // Check if we can visited the node safely.
-
286 if (--indegree[child] == 0) {
-
287 // if node can be visited safely, then add that node to
-
288 // the visit queue.
-
289 can_be_solved.emplace(child);
-
290 }
-
291 }
-
292 }
-
293 }
-
294
-
295 // If there are still nodes that we can't visit, then it means that
-
296 // there is a cycle and return true, else return false.
-
297 return !(remain == 0);
-
298 }
+
250 {
+
251 auto graphAjdList = graph.getAdjList();
+
252 auto vertices = graph.getVertices();
+
253
+
254 std::vector<unsigned int> indegree(vertices, 0);
+
255 // Calculate the indegree i.e. the number of incident edges to the node.
+
256 for (auto const& list : graphAjdList) {
+
257 auto children = list.second;
+
258 for (auto const& child : children) {
+
259 indegree[child]++;
+
260 }
+
261 }
+
262
+
263 std::queue<unsigned int> can_be_solved;
+
264 for (unsigned int node = 0; node < vertices; node++) {
+
265 // If a node doesn't have any input edges, then that node will
+
266 // definately not result in a cycle and can be visited safely.
+
267 if (!indegree[node]) {
+
268 can_be_solved.emplace(node);
+
269 }
+
270 }
+
271
+
272 // Vertices that need to be traversed.
+
273 auto remain = vertices;
+
274 // While there are safe nodes that we can visit.
+
275 while (!can_be_solved.empty()) {
+
276 auto solved = can_be_solved.front();
+
277 // Visit the node.
+
278 can_be_solved.pop();
+
279 // Decrease number of nodes that need to be traversed.
+
280 remain--;
+
281
+
282 // Visit all the children of the visited node.
+
283 auto it = graphAjdList.find(solved);
+
284 if (it != graphAjdList.end()) {
+
285 for (auto child : it->second) {
+
286 // Check if we can visited the node safely.
+
287 if (--indegree[child] == 0) {
+
288 // if node can be visited safely, then add that node to
+
289 // the visit queue.
+
290 can_be_solved.emplace(child);
+
291 }
+
292 }
+
293 }
+
294 }
+
295
+
296 // If there are still nodes that we can't visit, then it means that
+
297 // there is a cycle and return true, else return false.
+
298 return !(remain == 0);
+
299 }
T emplace(T... args)
T empty(T... args)
T front(T... args)
@@ -297,36 +297,36 @@ Here is the call graph for this function:

State of the node.

It is a vector of "nodeStates" which represents the state node is in. It can take only 3 values: "not_visited", "in_stack", and "visited".

Initially, all nodes are in "not_visited" state.

-
212 {
-
213 auto vertices = graph.getVertices();
-
214
-
215 /** State of the node.
-
216 *
-
217 * It is a vector of "nodeStates" which represents the state node is in.
-
218 * It can take only 3 values: "not_visited", "in_stack", and "visited".
-
219 *
-
220 * Initially, all nodes are in "not_visited" state.
-
221 */
-
222 std::vector<nodeStates> state(vertices, not_visited);
-
223
-
224 // Start visiting each node.
-
225 for (unsigned int node = 0; node < vertices; node++) {
-
226 // If a node is not visited, only then check for presence of cycle.
-
227 // There is no need to check for presence of cycle for a visited
-
228 // node as it has already been checked for presence of cycle.
-
229 if (state[node] == not_visited) {
-
230 // Check for cycle.
-
231 if (isCyclicDFSHelper(graph.getAdjList(), &state, node)) {
-
232 return true;
-
233 }
-
234 }
-
235 }
-
236
-
237 // All nodes have been safely traversed, that means there is no cycle in
-
238 // the graph. Return false.
-
239 return false;
-
240 }
-
static bool isCyclicDFSHelper(AdjList const &adjList, std::vector< nodeStates > *state, unsigned int node)
Definition cycle_check_directed_graph.cpp:170
+
213 {
+
214 auto vertices = graph.getVertices();
+
215
+
216 /** State of the node.
+
217 *
+
218 * It is a vector of "nodeStates" which represents the state node is in.
+
219 * It can take only 3 values: "not_visited", "in_stack", and "visited".
+
220 *
+
221 * Initially, all nodes are in "not_visited" state.
+
222 */
+
223 std::vector<nodeStates> state(vertices, not_visited);
+
224
+
225 // Start visiting each node.
+
226 for (unsigned int node = 0; node < vertices; node++) {
+
227 // If a node is not visited, only then check for presence of cycle.
+
228 // There is no need to check for presence of cycle for a visited
+
229 // node as it has already been checked for presence of cycle.
+
230 if (state[node] == not_visited) {
+
231 // Check for cycle.
+
232 if (isCyclicDFSHelper(graph.getAdjList(), &state, node)) {
+
233 return true;
+
234 }
+
235 }
+
236 }
+
237
+
238 // All nodes have been safely traversed, that means there is no cycle in
+
239 // the graph. Return false.
+
240 return false;
+
241 }
+
static bool isCyclicDFSHelper(AdjList const &adjList, std::vector< nodeStates > *state, unsigned int node)
Definition cycle_check_directed_graph.cpp:171
Here is the call graph for this function:
@@ -376,37 +376,37 @@ Here is the call graph for this function:
Returns
true if graph has a cycle, else false.
-
172 {
-
173 // Add node "in_stack" state.
-
174 (*state)[node] = in_stack;
-
175
-
176 // If the node has children, then recursively visit all children of the
-
177 // node.
-
178 auto const it = adjList.find(node);
-
179 if (it != adjList.end()) {
-
180 for (auto child : it->second) {
-
181 // If state of child node is "not_visited", evaluate that child
-
182 // for presence of cycle.
-
183 auto state_of_child = (*state)[child];
-
184 if (state_of_child == not_visited) {
-
185 if (isCyclicDFSHelper(adjList, state, child)) {
-
186 return true;
-
187 }
-
188 } else if (state_of_child == in_stack) {
-
189 // If child node was "in_stack", then that means that there
-
190 // is a cycle in the graph. Return true for presence of the
-
191 // cycle.
-
192 return true;
-
193 }
-
194 }
-
195 }
-
196
-
197 // Current node has been evaluated for the presence of cycle and had no
-
198 // cycle. Mark current node as "visited".
-
199 (*state)[node] = visited;
-
200 // Return that current node didn't result in any cycles.
-
201 return false;
-
202 }
+
173 {
+
174 // Add node "in_stack" state.
+
175 (*state)[node] = in_stack;
+
176
+
177 // If the node has children, then recursively visit all children of the
+
178 // node.
+
179 auto const it = adjList.find(node);
+
180 if (it != adjList.end()) {
+
181 for (auto child : it->second) {
+
182 // If state of child node is "not_visited", evaluate that child
+
183 // for presence of cycle.
+
184 auto state_of_child = (*state)[child];
+
185 if (state_of_child == not_visited) {
+
186 if (isCyclicDFSHelper(adjList, state, child)) {
+
187 return true;
+
188 }
+
189 } else if (state_of_child == in_stack) {
+
190 // If child node was "in_stack", then that means that there
+
191 // is a cycle in the graph. Return true for presence of the
+
192 // cycle.
+
193 return true;
+
194 }
+
195 }
+
196 }
+
197
+
198 // Current node has been evaluated for the presence of cycle and had no
+
199 // cycle. Mark current node as "visited".
+
200 (*state)[node] = visited;
+
201 // Return that current node didn't result in any cycles.
+
202 return false;
+
203 }
struct node { int data; int height; struct node *left; struct node *right;} node
for std::queue
Definition avltree.cpp:13
Here is the call graph for this function:
diff --git a/d3/dbb/kadanes3_8cpp__incl.map b/d3/dbb/kadanes3_8cpp__incl.map index f00df5ee7..7675d2001 100644 --- a/d3/dbb/kadanes3_8cpp__incl.map +++ b/d3/dbb/kadanes3_8cpp__incl.map @@ -1,11 +1,13 @@ - + - + - + - - - + + + + + diff --git a/d3/dbb/kadanes3_8cpp__incl.md5 b/d3/dbb/kadanes3_8cpp__incl.md5 index dd35aafd6..2bee3cdd3 100644 --- a/d3/dbb/kadanes3_8cpp__incl.md5 +++ b/d3/dbb/kadanes3_8cpp__incl.md5 @@ -1 +1 @@ -2853e3e0287877a0c88304a3b3f0ebe6 \ No newline at end of file +3163dfd62ad81ec4b4ed4dcc0bfcc2cb \ No newline at end of file diff --git a/d3/dbb/kadanes3_8cpp__incl.svg b/d3/dbb/kadanes3_8cpp__incl.svg index cd5f8ac55..c6dee1c77 100644 --- a/d3/dbb/kadanes3_8cpp__incl.svg +++ b/d3/dbb/kadanes3_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -others/kadanes3.cpp + +others/kadanes3.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -iostream + +cstdint @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +iostream + + + + + +Node1->Node6 + + + diff --git a/d3/dbb/kadanes3_8cpp__incl_org.svg b/d3/dbb/kadanes3_8cpp__incl_org.svg index 8caf3040a..b5b08e76e 100644 --- a/d3/dbb/kadanes3_8cpp__incl_org.svg +++ b/d3/dbb/kadanes3_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + others/kadanes3.cpp Node1 - -others/kadanes3.cpp + +others/kadanes3.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -iostream + +cstdint @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +iostream + + + + + +Node1->Node6 + + + diff --git a/d3/dcc/count__bits__flip_8cpp__incl.map b/d3/dcc/count__bits__flip_8cpp__incl.map index 53d335ec3..d093e7868 100644 --- a/d3/dcc/count__bits__flip_8cpp__incl.map +++ b/d3/dcc/count__bits__flip_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/d3/dcc/count__bits__flip_8cpp__incl.md5 b/d3/dcc/count__bits__flip_8cpp__incl.md5 index 421fa4d4d..4be17bca7 100644 --- a/d3/dcc/count__bits__flip_8cpp__incl.md5 +++ b/d3/dcc/count__bits__flip_8cpp__incl.md5 @@ -1 +1 @@ -db7caa113f953bd93d7f2cfdda744ab6 \ No newline at end of file +f620a9205930fbd2d725c6b93b2ce1db \ No newline at end of file diff --git a/d3/dcc/count__bits__flip_8cpp__incl.svg b/d3/dcc/count__bits__flip_8cpp__incl.svg index 8fea74275..4271d9107 100644 --- a/d3/dcc/count__bits__flip_8cpp__incl.svg +++ b/d3/dcc/count__bits__flip_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -bit_manipulation/count -_bits_flip.cpp + +bit_manipulation/count +_bits_flip.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d3/dcc/count__bits__flip_8cpp__incl_org.svg b/d3/dcc/count__bits__flip_8cpp__incl_org.svg index 8dbaa32d2..1180b5e30 100644 --- a/d3/dcc/count__bits__flip_8cpp__incl_org.svg +++ b/d3/dcc/count__bits__flip_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + bit_manipulation/count_bits_flip.cpp Node1 - -bit_manipulation/count -_bits_flip.cpp + +bit_manipulation/count +_bits_flip.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d3/df9/recursive__bubble__sort_8cpp.html b/d3/df9/recursive__bubble__sort_8cpp.html index 34b5af47e..2f74a68a4 100644 --- a/d3/df9/recursive__bubble__sort_8cpp.html +++ b/d3/df9/recursive__bubble__sort_8cpp.html @@ -113,15 +113,16 @@ $(function(){initNavTree('d3/df9/recursive__bubble__sort_8cpp.html','../../'); i

This is an implementation of a recursive version of the Bubble sort algorithm More...

-
#include <cassert>
+
#include <algorithm>
+#include <array>
+#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
-#include <array>
-#include <algorithm>
Include dependency graph for recursive_bubble_sort.cpp:
-
+

@@ -165,18 +166,18 @@ element). Disjoint sets uses cases : for finding connected components in a graph
Returns
0 on exit

< number of items

< object of class disjoint sets

-
205 {
-
206 uint64_t n = 10; ///< number of items
-
207 dsu d(n + 1); ///< object of class disjoint sets
-
208
-
209 test1(); // run 1st test case
-
210 test2(); // run 2nd test case
-
211
-
212 return 0;
-
213}
-
Disjoint sets union data structure, class based representation.
Definition dsu_path_compression.cpp:33
-
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:186
-
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:169
+
206 {
+
207 uint64_t n = 10; ///< number of items
+
208 dsu d(n + 1); ///< object of class disjoint sets
+
209
+
210 test1(); // run 1st test case
+
211 test2(); // run 2nd test case
+
212
+
213 return 0;
+
214}
+
Disjoint sets union data structure, class based representation.
Definition dsu_path_compression.cpp:34
+
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:187
+
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:170
Here is the call graph for this function:
@@ -212,19 +213,19 @@ Here is the call graph for this function:
Returns
void

< number of items

< object of class disjoint sets

-
169 {
-
170 // the minimum, maximum, and size of the set
-
171 uint64_t n = 10; ///< number of items
-
172 dsu d(n + 1); ///< object of class disjoint sets
-
173 // set 1
-
174 d.UnionSet(1, 2); // performs union operation on 1 and 2
-
175 d.UnionSet(1, 4); // performs union operation on 1 and 4
-
176 vector<uint64_t> ans = {1, 4, 3};
-
177 for (uint64_t i = 0; i < ans.size(); i++) {
-
178 assert(d.get(4).at(i) == ans[i]); // makes sure algorithm works fine
-
179 }
-
180 cout << "1st test passed!" << endl;
-
181}
+
170 {
+
171 // the minimum, maximum, and size of the set
+
172 uint64_t n = 10; ///< number of items
+
173 dsu d(n + 1); ///< object of class disjoint sets
+
174 // set 1
+
175 d.UnionSet(1, 2); // performs union operation on 1 and 2
+
176 d.UnionSet(1, 4); // performs union operation on 1 and 4
+
177 vector<uint64_t> ans = {1, 4, 3};
+
178 for (uint64_t i = 0; i < ans.size(); i++) {
+
179 assert(d.get(4).at(i) == ans[i]); // makes sure algorithm works fine
+
180 }
+
181 cout << "1st test passed!" << endl;
+
182}
#define endl
Definition matrix_exponentiation.cpp:36
@@ -263,20 +264,20 @@ Here is the call graph for this function:
Returns
void

< number of items

< object of class disjoint sets

-
186 {
-
187 // the minimum, maximum, and size of the set
-
188 uint64_t n = 10; ///< number of items
-
189 dsu d(n + 1); ///< object of class disjoint sets
-
190 // set 1
-
191 d.UnionSet(3, 5);
-
192 d.UnionSet(5, 6);
-
193 d.UnionSet(5, 7);
-
194 vector<uint64_t> ans = {3, 7, 4};
-
195 for (uint64_t i = 0; i < ans.size(); i++) {
-
196 assert(d.get(3).at(i) == ans[i]); // makes sure algorithm works fine
-
197 }
-
198 cout << "2nd test passed!" << endl;
-
199}
+
187 {
+
188 // the minimum, maximum, and size of the set
+
189 uint64_t n = 10; ///< number of items
+
190 dsu d(n + 1); ///< object of class disjoint sets
+
191 // set 1
+
192 d.UnionSet(3, 5);
+
193 d.UnionSet(5, 6);
+
194 d.UnionSet(5, 7);
+
195 vector<uint64_t> ans = {3, 7, 4};
+
196 for (uint64_t i = 0; i < ans.size(); i++) {
+
197 assert(d.get(3).at(i) == ans[i]); // makes sure algorithm works fine
+
198 }
+
199 cout << "2nd test passed!" << endl;
+
200}
Here is the call graph for this function:
diff --git a/d3/db3/lru__cache_8cpp.html b/d3/db3/lru__cache_8cpp.html index c3600cad6..397857c53 100644 --- a/d3/db3/lru__cache_8cpp.html +++ b/d3/db3/lru__cache_8cpp.html @@ -115,13 +115,14 @@ $(function(){initNavTree('d3/db3/lru__cache_8cpp.html','../../'); initResizable(

An implementation of LRU Cache. Lru is a part of cache algorithms (also frequently called cache replacement algorithms or cache replacement policies). More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <list>
#include <unordered_map>
Include dependency graph for lru_cache.cpp:
-
+

@@ -219,10 +220,10 @@ template<typename T >
Returns
void
-
148 {
-
149 // It's just to avoid writing cout and endl
-
150 std::cout << "[TESTS] : ---> " << msg << std::endl;
-
151}
+
149 {
+
150 // It's just to avoid writing cout and endl
+
151 std::cout << "[TESTS] : ---> " << msg << std::endl;
+
152}
T endl(T... args)
@@ -250,26 +251,26 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
251 {
- -
253
-
254 // Usage
- -
256 cache.refer(1);
-
257 cache.refer(2);
-
258 cache.refer(3);
-
259 cache.refer(4);
-
260 cache.refer(5);
+
252 {
+ +
254
+
255 // Usage
+ +
257 cache.refer(1);
+
258 cache.refer(2);
+
259 cache.refer(3);
+
260 cache.refer(4);
261 cache.refer(5);
-
262
-
263 cache.display();
-
264
-
265 std::cout << "Hits: " << cache.getHits()
-
266 << " Miss: " << cache.getPageFault() << std::endl;
-
267 return 0;
-
268}
-
LRU cache class.
Definition lru_cache.cpp:67
-
static void run_tests()
A function to invoke all test cases.
Definition lru_cache.cpp:238
+
262 cache.refer(5);
+
263
+
264 cache.display();
+
265
+
266 std::cout << "Hits: " << cache.getHits()
+
267 << " Miss: " << cache.getPageFault() << std::endl;
+
268 return 0;
+
269}
+
LRU cache class.
Definition lru_cache.cpp:68
+
static void run_tests()
A function to invoke all test cases.
Definition lru_cache.cpp:239
Here is the call graph for this function:
@@ -303,13 +304,13 @@ Here is the call graph for this function:

A function to invoke all test cases.

Returns
void
-
238 {
-
239 test_1();
-
240 test_2();
-
241 test_3();
-
242 log("");
-
243 log("TESTS COMPLETED!");
-
244}
+
239 {
+
240 test_1();
+
241 test_2();
+
242 test_3();
+
243 log("");
+
244 log("TESTS COMPLETED!");
+
245}
static void test_1()
Definition heavy_light_decomposition.cpp:505
static void test_2()
Definition heavy_light_decomposition.cpp:549
static void test_3()
Definition heavy_light_decomposition.cpp:592
@@ -347,26 +348,26 @@ Here is the call graph for this function:

A simple test case The assert statement will check expected hist and miss to resultant hits and miss.

Returns
void
-
159 {
-
160 uint64_t expected_hits = 2;
-
161 uint64_t expected_pageFault = 4;
-
162
-
163 log("Running Test-1...");
-
164
- -
166 cache.refer(1);
-
167 cache.refer(2);
-
168 cache.refer(5);
-
169 cache.refer(1);
-
170 cache.refer(4);
-
171 cache.refer(5);
-
172
-
173 log("Checking assert statement...");
-
174 assert(cache.getHits() == expected_hits &&
-
175 cache.getPageFault() == expected_pageFault);
-
176 log("Assert successful!");
-
177 log("Test-1 complete!");
-
178}
+
160 {
+
161 uint64_t expected_hits = 2;
+
162 uint64_t expected_pageFault = 4;
+
163
+
164 log("Running Test-1...");
+
165
+ +
167 cache.refer(1);
+
168 cache.refer(2);
+
169 cache.refer(5);
+
170 cache.refer(1);
+
171 cache.refer(4);
+
172 cache.refer(5);
+
173
+
174 log("Checking assert statement...");
+
175 assert(cache.getHits() == expected_hits &&
+
176 cache.getPageFault() == expected_pageFault);
+
177 log("Assert successful!");
+
178 log("Test-1 complete!");
+
179}
Here is the call graph for this function:
@@ -400,26 +401,26 @@ Here is the call graph for this function:

A test case contains hits more than cache size The assert statement will check expected hist and miss to resultant hits and miss.

Returns
void
-
186 {
-
187 uint64_t expected_hits = 4;
-
188 uint64_t expected_pageFault = 2;
-
189
-
190 log("Running Test-2...");
-
191
- -
193 cache.refer(1);
+
187 {
+
188 uint64_t expected_hits = 4;
+
189 uint64_t expected_pageFault = 2;
+
190
+
191 log("Running Test-2...");
+
192
+
194 cache.refer(1);
195 cache.refer(1);
196 cache.refer(1);
197 cache.refer(1);
-
198 cache.refer(5);
-
199
-
200 log("Checking assert statement...");
-
201 assert(cache.getHits() == expected_hits &&
-
202 cache.getPageFault() == expected_pageFault);
-
203 log("Assert successful!");
-
204 log("Test-2 complete!");
-
205}
+
198 cache.refer(1);
+
199 cache.refer(5);
+
200
+
201 log("Checking assert statement...");
+
202 assert(cache.getHits() == expected_hits &&
+
203 cache.getPageFault() == expected_pageFault);
+
204 log("Assert successful!");
+
205 log("Test-2 complete!");
+
206}
Here is the call graph for this function:
@@ -453,26 +454,26 @@ Here is the call graph for this function:

A simple test case The assert statement will check expected hist and miss to resultant hits and miss.

Returns
void
-
213 {
-
214 uint64_t expected_hits = 1;
-
215 uint64_t expected_pageFault = 5;
-
216
-
217 log("Running Test-3...");
-
218
- -
220 cache.refer(1);
-
221 cache.refer(2);
-
222 cache.refer(3);
-
223 cache.refer(4);
-
224 cache.refer(5);
+
214 {
+
215 uint64_t expected_hits = 1;
+
216 uint64_t expected_pageFault = 5;
+
217
+
218 log("Running Test-3...");
+
219
+ +
221 cache.refer(1);
+
222 cache.refer(2);
+
223 cache.refer(3);
+
224 cache.refer(4);
225 cache.refer(5);
-
226
-
227 log("Checking assert statement...");
-
228 assert(cache.getHits() == expected_hits &&
-
229 cache.getPageFault() == expected_pageFault);
-
230 log("Assert successful!");
-
231 log("Test-3 complete!");
-
232}
+
226 cache.refer(5);
+
227
+
228 log("Checking assert statement...");
+
229 assert(cache.getHits() == expected_hits &&
+
230 cache.getPageFault() == expected_pageFault);
+
231 log("Assert successful!");
+
232 log("Test-3 complete!");
+
233}
Here is the call graph for this function:
diff --git a/d3/dbb/class_cycle_check.html b/d3/dbb/class_cycle_check.html index e02e25053..7e835d658 100644 --- a/d3/dbb/class_cycle_check.html +++ b/d3/dbb/class_cycle_check.html @@ -160,7 +160,7 @@ Static Private Member Functions

-
160: uint8_t { not_visited = 0, in_stack, visited };
+
161: uint8_t { not_visited = 0, in_stack, visited };
@@ -196,56 +196,56 @@ Static Private Member Functions

- +

@@ -176,11 +177,11 @@ Algorithm

Main function.

Returns
0 on exit
-
146 {
-
147 test(); // run self-test implementations
-
148 return 0;
-
149}
-
static void test()
Self-test implementations.
Definition recursive_bubble_sort.cpp:95
+
155 {
+
156 test(); // run self-test implementations
+
157 return 0;
+
158}
+
static void test()
Self-test implementations.
Definition recursive_bubble_sort.cpp:105
Here is the call graph for this function:
@@ -214,58 +215,57 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
95 {
-
96 // 1st example. Creating an array of type `int`.
-
97 std::cout << "1st test using `int`\n";
-
98 const uint64_t size = 6;
- -
100 // populating the array
-
101 arr.push_back(22);
-
102 arr.push_back(46);
-
103 arr.push_back(94);
-
104 arr.push_back(12);
-
105 arr.push_back(37);
-
106 arr.push_back(63);
-
107 // array populating ends
-
108
- -
110 assert(std::is_sorted(std::begin(arr), std::end(arr)));
-
111 std::cout << " 1st test passed!\n";
-
112 // printing the array
-
113 for (uint64_t i = 0; i < size; i++) {
-
114 std::cout << arr[i] << ", ";
-
115 }
- -
117
-
118 // 2nd example. Creating an array of type `double`.
-
119 std::cout << "2nd test using doubles\n";
-
120 std::vector<double> double_arr;
-
121
-
122 // populating the array
-
123 double_arr.push_back(20.4);
-
124 double_arr.push_back(62.7);
-
125 double_arr.push_back(12.2);
-
126 double_arr.push_back(43.6);
-
127 double_arr.push_back(74.1);
-
128 double_arr.push_back(57.9);
-
129 // array populating ends
-
130
-
131 sorting::recursive_bubble_sort(&double_arr, size);
-
132 assert(std::is_sorted(std::begin(double_arr), std::end(double_arr)));
-
133 std::cout << " 2nd test passed!\n";
-
134 // printing the array
-
135 for (uint64_t i = 0; i < size; i++) {
-
136 std::cout << double_arr[i] << ", ";
-
137 }
- -
139
-
140}
+
105 {
+
106 // 1st example. Creating an array of type `int`.
+
107 std::cout << "1st test using `int`\n";
+
108 const uint64_t size = 6;
+ +
110 // populating the array
+
111 arr.push_back(22);
+
112 arr.push_back(46);
+
113 arr.push_back(94);
+
114 arr.push_back(12);
+
115 arr.push_back(37);
+
116 arr.push_back(63);
+
117 // array populating ends
+
118
+ +
120 assert(std::is_sorted(std::begin(arr), std::end(arr)));
+
121 std::cout << " 1st test passed!\n";
+
122 // printing the array
+
123 for (uint64_t i = 0; i < size; i++) {
+
124 std::cout << arr[i] << ", ";
+
125 }
+ +
127
+
128 // 2nd example. Creating an array of type `double`.
+
129 std::cout << "2nd test using doubles\n";
+
130 std::vector<double> double_arr;
+
131
+
132 // populating the array
+
133 double_arr.push_back(20.4);
+
134 double_arr.push_back(62.7);
+
135 double_arr.push_back(12.2);
+
136 double_arr.push_back(43.6);
+
137 double_arr.push_back(74.1);
+
138 double_arr.push_back(57.9);
+
139 // array populating ends
+
140
+
141 sorting::recursive_bubble_sort(&double_arr, size);
+
142 assert(std::is_sorted(std::begin(double_arr), std::end(double_arr)));
+
143 std::cout << " 2nd test passed!\n";
+
144 // printing the array
+
145 for (uint64_t i = 0; i < size; i++) {
+
146 std::cout << double_arr[i] << ", ";
+
147 }
+ +
149}
T begin(T... args)
T end(T... args)
T endl(T... args)
T is_sorted(T... args)
-
void recursive_bubble_sort(std::vector< T > *nums, uint64_t n)
This is an implementation of the recursive_bubble_sort. A vector is passed to the function which is t...
Definition recursive_bubble_sort.cpp:74
+
void recursive_bubble_sort(std::vector< T > *nums, uint64_t n)
This is an implementation of the recursive_bubble_sort. A vector is passed to the function which is t...
Definition recursive_bubble_sort.cpp:84
T push_back(T... args)
diff --git a/d3/dfe/perimeter_8cpp.html b/d3/dfe/perimeter_8cpp.html index 5dc3bcf01..2dc306b05 100644 --- a/d3/dfe/perimeter_8cpp.html +++ b/d3/dfe/perimeter_8cpp.html @@ -127,7 +127,7 @@ Include dependency graph for perimeter.cpp:

Namespaces

namespace  math
 for IO operations
 for assert
 
- + diff --git a/d4/d18/composite__simpson__rule_8cpp.html b/d4/d18/composite__simpson__rule_8cpp.html index 67bae9613..b4ebfb8d6 100644 --- a/d4/d18/composite__simpson__rule_8cpp.html +++ b/d4/d18/composite__simpson__rule_8cpp.html @@ -238,7 +238,7 @@ Functions
104 return evaluate_integral;
105}
T at(T... args)
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
int h(int key)
Definition hash_search.cpp:45
T insert(T... args)
diff --git a/d4/d26/durand__kerner__roots_8cpp__incl.map b/d4/d26/durand__kerner__roots_8cpp__incl.map index bf71b1625..e694b7578 100644 --- a/d4/d26/durand__kerner__roots_8cpp__incl.map +++ b/d4/d26/durand__kerner__roots_8cpp__incl.map @@ -1,21 +1,23 @@ - + - + - + - + - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/d4/d26/durand__kerner__roots_8cpp__incl.md5 b/d4/d26/durand__kerner__roots_8cpp__incl.md5 index 9df7d2e29..0a8ef2fde 100644 --- a/d4/d26/durand__kerner__roots_8cpp__incl.md5 +++ b/d4/d26/durand__kerner__roots_8cpp__incl.md5 @@ -1 +1 @@ -cac6ddeb8112feac143e4e69b4e6cfb8 \ No newline at end of file +b3701516f65ef32386452ebbb07ed41d \ No newline at end of file diff --git a/d4/d26/durand__kerner__roots_8cpp__incl.svg b/d4/d26/durand__kerner__roots_8cpp__incl.svg index 834c02172..70adfe080 100644 --- a/d4/d26/durand__kerner__roots_8cpp__incl.svg +++ b/d4/d26/durand__kerner__roots_8cpp__incl.svg @@ -47,7 +47,7 @@ @@ -59,9 +59,9 @@ var sectionId = 'dynsection-0'; Node1 - -numerical_methods/durand -_kerner_roots.cpp + +numerical_methods/durand +_kerner_roots.cpp @@ -78,8 +78,8 @@ var sectionId = 'dynsection-0'; Node1->Node2 - - + + @@ -96,8 +96,8 @@ var sectionId = 'dynsection-0'; Node1->Node3 - - + + @@ -114,8 +114,8 @@ var sectionId = 'dynsection-0'; Node1->Node4 - - + + @@ -132,8 +132,8 @@ var sectionId = 'dynsection-0'; Node1->Node5 - - + + @@ -141,8 +141,8 @@ var sectionId = 'dynsection-0'; Node6 - -cstdlib + +cstdint @@ -150,8 +150,8 @@ var sectionId = 'dynsection-0'; Node1->Node6 - - + + @@ -159,8 +159,8 @@ var sectionId = 'dynsection-0'; Node7 - -ctime + +cstdlib @@ -168,8 +168,8 @@ var sectionId = 'dynsection-0'; Node1->Node7 - - + + @@ -177,8 +177,8 @@ var sectionId = 'dynsection-0'; Node8 - -fstream + +ctime @@ -186,8 +186,8 @@ var sectionId = 'dynsection-0'; Node1->Node8 - - + + @@ -195,8 +195,8 @@ var sectionId = 'dynsection-0'; Node9 - -iostream + +fstream @@ -204,8 +204,8 @@ var sectionId = 'dynsection-0'; Node1->Node9 - - + + @@ -213,8 +213,8 @@ var sectionId = 'dynsection-0'; Node10 - -valarray + +iostream @@ -222,8 +222,26 @@ var sectionId = 'dynsection-0'; Node1->Node10 - - + + + + + + + +Node11 + + +valarray + + + + + +Node1->Node11 + + + diff --git a/d4/d26/durand__kerner__roots_8cpp__incl_org.svg b/d4/d26/durand__kerner__roots_8cpp__incl_org.svg index f212c75a7..c6d108a35 100644 --- a/d4/d26/durand__kerner__roots_8cpp__incl_org.svg +++ b/d4/d26/durand__kerner__roots_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + numerical_methods/durand_kerner_roots.cpp Node1 - -numerical_methods/durand -_kerner_roots.cpp + +numerical_methods/durand +_kerner_roots.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -cstdlib + +cstdint @@ -103,8 +103,8 @@ Node1->Node6 - - + + @@ -112,8 +112,8 @@ Node7 - -ctime + +cstdlib @@ -121,8 +121,8 @@ Node1->Node7 - - + + @@ -130,8 +130,8 @@ Node8 - -fstream + +ctime @@ -139,8 +139,8 @@ Node1->Node8 - - + + @@ -148,8 +148,8 @@ Node9 - -iostream + +fstream @@ -157,8 +157,8 @@ Node1->Node9 - - + + @@ -166,8 +166,8 @@ Node10 - -valarray + +iostream @@ -175,8 +175,26 @@ Node1->Node10 - - + + + + + + + +Node11 + + +valarray + + + + + +Node1->Node11 + + + diff --git a/d4/d2f/fcfs__scheduling_8cpp__incl.map b/d4/d2f/fcfs__scheduling_8cpp__incl.map index 4e0cbb3d9..5d07d077d 100644 --- a/d4/d2f/fcfs__scheduling_8cpp__incl.map +++ b/d4/d2f/fcfs__scheduling_8cpp__incl.map @@ -1,21 +1,23 @@ - + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/d4/d2f/fcfs__scheduling_8cpp__incl.md5 b/d4/d2f/fcfs__scheduling_8cpp__incl.md5 index c20c19f27..8eafc0d5e 100644 --- a/d4/d2f/fcfs__scheduling_8cpp__incl.md5 +++ b/d4/d2f/fcfs__scheduling_8cpp__incl.md5 @@ -1 +1 @@ -574160bb27e3ebdf5d382774d4a8ad38 \ No newline at end of file +cca3a95fa3f0ea01ce0fcbde556d97b8 \ No newline at end of file diff --git a/d4/d2f/fcfs__scheduling_8cpp__incl.svg b/d4/d2f/fcfs__scheduling_8cpp__incl.svg index 155a9d70d..560d79ac2 100644 --- a/d4/d2f/fcfs__scheduling_8cpp__incl.svg +++ b/d4/d2f/fcfs__scheduling_8cpp__incl.svg @@ -47,7 +47,7 @@ @@ -59,9 +59,9 @@ var sectionId = 'dynsection-0'; Node1 - -cpu_scheduling_algorithms -/fcfs_scheduling.cpp + +cpu_scheduling_algorithms +/fcfs_scheduling.cpp @@ -78,8 +78,8 @@ var sectionId = 'dynsection-0'; Node1->Node2 - - + + @@ -96,8 +96,8 @@ var sectionId = 'dynsection-0'; Node1->Node3 - - + + @@ -105,8 +105,8 @@ var sectionId = 'dynsection-0'; Node4 - -cstdlib + +cstdint @@ -114,8 +114,8 @@ var sectionId = 'dynsection-0'; Node1->Node4 - - + + @@ -123,8 +123,8 @@ var sectionId = 'dynsection-0'; Node5 - -ctime + +cstdlib @@ -132,8 +132,8 @@ var sectionId = 'dynsection-0'; Node1->Node5 - - + + @@ -141,8 +141,8 @@ var sectionId = 'dynsection-0'; Node6 - -iomanip + +ctime @@ -150,8 +150,8 @@ var sectionId = 'dynsection-0'; Node1->Node6 - - + + @@ -159,8 +159,8 @@ var sectionId = 'dynsection-0'; Node7 - -iostream + +iomanip @@ -168,8 +168,8 @@ var sectionId = 'dynsection-0'; Node1->Node7 - - + + @@ -177,8 +177,8 @@ var sectionId = 'dynsection-0'; Node8 - -queue + +iostream @@ -186,8 +186,8 @@ var sectionId = 'dynsection-0'; Node1->Node8 - - + + @@ -195,8 +195,8 @@ var sectionId = 'dynsection-0'; Node9 - -unordered_set + +queue @@ -204,8 +204,8 @@ var sectionId = 'dynsection-0'; Node1->Node9 - - + + @@ -213,8 +213,8 @@ var sectionId = 'dynsection-0'; Node10 - -vector + +unordered_set @@ -222,8 +222,26 @@ var sectionId = 'dynsection-0'; Node1->Node10 - - + + + + + + + +Node11 + + +vector + + + + + +Node1->Node11 + + + diff --git a/d4/d2f/fcfs__scheduling_8cpp__incl_org.svg b/d4/d2f/fcfs__scheduling_8cpp__incl_org.svg index 6e2af8051..87a526c5d 100644 --- a/d4/d2f/fcfs__scheduling_8cpp__incl_org.svg +++ b/d4/d2f/fcfs__scheduling_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + cpu_scheduling_algorithms/fcfs_scheduling.cpp Node1 - -cpu_scheduling_algorithms -/fcfs_scheduling.cpp + +cpu_scheduling_algorithms +/fcfs_scheduling.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -cstdlib + +cstdint @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -ctime + +cstdlib @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -iomanip + +ctime @@ -103,8 +103,8 @@ Node1->Node6 - - + + @@ -112,8 +112,8 @@ Node7 - -iostream + +iomanip @@ -121,8 +121,8 @@ Node1->Node7 - - + + @@ -130,8 +130,8 @@ Node8 - -queue + +iostream @@ -139,8 +139,8 @@ Node1->Node8 - - + + @@ -148,8 +148,8 @@ Node9 - -unordered_set + +queue @@ -157,8 +157,8 @@ Node1->Node9 - - + + @@ -166,8 +166,8 @@ Node10 - -vector + +unordered_set @@ -175,8 +175,26 @@ Node1->Node10 - - + + + + + + + +Node11 + + +vector + + + + + +Node1->Node11 + + + diff --git a/d4/d38/power__of__two_8cpp.html b/d4/d38/power__of__two_8cpp.html index 23391ab1f..01d3e3ca5 100644 --- a/d4/d38/power__of__two_8cpp.html +++ b/d4/d38/power__of__two_8cpp.html @@ -124,7 +124,7 @@ Include dependency graph for power_of_two.cpp:

Namespaces

- +

diff --git a/d4/d08/sha256_8cpp.html b/d4/d08/sha256_8cpp.html index 6f42a66ac..d8e910ffb 100644 --- a/d4/d08/sha256_8cpp.html +++ b/d4/d08/sha256_8cpp.html @@ -137,7 +137,7 @@ Classes

Namespaces

namespace  hashing
 Hashing algorithms.
 Used for assert.
 
namespace  SHA
 Functions for the SHA-1 algorithm implementation.
namespace  math
 for IO operations
 for assert
 

Detailed Description

for working with vectors

for io operations

-

for std::is_sorted

for returning multiple values form a function at once

+

header files

Sorting Algorithms.

+

for std::assert

for using std::vector

+

for assert

for std::vector

Sorting algorithms.

for algorithm functions for assert for IO operations

@@ -204,23 +206,23 @@ Functions

for std::is_sorted for assert for IO implementations for std::string for std::pair, std::swap for std::vector, std::vector::push_back, std::vector::size

for assert for typedef datatype uint64_t for IO operations

Sorting algorithms

-

for std::is_sorted, std::swap for assert for io operations

+

for std::is_sorted, std::swap for io operations for std::vector

Sorting algorithms

-

for std::is_sorted for assert for std::swap and io operations

+

for std::is_sorted for std::swap and io operations for std::vector

@breif Sorting algorithms

Sorting algorithms

for std::is_sorted for assert function in testing for std::cout and std::endl

Contains sorting algorithms

-

for std::is_sorted for std::assert for std::time for IO operations

+

for std::is_sorted for std::time for IO operations for std::vector

Sorting algorithms

for std::cout for std::vector for std::stack for std::is_sorted for assert

-

header files for collection of functions for a macro called assert which can be used to verify assumptions for io operations

+

for collection of functions for a macro called assert which can be used to verify assumptions for io operations for std::vector

Sorting algorithms

for std::is_sorted(), std::swap() for std::array for assert for initializing random number generator for IO operations

Sorting algorithms

-

for assert for IO operations for std::vector for std::array

+

for std::is_sorted for std::array for IO operations for std::vector

Sorting algorithms

-

for std::is_sorted for std::assert for IO operations

+

for std::is_sorted for IO operations for std::vector

for std::is_sorted for assert for std::swap and io operations

Sorting algorithms

for std::is_sorted, std::swap for assert for IO operations

@@ -1193,22 +1195,22 @@ template<typename T >

< base case; when size of the array is 1

< iterating over the entire array

< if a larger number appears before the smaller one, swap them.

-
74 {
-
75 if (n == 1) { //!< base case; when size of the array is 1
-
76 return;
-
77 }
-
78
-
79 for (uint64_t i = 0; i < n - 1; i++) { //!< iterating over the entire array
-
80 //!< if a larger number appears before the smaller one, swap them.
-
81 if ((*nums)[i] > (*nums)[i + 1]) {
-
82 std::swap((*nums)[i], (*nums)[i + 1]);
-
83 }
-
84 }
-
85
-
86 //!< calling the function after we have fixed the last element
-
87 recursive_bubble_sort(nums, n - 1);
-
88}
-
void recursive_bubble_sort(std::vector< T > *nums, uint64_t n)
This is an implementation of the recursive_bubble_sort. A vector is passed to the function which is t...
Definition recursive_bubble_sort.cpp:74
+
84 {
+
85 if (n == 1) { //!< base case; when size of the array is 1
+
86 return;
+
87 }
+
88
+
89 for (uint64_t i = 0; i < n - 1; i++) { //!< iterating over the entire array
+
90 //!< if a larger number appears before the smaller one, swap them.
+
91 if ((*nums)[i] > (*nums)[i + 1]) {
+
92 std::swap((*nums)[i], (*nums)[i + 1]);
+
93 }
+
94 }
+
95
+
96 //!< calling the function after we have fixed the last element
+
97 recursive_bubble_sort(nums, n - 1);
+
98}
+
void recursive_bubble_sort(std::vector< T > *nums, uint64_t n)
This is an implementation of the recursive_bubble_sort. A vector is passed to the function which is t...
Definition recursive_bubble_sort.cpp:84
Here is the call graph for this function:
@@ -1235,27 +1237,27 @@ Here is the call graph for this function:

@@ -277,7 +277,7 @@ Here is the call graph for this function:
93}
T endl(T... args)
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/d4/d48/hamming__distance_8cpp.html b/d4/d48/hamming__distance_8cpp.html index 2e4500d97..a602d5f11 100644 --- a/d4/d48/hamming__distance_8cpp.html +++ b/d4/d48/hamming__distance_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d4/d48/hamming__distance_8cpp.html','../../'); initRes

Returns the Hamming distance between two integers. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for hamming_distance.cpp:
-
+
- + @@ -171,16 +172,16 @@ Functions
Returns
the number of set bits in the given number.
-
34 {
-
35 uint64_t count = 0;
-
36 while (value) { // until all bits are zero
-
37 if (value & 1) { // check lower bit
-
38 count++;
-
39 }
-
40 value >>= 1; // shift bits, removing lower bit
-
41 }
-
42 return count;
-
43}
+
35 {
+
36 uint64_t count = 0;
+
37 while (value) { // until all bits are zero
+
38 if (value & 1) { // check lower bit
+
39 count++;
+
40 }
+
41 value >>= 1; // shift bits, removing lower bit
+
42 }
+
43 return count;
+
44}
Here is the call graph for this function:
@@ -215,15 +216,15 @@ Here is the call graph for this function:
Returns
the number of characters differing between the two strings.
-
59 {
-
60 assert(a.size() == b.size());
-
61 size_t n = a.size();
-
62 uint64_t count = 0;
-
63 for (size_t i = 0; i < n; i++) {
-
64 count += (b[i] != a[i]);
-
65 }
-
66 return count;
-
67}
+
60 {
+
61 assert(a.size() == b.size());
+
62 size_t n = a.size();
+
63 uint64_t count = 0;
+
64 for (size_t i = 0; i < n; i++) {
+
65 count += (b[i] != a[i]);
+
66 }
+
67 return count;
+
68}
T size(T... args)
Here is the call graph for this function:
@@ -259,8 +260,8 @@ Here is the call graph for this function:
Returns
the number of bits differing between the two integers.
-
51{ return bitCount(a ^ b); }
-
uint64_t bitCount(uint64_t value)
Definition hamming_distance.cpp:34
+
52{ return bitCount(a ^ b); }
+
uint64_t bitCount(uint64_t value)
Definition hamming_distance.cpp:35
Here is the call graph for this function:
@@ -286,19 +287,19 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
99 {
-
100 test(); // execute the tests
-
101 uint64_t a = 11; // 1011 in binary
-
102 uint64_t b = 2; // 0010 in binary
-
103
-
104 std::cout << "Hamming distance between " << a << " and " << b << " is "
- -
106 << std::endl;
-
107}
+
100 {
+
101 test(); // execute the tests
+
102 uint64_t a = 11; // 1011 in binary
+
103 uint64_t b = 2; // 0010 in binary
+
104
+
105 std::cout << "Hamming distance between " << a << " and " << b << " is "
+ +
107 << std::endl;
+
108}
T endl(T... args)
-
static void test()
Function to the test hamming distance.
Definition hamming_distance.cpp:75
-
uint64_t hamming_distance(uint64_t a, uint64_t b)
Definition hamming_distance.cpp:51
+
static void test()
Function to the test hamming distance.
Definition hamming_distance.cpp:76
+
uint64_t hamming_distance(uint64_t a, uint64_t b)
Definition hamming_distance.cpp:52
Here is the call graph for this function:
@@ -332,25 +333,25 @@ Here is the call graph for this function:

Function to the test hamming distance.

Returns
void
-
75 {
-
76 assert(bit_manipulation::hamming_distance::hamming_distance(11, 2) == 2);
-
77 assert(bit_manipulation::hamming_distance::hamming_distance(2, 0) == 1);
-
78 assert(bit_manipulation::hamming_distance::hamming_distance(11, 0) == 3);
-
79
-
80 assert(bit_manipulation::hamming_distance::hamming_distance("1101",
-
81 "1111") == 1);
-
82 assert(bit_manipulation::hamming_distance::hamming_distance("1111",
-
83 "1111") == 0);
-
84 assert(bit_manipulation::hamming_distance::hamming_distance("0000",
-
85 "1111") == 4);
-
86
-
87 assert(bit_manipulation::hamming_distance::hamming_distance("alpha",
-
88 "alphb") == 1);
-
89 assert(bit_manipulation::hamming_distance::hamming_distance("abcd",
-
90 "abcd") == 0);
-
91 assert(bit_manipulation::hamming_distance::hamming_distance("dcba",
-
92 "abcd") == 4);
-
93}
+
76 {
+
77 assert(bit_manipulation::hamming_distance::hamming_distance(11, 2) == 2);
+
78 assert(bit_manipulation::hamming_distance::hamming_distance(2, 0) == 1);
+
79 assert(bit_manipulation::hamming_distance::hamming_distance(11, 0) == 3);
+
80
+
81 assert(bit_manipulation::hamming_distance::hamming_distance("1101",
+
82 "1111") == 1);
+
83 assert(bit_manipulation::hamming_distance::hamming_distance("1111",
+
84 "1111") == 0);
+
85 assert(bit_manipulation::hamming_distance::hamming_distance("0000",
+
86 "1111") == 4);
+
87
+
88 assert(bit_manipulation::hamming_distance::hamming_distance("alpha",
+
89 "alphb") == 1);
+
90 assert(bit_manipulation::hamming_distance::hamming_distance("abcd",
+
91 "abcd") == 0);
+
92 assert(bit_manipulation::hamming_distance::hamming_distance("dcba",
+
93 "abcd") == 4);
+
94}
diff --git a/d4/d8d/jarvis__algorithm_8cpp.html b/d4/d8d/jarvis__algorithm_8cpp.html index 2579233ef..08802f48b 100644 --- a/d4/d8d/jarvis__algorithm_8cpp.html +++ b/d4/d8d/jarvis__algorithm_8cpp.html @@ -133,7 +133,7 @@ Classes
- + diff --git a/d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html b/d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html index 2008cd28b..8bb63553e 100644 --- a/d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html +++ b/d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html @@ -115,19 +115,20 @@ $(function(){initNavTree('d4/d8f/travelling__salesman__using__bit__manipulation_ More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <iostream>
#include <limits>
#include <vector>
Include dependency graph for travelling_salesman_using_bit_manipulation.cpp:
-
+

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 
namespace  hamming_distance
 Functions for Hamming distance implementation.

Namespaces

namespace  geometry
 for std::vector
 for std::swap
 
namespace  jarvis
 Functions for Jarvis’s algorithm.
- + @@ -169,11 +170,11 @@ Functions

Main function.

Returns
0 on exit
-
138 {
-
139 test(); // run self-test implementations
-
140 return 0;
-
141}
-
static void test()
Self-test implementations.
Definition travelling_salesman_using_bit_manipulation.cpp:99
+
139 {
+
140 test(); // run self-test implementations
+
141 return 0;
+
142}
+
static void test()
Self-test implementations.
Definition travelling_salesman_using_bit_manipulation.cpp:100
Here is the call graph for this function:
@@ -207,44 +208,44 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
99 {
-
100 // 1st test-case
- -
102 {0, 20, 42, 35}, {20, 0, 30, 34}, {42, 30, 0, 12}, {35, 34, 12, 0}};
-
103 uint32_t V = dist.size();
- -
105 assert(bit_manipulation::travelling_salesman_using_bit_manipulation::
- -
107 97);
-
108 std::cout << "1st test-case: passed!"
-
109 << "\n";
-
110
-
111 // 2nd test-case
-
112 dist = {{0, 5, 10, 15}, {5, 0, 20, 30}, {10, 20, 0, 35}, {15, 30, 35, 0}};
-
113 V = dist.size();
- -
115 std::vector<uint32_t>(V, -1));
-
116 assert(bit_manipulation::travelling_salesman_using_bit_manipulation::
-
117 travelling_salesman_using_bit_manipulation(dist, 1, 0, V, dp1) ==
-
118 75);
-
119 std::cout << "2nd test-case: passed!"
-
120 << "\n";
-
121 // 3rd test-case
-
122 dist = {{0, 10, 15, 20}, {10, 0, 35, 25}, {15, 35, 0, 30}, {20, 25, 30, 0}};
-
123 V = dist.size();
- -
125 std::vector<uint32_t>(V, -1));
-
126 assert(bit_manipulation::travelling_salesman_using_bit_manipulation::
-
127 travelling_salesman_using_bit_manipulation(dist, 1, 0, V, dp2) ==
-
128 80);
-
129
-
130 std::cout << "3rd test-case: passed!"
-
131 << "\n";
-
132}
+
100 {
+
101 // 1st test-case
+ +
103 {0, 20, 42, 35}, {20, 0, 30, 34}, {42, 30, 0, 12}, {35, 34, 12, 0}};
+
104 uint32_t V = dist.size();
+ +
106 assert(bit_manipulation::travelling_salesman_using_bit_manipulation::
+ +
108 97);
+
109 std::cout << "1st test-case: passed!"
+
110 << "\n";
+
111
+
112 // 2nd test-case
+
113 dist = {{0, 5, 10, 15}, {5, 0, 20, 30}, {10, 20, 0, 35}, {15, 30, 35, 0}};
+
114 V = dist.size();
+ +
116 std::vector<uint32_t>(V, -1));
+
117 assert(bit_manipulation::travelling_salesman_using_bit_manipulation::
+
118 travelling_salesman_using_bit_manipulation(dist, 1, 0, V, dp1) ==
+
119 75);
+
120 std::cout << "2nd test-case: passed!"
+
121 << "\n";
+
122 // 3rd test-case
+
123 dist = {{0, 10, 15, 20}, {10, 0, 35, 25}, {15, 35, 0, 30}, {20, 25, 30, 0}};
+
124 V = dist.size();
+ +
126 std::vector<uint32_t>(V, -1));
+
127 assert(bit_manipulation::travelling_salesman_using_bit_manipulation::
+
128 travelling_salesman_using_bit_manipulation(dist, 1, 0, V, dp2) ==
+
129 80);
+
130
+
131 std::cout << "3rd test-case: passed!"
+
132 << "\n";
+
133}
for std::vector
Definition partition_problem.cpp:39
T size(T... args)
-
std::uint64_t travelling_salesman_using_bit_manipulation(std::vector< std::vector< uint32_t > > dist, std::uint64_t setOfCities, std::uint64_t city, std::uint64_t n, std::vector< std::vector< uint32_t > > &dp)
The function implements travellingSalesman using bitmanipulation.
Definition travelling_salesman_using_bit_manipulation.cpp:52
+
std::uint64_t travelling_salesman_using_bit_manipulation(std::vector< std::vector< uint32_t > > dist, std::uint64_t setOfCities, std::uint64_t city, std::uint64_t n, std::vector< std::vector< uint32_t > > &dp)
The function implements travellingSalesman using bitmanipulation.
Definition travelling_salesman_using_bit_manipulation.cpp:53
Here is the call graph for this function:
@@ -300,34 +301,34 @@ Here is the call graph for this function:
Returns
minimum cost of traversing whole nodes/cities from starting point back to starting point
-
64{
-
65 // base case;
-
66 if (setOfCities == (1 << n) - 1) { // we have covered all the cities
-
67 return dist[city][0]; // return the cost from the current city to the
-
68 // original city.
-
69 }
-
70
-
71 if (dp[setOfCities][city] != -1) {
-
72 return dp[setOfCities][city];
-
73 }
-
74 // otherwise try all possible options
-
75 uint64_t ans = 2147483647;
-
76 for (int choice = 0; choice < n; choice++) {
-
77 // check if the city is visited or not.
-
78 if ((setOfCities & (1 << choice)) ==
-
79 0) { // this means that this perticular city is not visited.
-
80 std::uint64_t subProb =
-
81 dist[city][choice] +
- -
83 dist, setOfCities | (1 << choice), choice, n, dp);
-
84 // Here we are doing a recursive call to tsp with the updated set of
-
85 // city/node and choice which tells that where we are currently.
-
86 ans = std::min(ans, subProb);
-
87 }
-
88 }
-
89 dp[setOfCities][city] = ans;
-
90 return ans;
-
91}
+
65{
+
66 // base case;
+
67 if (setOfCities == (1 << n) - 1) { // we have covered all the cities
+
68 return dist[city][0]; // return the cost from the current city to the
+
69 // original city.
+
70 }
+
71
+
72 if (dp[setOfCities][city] != -1) {
+
73 return dp[setOfCities][city];
+
74 }
+
75 // otherwise try all possible options
+
76 uint64_t ans = 2147483647;
+
77 for (int choice = 0; choice < n; choice++) {
+
78 // check if the city is visited or not.
+
79 if ((setOfCities & (1 << choice)) ==
+
80 0) { // this means that this perticular city is not visited.
+
81 std::uint64_t subProb =
+
82 dist[city][choice] +
+ +
84 dist, setOfCities | (1 << choice), choice, n, dp);
+
85 // Here we are doing a recursive call to tsp with the updated set of
+
86 // city/node and choice which tells that where we are currently.
+
87 ans = std::min(ans, subProb);
+
88 }
+
89 }
+
90 dp[setOfCities][city] = ans;
+
91 return ans;
+
92}
T min(T... args)
diff --git a/d4/d9d/sum__of__binomial__coefficient_8cpp.html b/d4/d9d/sum__of__binomial__coefficient_8cpp.html index 15334853b..3fc64218f 100644 --- a/d4/d9d/sum__of__binomial__coefficient_8cpp.html +++ b/d4/d9d/sum__of__binomial__coefficient_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d4/d9d/sum__of__binomial__coefficient_8cpp.html','../.

Algorithm to find sum of binomial coefficients of a given positive integer. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for sum_of_binomial_coefficient.cpp:
-
+

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 
namespace  travellingSalesman_bitmanipulation
 Functions for the Travelling Salesman Bitmask implementation.
- +

Namespaces

namespace  math
 for IO operations
 for assert
 

Main function.

Returns
0 on exit
-
63 {
-
64 test(); // execute the tests
-
65 return 0;
-
66}
-
static void test()
Definition sum_of_binomial_coefficient.cpp:37
+
64 {
+
65 test(); // execute the tests
+
66 return 0;
+
67}
+
static void test()
Definition sum_of_binomial_coefficient.cpp:38
Here is the call graph for this function:
@@ -195,30 +196,30 @@ Here is the call graph for this function:

@@ -159,11 +160,11 @@ Functions

Function for testing binomialCoeffSum function. test cases and assert statement.

Returns
void
-
37 {
-
38 int test_case_1 = math::binomialCoeffSum(2);
-
39 assert(test_case_1 == 4);
-
40 std::cout << "Test_case_1 Passed!" << std::endl;
-
41
-
42 int test_case_2 = math::binomialCoeffSum(3);
-
43 assert(test_case_2 == 8);
-
44 std::cout << "Test_case_2 Passed!" << std::endl;
-
45
-
46 int test_case_3 = math::binomialCoeffSum(4);
-
47 assert(test_case_3 == 16);
-
48 std::cout << "Test_case_3 Passed!" << std::endl;
-
49
-
50 int test_case_4 = math::binomialCoeffSum(5);
-
51 assert(test_case_4 == 32);
-
52 std::cout << "Test_case_4 Passed!" << std::endl;
-
53
-
54 int test_case_5 = math::binomialCoeffSum(7);
-
55 assert(test_case_5 == 128);
-
56 std::cout << "Test_case_5 Passed!" << std::endl;
-
57}
+
38 {
+
39 int test_case_1 = math::binomialCoeffSum(2);
+
40 assert(test_case_1 == 4);
+
41 std::cout << "Test_case_1 Passed!" << std::endl;
+
42
+
43 int test_case_2 = math::binomialCoeffSum(3);
+
44 assert(test_case_2 == 8);
+
45 std::cout << "Test_case_2 Passed!" << std::endl;
+
46
+
47 int test_case_3 = math::binomialCoeffSum(4);
+
48 assert(test_case_3 == 16);
+
49 std::cout << "Test_case_3 Passed!" << std::endl;
+
50
+
51 int test_case_4 = math::binomialCoeffSum(5);
+
52 assert(test_case_4 == 32);
+
53 std::cout << "Test_case_4 Passed!" << std::endl;
+
54
+
55 int test_case_5 = math::binomialCoeffSum(7);
+
56 assert(test_case_5 == 128);
+
57 std::cout << "Test_case_5 Passed!" << std::endl;
+
58}
T endl(T... args)
-
uint64_t binomialCoeffSum(uint64_t n)
Definition sum_of_binomial_coefficient.cpp:26
+
uint64_t binomialCoeffSum(uint64_t n)
Definition sum_of_binomial_coefficient.cpp:27
Here is the call graph for this function:
diff --git a/d4/d9f/selection__sort__recursive_8cpp.html b/d4/d9f/selection__sort__recursive_8cpp.html index 0fa0fdd44..078e0f832 100644 --- a/d4/d9f/selection__sort__recursive_8cpp.html +++ b/d4/d9f/selection__sort__recursive_8cpp.html @@ -115,12 +115,13 @@ $(function(){initNavTree('d4/d9f/selection__sort__recursive_8cpp.html','../../') More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for selection_sort_recursive.cpp:
-
+

Main function.

Returns
0 on exit
-
75{
-
76 test(); // execute the tests
-
77 return 0;
-
78}
-
static void test()
Function for testing largestPower function. test cases and assert statement.
Definition largest_power.cpp:47
+
74 {
+
75 test(); // execute the tests
+
76 return 0;
+
77}
+
static void test()
Function for testing largestPower function. test cases and assert statement.
Definition largest_power.cpp:48
Here is the call graph for this function:
@@ -199,30 +203,30 @@ Here is the call graph for this function:

Function for testing largestPower function. test cases and assert statement.

Returns
void
-
48{
-
49 uint8_t test_case_1 = math::largestPower(5,2);
-
50 assert(test_case_1==3);
-
51 std::cout<<"Test 1 Passed!"<<std::endl;
-
52
-
53 uint16_t test_case_2 = math::largestPower(10,3);
-
54 assert(test_case_2==4);
-
55 std::cout<<"Test 2 Passed!"<<std::endl;
-
56
-
57 uint32_t test_case_3 = math::largestPower(25,5);
-
58 assert(test_case_3==6);
-
59 std::cout<<"Test 3 Passed!"<<std::endl;
-
60
-
61 uint32_t test_case_4 = math::largestPower(27,2);
-
62 assert(test_case_4==23);
-
63 std::cout<<"Test 4 Passed!"<<std::endl;
-
64
-
65 uint16_t test_case_5 = math::largestPower(7,3);
-
66 assert(test_case_5==2);
-
67 std::cout<<"Test 5 Passed!"<<std::endl;
-
68}
+
48 {
+
49 uint8_t test_case_1 = math::largestPower(5, 2);
+
50 assert(test_case_1 == 3);
+
51 std::cout << "Test 1 Passed!" << std::endl;
+
52
+
53 uint16_t test_case_2 = math::largestPower(10, 3);
+
54 assert(test_case_2 == 4);
+
55 std::cout << "Test 2 Passed!" << std::endl;
+
56
+
57 uint32_t test_case_3 = math::largestPower(25, 5);
+
58 assert(test_case_3 == 6);
+
59 std::cout << "Test 3 Passed!" << std::endl;
+
60
+
61 uint32_t test_case_4 = math::largestPower(27, 2);
+
62 assert(test_case_4 == 23);
+
63 std::cout << "Test 4 Passed!" << std::endl;
+
64
+
65 uint16_t test_case_5 = math::largestPower(7, 3);
+
66 assert(test_case_5 == 2);
+
67 std::cout << "Test 5 Passed!" << std::endl;
+
68}
T endl(T... args)
-
uint64_t largestPower(uint32_t n, const uint16_t &p)
Function to calculate largest power.
Definition largest_power.cpp:26
+
uint64_t largestPower(uint32_t n, const uint16_t &p)
Function to calculate largest power.
Definition largest_power.cpp:29
Here is the call graph for this function:
diff --git a/d5/d83/lcm__sum_8cpp.html b/d5/d83/lcm__sum_8cpp.html index fcda3fc65..215a3327c 100644 --- a/d5/d83/lcm__sum_8cpp.html +++ b/d5/d83/lcm__sum_8cpp.html @@ -115,18 +115,19 @@ $(function(){initNavTree('d5/d83/lcm__sum_8cpp.html','../../'); initResizable(tr \mathrm{LCM}(2,n) + \ldots + \mathrm{LCM}(n,n)\). More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for lcm_sum.cpp:
-
+

@@ -193,17 +194,17 @@ template<typename T >
Returns
index of the minimum element
-
56 {
-
57 if (current_position + 1 == in_arr.size()) {
-
58 return current_position;
-
59 }
-
60 uint64_t answer = findMinIndex(in_arr, current_position + 1);
-
61 if (in_arr[current_position] < in_arr[answer]) {
-
62 answer = current_position;
-
63 }
-
64 return answer;
-
65}
-
uint64_t findMinIndex(const std::vector< T > &in_arr, uint64_t current_position=0)
The main function finds the index of the minimum element.
Definition selection_sort_recursive.cpp:55
+
57 {
+
58 if (current_position + 1 == in_arr.size()) {
+
59 return current_position;
+
60 }
+
61 uint64_t answer = findMinIndex(in_arr, current_position + 1);
+
62 if (in_arr[current_position] < in_arr[answer]) {
+
63 answer = current_position;
+
64 }
+
65 return answer;
+
66}
+
uint64_t findMinIndex(const std::vector< T > &in_arr, uint64_t current_position=0)
The main function finds the index of the minimum element.
Definition selection_sort_recursive.cpp:56
T size(T... args)
Here is the call graph for this function:
@@ -230,11 +231,11 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
129 {
-
130 test(); // run self-test implementations
-
131 return 0;
-
132}
-
static void test()
Self-test implementations.
Definition selection_sort_recursive.cpp:94
+
130 {
+
131 test(); // run self-test implementations
+
132 return 0;
+
133}
+
static void test()
Self-test implementations.
Definition selection_sort_recursive.cpp:95
Here is the call graph for this function:
@@ -279,18 +280,18 @@ template<typename T >
Returns
void
-
76 {
-
77 if (current_position == in_arr.size()) {
-
78 return;
-
79 }
-
80 uint64_t min_element_idx =
-
81 selection_sort_recursive::findMinIndex(in_arr, current_position);
-
82 if (min_element_idx != current_position) {
-
83 std::swap(in_arr[min_element_idx], in_arr[current_position]);
-
84 }
-
85 selectionSortRecursive(in_arr, current_position + 1);
-
86}
-
void selectionSortRecursive(std::vector< T > &in_arr, uint64_t current_position=0)
The main function implements Selection sort.
Definition selection_sort_recursive.cpp:75
+
77 {
+
78 if (current_position == in_arr.size()) {
+
79 return;
+
80 }
+
81 uint64_t min_element_idx =
+
82 selection_sort_recursive::findMinIndex(in_arr, current_position);
+
83 if (min_element_idx != current_position) {
+
84 std::swap(in_arr[min_element_idx], in_arr[current_position]);
+
85 }
+
86 selectionSortRecursive(in_arr, current_position + 1);
+
87}
+
void selectionSortRecursive(std::vector< T > &in_arr, uint64_t current_position=0)
The main function implements Selection sort.
Definition selection_sort_recursive.cpp:76
T swap(T... args)
Here is the call graph for this function:
@@ -325,36 +326,36 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
94 {
-
95 // 1st test
-
96 // [1, 0, 2, 1] return [0, 1, 1, 2]
-
97 std::vector<uint64_t> array1 = {0, 1, 1, 2};
-
98 std::cout << "1st test... ";
- -
100 assert(std::is_sorted(std::begin(array1), std::end(array1)));
-
101 std::cout << "passed" << std::endl;
-
102 // 2nd test
-
103 // [1, 0, 0, 1, 1, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2]
-
104 std::vector<uint64_t> array2 = {1, 0, 0, 1, 1, 0, 2, 1};
-
105 std::cout << "2nd test... ";
- -
107 assert(std::is_sorted(std::begin(array2), std::end(array2)));
-
108 std::cout << "passed" << std::endl;
-
109 // 3rd test
-
110 // [1, 1, 0, 0, 1, 2, 2, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]
-
111 std::vector<uint64_t> array3 = {1, 1, 0, 0, 1, 2, 2, 0, 2, 1};
-
112 std::cout << "3rd test... ";
- -
114 assert(std::is_sorted(std::begin(array3), std::end(array3)));
-
115 std::cout << "passed" << std::endl;
-
116 // 4th test
-
117 // [2, 2, 2, 0, 0, 1, 1] return [0, 0, 1, 1, 2, 2, 2]
-
118 std::vector<uint64_t> array4 = {2, 2, 2, 0, 0, 1, 1};
-
119 std::cout << "4th test... ";
- -
121 assert(std::is_sorted(std::begin(array4), std::end(array4)));
-
122 std::cout << "passed" << std::endl;
-
123}
+
95 {
+
96 // 1st test
+
97 // [1, 0, 2, 1] return [0, 1, 1, 2]
+
98 std::vector<uint64_t> array1 = {0, 1, 1, 2};
+
99 std::cout << "1st test... ";
+ +
101 assert(std::is_sorted(std::begin(array1), std::end(array1)));
+
102 std::cout << "passed" << std::endl;
+
103 // 2nd test
+
104 // [1, 0, 0, 1, 1, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2]
+
105 std::vector<uint64_t> array2 = {1, 0, 0, 1, 1, 0, 2, 1};
+
106 std::cout << "2nd test... ";
+ +
108 assert(std::is_sorted(std::begin(array2), std::end(array2)));
+
109 std::cout << "passed" << std::endl;
+
110 // 3rd test
+
111 // [1, 1, 0, 0, 1, 2, 2, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]
+
112 std::vector<uint64_t> array3 = {1, 1, 0, 0, 1, 2, 2, 0, 2, 1};
+
113 std::cout << "3rd test... ";
+ +
115 assert(std::is_sorted(std::begin(array3), std::end(array3)));
+
116 std::cout << "passed" << std::endl;
+
117 // 4th test
+
118 // [2, 2, 2, 0, 0, 1, 1] return [0, 0, 1, 1, 2, 2, 2]
+
119 std::vector<uint64_t> array4 = {2, 2, 2, 0, 0, 1, 1};
+
120 std::cout << "4th test... ";
+ +
122 assert(std::is_sorted(std::begin(array4), std::end(array4)));
+
123 std::cout << "passed" << std::endl;
+
124}
T begin(T... args)
T end(T... args)
diff --git a/d4/dd2/namespacequadratic__probing.html b/d4/dd2/namespacequadratic__probing.html index c05553e92..0eb3881bf 100644 --- a/d4/dd2/namespacequadratic__probing.html +++ b/d4/dd2/namespacequadratic__probing.html @@ -239,7 +239,7 @@ Here is the call graph for this function:
217}
T endl(T... args)
-
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:37
+
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:38
Here is the call graph for this function:
@@ -459,7 +459,7 @@ Here is the call graph for this function:
96 } while (entry.key != notPresent);
97 return notPresent;
98}
-
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:287
+
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:288
bool putProber(const Entry &entry, int key)
Definition double_hash_hash_table.cpp:120
T pow(T... args)
T round(T... args)
diff --git a/d4/def/kohonen__som__topology_8cpp.html b/d4/def/kohonen__som__topology_8cpp.html index 4e05bbe9b..f54577003 100644 --- a/d4/def/kohonen__som__topology_8cpp.html +++ b/d4/def/kohonen__som__topology_8cpp.html @@ -335,7 +335,7 @@ Here is the call graph for this function:
399 save_u_matrix("w12.csv", W); // save the resultant weights
400}
double k(double x)
Another test function.
Definition composite_simpson_rule.cpp:117
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
int save_2d_data(const char *fname, const std::vector< std::valarray< double > > &X)
Definition kohonen_som_topology.cpp:65
double _random(double a, double b)
Definition kohonen_som_topology.cpp:53
void test_2d_classes(std::vector< std::valarray< double > > *data)
Definition kohonen_som_topology.cpp:330
diff --git a/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html b/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html index 0f2236029..edb19791a 100644 --- a/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html +++ b/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d5/d1e/next__higher__number__with__same__number__of__s

[Next higher number with same number of set bits] (https://www.geeksforgeeks.org/next-higher-number-with-same-number-of-set-bits/) implementation More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for next_higher_number_with_same_number_of_set_bits.cpp:
-
+
- +

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 

Main function.

Returns
0 on exit
-
97 {
-
98 test(); // run self-test implementations
-
99 return 0;
-
100}
-
static void test()
Self-test implementations.
Definition next_higher_number_with_same_number_of_set_bits.cpp:73
+
98 {
+
99 test(); // run self-test implementations
+
100 return 0;
+
101}
+
static void test()
Self-test implementations.
Definition next_higher_number_with_same_number_of_set_bits.cpp:74
Here is the call graph for this function:
@@ -199,29 +200,29 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
73 {
-
74 // x = 4 return 8
- -
76 // x = 6 return 9
- -
78 // x = 13 return 14
- -
80 // x = 64 return 128
-
81 assert(bit_manipulation::next_higher_number(64) == 128);
-
82 // x = 15 return 23
- -
84 // x= 32 return 64
- -
86 // x = 97 return 98
- -
88 // x = 1024 return 2048
-
89 assert(bit_manipulation::next_higher_number(1024) == 2048);
-
90
-
91 std::cout << "All test cases have successfully passed!" << std::endl;
-
92}
+
74 {
+
75 // x = 4 return 8
+ +
77 // x = 6 return 9
+ +
79 // x = 13 return 14
+ +
81 // x = 64 return 128
+
82 assert(bit_manipulation::next_higher_number(64) == 128);
+
83 // x = 15 return 23
+ +
85 // x= 32 return 64
+ +
87 // x = 97 return 98
+ +
89 // x = 1024 return 2048
+
90 assert(bit_manipulation::next_higher_number(1024) == 2048);
+
91
+
92 std::cout << "All test cases have successfully passed!" << std::endl;
+
93}
T endl(T... args)
-
uint64_t next_higher_number(uint64_t x)
The main function implements checking the next number.
Definition next_higher_number_with_same_number_of_set_bits.cpp:32
+
uint64_t next_higher_number(uint64_t x)
The main function implements checking the next number.
Definition next_higher_number_with_same_number_of_set_bits.cpp:33
Here is the call graph for this function:
diff --git a/d5/d3c/namespacedata__structures.html b/d5/d3c/namespacedata__structures.html index bbd546ec0..3ad71ada8 100644 --- a/d5/d3c/namespacedata__structures.html +++ b/d5/d3c/namespacedata__structures.html @@ -173,7 +173,6 @@ constexpr float 

@@ -161,11 +162,11 @@ Functions

PROBABILIT

Detailed Description

for IO operations

for std::vector

-

For IO operations.

Stack Data Structure Using the Queue Data Structure.

For std::out_of_range.

Data-structure algorithms.

@@ -184,19 +183,19 @@ constexpr float 
PROBABILIT

Data Structures algorithms.

for assert for list of hash functions for bloom filter constructor for initializer_list for bloom filter constructor for testing on strings for std::vector

Data Structures algorithms

-

for io operations for std::array

+

for std::array for io operations

Algorithms with data structures

for assert for I/O operations

Data Structures algorithms

For IO operations For std::vector For std::min and std::max

-

for std::array for assert

+

for std::array for IO operations

Data Structures algorithms

For std::assert For std::cout For std::unique_ptr

data_structures

Using 2 Queues inside the Stack class, we can easily implement Stack data structure with heavy computation in push function.

References used: StudyTonight

Author
tushar2407 for assert for IO operations for queue data structure

Data structures algorithms

-

For array For assert

+

For array For IO operations

Data Structures

for std::array for assert for std::ofstream for std::cout for std::unique_ptr for std::queue for std::to_string

for assert for IO operations for std::shared_ptr for std::stack for std::unordered_map

diff --git a/d5/d44/selection__sort__recursive_8cpp__incl.map b/d5/d44/selection__sort__recursive_8cpp__incl.map index a1df3ad02..3e71c1f0d 100644 --- a/d5/d44/selection__sort__recursive_8cpp__incl.map +++ b/d5/d44/selection__sort__recursive_8cpp__incl.map @@ -1,11 +1,13 @@ - + - + - - - - - + + + + + + + diff --git a/d5/d44/selection__sort__recursive_8cpp__incl.md5 b/d5/d44/selection__sort__recursive_8cpp__incl.md5 index 1dcc8924e..0bf965270 100644 --- a/d5/d44/selection__sort__recursive_8cpp__incl.md5 +++ b/d5/d44/selection__sort__recursive_8cpp__incl.md5 @@ -1 +1 @@ -780116b32fefbfe4a2df7d89aecf2b53 \ No newline at end of file +5f08f017434840d662bf06cc2099d100 \ No newline at end of file diff --git a/d5/d44/selection__sort__recursive_8cpp__incl.svg b/d5/d44/selection__sort__recursive_8cpp__incl.svg index 3356c2098..97da45c02 100644 --- a/d5/d44/selection__sort__recursive_8cpp__incl.svg +++ b/d5/d44/selection__sort__recursive_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -sorting/selection_sort -_recursive.cpp + +sorting/selection_sort +_recursive.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -iostream + +cstdint @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -vector + +iostream @@ -96,8 +96,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d5/d44/selection__sort__recursive_8cpp__incl_org.svg b/d5/d44/selection__sort__recursive_8cpp__incl_org.svg index eca4ea2b8..e591193ec 100644 --- a/d5/d44/selection__sort__recursive_8cpp__incl_org.svg +++ b/d5/d44/selection__sort__recursive_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + sorting/selection_sort_recursive.cpp Node1 - -sorting/selection_sort -_recursive.cpp + +sorting/selection_sort +_recursive.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -iostream + +cstdint @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -vector + +iostream @@ -85,8 +85,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d5/d45/sublist__search_8cpp.html b/d5/d45/sublist__search_8cpp.html index a51494f35..3ec24b41d 100644 --- a/d5/d45/sublist__search_8cpp.html +++ b/d5/d45/sublist__search_8cpp.html @@ -115,12 +115,13 @@ $(function(){initNavTree('d5/d45/sublist__search_8cpp.html','../../'); initResiz

Implementation of the Sublist Search Algorithm More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for sublist_search.cpp:
-
+
- + @@ -192,12 +193,12 @@ Working

@@ -135,7 +136,7 @@ Classes

Namespaces

namespace  search
 for std::vector
 for std::assert
 
namespace  sublist_search
-
100 {
-
101 if (root != NULL) {
-
102 deleteList(root->next);
-
103 delete root;
-
104 }
-
105}
+
101 {
+
102 if (root != NULL) {
+
103 deleteList(root->next);
+
104 delete root;
+
105 }
+
106}
@@ -233,48 +234,48 @@ Working

< Sublist to be searched

< Main list in which sublist is to be searched

< boolean to check if the sublist exists or not

-
359 {
-
360 test(); // run self-test implementations
-
361
-
362 std::vector<uint64_t> mainlistData = {
-
363 2, 5, 6, 7, 8}; ///< Main list in which sublist is to be searched
-
364 std::vector<uint64_t> sublistData = {6, 8}; ///< Sublist to be searched
-
365
-
366 search::sublist_search::Node *mainlistLL =
- - - -
370 sublistData); ///< Main list in which sublist is to be
-
371 ///< searched
-
372
- -
374 sublistLL,
-
375 mainlistLL); ///< boolean to check if the sublist exists or not
-
376
-
377 std::cout << "Sublist: " << std::endl;
- -
379
-
380 std::cout << "Main list: " << std::endl;
- - -
383
-
384 if (exists) {
-
385 std::cout << "[TRUE] - sublist found in main list\n";
-
386 } else {
-
387 std::cout << "[FALSE] - sublist NOT found in main list\n";
-
388 }
-
389
-
390 deleteList(mainlistLL);
-
391 deleteList(sublistLL);
-
392 return 0;
-
393}
+
360 {
+
361 test(); // run self-test implementations
+
362
+
363 std::vector<uint64_t> mainlistData = {
+
364 2, 5, 6, 7, 8}; ///< Main list in which sublist is to be searched
+
365 std::vector<uint64_t> sublistData = {6, 8}; ///< Sublist to be searched
+
366
+
367 search::sublist_search::Node *mainlistLL =
+ + + +
371 sublistData); ///< Main list in which sublist is to be
+
372 ///< searched
+
373
+ +
375 sublistLL,
+
376 mainlistLL); ///< boolean to check if the sublist exists or not
+
377
+
378 std::cout << "Sublist: " << std::endl;
+ +
380
+
381 std::cout << "Main list: " << std::endl;
+ + +
384
+
385 if (exists) {
+
386 std::cout << "[TRUE] - sublist found in main list\n";
+
387 } else {
+
388 std::cout << "[FALSE] - sublist NOT found in main list\n";
+
389 }
+
390
+
391 deleteList(mainlistLL);
+
392 deleteList(sublistLL);
+
393 return 0;
+
394}
T endl(T... args)
-
A Node structure representing a single link Node in a linked list.
Definition sublist_search.cpp:47
-
bool sublistSearch(Node *sublist, Node *mainList)
Main searching function.
Definition sublist_search.cpp:114
-
Node * makeLinkedList(const std::vector< uint64_t > &data)
Give a vector of data, it adds each element of vector in the linked list and return the address of he...
Definition sublist_search.cpp:73
-
static void test()
Self-test implementations.
Definition sublist_search.cpp:348
-
void printLinkedList(Node *start)
A simple function to print the linked list.
Definition sublist_search.cpp:57
+
A Node structure representing a single link Node in a linked list.
Definition sublist_search.cpp:48
+
bool sublistSearch(Node *sublist, Node *mainList)
Main searching function.
Definition sublist_search.cpp:115
+
Node * makeLinkedList(const std::vector< uint64_t > &data)
Give a vector of data, it adds each element of vector in the linked list and return the address of he...
Definition sublist_search.cpp:74
+
static void test()
Self-test implementations.
Definition sublist_search.cpp:349
+
void printLinkedList(Node *start)
A simple function to print the linked list.
Definition sublist_search.cpp:58
bool exists(const std::string &str, const std::unordered_set< std::string > &strSet)
Function that checks if the string passed in param is present in the the unordered_set passed.
Definition word_break.cpp:60
@@ -309,25 +310,25 @@ Here is the call graph for this function:
Returns
Node* A head pointer to the linked list.

This is used in test cases for rapidly creating linked list with 100+ elements, instead of hard-coding 100 elements in test cases.

-
73 {
-
74 /// This is used in test cases for rapidly creating linked list with 100+
-
75 /// elements, instead of hard-coding 100 elements in test cases.
-
76 Node *head = nullptr;
-
77 Node *tail = nullptr;
-
78 for (int i : data) {
-
79 Node *node = new Node;
-
80 node->data = i;
-
81 node->next = nullptr;
-
82 if (head == nullptr) {
-
83 head = node;
-
84 tail = node;
-
85 } else {
-
86 tail->next = node;
-
87 tail = tail->next;
-
88 }
-
89 }
-
90 return head;
-
91}
+
74 {
+
75 /// This is used in test cases for rapidly creating linked list with 100+
+
76 /// elements, instead of hard-coding 100 elements in test cases.
+
77 Node *head = nullptr;
+
78 Node *tail = nullptr;
+
79 for (int i : data) {
+
80 Node *node = new Node;
+
81 node->data = i;
+
82 node->next = nullptr;
+
83 if (head == nullptr) {
+
84 head = node;
+
85 tail = node;
+
86 } else {
+
87 tail->next = node;
+
88 tail = tail->next;
+
89 }
+
90 }
+
91 return head;
+
92}
struct node { int data; int height; struct node *left; struct node *right;} node
for std::queue
Definition avltree.cpp:13
int data[MAX]
test data
Definition hash_search.cpp:24
Definition linkedlist_implentation_usingarray.cpp:14
@@ -363,13 +364,13 @@ Here is the call graph for this function:
Returns
void
-
57 {
-
58 while (start != nullptr) {
-
59 std::cout << "->" << start->data;
-
60 start = start->next;
-
61 }
- -
63}
+
58 {
+
59 while (start != nullptr) {
+
60 std::cout << "->" << start->data;
+
61 start = start->next;
+
62 }
+ +
64}
Here is the call graph for this function:
@@ -415,52 +416,52 @@ false if the sublist is NOT found

set the target pointer again to stating point of target list.

set the main pointer to the next element of the main list and repeat the algo.

If the main list is exhausted, means sublist does not found, return false

-
114 {
-
115 if (sublist == nullptr || mainList == nullptr) {
-
116 return false;
-
117 }
-
118
-
119 /// Initialize target pointer to the head node of sublist.
-
120 Node *target_ptr = sublist;
-
121
-
122 while (mainList != nullptr) {
-
123 /// Initialize main pointer to the current node of main list.
-
124 Node *main_ptr = mainList;
-
125
-
126 while (target_ptr != nullptr) {
-
127 if (main_ptr == nullptr) {
-
128 return false;
-
129
-
130 } else if (main_ptr->data == target_ptr->data) {
-
131 /// If the data of target node and main node is equal then move
-
132 /// to the next node of both lists.
-
133 target_ptr = target_ptr->next;
-
134 main_ptr = main_ptr->next;
-
135
-
136 } else {
-
137 break;
-
138 }
-
139 }
-
140
-
141 if (target_ptr == nullptr) {
-
142 /// Is target pointer becomes null that means the target list is
-
143 /// been traversed without returning false. Which means the sublist
-
144 /// has been found and return ture.
-
145 return true;
-
146 }
-
147
-
148 /// set the target pointer again to stating point of target list.
-
149 target_ptr = sublist;
-
150
-
151 /// set the main pointer to the next element of the main list and repeat
-
152 /// the algo.
-
153 mainList = mainList->next;
-
154 }
-
155
-
156 /// If the main list is exhausted, means sublist does not found, return
-
157 /// false
-
158 return false;
-
159}
+
115 {
+
116 if (sublist == nullptr || mainList == nullptr) {
+
117 return false;
+
118 }
+
119
+
120 /// Initialize target pointer to the head node of sublist.
+
121 Node *target_ptr = sublist;
+
122
+
123 while (mainList != nullptr) {
+
124 /// Initialize main pointer to the current node of main list.
+
125 Node *main_ptr = mainList;
+
126
+
127 while (target_ptr != nullptr) {
+
128 if (main_ptr == nullptr) {
+
129 return false;
+
130
+
131 } else if (main_ptr->data == target_ptr->data) {
+
132 /// If the data of target node and main node is equal then move
+
133 /// to the next node of both lists.
+
134 target_ptr = target_ptr->next;
+
135 main_ptr = main_ptr->next;
+
136
+
137 } else {
+
138 break;
+
139 }
+
140 }
+
141
+
142 if (target_ptr == nullptr) {
+
143 /// Is target pointer becomes null that means the target list is
+
144 /// been traversed without returning false. Which means the sublist
+
145 /// has been found and return ture.
+
146 return true;
+
147 }
+
148
+
149 /// set the target pointer again to stating point of target list.
+
150 target_ptr = sublist;
+
151
+
152 /// set the main pointer to the next element of the main list and repeat
+
153 /// the algo.
+
154 mainList = mainList->next;
+
155 }
+
156
+
157 /// If the main list is exhausted, means sublist does not found, return
+
158 /// false
+
159 return false;
+
160}
Here is the call graph for this function:
@@ -494,10 +495,10 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
348 {
-
349 TestCases tc;
-
350 tc.runTests();
-
351}
+
349 {
+
350 TestCases tc;
+
351 tc.runTests();
+
352}
class encapsulating the necessary test cases
Definition inorder_successor_of_bst.cpp:225
void runTests()
Executes test cases.
Definition inorder_successor_of_bst.cpp:243
diff --git a/d5/d4c/group__sorting.html b/d5/d4c/group__sorting.html index 3e8a90332..d4627fb12 100644 --- a/d5/d4c/group__sorting.html +++ b/d5/d4c/group__sorting.html @@ -195,22 +195,22 @@ template<typename T >
Examples
/Users/runner/work/C-Plus-Plus/C-Plus-Plus/sorting/wiggle_sort.cpp.
-
85 {
-
86 uint32_t size = arr.size();
-
87
-
88 std::cout << "Sorted elements are as follows: ";
-
89
-
90 std::cout << "[";
-
91
-
92 for (int i = 0; i < size; i++) {
-
93 std::cout << arr[i];
-
94 if (i != size - 1) {
-
95 std::cout << ", ";
-
96 }
-
97 }
-
98
-
99 std::cout << "]" << std::endl;
-
100}
+
86 {
+
87 uint32_t size = arr.size();
+
88
+
89 std::cout << "Sorted elements are as follows: ";
+
90
+
91 std::cout << "[";
+
92
+
93 for (int i = 0; i < size; i++) {
+
94 std::cout << arr[i];
+
95 if (i != size - 1) {
+
96 std::cout << ", ";
+
97 }
+
98 }
+
99
+
100 std::cout << "]" << std::endl;
+
101}
T endl(T... args)
T size(T... args)
@@ -525,26 +525,26 @@ Here is the call graph for this function:

Test function

Returns
void
-
106 {
-
107 std::srand(std::time(nullptr)); // initialize random number generator
-
108
-
109 std::vector<float> data1(100);
-
110 for (auto &d : data1) { // generate random numbers between -5.0 and 4.99
-
111 d = float(std::rand() % 1000 - 500) / 100.f;
-
112 }
-
113
-
114 std::vector<float> sorted = sorting::wiggle_sort::wiggleSort<float>(data1);
-
115
-
116 displayElements(sorted);
-
117
-
118 for (uint32_t j = 0; j < data1.size(); j += 2) {
-
119 assert(data1[j] <= data1[j + 1] &&
-
120 data1[j + 1] >= data1[j + 2]); // check the validation condition
-
121 }
-
122
-
123 std::cout << "Test 1 passed\n";
-
124}
-
static void displayElements(const std::vector< T > &arr)
Utility function used for printing the elements. Prints elements of the array after they're sorted us...
Definition wiggle_sort.cpp:85
+
107 {
+
108 std::srand(std::time(nullptr)); // initialize random number generator
+
109
+
110 std::vector<float> data1(100);
+
111 for (auto &d : data1) { // generate random numbers between -5.0 and 4.99
+
112 d = float(std::rand() % 1000 - 500) / 100.f;
+
113 }
+
114
+
115 std::vector<float> sorted = sorting::wiggle_sort::wiggleSort<float>(data1);
+
116
+
117 displayElements(sorted);
+
118
+
119 for (uint32_t j = 0; j < data1.size(); j += 2) {
+
120 assert(data1[j] <= data1[j + 1] &&
+
121 data1[j + 1] >= data1[j + 2]); // check the validation condition
+
122 }
+
123
+
124 std::cout << "Test 1 passed\n";
+
125}
+
static void displayElements(const std::vector< T > &arr)
Utility function used for printing the elements. Prints elements of the array after they're sorted us...
Definition wiggle_sort.cpp:86
T rand(T... args)
T srand(T... args)
T time(T... args)
diff --git a/d5/d58/class_test_cases.html b/d5/d58/class_test_cases.html index 998abdb19..5f351f2f5 100644 --- a/d5/d58/class_test_cases.html +++ b/d5/d58/class_test_cases.html @@ -253,10 +253,10 @@ template<typename T >
Returns
void
-
175 {
-
176 // It's just to avoid writing cout and endl
-
177 std::cout << "[TESTS] : ---> " << msg << std::endl;
-
178 }
+
176 {
+
177 // It's just to avoid writing cout and endl
+
178 std::cout << "[TESTS] : ---> " << msg << std::endl;
+
179 }
Here is the call graph for this function:
@@ -382,16 +382,16 @@ Here is the call graph for this function:

Executes test cases.

Returns
void
-
185 {
-
186 log("Running Tests...");
-
187
-
188 testCase_1();
-
189 testCase_2();
-
190 testCase_3();
-
191
-
192 log("Test Cases over!");
- -
194 }
+
186 {
+
187 log("Running Tests...");
+
188
+
189 testCase_1();
+
190 testCase_2();
+
191 testCase_3();
+
192
+
193 log("Test Cases over!");
+ +
195 }
Here is the call graph for this function:
@@ -557,46 +557,46 @@ Here is the call graph for this function:

< Sublist to be searched

< Main list in which sublist is to be searched

< boolean, if sublist exist or not

-
200 {
-
201 const bool expectedOutput = true; ///< Expected output of this test
-
202
-
203 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-
204 "~");
-
205 log("This is test case 1 for sublist search Algorithm : ");
-
206 log("Description:");
-
207 log(" EDGE CASE : Only contains one element");
-
208
-
209 std::vector<uint64_t> sublistData = {
-
210 6}; ///< Data to make linked list which will be the sublist
-
211 std::vector<uint64_t> mainlistData = {
-
212 2, 5, 6, 7,
-
213 8}; ///< Data to make linked list which will be the main list
-
214
- - -
217 sublistData); ///< Sublist to be searched
-
218 search::sublist_search::Node *mainlistLL =
- -
220 mainlistData); ///< Main list in which sublist is to be
-
221 ///< searched
-
222
- -
224 sublistLL, mainlistLL); ///< boolean, if sublist exist or not
-
225
-
226 log("Checking assert expression...");
-
227 assert(exists == expectedOutput);
-
228 log("Assertion check passed!");
-
229
-
230 log("[PASS] : TEST CASE 1 PASS!");
-
231 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-
232 "~");
-
233
-
234 deleteList(mainlistLL);
-
235 deleteList(sublistLL);
-
236 }
-
A Node structure representing a single link Node in a linked list.
Definition sublist_search.cpp:47
-
bool sublistSearch(Node *sublist, Node *mainList)
Main searching function.
Definition sublist_search.cpp:114
-
Node * makeLinkedList(const std::vector< uint64_t > &data)
Give a vector of data, it adds each element of vector in the linked list and return the address of he...
Definition sublist_search.cpp:73
+
201 {
+
202 const bool expectedOutput = true; ///< Expected output of this test
+
203
+
204 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+
205 "~");
+
206 log("This is test case 1 for sublist search Algorithm : ");
+
207 log("Description:");
+
208 log(" EDGE CASE : Only contains one element");
+
209
+
210 std::vector<uint64_t> sublistData = {
+
211 6}; ///< Data to make linked list which will be the sublist
+
212 std::vector<uint64_t> mainlistData = {
+
213 2, 5, 6, 7,
+
214 8}; ///< Data to make linked list which will be the main list
+
215
+ + +
218 sublistData); ///< Sublist to be searched
+
219 search::sublist_search::Node *mainlistLL =
+ +
221 mainlistData); ///< Main list in which sublist is to be
+
222 ///< searched
+
223
+ +
225 sublistLL, mainlistLL); ///< boolean, if sublist exist or not
+
226
+
227 log("Checking assert expression...");
+
228 assert(exists == expectedOutput);
+
229 log("Assertion check passed!");
+
230
+
231 log("[PASS] : TEST CASE 1 PASS!");
+
232 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+
233 "~");
+
234
+
235 deleteList(mainlistLL);
+
236 deleteList(sublistLL);
+
237 }
+
A Node structure representing a single link Node in a linked list.
Definition sublist_search.cpp:48
+
bool sublistSearch(Node *sublist, Node *mainList)
Main searching function.
Definition sublist_search.cpp:115
+
Node * makeLinkedList(const std::vector< uint64_t > &data)
Give a vector of data, it adds each element of vector in the linked list and return the address of he...
Definition sublist_search.cpp:74
bool exists(const std::string &str, const std::unordered_set< std::string > &strSet)
Function that checks if the string passed in param is present in the the unordered_set passed.
Definition word_break.cpp:60
Here is the call graph for this function:
@@ -778,54 +778,54 @@ Here is the call graph for this function:

< Sublist to be searched

< Main list in which sublist is to be searched

< boolean, if sublist exist or not

-
243 {
-
244 const bool expectedOutput = true; /// Expected output of this test
-
245
-
246 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-
247 "~");
-
248 log("This is test case 2 for sublist search Algorithm : ");
-
249 log("Description:");
-
250 log(" contains main list of 100 elements and sublist of 20");
-
251
-
252 std::vector<uint64_t> sublistData(
-
253 20); ///< Data to make linked list which will be the sublist
-
254 std::vector<uint64_t> mainlistData(
-
255 100); ///< Main list in which sublist is to be searched
-
256
-
257 for (int i = 0; i < 100; i++) {
-
258 /// Inserts 100 elements in main list
-
259 mainlistData[i] = i + 1;
-
260 }
-
261
-
262 int temp = 0;
-
263 for (int i = 45; i < 65; i++) {
-
264 /// Inserts 20 elements in sublist
-
265 sublistData[temp] = i + 1;
-
266 temp++;
-
267 }
-
268
- - -
271 sublistData); ///< Sublist to be searched
-
272 search::sublist_search::Node *mainlistLL =
- -
274 mainlistData); ///< Main list in which sublist is to be
-
275 ///< searched
-
276
- -
278 sublistLL, mainlistLL); ///< boolean, if sublist exist or not
-
279
-
280 log("Checking assert expression...");
-
281 assert(exists == expectedOutput);
-
282 log("Assertion check passed!");
-
283
-
284 log("[PASS] : TEST CASE 2 PASS!");
-
285 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-
286 "~");
-
287
-
288 deleteList(mainlistLL);
-
289 deleteList(sublistLL);
-
290 }
+
244 {
+
245 const bool expectedOutput = true; /// Expected output of this test
+
246
+
247 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+
248 "~");
+
249 log("This is test case 2 for sublist search Algorithm : ");
+
250 log("Description:");
+
251 log(" contains main list of 100 elements and sublist of 20");
+
252
+
253 std::vector<uint64_t> sublistData(
+
254 20); ///< Data to make linked list which will be the sublist
+
255 std::vector<uint64_t> mainlistData(
+
256 100); ///< Main list in which sublist is to be searched
+
257
+
258 for (int i = 0; i < 100; i++) {
+
259 /// Inserts 100 elements in main list
+
260 mainlistData[i] = i + 1;
+
261 }
+
262
+
263 int temp = 0;
+
264 for (int i = 45; i < 65; i++) {
+
265 /// Inserts 20 elements in sublist
+
266 sublistData[temp] = i + 1;
+
267 temp++;
+
268 }
+
269
+ + +
272 sublistData); ///< Sublist to be searched
+
273 search::sublist_search::Node *mainlistLL =
+ +
275 mainlistData); ///< Main list in which sublist is to be
+
276 ///< searched
+
277
+ +
279 sublistLL, mainlistLL); ///< boolean, if sublist exist or not
+
280
+
281 log("Checking assert expression...");
+
282 assert(exists == expectedOutput);
+
283 log("Assertion check passed!");
+
284
+
285 log("[PASS] : TEST CASE 2 PASS!");
+
286 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+
287 "~");
+
288
+
289 deleteList(mainlistLL);
+
290 deleteList(sublistLL);
+
291 }
Here is the call graph for this function:
@@ -1003,51 +1003,51 @@ Here is the call graph for this function:

< Sublist to be searched

< Main list in which sublist is to be searched

< boolean, if sublist exist or not

-
297 {
-
298 const bool expectedOutput = false; ///< Expected output of this test
-
299
-
300 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-
301 "~");
-
302 log("This is test case 3 for sublist search Algorithm : ");
-
303 log("Description:");
-
304 log(" contains main list of 50 elements and sublist of 20");
-
305
-
306 std::vector<uint64_t> sublistData(20); ///< Sublist to be searched
-
307 std::vector<uint64_t> mainlistData(
-
308 50); ///< Main list in which sublist is to be searched
-
309
-
310 for (int i = 0; i < 50; i++) {
-
311 /// Inserts 100 elements in main list
-
312 mainlistData.push_back(i + 1);
-
313 }
-
314
-
315 for (int i = 45; i < 65; i++) {
-
316 /// Inserts 20 elements in sublist
-
317 sublistData.push_back(i + 1);
-
318 }
-
319
- - -
322 sublistData); ///< Sublist to be searched
-
323 search::sublist_search::Node *mainlistLL =
- -
325 mainlistData); ///< Main list in which sublist is to be
-
326 ///< searched
-
327
- -
329 sublistLL, mainlistLL); ///< boolean, if sublist exist or not
-
330
-
331 log("Checking assert expression...");
-
332 assert(exists == expectedOutput);
-
333 log("Assertion check passed!");
-
334
-
335 log("[PASS] : TEST CASE 3 PASS!");
-
336 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-
337 "~");
-
338
-
339 deleteList(mainlistLL);
-
340 deleteList(sublistLL);
-
341 }
+
298 {
+
299 const bool expectedOutput = false; ///< Expected output of this test
+
300
+
301 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+
302 "~");
+
303 log("This is test case 3 for sublist search Algorithm : ");
+
304 log("Description:");
+
305 log(" contains main list of 50 elements and sublist of 20");
+
306
+
307 std::vector<uint64_t> sublistData(20); ///< Sublist to be searched
+
308 std::vector<uint64_t> mainlistData(
+
309 50); ///< Main list in which sublist is to be searched
+
310
+
311 for (int i = 0; i < 50; i++) {
+
312 /// Inserts 100 elements in main list
+
313 mainlistData.push_back(i + 1);
+
314 }
+
315
+
316 for (int i = 45; i < 65; i++) {
+
317 /// Inserts 20 elements in sublist
+
318 sublistData.push_back(i + 1);
+
319 }
+
320
+ + +
323 sublistData); ///< Sublist to be searched
+
324 search::sublist_search::Node *mainlistLL =
+ +
326 mainlistData); ///< Main list in which sublist is to be
+
327 ///< searched
+
328
+ +
330 sublistLL, mainlistLL); ///< boolean, if sublist exist or not
+
331
+
332 log("Checking assert expression...");
+
333 assert(exists == expectedOutput);
+
334 log("Assertion check passed!");
+
335
+
336 log("[PASS] : TEST CASE 3 PASS!");
+
337 log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+
338 "~");
+
339
+
340 deleteList(mainlistLL);
+
341 deleteList(sublistLL);
+
342 }
Here is the call graph for this function:
diff --git a/d5/d5f/namespacegeometry.html b/d5/d5f/namespacegeometry.html index b9463c5d6..21786c617 100644 --- a/d5/d5f/namespacegeometry.html +++ b/d5/d5f/namespacegeometry.html @@ -108,12 +108,12 @@ $(function(){initNavTree('d5/d5f/namespacegeometry.html','../../'); initResizabl
-

for std::vector +

for std::swap More...

Detailed Description

-

for std::vector

+

for std::swap

Geometry algorithms.

-

for std::swap for mathematics and datatype conversion for IO operations for std::stack

+

for mathematics and datatype conversion for IO operations for std::stack for std::vector

diff --git a/d5/d67/complex__numbers_8cpp.html b/d5/d67/complex__numbers_8cpp.html index f88676d89..9dcc14ba0 100644 --- a/d5/d67/complex__numbers_8cpp.html +++ b/d5/d67/complex__numbers_8cpp.html @@ -372,7 +372,7 @@ Here is the call graph for this function:
double get_rand()
Function to get random numbers to generate our complex numbers for test.
Definition complex_numbers.cpp:201
T endl(T... args)
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T imag(T... args)
T real(T... args)
T srand(T... args)
diff --git a/d5/d7a/largest__power_8cpp.html b/d5/d7a/largest__power_8cpp.html index df1262a89..2dc6ac381 100644 --- a/d5/d7a/largest__power_8cpp.html +++ b/d5/d7a/largest__power_8cpp.html @@ -113,18 +113,19 @@ $(function(){initNavTree('d5/d7a/largest__power_8cpp.html','../../'); initResiza

Algorithm to find largest x such that p^x divides n! (factorial) using Legendre's Formula. More...

-
#include <iostream>
-#include <cassert>
+
#include <cassert>
+#include <cstdint>
+#include <iostream>
Include dependency graph for largest_power.cpp:
-
+
- +

Namespaces

namespace  math
 for IO operations
 for assert
 

@@ -141,8 +142,11 @@ Functions

Detailed Description

Algorithm to find largest x such that p^x divides n! (factorial) using Legendre's Formula.

-

Given an integer n and a prime number p, the task is to find the largest x such that p^x (p raised to power x) divides n! (factorial). This will be done using Legendre's formula: x = [n/(p^1)] + [n/(p^2)] + [n/(p^3)] + \ldots + 1

See also
more on https://math.stackexchange.com/questions/141196/highest-power-of-a-prime-p-dividing-n
+

Given an integer n and a prime number p, the task is to find the largest x such that p^x (p raised to power x) divides n! (factorial). This will be done using Legendre's formula: x = [n/(p^1)] + [n/(p^2)] + [n/(p^3)]

Function Documentation

◆ main()

@@ -161,11 +165,11 @@ Functions

- +

Namespaces

namespace  math
 for IO operations
 for assert
 

Main function.

Returns
0 on exit
-
96 {
-
97 test(); // execute the tests
-
98 return 0;
-
99}
-
static void test()
Definition lcm_sum.cpp:65
+
97 {
+
98 test(); // execute the tests
+
99 return 0;
+
100}
+
static void test()
Definition lcm_sum.cpp:66
Here is the call graph for this function:
@@ -202,38 +203,38 @@ Here is the call graph for this function:

@@ -166,11 +167,11 @@ Functions

Function for testing lcmSum function. test cases and assert statement.

Returns
void
-
65 {
-
66 uint64_t n = 2;
-
67 uint64_t test_1 = math::lcmSum(n);
-
68 assert(test_1 == 4);
-
69 std::cout << "Passed Test 1!" << std::endl;
-
70
-
71 n = 5;
-
72 uint64_t test_2 = math::lcmSum(n);
-
73 assert(test_2 == 55);
-
74 std::cout << "Passed Test 2!" << std::endl;
-
75
-
76 n = 10;
-
77 uint64_t test_3 = math::lcmSum(n);
-
78 assert(test_3 == 320);
-
79 std::cout << "Passed Test 3!" << std::endl;
-
80
-
81 n = 11;
-
82 uint64_t test_4 = math::lcmSum(n);
-
83 assert(test_4 == 616);
-
84 std::cout << "Passed Test 4!" << std::endl;
-
85
-
86 n = 15;
-
87 uint64_t test_5 = math::lcmSum(n);
-
88 assert(test_5 == 1110);
-
89 std::cout << "Passed Test 5!" << std::endl;
-
90}
+
66 {
+
67 uint64_t n = 2;
+
68 uint64_t test_1 = math::lcmSum(n);
+
69 assert(test_1 == 4);
+
70 std::cout << "Passed Test 1!" << std::endl;
+
71
+
72 n = 5;
+
73 uint64_t test_2 = math::lcmSum(n);
+
74 assert(test_2 == 55);
+
75 std::cout << "Passed Test 2!" << std::endl;
+
76
+
77 n = 10;
+
78 uint64_t test_3 = math::lcmSum(n);
+
79 assert(test_3 == 320);
+
80 std::cout << "Passed Test 3!" << std::endl;
+
81
+
82 n = 11;
+
83 uint64_t test_4 = math::lcmSum(n);
+
84 assert(test_4 == 616);
+
85 std::cout << "Passed Test 4!" << std::endl;
+
86
+
87 n = 15;
+
88 uint64_t test_5 = math::lcmSum(n);
+
89 assert(test_5 == 1110);
+
90 std::cout << "Passed Test 5!" << std::endl;
+
91}
T endl(T... args)
static void test_1()
Definition heavy_light_decomposition.cpp:505
static void test_2()
Definition heavy_light_decomposition.cpp:549
static void test_3()
Definition heavy_light_decomposition.cpp:592
-
uint64_t lcmSum(const uint16_t &num)
Definition lcm_sum.cpp:29
+
uint64_t lcmSum(const uint16_t &num)
Definition lcm_sum.cpp:30
Here is the call graph for this function:
diff --git a/d5/d91/namespacesorting.html b/d5/d91/namespacesorting.html index 4be50636c..1d84d4371 100644 --- a/d5/d91/namespacesorting.html +++ b/d5/d91/namespacesorting.html @@ -193,10 +193,12 @@ Functions

-
48 {
- -
50 arr.begin(),
-
51 arr.end()); // declare a vector in which result will be stored
-
52 for (uint64_t it = 0; it < len; ++it) {
-
53 uint64_t min = it; // set min value
-
54 for (uint64_t it2 = it + 1; it2 < len; ++it2) {
-
55 if (array[it2] < array[min]) { // check which element is smaller
-
56 min = it2; // store index of smallest element to min
-
57 }
-
58 }
-
59
-
60 if (min != it) { // swap if min does not match to i
-
61 uint64_t tmp = array[min];
-
62 array[min] = array[it];
-
63 array[it] = tmp;
-
64 }
-
65 }
-
66
-
67 return array; // return sorted vector
-
68}
+
49 {
+ +
51 arr.begin(),
+
52 arr.end()); // declare a vector in which result will be stored
+
53 for (uint64_t it = 0; it < len; ++it) {
+
54 uint64_t min = it; // set min value
+
55 for (uint64_t it2 = it + 1; it2 < len; ++it2) {
+
56 if (array[it2] < array[min]) { // check which element is smaller
+
57 min = it2; // store index of smallest element to min
+
58 }
+
59 }
+
60
+
61 if (min != it) { // swap if min does not match to i
+
62 uint64_t tmp = array[min];
+
63 array[min] = array[it];
+
64 array[it] = tmp;
+
65 }
+
66 }
+
67
+
68 return array; // return sorted vector
+
69}
T min(T... args)
diff --git a/d5/d95/n__bonacci_8cpp__incl.map b/d5/d95/n__bonacci_8cpp__incl.map index bf2f1c67e..ba9057e20 100644 --- a/d5/d95/n__bonacci_8cpp__incl.map +++ b/d5/d95/n__bonacci_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/d5/d95/n__bonacci_8cpp__incl.md5 b/d5/d95/n__bonacci_8cpp__incl.md5 index aaa0254c7..72171e0f1 100644 --- a/d5/d95/n__bonacci_8cpp__incl.md5 +++ b/d5/d95/n__bonacci_8cpp__incl.md5 @@ -1 +1 @@ -f95b75adf32770a96552e31efab5dfe0 \ No newline at end of file +aec52c69ab37f528c36ddb8c30b99164 \ No newline at end of file diff --git a/d5/d95/n__bonacci_8cpp__incl.svg b/d5/d95/n__bonacci_8cpp__incl.svg index 594531dcc..312d0c3f5 100644 --- a/d5/d95/n__bonacci_8cpp__incl.svg +++ b/d5/d95/n__bonacci_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/n_bonacci.cpp + +math/n_bonacci.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -vector + +iostream @@ -77,8 +77,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d5/d95/n__bonacci_8cpp__incl_org.svg b/d5/d95/n__bonacci_8cpp__incl_org.svg index 2cbe7ac8d..736444877 100644 --- a/d5/d95/n__bonacci_8cpp__incl_org.svg +++ b/d5/d95/n__bonacci_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/n_bonacci.cpp Node1 - -math/n_bonacci.cpp + +math/n_bonacci.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -vector + +iostream @@ -66,8 +66,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d5/d95/structdata__structures_1_1treap_1_1_treap.html b/d5/d95/structdata__structures_1_1treap_1_1_treap.html index e49b4df71..b0c53b8ea 100644 --- a/d5/d95/structdata__structures_1_1treap_1_1_treap.html +++ b/d5/d95/structdata__structures_1_1treap_1_1_treap.html @@ -214,13 +214,13 @@ int treapCnt = 0<

Initialization.

-
54 : treapCnt(1) {
-
55 priority[0] = INT32_MAX;
-
56 size[0] = 0;
-
57 }
-
int treapCnt
Total number of current nodes in the treap.
Definition treap.cpp:41
-
std::array< int, maxNode > priority
Random priority.
Definition treap.cpp:43
-
std::array< int, maxNode > size
The number of copies per node.
Definition treap.cpp:50
+
55 : treapCnt(1) {
+
56 priority[0] = INT32_MAX;
+
57 size[0] = 0;
+
58 }
+
int treapCnt
Total number of current nodes in the treap.
Definition treap.cpp:42
+
std::array< int, maxNode > priority
Random priority.
Definition treap.cpp:44
+
std::array< int, maxNode > size
The number of copies per node.
Definition treap.cpp:51
@@ -260,33 +260,33 @@ int treapCnt = 0< -
111 {
-
112 if (key[x] == k) {
-
113 if (cnt[x] > 1) {
-
114 cnt[x]--;
-
115 } // If the node has more than one copy, the number of copies --
-
116 else {
-
117 if (childs[x][0] == 0 && childs[x][1] == 0) {
-
118 x = 0;
-
119 return;
-
120 } // If there are no children, delete and return
-
121 // Otherwise, we need to rotate the sons and delete them
-
122 // recursively
-
123 int t = (priority[childs[x][0]] > priority[childs[x][1]]);
-
124 rotate(x, t);
-
125 _erase(x, k);
-
126 }
-
127 } else { // Find the target value based on BST properties
-
128 _erase(childs[x][key[x] < k], k);
-
129 }
-
130 update(x);
-
131 }
-
std::array< int, maxNode > key
Node identifier.
Definition treap.cpp:42
-
void rotate(int &x, int t)
Rotate without breaking the property of BST.
Definition treap.cpp:70
-
void update(int x)
Update the subtree size of the node.
Definition treap.cpp:62
-
std::array< std::array< int, 2 >, maxNode > childs
Definition treap.cpp:44
-
void _erase(int &x, int k)
Erase a value from the specified subtree (internal method)
Definition treap.cpp:111
-
std::array< int, maxNode > cnt
Maintains the subtree size for ranking query.
Definition treap.cpp:48
+
112 {
+
113 if (key[x] == k) {
+
114 if (cnt[x] > 1) {
+
115 cnt[x]--;
+
116 } // If the node has more than one copy, the number of copies --
+
117 else {
+
118 if (childs[x][0] == 0 && childs[x][1] == 0) {
+
119 x = 0;
+
120 return;
+
121 } // If there are no children, delete and return
+
122 // Otherwise, we need to rotate the sons and delete them
+
123 // recursively
+
124 int t = (priority[childs[x][0]] > priority[childs[x][1]]);
+
125 rotate(x, t);
+
126 _erase(x, k);
+
127 }
+
128 } else { // Find the target value based on BST properties
+
129 _erase(childs[x][key[x] < k], k);
+
130 }
+
131 update(x);
+
132 }
+
std::array< int, maxNode > key
Node identifier.
Definition treap.cpp:43
+
void rotate(int &x, int t)
Rotate without breaking the property of BST.
Definition treap.cpp:71
+
void update(int x)
Update the subtree size of the node.
Definition treap.cpp:63
+
std::array< std::array< int, 2 >, maxNode > childs
Definition treap.cpp:45
+
void _erase(int &x, int k)
Erase a value from the specified subtree (internal method)
Definition treap.cpp:112
+
std::array< int, maxNode > cnt
Maintains the subtree size for ranking query.
Definition treap.cpp:49
Here is the call graph for this function:
@@ -331,18 +331,18 @@ Here is the call graph for this function:
Returns
The element ranked number k
-
138 {
-
139 if (k <= size[childs[x][0]]) {
-
140 return _get_k_th(childs[x][0], k);
-
141 }
-
142 k -= size[childs[x][0]] + cnt[x];
-
143 if (k <= 0) {
-
144 return key[x];
-
145 }
-
146 return _get_k_th(childs[x][1], k);
-
147 }
+
139 {
+
140 if (k <= size[childs[x][0]]) {
+
141 return _get_k_th(childs[x][0], k);
+
142 }
+
143 k -= size[childs[x][0]] + cnt[x];
+
144 if (k <= 0) {
+
145 return key[x];
+
146 }
+
147 return _get_k_th(childs[x][1], k);
+
148 }
double k(double x)
Another test function.
Definition composite_simpson_rule.cpp:117
-
int _get_k_th(int &x, int k)
Find the KTH largest value (internal method)
Definition treap.cpp:138
+
int _get_k_th(int &x, int k)
Find the KTH largest value (internal method)
Definition treap.cpp:139
Here is the call graph for this function:
@@ -387,21 +387,19 @@ Here is the call graph for this function:
Returns
The rank of element k
-
154 {
-
155 if (!x) {
-
156 return 0;
-
157 }
-
158 if (k == key[x]) {
-
159 return size[childs[x][0]] + 1;
-
160 }
-
161 else if (k < key[x]) {
+
155 {
+
156 if (!x) {
+
157 return 0;
+
158 }
+
159 if (k == key[x]) {
+
160 return size[childs[x][0]] + 1;
+
161 } else if (k < key[x]) {
162 return _get_rank(childs[x][0], k);
-
163 }
-
164 else {
-
165 return size[childs[x][0]] + cnt[x] + _get_rank(childs[x][1], k);
-
166 }
-
167 }
-
int _get_rank(int x, int k)
Query the rank of specified element (internal method)
Definition treap.cpp:154
+
163 } else {
+
164 return size[childs[x][0]] + cnt[x] + _get_rank(childs[x][1], k);
+
165 }
+
166 }
+
int _get_rank(int x, int k)
Query the rank of specified element (internal method)
Definition treap.cpp:155
Here is the call graph for this function:
@@ -445,29 +443,29 @@ Here is the call graph for this function:
-
84 {
-
85 if (x) {
-
86 if (key[x] == k) {
-
87 cnt[x]++;
-
88 } // If the node already exists, the number of copies is ++
-
89 else {
-
90 int t = (key[x] < k); // Insert according to BST properties
-
91 _insert(childs[x][t], k);
-
92 // After insertion, the heap properties are retained by rotation
-
93 if (priority[childs[x][t]] < priority[x]) {
-
94 rotate(x, t);
-
95 }
-
96 }
-
97 } else { // Create a new node
-
98 x = treapCnt++;
-
99 key[x] = k;
-
100 cnt[x] = 1;
-
101 priority[x] = rand(); // Random priority
-
102 childs[x][0] = childs[x][1] = 0;
-
103 }
-
104 update(x);
-
105 }
-
void _insert(int &x, int k)
Insert a value into the specified subtree (internal method)
Definition treap.cpp:84
+
85 {
+
86 if (x) {
+
87 if (key[x] == k) {
+
88 cnt[x]++;
+
89 } // If the node already exists, the number of copies is ++
+
90 else {
+
91 int t = (key[x] < k); // Insert according to BST properties
+
92 _insert(childs[x][t], k);
+
93 // After insertion, the heap properties are retained by rotation
+
94 if (priority[childs[x][t]] < priority[x]) {
+
95 rotate(x, t);
+
96 }
+
97 }
+
98 } else { // Create a new node
+
99 x = treapCnt++;
+
100 key[x] = k;
+
101 cnt[x] = 1;
+
102 priority[x] = rand(); // Random priority
+
103 childs[x][0] = childs[x][1] = 0;
+
104 }
+
105 update(x);
+
106 }
+
void _insert(int &x, int k)
Insert a value into the specified subtree (internal method)
Definition treap.cpp:85
Here is the call graph for this function:
@@ -506,8 +504,8 @@ Here is the call graph for this function:
-
209{ _erase(root, k); }
-
int root
root of the treap
Definition treap.cpp:40
+
208{ _erase(root, k); }
+
int root
root of the treap
Definition treap.cpp:41
Here is the call graph for this function:
@@ -547,7 +545,7 @@ Here is the call graph for this function:
Returns
The element ranked number x
-
215{ return _get_k_th(root, k); }
+
214{ return _get_k_th(root, k); }
Here is the call graph for this function:
@@ -587,17 +585,17 @@ Here is the call graph for this function:
Returns
The successor
-
189 {
-
190 int x = root, next = -1;
-
191 while (x) {
-
192 if (key[x] > k) {
-
193 next = key[x], x = childs[x][0];
-
194 } else {
-
195 x = childs[x][1];
-
196 }
-
197 }
-
198 return next;
-
199 }
+
188 {
+
189 int x = root, next = -1;
+
190 while (x) {
+
191 if (key[x] > k) {
+
192 next = key[x], x = childs[x][0];
+
193 } else {
+
194 x = childs[x][1];
+
195 }
+
196 }
+
197 return next;
+
198 }
T next(T... args)
@@ -633,17 +631,17 @@ Here is the call graph for this function:
Returns
The predecessor
-
173 {
-
174 int x = root, pre = -1;
-
175 while (x) {
-
176 if (key[x] < k) {
-
177 pre = key[x], x = childs[x][1];
-
178 } else {
-
179 x = childs[x][0];
-
180 }
-
181 }
-
182 return pre;
-
183 }
+
172 {
+
173 int x = root, pre = -1;
+
174 while (x) {
+
175 if (key[x] < k) {
+
176 pre = key[x], x = childs[x][1];
+
177 } else {
+
178 x = childs[x][0];
+
179 }
+
180 }
+
181 return pre;
+
182 }
@@ -678,7 +676,7 @@ Here is the call graph for this function:
Returns
The rank of element k
-
221{ return _get_rank(root, k); }
+
220{ return _get_rank(root, k); }
Here is the call graph for this function:
@@ -717,7 +715,7 @@ Here is the call graph for this function:
-
204{ _insert(root, k); }
+
203{ _insert(root, k); }
Here is the call graph for this function:
@@ -761,15 +759,15 @@ Here is the call graph for this function:
-
70 {
-
71 int y = childs[x][t];
-
72 childs[x][t] = childs[y][1 - t];
-
73 childs[y][1 - t] = x;
-
74 // The rotation will only change itself and its son nodes
-
75 update(x);
-
76 update(y);
-
77 x = y;
-
78 }
+
71 {
+
72 int y = childs[x][t];
+
73 childs[x][t] = childs[y][1 - t];
+
74 childs[y][1 - t] = x;
+
75 // The rotation will only change itself and its son nodes
+
76 update(x);
+
77 update(y);
+
78 x = y;
+
79 }
Here is the call graph for this function:
@@ -808,9 +806,9 @@ Here is the call graph for this function:
-
62 {
-
63 size[x] = size[childs[x][0]] + cnt[x] + size[childs[x][1]];
-
64 }
+
63 {
+
64 size[x] = size[childs[x][0]] + cnt[x] + size[childs[x][1]];
+
65 }
@@ -829,8 +827,8 @@ Here is the call graph for this function:
Initial value:
= {
{}}

[i][0] represents the left child of node i, and [i][1] represents the right

-
44 {
-
45 {}}; ///< [i][0] represents the
+
45 {
+
46 {}}; ///< [i][0] represents the
@@ -849,7 +847,7 @@ Here is the call graph for this function:
{}

Maintains the subtree size for ranking query.

-
49 {}; ///< Maintains the subtree size for ranking query
+
50 {}; ///< Maintains the subtree size for ranking query
@@ -866,7 +864,7 @@ Here is the call graph for this function:

Node identifier.

-
42{}; ///< Node identifier
+
43{}; ///< Node identifier
@@ -883,7 +881,7 @@ Here is the call graph for this function:

Random priority.

-
43{}; ///< Random priority
+
44{}; ///< Random priority
@@ -900,7 +898,7 @@ Here is the call graph for this function:

The number of copies per node.

-
50{}; ///< The number of copies per node
+
51{}; ///< The number of copies per node
diff --git a/d5/d96/md5_8cpp.html b/d5/d96/md5_8cpp.html index 195bdf030..4694c83c5 100644 --- a/d5/d96/md5_8cpp.html +++ b/d5/d96/md5_8cpp.html @@ -116,6 +116,7 @@ $(function(){initNavTree('d5/d96/md5_8cpp.html','../../'); initResizable(true);
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstdint>
#include <cstring>
#include <iostream>
#include <string>
@@ -123,13 +124,13 @@ $(function(){initNavTree('d5/d96/md5_8cpp.html','../../'); initResizable(true);
Include dependency graph for md5.cpp:
-
+
- + @@ -206,10 +207,10 @@ Algorithm
Returns
void* Pointer to the MD5 signature
-
287 {
-
288 return hash_bs(&message[0], message.size());
-
289}
-
void * hash_bs(const void *input_bs, uint64_t input_size)
The MD5 algorithm itself, taking in a bytestring.
Definition md5.cpp:138
+
288 {
+
289 return hash_bs(&message[0], message.size());
+
290}
+
void * hash_bs(const void *input_bs, uint64_t input_size)
The MD5 algorithm itself, taking in a bytestring.
Definition md5.cpp:139
T size(T... args)
Here is the call graph for this function:
@@ -251,156 +252,156 @@ Here is the call graph for this function:
for i in range(64):
print(floor(2**32 * abs(sin(i+1))))
-
138 {
-
139 auto* input = static_cast<const uint8_t*>(input_bs);
-
140
-
141 // Step 0: Initial Data (Those are decided in the MD5 protocol)
-
142 // s is the shift used in the leftrotate each round
- -
144 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
-
145 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
-
146 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
-
147 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21};
-
148 // K is pseudo-random values used each round
-
149 // The values can be obtained by the following python code:
-
150
-
151 /**
-
152 * @brief Values of K are pseudo-random and used to "salt" each round
-
153 * The values can be obtained by the following python code
-
154 * @code{.py}
-
155 * from math import floor, sin
-
156 *
-
157 * for i in range(64):
-
158 * print(floor(2**32 * abs(sin(i+1))))
-
159 * @endcode
-
160 */
- -
162 3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426,
-
163 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134,
-
164 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664,
-
165 643717713, 3921069994, 3593408605, 38016083, 3634488961, 3889429448,
-
166 568446438, 3275163606, 4107603335, 1163531501, 2850285829, 4243563512,
-
167 1735328473, 2368359562, 4294588738, 2272392833, 1839030562, 4259657740,
-
168 2763975236, 1272893353, 4139469664, 3200236656, 681279174, 3936430074,
-
169 3572445317, 76029189, 3654602809, 3873151461, 530742520, 3299628645,
-
170 4096336452, 1126891415, 2878612391, 4237533241, 1700485571, 2399980690,
-
171 4293915773, 2240044497, 1873313359, 4264355552, 2734768916, 1309151649,
-
172 4149444226, 3174756917, 718787259, 3951481745};
-
173
-
174 // The initial 128-bit state
-
175 uint32_t a0 = 0x67452301, A = 0;
-
176 uint32_t b0 = 0xefcdab89, B = 0;
-
177 uint32_t c0 = 0x98badcfe, C = 0;
-
178 uint32_t d0 = 0x10325476, D = 0;
-
179
-
180 // Step 1: Processing the bytestring
-
181
-
182 // First compute the size the padded message will have
-
183 // so it is possible to allocate the right amount of memory
-
184 uint64_t padded_message_size = 0;
-
185 if (input_size % 64 < 56) {
-
186 padded_message_size = input_size + 64 - (input_size % 64);
-
187 } else {
-
188 padded_message_size = input_size + 128 - (input_size % 64);
-
189 }
-
190
-
191 std::vector<uint8_t> padded_message(padded_message_size);
-
192
-
193 // Beginning of the padded message is the original message
-
194 std::copy(input, input + input_size, padded_message.begin());
-
195
-
196 // Afterwards comes a single 1 bit and then only zeroes
-
197 padded_message[input_size] = 1 << 7; // 10000000
-
198 for (uint64_t i = input_size; i % 64 != 56; i++) {
-
199 if (i == input_size) {
-
200 continue; // pass first iteration
-
201 }
-
202 padded_message[i] = 0;
-
203 }
-
204
-
205 // We then have to add the 64-bit size of the message at the end
-
206 // When there is a conversion from int to bytestring or vice-versa
-
207 // We always need to make sure it is little endian
-
208 uint64_t input_bitsize_le = toLittleEndian64(input_size * 8);
-
209 for (uint8_t i = 0; i < 8; i++) {
-
210 padded_message[padded_message_size - 8 + i] =
-
211 (input_bitsize_le >> (56 - 8 * i)) & 0xFF;
-
212 }
-
213
-
214 // Already allocate memory for blocks
- -
216
-
217 // Rounds
-
218 for (uint64_t chunk = 0; chunk * 64 < padded_message_size; chunk++) {
-
219 // First, build the 16 32-bits blocks from the chunk
-
220 for (uint8_t bid = 0; bid < 16; bid++) {
-
221 blocks[bid] = 0;
-
222
-
223 // Having to build a 32-bit word from 4-bit words
-
224 // Add each and shift them to the left
-
225 for (uint8_t cid = 0; cid < 4; cid++) {
-
226 blocks[bid] = (blocks[bid] << 8) +
-
227 padded_message[chunk * 64 + bid * 4 + cid];
-
228 }
-
229 }
-
230
-
231 A = a0;
-
232 B = b0;
-
233 C = c0;
-
234 D = d0;
-
235
-
236 // Main "hashing" loop
-
237 for (uint8_t i = 0; i < 64; i++) {
-
238 uint32_t F = 0, g = 0;
-
239 if (i < 16) {
-
240 F = (B & C) | ((~B) & D);
-
241 g = i;
-
242 } else if (i < 32) {
-
243 F = (D & B) | ((~D) & C);
-
244 g = (5 * i + 1) % 16;
-
245 } else if (i < 48) {
-
246 F = B ^ C ^ D;
-
247 g = (3 * i + 5) % 16;
-
248 } else {
-
249 F = C ^ (B | (~D));
-
250 g = (7 * i) % 16;
-
251 }
-
252
-
253 // Update the accumulators
-
254 F += A + K[i] + toLittleEndian32(blocks[g]);
-
255
-
256 A = D;
-
257 D = C;
-
258 C = B;
-
259 B += leftRotate32bits(F, s[i]);
-
260 }
-
261 // Update the state with this chunk's hash
-
262 a0 += A;
-
263 b0 += B;
-
264 c0 += C;
-
265 d0 += D;
-
266 }
-
267
-
268 // Build signature from state
-
269 // Note, any type could be used for the signature
-
270 // uint8_t was used to make the 16 bytes obvious
-
271 // The sig needs to be little endian
-
272 auto* sig = new uint8_t[16];
-
273 for (uint8_t i = 0; i < 4; i++) {
-
274 sig[i] = (a0 >> (8 * i)) & 0xFF;
-
275 sig[i + 4] = (b0 >> (8 * i)) & 0xFF;
-
276 sig[i + 8] = (c0 >> (8 * i)) & 0xFF;
-
277 sig[i + 12] = (d0 >> (8 * i)) & 0xFF;
-
278 }
-
279
-
280 return sig;
-
281}
+
139 {
+
140 auto* input = static_cast<const uint8_t*>(input_bs);
+
141
+
142 // Step 0: Initial Data (Those are decided in the MD5 protocol)
+
143 // s is the shift used in the leftrotate each round
+ +
145 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
+
146 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
+
147 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
+
148 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21};
+
149 // K is pseudo-random values used each round
+
150 // The values can be obtained by the following python code:
+
151
+
152 /**
+
153 * @brief Values of K are pseudo-random and used to "salt" each round
+
154 * The values can be obtained by the following python code
+
155 * @code{.py}
+
156 * from math import floor, sin
+
157 *
+
158 * for i in range(64):
+
159 * print(floor(2**32 * abs(sin(i+1))))
+
160 * @endcode
+
161 */
+ +
163 3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426,
+
164 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134,
+
165 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664,
+
166 643717713, 3921069994, 3593408605, 38016083, 3634488961, 3889429448,
+
167 568446438, 3275163606, 4107603335, 1163531501, 2850285829, 4243563512,
+
168 1735328473, 2368359562, 4294588738, 2272392833, 1839030562, 4259657740,
+
169 2763975236, 1272893353, 4139469664, 3200236656, 681279174, 3936430074,
+
170 3572445317, 76029189, 3654602809, 3873151461, 530742520, 3299628645,
+
171 4096336452, 1126891415, 2878612391, 4237533241, 1700485571, 2399980690,
+
172 4293915773, 2240044497, 1873313359, 4264355552, 2734768916, 1309151649,
+
173 4149444226, 3174756917, 718787259, 3951481745};
+
174
+
175 // The initial 128-bit state
+
176 uint32_t a0 = 0x67452301, A = 0;
+
177 uint32_t b0 = 0xefcdab89, B = 0;
+
178 uint32_t c0 = 0x98badcfe, C = 0;
+
179 uint32_t d0 = 0x10325476, D = 0;
+
180
+
181 // Step 1: Processing the bytestring
+
182
+
183 // First compute the size the padded message will have
+
184 // so it is possible to allocate the right amount of memory
+
185 uint64_t padded_message_size = 0;
+
186 if (input_size % 64 < 56) {
+
187 padded_message_size = input_size + 64 - (input_size % 64);
+
188 } else {
+
189 padded_message_size = input_size + 128 - (input_size % 64);
+
190 }
+
191
+
192 std::vector<uint8_t> padded_message(padded_message_size);
+
193
+
194 // Beginning of the padded message is the original message
+
195 std::copy(input, input + input_size, padded_message.begin());
+
196
+
197 // Afterwards comes a single 1 bit and then only zeroes
+
198 padded_message[input_size] = 1 << 7; // 10000000
+
199 for (uint64_t i = input_size; i % 64 != 56; i++) {
+
200 if (i == input_size) {
+
201 continue; // pass first iteration
+
202 }
+
203 padded_message[i] = 0;
+
204 }
+
205
+
206 // We then have to add the 64-bit size of the message at the end
+
207 // When there is a conversion from int to bytestring or vice-versa
+
208 // We always need to make sure it is little endian
+
209 uint64_t input_bitsize_le = toLittleEndian64(input_size * 8);
+
210 for (uint8_t i = 0; i < 8; i++) {
+
211 padded_message[padded_message_size - 8 + i] =
+
212 (input_bitsize_le >> (56 - 8 * i)) & 0xFF;
+
213 }
+
214
+
215 // Already allocate memory for blocks
+ +
217
+
218 // Rounds
+
219 for (uint64_t chunk = 0; chunk * 64 < padded_message_size; chunk++) {
+
220 // First, build the 16 32-bits blocks from the chunk
+
221 for (uint8_t bid = 0; bid < 16; bid++) {
+
222 blocks[bid] = 0;
+
223
+
224 // Having to build a 32-bit word from 4-bit words
+
225 // Add each and shift them to the left
+
226 for (uint8_t cid = 0; cid < 4; cid++) {
+
227 blocks[bid] = (blocks[bid] << 8) +
+
228 padded_message[chunk * 64 + bid * 4 + cid];
+
229 }
+
230 }
+
231
+
232 A = a0;
+
233 B = b0;
+
234 C = c0;
+
235 D = d0;
+
236
+
237 // Main "hashing" loop
+
238 for (uint8_t i = 0; i < 64; i++) {
+
239 uint32_t F = 0, g = 0;
+
240 if (i < 16) {
+
241 F = (B & C) | ((~B) & D);
+
242 g = i;
+
243 } else if (i < 32) {
+
244 F = (D & B) | ((~D) & C);
+
245 g = (5 * i + 1) % 16;
+
246 } else if (i < 48) {
+
247 F = B ^ C ^ D;
+
248 g = (3 * i + 5) % 16;
+
249 } else {
+
250 F = C ^ (B | (~D));
+
251 g = (7 * i) % 16;
+
252 }
+
253
+
254 // Update the accumulators
+
255 F += A + K[i] + toLittleEndian32(blocks[g]);
+
256
+
257 A = D;
+
258 D = C;
+
259 C = B;
+
260 B += leftRotate32bits(F, s[i]);
+
261 }
+
262 // Update the state with this chunk's hash
+
263 a0 += A;
+
264 b0 += B;
+
265 c0 += C;
+
266 d0 += D;
+
267 }
+
268
+
269 // Build signature from state
+
270 // Note, any type could be used for the signature
+
271 // uint8_t was used to make the 16 bytes obvious
+
272 // The sig needs to be little endian
+
273 auto* sig = new uint8_t[16];
+
274 for (uint8_t i = 0; i < 4; i++) {
+
275 sig[i] = (a0 >> (8 * i)) & 0xFF;
+
276 sig[i + 4] = (b0 >> (8 * i)) & 0xFF;
+
277 sig[i + 8] = (c0 >> (8 * i)) & 0xFF;
+
278 sig[i + 12] = (d0 >> (8 * i)) & 0xFF;
+
279 }
+
280
+
281 return sig;
+
282}
double g(double x)
Another test function.
Definition composite_simpson_rule.cpp:115
T copy(T... args)
-
uint32_t toLittleEndian32(uint32_t n)
Sets 32-bit integer to little-endian if needed.
Definition md5.cpp:89
-
uint64_t toLittleEndian64(uint64_t n)
Sets 64-bit integer to little-endian if needed.
Definition md5.cpp:102
-
uint32_t leftRotate32bits(uint32_t n, std::size_t rotate)
Rotates the bits of a 32-bit unsigned integer.
Definition md5.cpp:66
+
uint32_t toLittleEndian32(uint32_t n)
Sets 32-bit integer to little-endian if needed.
Definition md5.cpp:90
+
uint64_t toLittleEndian64(uint64_t n)
Sets 64-bit integer to little-endian if needed.
Definition md5.cpp:103
+
uint32_t leftRotate32bits(uint32_t n, std::size_t rotate)
Rotates the bits of a 32-bit unsigned integer.
Definition md5.cpp:67
Here is the call graph for this function:
@@ -435,34 +436,34 @@ Here is the call graph for this function:

Puts user in a loop where inputs can be given and MD5 hash will be computed and printed.

Returns
void
-
351 {
-
352 while (true) {
-
353 std::string input;
-
354 std::cout << "Enter a message to be hashed (Ctrl-C to exit): "
-
355 << std::endl;
-
356 std::getline(std::cin, input);
-
357 void* sig = hashing::md5::hash(input);
-
358 std::cout << "Hash is: " << hashing::md5::sig2hex(sig) << std::endl;
-
359
-
360 while (true) {
-
361 std::cout << "Want to enter another message? (y/n) ";
-
362 std::getline(std::cin, input);
-
363 if (input.compare("y") == 0) {
-
364 break;
-
365 } else if (input.compare("n") == 0) {
-
366 return;
-
367 }
-
368 }
-
369 }
-
370}
+
352 {
+
353 while (true) {
+
354 std::string input;
+
355 std::cout << "Enter a message to be hashed (Ctrl-C to exit): "
+
356 << std::endl;
+
357 std::getline(std::cin, input);
+
358 void* sig = hashing::md5::hash(input);
+
359 std::cout << "Hash is: " << hashing::md5::sig2hex(sig) << std::endl;
+
360
+
361 while (true) {
+
362 std::cout << "Want to enter another message? (y/n) ";
+
363 std::getline(std::cin, input);
+
364 if (input.compare("y") == 0) {
+
365 break;
+
366 } else if (input.compare("n") == 0) {
+
367 return;
+
368 }
+
369 }
+
370 }
+
371}
T compare(T... args)
T endl(T... args)
T getline(T... args)
-
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:287
-
std::string sig2hex(void *sig)
Transforms the 128-bit MD5 signature into a 32 char hex string.
Definition md5.cpp:122
+
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:288
+
std::string sig2hex(void *sig)
Transforms the 128-bit MD5 signature into a 32 char hex string.
Definition md5.cpp:123
Here is the call graph for this function:
@@ -491,14 +492,14 @@ Here is the call graph for this function:
Returns
true IF integers are detected to work as big-endian
false IF integers are detected to work as little-endian
-
76 {
-
77 union {
-
78 uint32_t i;
- -
80 } bint = {0x01020304};
-
81
-
82 return bint.c[0] == 1;
-
83}
+
77 {
+
78 union {
+
79 uint32_t i;
+ +
81 } bint = {0x01020304};
+
82
+
83 return bint.c[0] == 1;
+
84}
Here is the call graph for this function:
@@ -535,9 +536,9 @@ Here is the call graph for this function:
Returns
uint32_t The rotated integer
-
66 {
-
67 return (n << rotate) | (n >> (32 - rotate));
-
68}
+
67 {
+
68 return (n << rotate) | (n >> (32 - rotate));
+
69}
T rotate(T... args)
Here is the call graph for this function:
@@ -564,16 +565,16 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
376 {
-
377 test(); // run self-test implementations
-
378
-
379 // Launch interactive mode where user can input messages and see
-
380 // their hash
-
381 interactive();
-
382 return 0;
-
383}
-
static void test()
Self-test implementations of well-known MD5 hashes.
Definition md5.cpp:297
-
static void interactive()
Puts user in a loop where inputs can be given and MD5 hash will be computed and printed.
Definition md5.cpp:351
+
377 {
+
378 test(); // run self-test implementations
+
379
+
380 // Launch interactive mode where user can input messages and see
+
381 // their hash
+
382 interactive();
+
383 return 0;
+
384}
+
static void test()
Self-test implementations of well-known MD5 hashes.
Definition md5.cpp:298
+
static void interactive()
Puts user in a loop where inputs can be given and MD5 hash will be computed and printed.
Definition md5.cpp:352
Here is the call graph for this function:
@@ -605,16 +606,16 @@ Here is the call graph for this function:
Returns
std::string The hex signature
-
122 {
-
123 const char* hexChars = "0123456789abcdef";
-
124 auto* intsig = static_cast<uint8_t*>(sig);
-
125 std::string hex = "";
-
126 for (uint8_t i = 0; i < 16; i++) {
-
127 hex.push_back(hexChars[(intsig[i] >> 4) & 0xF]);
-
128 hex.push_back(hexChars[(intsig[i]) & 0xF]);
-
129 }
-
130 return hex;
-
131}
+
123 {
+
124 const char* hexChars = "0123456789abcdef";
+
125 auto* intsig = static_cast<uint8_t*>(sig);
+
126 std::string hex = "";
+
127 for (uint8_t i = 0; i < 16; i++) {
+
128 hex.push_back(hexChars[(intsig[i] >> 4) & 0xF]);
+
129 hex.push_back(hexChars[(intsig[i]) & 0xF]);
+
130 }
+
131 return hex;
+
132}
T hex(T... args)
Here is the call graph for this function:
@@ -649,54 +650,54 @@ Here is the call graph for this function:

Self-test implementations of well-known MD5 hashes.

Returns
void
-
297 {
-
298 // Hashes empty string and stores signature
-
299 void* sig = hashing::md5::hash("");
-
300 std::cout << "Hashing empty string" << std::endl;
-
301 // Prints signature hex representation
- -
303 // Test with cassert whether sig is correct from the expected value
-
304 assert(hashing::md5::sig2hex(sig).compare(
-
305 "d41d8cd98f00b204e9800998ecf8427e") == 0);
-
306
-
307 // Hashes "The quick brown fox jumps over the lazy dog" and stores signature
-
308 void* sig2 =
-
309 hashing::md5::hash("The quick brown fox jumps over the lazy dog");
-
310 std::cout << "Hashing The quick brown fox jumps over the lazy dog"
-
311 << std::endl;
-
312 // Prints signature hex representation
- -
314 // Test with cassert whether sig is correct from the expected value
-
315 assert(hashing::md5::sig2hex(sig2).compare(
-
316 "9e107d9d372bb6826bd81d3542a419d6") == 0);
-
317
-
318 // Hashes "The quick brown fox jumps over the lazy dog." (notice the
-
319 // additional period) and stores signature
-
320 void* sig3 =
-
321 hashing::md5::hash("The quick brown fox jumps over the lazy dog.");
-
322 std::cout << "Hashing "
-
323 "The quick brown fox jumps over the lazy dog."
-
324 << std::endl;
-
325 // Prints signature hex representation
- -
327 // Test with cassert whether sig is correct from the expected value
-
328 assert(hashing::md5::sig2hex(sig3).compare(
-
329 "e4d909c290d0fb1ca068ffaddf22cbd0") == 0);
-
330
-
331 // Hashes "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-
332 // and stores signature
-
333 void* sig4 = hashing::md5::hash(
-
334 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
- -
336 << "Hashing "
-
337 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-
338 << std::endl;
-
339 // Prints signature hex representation
- -
341 // Test with cassert whether sig is correct from the expected value
-
342 assert(hashing::md5::sig2hex(sig4).compare(
-
343 "d174ab98d277d9f5a5611c2c9f419d9f") == 0);
-
344}
+
298 {
+
299 // Hashes empty string and stores signature
+
300 void* sig = hashing::md5::hash("");
+
301 std::cout << "Hashing empty string" << std::endl;
+
302 // Prints signature hex representation
+ +
304 // Test with cassert whether sig is correct from the expected value
+
305 assert(hashing::md5::sig2hex(sig).compare(
+
306 "d41d8cd98f00b204e9800998ecf8427e") == 0);
+
307
+
308 // Hashes "The quick brown fox jumps over the lazy dog" and stores signature
+
309 void* sig2 =
+
310 hashing::md5::hash("The quick brown fox jumps over the lazy dog");
+
311 std::cout << "Hashing The quick brown fox jumps over the lazy dog"
+
312 << std::endl;
+
313 // Prints signature hex representation
+ +
315 // Test with cassert whether sig is correct from the expected value
+
316 assert(hashing::md5::sig2hex(sig2).compare(
+
317 "9e107d9d372bb6826bd81d3542a419d6") == 0);
+
318
+
319 // Hashes "The quick brown fox jumps over the lazy dog." (notice the
+
320 // additional period) and stores signature
+
321 void* sig3 =
+
322 hashing::md5::hash("The quick brown fox jumps over the lazy dog.");
+
323 std::cout << "Hashing "
+
324 "The quick brown fox jumps over the lazy dog."
+
325 << std::endl;
+
326 // Prints signature hex representation
+ +
328 // Test with cassert whether sig is correct from the expected value
+
329 assert(hashing::md5::sig2hex(sig3).compare(
+
330 "e4d909c290d0fb1ca068ffaddf22cbd0") == 0);
+
331
+
332 // Hashes "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+
333 // and stores signature
+
334 void* sig4 = hashing::md5::hash(
+
335 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+ +
337 << "Hashing "
+
338 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+
339 << std::endl;
+
340 // Prints signature hex representation
+ +
342 // Test with cassert whether sig is correct from the expected value
+
343 assert(hashing::md5::sig2hex(sig4).compare(
+
344 "d174ab98d277d9f5a5611c2c9f419d9f") == 0);
+
345}
int compare(const void *a, const void *b)
Definition shell_sort2.cpp:87
Here is the call graph for this function:
@@ -729,15 +730,15 @@ Here is the call graph for this function:
Returns
uint32_t param n with binary representation as little-endian
-
89 {
-
90 if (!isBigEndian()) {
-
91 return ((n << 24) & 0xFF000000) | ((n << 8) & 0x00FF0000) |
-
92 ((n >> 8) & 0x0000FF00) | ((n >> 24) & 0x000000FF);
-
93 }
-
94 // Machine works on little endian, no need to change anything
-
95 return n;
-
96}
-
bool isBigEndian()
Checks whether integers are stored as big endian or not.
Definition md5.cpp:76
+
90 {
+
91 if (!isBigEndian()) {
+
92 return ((n << 24) & 0xFF000000) | ((n << 8) & 0x00FF0000) |
+
93 ((n >> 8) & 0x0000FF00) | ((n >> 24) & 0x000000FF);
+
94 }
+
95 // Machine works on little endian, no need to change anything
+
96 return n;
+
97}
+
bool isBigEndian()
Checks whether integers are stored as big endian or not.
Definition md5.cpp:77
Here is the call graph for this function:
@@ -769,21 +770,21 @@ Here is the call graph for this function:
Returns
uint64_t param n with binary representation as little-endian
-
102 {
-
103 if (!isBigEndian()) {
-
104 return ((n << 56) & 0xFF00000000000000) |
-
105 ((n << 40) & 0x00FF000000000000) |
-
106 ((n << 24) & 0x0000FF0000000000) |
-
107 ((n << 8) & 0x000000FF00000000) |
-
108 ((n >> 8) & 0x00000000FF000000) |
-
109 ((n >> 24) & 0x0000000000FF0000) |
-
110 ((n >> 40) & 0x000000000000FF00) |
-
111 ((n >> 56) & 0x00000000000000FF);
-
112 ;
-
113 }
-
114 // Machine works on little endian, no need to change anything
-
115 return n;
-
116}
+
103 {
+
104 if (!isBigEndian()) {
+
105 return ((n << 56) & 0xFF00000000000000) |
+
106 ((n << 40) & 0x00FF000000000000) |
+
107 ((n << 24) & 0x0000FF0000000000) |
+
108 ((n << 8) & 0x000000FF00000000) |
+
109 ((n >> 8) & 0x00000000FF000000) |
+
110 ((n >> 24) & 0x0000000000FF0000) |
+
111 ((n >> 40) & 0x000000000000FF00) |
+
112 ((n >> 56) & 0x00000000000000FF);
+
113 ;
+
114 }
+
115 // Machine works on little endian, no need to change anything
+
116 return n;
+
117}
Here is the call graph for this function:
diff --git a/d5/dab/structdata__structures_1_1list__array_1_1list.html b/d5/dab/structdata__structures_1_1list__array_1_1list.html index a7951c8f0..5e2aab232 100644 --- a/d5/dab/structdata__structures_1_1list__array_1_1list.html +++ b/d5/dab/structdata__structures_1_1list__array_1_1list.html @@ -208,27 +208,30 @@ template<uint64_t N>
Returns
index of element in the list if present else -1
-
46 {
-
47 // If both pointer cross each other means no element present in the list which is equal to the val
-
48 if (last < first) {
-
49 return -1;
-
50 }
-
51 uint64_t mid = (first + last) / 2;
-
52 // check whether current mid pointer value is equal to element or not
-
53 if (dataArr[mid] == val)
-
54 return mid;
-
55 // if current mid value is greater than element we have to search in first half
-
56 else if (val < dataArr[mid])
-
57 return (BinarySearch(dataArr, first, mid - 1, val));
-
58 // if current mid value is greater than element we have to search in second half
-
59 else if (val > dataArr[mid])
-
60 return (BinarySearch(dataArr, mid + 1, last, val));
-
61
-
62 std::cerr << __func__ << ":" << __LINE__ << ": Undefined condition\n";
-
63 return -1;
-
64 }
+
51 {
+
52 // If both pointer cross each other means no element present in the list
+
53 // which is equal to the val
+
54 if (last < first) {
+
55 return -1;
+
56 }
+
57 uint64_t mid = (first + last) / 2;
+
58 // check whether current mid pointer value is equal to element or not
+
59 if (dataArr[mid] == val)
+
60 return mid;
+
61 // if current mid value is greater than element we have to search in
+
62 // first half
+
63 else if (val < dataArr[mid])
+
64 return (BinarySearch(dataArr, first, mid - 1, val));
+
65 // if current mid value is greater than element we have to search in
+
66 // second half
+
67 else if (val > dataArr[mid])
+
68 return (BinarySearch(dataArr, mid + 1, last, val));
+
69
+
70 std::cerr << __func__ << ":" << __LINE__ << ": Undefined condition\n";
+
71 return -1;
+
72 }
-
uint64_t BinarySearch(const std::array< uint64_t, N > &dataArr, const uint64_t &first, const uint64_t &last, const uint64_t &val)
Search an element in the list using binarySearch.
Definition list_array.cpp:45
+
uint64_t BinarySearch(const std::array< uint64_t, N > &dataArr, const uint64_t &first, const uint64_t &last, const uint64_t &val)
Search an element in the list using binarySearch.
Definition list_array.cpp:49
Here is the call graph for this function:
@@ -270,39 +273,40 @@ template<uint64_t N>
Returns
void
-
133 {
-
134 // overflow check
-
135 if (top == N) {
-
136 std::cout << "\nOverflow";
-
137 return;
-
138 }
-
139 // if list is not sorted, insert at the last
-
140 // otherwise place it to correct position
-
141 if (!isSorted) {
-
142 data[top] = val;
-
143 top++;
-
144 } else {
-
145 uint64_t pos = 0; // Initialize the index variable
-
146 // Going through each element and find correct position for element
-
147 for (uint64_t i = 0; i < top - 1; i++) {
-
148 // check for the correct position
-
149 if (data[i] <= val && val <= data[i + 1]) {
-
150 pos = i + 1; // assign correct pos to the index var
-
151 break; // to get out from the loop
-
152 }
-
153 }
-
154 // if all elements are smaller than the element
-
155 if (pos == 0) {
-
156 pos = top - 1;
-
157 }
-
158 // shift all element to make a room for new element
-
159 for (uint64_t i = top; i > pos; i--) {
-
160 data[i] = data[i - 1];
-
161 }
-
162 top++; // Increment the value of top.
-
163 data[pos] = val; // Assign the value to the correct index in the array
-
164 }
-
165 }
+
143 {
+
144 // overflow check
+
145 if (top == N) {
+
146 std::cout << "\nOverflow";
+
147 return;
+
148 }
+
149 // if list is not sorted, insert at the last
+
150 // otherwise place it to correct position
+
151 if (!isSorted) {
+
152 data[top] = val;
+
153 top++;
+
154 } else {
+
155 uint64_t pos = 0; // Initialize the index variable
+
156 // Going through each element and find correct position for element
+
157 for (uint64_t i = 0; i < top - 1; i++) {
+
158 // check for the correct position
+
159 if (data[i] <= val && val <= data[i + 1]) {
+
160 pos = i + 1; // assign correct pos to the index var
+
161 break; // to get out from the loop
+
162 }
+
163 }
+
164 // if all elements are smaller than the element
+
165 if (pos == 0) {
+
166 pos = top - 1;
+
167 }
+
168 // shift all element to make a room for new element
+
169 for (uint64_t i = top; i > pos; i--) {
+
170 data[i] = data[i - 1];
+
171 }
+
172 top++; // Increment the value of top.
+
173 data[pos] =
+
174 val; // Assign the value to the correct index in the array
+
175 }
+
176 }
@@ -344,16 +348,16 @@ template<uint64_t N>
Returns
index of element in the list if present else -1
-
72 {
-
73 // Going through each element in the list
-
74 for (uint64_t i = 0; i < top; i++) {
-
75 if (dataArr[i] == val) {
-
76 return i; // element found at ith index
-
77 }
-
78 }
-
79 // element is not present in the list
-
80 return -1;
-
81 }
+
81 {
+
82 // Going through each element in the list
+
83 for (uint64_t i = 0; i < top; i++) {
+
84 if (dataArr[i] == val) {
+
85 return i; // element found at ith index
+
86 }
+
87 }
+
88 // element is not present in the list
+
89 return -1;
+
90 }
@@ -390,22 +394,23 @@ template<uint64_t N>
Returns
void
-
172 {
-
173 uint64_t pos = search(val); // search the index of the value
-
174 // if search returns -1, element does not present in the list
-
175 if (pos == -1) {
-
176 std::cout << "\n Element does not present in the list ";
-
177 return;
-
178 }
-
179 std::cout << "\n" << data[pos] << " deleted"; // print the appropriate message
-
180 // shift all the element 1 left to fill vacant space
-
181 for (uint64_t i = pos; i < top; i++) {
-
182 data[i] = data[i + 1];
-
183 }
-
184 top--; // decrement the top variable to maintain last index
-
185 }
+
183 {
+
184 uint64_t pos = search(val); // search the index of the value
+
185 // if search returns -1, element does not present in the list
+
186 if (pos == -1) {
+
187 std::cout << "\n Element does not present in the list ";
+
188 return;
+
189 }
+
190 std::cout << "\n"
+
191 << data[pos] << " deleted"; // print the appropriate message
+
192 // shift all the element 1 left to fill vacant space
+
193 for (uint64_t i = pos; i < top; i++) {
+
194 data[i] = data[i + 1];
+
195 }
+
196 top--; // decrement the top variable to maintain last index
+
197 }
int data[MAX]
test data
Definition hash_search.cpp:24
-
for std::vector
Definition binary_search.cpp:46
+
for std::assert
Definition binary_search.cpp:47
@@ -433,25 +438,26 @@ template<uint64_t N>

Namespaces

namespace  hashing
 Hashing algorithms.
 Used for assert.
 
namespace  MD5
 Functions for the MD5 algorithm implementation.
-
88 {
-
89 uint64_t pos; // pos variable to store index value of element.
-
90 // if list is sorted, binary search works efficiently else linear search is the only option
-
91 if (isSorted) {
-
92 pos = BinarySearch(data, 0, top - 1, val);
-
93 } else {
-
94 pos = LinearSearch(data, val);
-
95 }
-
96 // if index is equal to -1 means element does not present
-
97 // else print the index of that element
-
98 if (pos != -1) {
-
99 std::cout << "\nElement found at position : " << pos;
-
100 } else {
-
101 std::cout << "\nElement not found";
-
102 }
-
103 // return the index of element or -1.
-
104 return pos;
+
97 {
+
98 uint64_t pos; // pos variable to store index value of element.
+
99 // if list is sorted, binary search works efficiently else linear search
+
100 // is the only option
+
101 if (isSorted) {
+
102 pos = BinarySearch(data, 0, top - 1, val);
+
103 } else {
+
104 pos = LinearSearch(data, val);
105 }
-
uint64_t LinearSearch(const std::array< uint64_t, N > &dataArr, const uint64_t &val) const
Search an element using linear search.
Definition list_array.cpp:72
+
106 // if index is equal to -1 means element does not present
+
107 // else print the index of that element
+
108 if (pos != -1) {
+
109 std::cout << "\nElement found at position : " << pos;
+
110 } else {
+
111 std::cout << "\nElement not found";
+
112 }
+
113 // return the index of element or -1.
+
114 return pos;
+
115 }
+
uint64_t LinearSearch(const std::array< uint64_t, N > &dataArr, const uint64_t &val) const
Search an element using linear search.
Definition list_array.cpp:80
@@ -482,13 +488,13 @@ template<uint64_t N>

Utility function to print array.

Returns
void
-
191 {
-
192 // Going through each element in the list
-
193 std::cout << '\n';
-
194 for (uint64_t i = 0; i < top; i++) {
-
195 std::cout << data[i] << " "; // print the element
-
196 }
-
197 }
+
203 {
+
204 // Going through each element in the list
+
205 std::cout << '\n';
+
206 for (uint64_t i = 0; i < top; i++) {
+
207 std::cout << data[i] << " "; // print the element
+
208 }
+
209 }
@@ -519,22 +525,22 @@ template<uint64_t N>

Sort the list.

Returns
void
-
111 {
-
112 //Going through each element in the list
-
113 for (uint64_t i = 0; i < top; i++) {
-
114 uint64_t min_idx = i; // Initialize the min variable
-
115 for (uint64_t j = i + 1; j < top; j++) {
-
116 // check whether any element less than current min value
-
117 if (data[j] < data[min_idx]) {
-
118 min_idx = j; // update index accordingly
-
119 }
-
120 }
-
121 // swap min value and element at the ith index
-
122 std::swap(data[min_idx], data[i]);
-
123 }
-
124 // mark isSorted variable as true
-
125 isSorted = true;
-
126 }
+
121 {
+
122 // Going through each element in the list
+
123 for (uint64_t i = 0; i < top; i++) {
+
124 uint64_t min_idx = i; // Initialize the min variable
+
125 for (uint64_t j = i + 1; j < top; j++) {
+
126 // check whether any element less than current min value
+
127 if (data[j] < data[min_idx]) {
+
128 min_idx = j; // update index accordingly
+
129 }
+
130 }
+
131 // swap min value and element at the ith index
+
132 std::swap(data[min_idx], data[i]);
+
133 }
+
134 // mark isSorted variable as true
+
135 isSorted = true;
+
136 }
T swap(T... args)
Here is the call graph for this function:
@@ -558,7 +564,7 @@ template<uint64_t N>
-
34{}; // Array that implement list
+
38{}; // Array that implement list
diff --git a/d5/dad/magic__number_8cpp__incl.map b/d5/dad/magic__number_8cpp__incl.map index e3e5beeac..3ff95f109 100644 --- a/d5/dad/magic__number_8cpp__incl.map +++ b/d5/dad/magic__number_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/d5/dad/magic__number_8cpp__incl.md5 b/d5/dad/magic__number_8cpp__incl.md5 index 50d535c4b..a83136753 100644 --- a/d5/dad/magic__number_8cpp__incl.md5 +++ b/d5/dad/magic__number_8cpp__incl.md5 @@ -1 +1 @@ -0d116aa3dda0f78e5cfc7e2ec0b45846 \ No newline at end of file +a2f2787970244cf64e5df1c4220227a7 \ No newline at end of file diff --git a/d5/dad/magic__number_8cpp__incl.svg b/d5/dad/magic__number_8cpp__incl.svg index aacbc7b69..6706361d5 100644 --- a/d5/dad/magic__number_8cpp__incl.svg +++ b/d5/dad/magic__number_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/magic_number.cpp + +math/magic_number.cpp @@ -32,8 +32,8 @@ Node2 - -cassert + +cassert @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d5/dad/magic__number_8cpp__incl_org.svg b/d5/dad/magic__number_8cpp__incl_org.svg index b3a88e580..cd9f10694 100644 --- a/d5/dad/magic__number_8cpp__incl_org.svg +++ b/d5/dad/magic__number_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/magic_number.cpp Node1 - -math/magic_number.cpp + +math/magic_number.cpp @@ -21,8 +21,8 @@ Node2 - -cassert + +cassert @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d5/db0/adaline__learning_8cpp.html b/d5/db0/adaline__learning_8cpp.html index d24272a36..d41e0c847 100644 --- a/d5/db0/adaline__learning_8cpp.html +++ b/d5/db0/adaline__learning_8cpp.html @@ -211,8 +211,8 @@ Variables
378}
-
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:186
-
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:169
+
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:187
+
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:170
T endl(T... args)
static void test3()
Definition hamiltons_cycle.cpp:122
T srand(T... args)
@@ -278,7 +278,7 @@ Here is the call graph for this function:
253}
Definition adaline_learning.cpp:46
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
Here is the call graph for this function:
diff --git a/d5/db5/set__kth__bit_8cpp.html b/d5/db5/set__kth__bit_8cpp.html index 083274f49..fc0988f04 100644 --- a/d5/db5/set__kth__bit_8cpp.html +++ b/d5/db5/set__kth__bit_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d5/db5/set__kth__bit_8cpp.html','../../'); initResizab

Implementation to [From the right, set the Kth bit in the binary representation of N] (https://practice.geeksforgeeks.org/problems/set-kth-bit3724/1/) in an integer. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for set_kth_bit.cpp:
-
+
- + @@ -165,11 +166,11 @@ Functions

Main function.

Returns
0 on exit
-
76 {
-
77 test(); // run self-test implementations
-
78 return 0;
-
79}
-
static void test()
Self-test implementations.
Definition set_kth_bit.cpp:60
+
77 {
+
78 test(); // run self-test implementations
+
79 return 0;
+
80}
+
static void test()
Self-test implementations.
Definition set_kth_bit.cpp:61
Here is the call graph for this function:
@@ -205,18 +206,18 @@ Here is the call graph for this function:
Returns
returns an integer after setting the K'th bit in N
-
43 { // int64_t is preferred over int so
-
44 // that no Overflow can be there.
-
45
-
46 int pos =
-
47 1 << k; // "pos" variable is used to store 1 at kth postion and
-
48 // rest bits are 0. in binary representation of number 'n'
-
49
-
50 return N | pos; // by taking or with the pos and the N we set the bit of N
-
51 // at kth position.
-
52}
+
44 { // int64_t is preferred over int so
+
45 // that no Overflow can be there.
+
46
+
47 int pos =
+
48 1 << k; // "pos" variable is used to store 1 at kth postion and
+
49 // rest bits are 0. in binary representation of number 'n'
+
50
+
51 return N | pos; // by taking or with the pos and the N we set the bit of N
+
52 // at kth position.
+
53}
double k(double x)
Another test function.
Definition composite_simpson_rule.cpp:117
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
@@ -245,18 +246,18 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
60 {
-
61 // n = 10,2 return 14
-
62 assert(bit_manipulation::set_kth_bit::setKthBit(10, 2) == 14);
-
63 // n = 25,1 return 27
-
64 assert(bit_manipulation::set_kth_bit::setKthBit(25, 1) == 27);
-
65 // n = 400001,5 return 400033
-
66 assert(bit_manipulation::set_kth_bit::setKthBit(400001, 5) == 400033);
-
67 // n = 123 return 123
-
68 assert(bit_manipulation::set_kth_bit::setKthBit(123, 3) == 123);
-
69
-
70 std::cout << "All test cases successfully passed!" << std::endl;
-
71}
+
61 {
+
62 // n = 10,2 return 14
+
63 assert(bit_manipulation::set_kth_bit::setKthBit(10, 2) == 14);
+
64 // n = 25,1 return 27
+
65 assert(bit_manipulation::set_kth_bit::setKthBit(25, 1) == 27);
+
66 // n = 400001,5 return 400033
+
67 assert(bit_manipulation::set_kth_bit::setKthBit(400001, 5) == 400033);
+
68 // n = 123 return 123
+
69 assert(bit_manipulation::set_kth_bit::setKthBit(123, 3) == 123);
+
70
+
71 std::cout << "All test cases successfully passed!" << std::endl;
+
72}
T endl(T... args)
diff --git a/d5/dc3/integral__approximation_8cpp__incl.map b/d5/dc3/integral__approximation_8cpp__incl.map index f8d5b3b55..b4f184b9c 100644 --- a/d5/dc3/integral__approximation_8cpp__incl.map +++ b/d5/dc3/integral__approximation_8cpp__incl.map @@ -1,11 +1,13 @@ - + - + - - - - - + + + + + + + diff --git a/d5/dc3/integral__approximation_8cpp__incl.md5 b/d5/dc3/integral__approximation_8cpp__incl.md5 index 08b7f6abe..d28140730 100644 --- a/d5/dc3/integral__approximation_8cpp__incl.md5 +++ b/d5/dc3/integral__approximation_8cpp__incl.md5 @@ -1 +1 @@ -bbc215eb0d5989611a6c6d85aae850e2 \ No newline at end of file +f001cc2facb430a91e427eafd1fa5242 \ No newline at end of file diff --git a/d5/dc3/integral__approximation_8cpp__incl.svg b/d5/dc3/integral__approximation_8cpp__incl.svg index 02199b17b..bd5cc68a9 100644 --- a/d5/dc3/integral__approximation_8cpp__incl.svg +++ b/d5/dc3/integral__approximation_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/integral_approximation.cpp + +math/integral_approximation.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -functional + +cstdint @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -iostream + +functional @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +iostream + + + + + +Node1->Node6 + + + diff --git a/d5/dc3/integral__approximation_8cpp__incl_org.svg b/d5/dc3/integral__approximation_8cpp__incl_org.svg index e2d657be0..ea47b48dc 100644 --- a/d5/dc3/integral__approximation_8cpp__incl_org.svg +++ b/d5/dc3/integral__approximation_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/integral_approximation.cpp Node1 - -math/integral_approximation.cpp + +math/integral_approximation.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -functional + +cstdint @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -iostream + +functional @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +iostream + + + + + +Node1->Node6 + + + diff --git a/d5/df6/check__amicable__pair_8cpp.html b/d5/df6/check__amicable__pair_8cpp.html index 929aad883..0e007c170 100644 --- a/d5/df6/check__amicable__pair_8cpp.html +++ b/d5/df6/check__amicable__pair_8cpp.html @@ -124,7 +124,7 @@ Include dependency graph for check_amicable_pair.cpp:
- +

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 
namespace  setKthBit
 Functions for the [From the right, set the Kth bit in the binary representation of N] (https://practice.geeksforgeeks.org/problems/set-kth-bit3724/1/) implementation.

Namespaces

namespace  math
 for IO operations
 for assert
 

Delete element from back of the queue.

Remove element that is located at the first of the queue.

Returns
data that is deleted if queue is not empty
-
75 {
-
76 int8_t d{0};
-
77 if (front == -1) {
-
78 std::cout << "\nstack is empty ";
-
79 return 0;
-
80 } else if (front == rear) {
-
81 d = arr.at(front);
-
82 front = rear = -1;
-
83 } else {
-
84 d = arr.at(front++);
-
85 }
-
86
-
87 return d;
-
88}
+
76 {
+
77 int8_t d{0};
+
78 if (front == -1) {
+
79 std::cout << "\nstack is empty ";
+
80 return 0;
+
81 } else if (front == rear) {
+
82 d = arr.at(front);
+
83 front = rear = -1;
+
84 } else {
+
85 d = arr.at(front++);
+
86 }
+
87
+
88 return d;
+
89}
T at(T... args)
-
int8_t front
Index of head of the array.
Definition queue_using_array.cpp:49
-
int8_t rear
Index of tail of the array.
Definition queue_using_array.cpp:50
-
std::array< int16_t, max_size > arr
All stored data.
Definition queue_using_array.cpp:51
+
int8_t front
Index of head of the array.
Definition queue_using_array.cpp:50
+
int8_t rear
Index of tail of the array.
Definition queue_using_array.cpp:51
+
std::array< int16_t, max_size > arr
All stored data.
Definition queue_using_array.cpp:52
Here is the call graph for this function:
@@ -209,13 +209,13 @@ Here is the call graph for this function:

Show all saved data.

Utility function to show all elements in the queue.

-
93 {
-
94 if (front == -1) {
-
95 std::cout << "\nStack is empty";
-
96 } else {
-
97 for (int16_t i{front}; i <= rear; ++i) std::cout << arr.at(i) << " ";
-
98 }
-
99}
+
94 {
+
95 if (front == -1) {
+
96 std::cout << "\nStack is empty";
+
97 } else {
+
98 for (int16_t i{front}; i <= rear; ++i) std::cout << arr.at(i) << " ";
+
99 }
+
100}
Here is the call graph for this function:
@@ -247,18 +247,18 @@ Here is the call graph for this function:

diff --git a/d6/d04/classdata__structures_1_1queue__using__array_1_1_queue___array.html b/d6/d04/classdata__structures_1_1queue__using__array_1_1_queue___array.html index de7c2dcb8..ed9582bb6 100644 --- a/d6/d04/classdata__structures_1_1queue__using__array_1_1_queue___array.html +++ b/d6/d04/classdata__structures_1_1queue__using__array_1_1_queue___array.html @@ -165,25 +165,25 @@ Private Attributes

-
58 {
-
59 if (rear == arr.size() - 1) {
-
60 std::cout << "\nStack is full";
-
61 } else if (front == -1 && rear == -1) {
-
62 front = 0;
-
63 rear = 0;
-
64 arr[rear] = ele;
-
65 } else if (rear < arr.size()) {
-
66 ++rear;
-
67 arr[rear] = ele;
-
68 }
-
69}
+
59 {
+
60 if (rear == arr.size() - 1) {
+
61 std::cout << "\nStack is full";
+
62 } else if (front == -1 && rear == -1) {
+
63 front = 0;
+
64 rear = 0;
+
65 arr[rear] = ele;
+
66 } else if (rear < arr.size()) {
+
67 ++rear;
+
68 arr[rear] = ele;
+
69 }
+
70}
T size(T... args)
Here is the call graph for this function:
@@ -290,7 +290,7 @@ Here is the call graph for this function:

All stored data.

-
51{}; ///< All stored data
+
52{}; ///< All stored data
@@ -315,7 +315,7 @@ Here is the call graph for this function:

Index of head of the array.

-
49{-1}; ///< Index of head of the array
+
50{-1}; ///< Index of head of the array
@@ -340,7 +340,7 @@ Here is the call graph for this function:

Index of tail of the array.

-
50{-1}; ///< Index of tail of the array
+
51{-1}; ///< Index of tail of the array
diff --git a/d6/d0c/namespacehashing.html b/d6/d0c/namespacehashing.html index e294b8b3e..51d8b76f0 100644 --- a/d6/d0c/namespacehashing.html +++ b/d6/d0c/namespacehashing.html @@ -108,13 +108,16 @@ $(function(){initNavTree('d6/d0c/namespacehashing.html','../../'); initResizable
-

Hashing algorithms. +

Used for assert. More...

Detailed Description

-

Hashing algorithms.

+

Used for assert.

For std::vector.

-

Used for std::copy Used for std::array Used for assert Used for std::memcopy Used for IO operations Used for strings Used for std::vector

-

For std::copy For std::array For assert For std::memcopy For IO operations For strings For std::vector

+

For assert.

+

Used for std::copy Used for std::array Used for std::memcopy Used for IO operations Used for strings Used for std::vector

+

Hashing algorithms

+

For std::copy For std::array For std::memcopy For IO operations For strings For std::vector

+

Hashing algorithms

For std::array For assert For uint8_t, uint32_t and uint64_t data types For std::setfill and std::setw For IO operations For std::stringstream For std::move

Hashing algorithms

diff --git a/d6/d1a/dnf__sort_8cpp.html b/d6/d1a/dnf__sort_8cpp.html index 7b7cefeeb..8af4909e0 100644 --- a/d6/d1a/dnf__sort_8cpp.html +++ b/d6/d1a/dnf__sort_8cpp.html @@ -115,12 +115,13 @@ $(function(){initNavTree('d6/d1a/dnf__sort_8cpp.html','../../'); initResizable(t More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for dnf_sort.cpp:
-
+
Returns
encrypted/decrypted output
-
211 {
-
212 size_t text_len = text.length();
-
213 size_t key_len = key.size();
-
214
-
215 // length of output string must be a multiple of key_len
-
216 // create output string and initialize with '\0' character
-
217 size_t L2 = text_len % key_len == 0
-
218 ? text_len
-
219 : text_len + key_len - (text_len % key_len);
-
220 std::string coded_text(L2, '\0');
-
221
-
222 // temporary array for batch processing
-
223 int i;
-
224#ifdef _OPENMP
-
225#pragma parallel omp for private(i)
-
226#endif
-
227 for (i = 0; i < L2 - key_len + 1; i += key_len) {
-
228 std::valarray<uint8_t> batch_int(key_len);
-
229 for (size_t j = 0; j < key_len; j++) {
-
230 batch_int[j] = get_char_idx(text[i + j]);
-
231 }
-
232
-
233 batch_int = mat_mul(batch_int, key);
-
234
-
235 for (size_t j = 0; j < key_len; j++) {
-
236 coded_text[i + j] =
-
237 STRKEY[batch_int[j]]; // get character at key
-
238 }
-
239 }
-
240
-
241 return coded_text;
-
242 }
+
212 {
+
213 size_t text_len = text.length();
+
214 size_t key_len = key.size();
+
215
+
216 // length of output string must be a multiple of key_len
+
217 // create output string and initialize with '\0' character
+
218 size_t L2 = text_len % key_len == 0
+
219 ? text_len
+
220 : text_len + key_len - (text_len % key_len);
+
221 std::string coded_text(L2, '\0');
+
222
+
223 // temporary array for batch processing
+
224 int i;
+
225#ifdef _OPENMP
+
226#pragma parallel omp for private(i)
+
227#endif
+
228 for (i = 0; i < L2 - key_len + 1; i += key_len) {
+
229 std::valarray<uint8_t> batch_int(key_len);
+
230 for (size_t j = 0; j < key_len; j++) {
+
231 batch_int[j] = get_char_idx(text[i + j]);
+
232 }
+
233
+
234 batch_int = mat_mul(batch_int, key);
+
235
+
236 for (size_t j = 0; j < key_len; j++) {
+
237 coded_text[i + j] =
+
238 STRKEY[batch_int[j]]; // get character at key
+
239 }
+
240 }
+
241
+
242 return coded_text;
+
243 }
-
static const std::valarray< uint8_t > mat_mul(const std::valarray< uint8_t > &vector, const matrix< int > &key)
helper function to perform vector multiplication with encryption or decryption matrix
Definition hill_cipher.cpp:159
-
static uint8_t get_char_idx(const char ch)
Get the index of a character in the STRKEY.
Definition hill_cipher.cpp:190
-
static const char * STRKEY
Definition hill_cipher.cpp:73
+
static const std::valarray< uint8_t > mat_mul(const std::valarray< uint8_t > &vector, const matrix< int > &key)
helper function to perform vector multiplication with encryption or decryption matrix
Definition hill_cipher.cpp:160
+
static uint8_t get_char_idx(const char ch)
Get the index of a character in the STRKEY.
Definition hill_cipher.cpp:191
+
static const char * STRKEY
Definition hill_cipher.cpp:74
T length(T... args)
@@ -286,10 +286,10 @@ Here is the call graph for this function:
Returns
decrypted text
-
458 {
-
459 return codec(text, decrypt_key);
-
460 }
-
static const std::string codec(const std::string &text, const matrix< int > &key)
Convenience function to perform block cipher operations. The operations are identical for both encryp...
Definition hill_cipher.cpp:210
+
459 {
+
460 return codec(text, decrypt_key);
+
461 }
+
static const std::string codec(const std::string &text, const matrix< int > &key)
Convenience function to perform block cipher operations. The operations are identical for both encryp...
Definition hill_cipher.cpp:211
Here is the call graph for this function:
@@ -334,9 +334,9 @@ Here is the call graph for this function:
Returns
encrypted text
-
446 {
-
447 return codec(text, encrypt_key);
-
448 }
+
447 {
+
448 return codec(text, encrypt_key);
+
449 }
Here is the call graph for this function:
@@ -383,18 +383,18 @@ template<typename T >
Returns
GCD of \(a\) and \(b\)
-
138 {
-
139 if (b > a) // ensure always a < b
-
140 std::swap(a, b);
-
141
-
142 while (b != 0) {
-
143 T tmp = b;
-
144 b = a % b;
-
145 a = tmp;
-
146 }
-
147
-
148 return a;
-
149 }
+
139 {
+
140 if (b > a) // ensure always a < b
+
141 std::swap(a, b);
+
142
+
143 while (b != 0) {
+
144 T tmp = b;
+
145 b = a % b;
+
146 a = tmp;
+
147 }
+
148
+
149 return a;
+
150 }
T swap(T... args)
Here is the call graph for this function:
@@ -435,49 +435,49 @@ Here is the call graph for this function:
Returns
Decryption martix
-
371 {
-
372 size_t size = encrypt_key.size();
-
373 int L = std::strlen(STRKEY);
-
374
-
375 matrix<int> decrypt_key(size, std::valarray<int>(size));
-
376 int det_encrypt = static_cast<int>(determinant_lu(encrypt_key));
-
377
-
378 int mat_determinant = det_encrypt < 0 ? det_encrypt % L : det_encrypt;
-
379
-
380 matrix<double> tmp_inverse = get_inverse(encrypt_key);
-
381 double d2 = determinant_lu(decrypt_key);
-
382
-
383 // find co-prime factor for inversion
-
384 int det_inv = -1;
-
385 for (int i = 0; i < L; i++) {
-
386 if (modulo(mat_determinant * i, L) == 1) {
-
387 det_inv = i;
-
388 break;
-
389 }
-
390 }
-
391
-
392 if (det_inv == -1) {
-
393 std::cerr << "Could not find a co-prime for inversion\n";
-
394 std::exit(EXIT_FAILURE);
-
395 }
-
396
-
397 mat_determinant = det_inv * det_encrypt;
-
398
-
399 // perform modular inverse of encryption matrix
-
400 int i;
-
401#ifdef _OPENMP
-
402#pragma parallel omp for private(i)
-
403#endif
-
404 for (i = 0; i < size; i++) {
-
405 for (int j = 0; j < size; j++) {
-
406 int temp = std::round(tmp_inverse[i][j] * mat_determinant);
-
407 decrypt_key[i][j] = modulo(temp, L);
-
408 }
-
409 }
-
410 return decrypt_key;
-
411 }
+
372 {
+
373 size_t size = encrypt_key.size();
+
374 int L = std::strlen(STRKEY);
+
375
+
376 matrix<int> decrypt_key(size, std::valarray<int>(size));
+
377 int det_encrypt = static_cast<int>(determinant_lu(encrypt_key));
+
378
+
379 int mat_determinant = det_encrypt < 0 ? det_encrypt % L : det_encrypt;
+
380
+
381 matrix<double> tmp_inverse = get_inverse(encrypt_key);
+
382 double d2 = determinant_lu(decrypt_key);
+
383
+
384 // find co-prime factor for inversion
+
385 int det_inv = -1;
+
386 for (int i = 0; i < L; i++) {
+
387 if (modulo(mat_determinant * i, L) == 1) {
+
388 det_inv = i;
+
389 break;
+
390 }
+
391 }
+
392
+
393 if (det_inv == -1) {
+
394 std::cerr << "Could not find a co-prime for inversion\n";
+
395 std::exit(EXIT_FAILURE);
+
396 }
+
397
+
398 mat_determinant = det_inv * det_encrypt;
+
399
+
400 // perform modular inverse of encryption matrix
+
401 int i;
+
402#ifdef _OPENMP
+
403#pragma parallel omp for private(i)
+
404#endif
+
405 for (i = 0; i < size; i++) {
+
406 for (int j = 0; j < size; j++) {
+
407 int temp = std::round(tmp_inverse[i][j] * mat_determinant);
+
408 decrypt_key[i][j] = modulo(temp, L);
+
409 }
+
410 }
+
411 return decrypt_key;
+
412 }
-
static matrix< double > get_inverse(matrix< T > const &A)
Definition hill_cipher.cpp:250
+
static matrix< double > get_inverse(matrix< T > const &A)
Definition hill_cipher.cpp:251
T exit(T... args)
double determinant_lu(const matrix< T > &A)
Definition lu_decomposition.h:90
T round(T... args)
@@ -537,32 +537,32 @@ Here is the call graph for this function:
Returns
Encryption martix
-
340 {
-
341 matrix<int> encrypt_key(size, std::valarray<int>(size));
-
342 matrix<int> min_mat = encrypt_key;
-
343 int mat_determinant = -1; // because matrix has only ints, the
-
344 // determinant will also be an int
-
345 int L = std::strlen(STRKEY);
-
346
-
347 double dd;
-
348 do {
-
349 // keeping the random number range smaller generates better
-
350 // defined matrices with more ease of cracking
-
351 dd = rand_range(&encrypt_key, limit1, limit2);
-
352 mat_determinant = static_cast<int>(dd);
-
353
-
354 if (mat_determinant < 0)
-
355 mat_determinant = (mat_determinant % L);
-
356 } while (std::abs(dd) > 1e3 || // while ill-defined
-
357 dd < 0.1 || // while singular or negative determinant
-
358 !std::isfinite(dd) || // while determinant is not finite
-
359 gcd(mat_determinant, L) != 1); // while no common factors
-
360 // std::cout <<
-
361
-
362 return encrypt_key;
-
363 }
-
static const T2 rand_range(T1 a, T1 b)
Function to generate a random integer in a given interval.
Definition hill_cipher.cpp:92
-
static const T gcd(T a, T b)
Compute GCD of two integers using Euler's algorithm.
Definition hill_cipher.cpp:138
+
341 {
+
342 matrix<int> encrypt_key(size, std::valarray<int>(size));
+
343 matrix<int> min_mat = encrypt_key;
+
344 int mat_determinant = -1; // because matrix has only ints, the
+
345 // determinant will also be an int
+
346 int L = std::strlen(STRKEY);
+
347
+
348 double dd;
+
349 do {
+
350 // keeping the random number range smaller generates better
+
351 // defined matrices with more ease of cracking
+
352 dd = rand_range(&encrypt_key, limit1, limit2);
+
353 mat_determinant = static_cast<int>(dd);
+
354
+
355 if (mat_determinant < 0)
+
356 mat_determinant = (mat_determinant % L);
+
357 } while (std::abs(dd) > 1e3 || // while ill-defined
+
358 dd < 0.1 || // while singular or negative determinant
+
359 !std::isfinite(dd) || // while determinant is not finite
+
360 gcd(mat_determinant, L) != 1); // while no common factors
+
361 // std::cout <<
+
362
+
363 return encrypt_key;
+
364 }
+
static const T2 rand_range(T1 a, T1 b)
Function to generate a random integer in a given interval.
Definition hill_cipher.cpp:93
+
static const T gcd(T a, T b)
Compute GCD of two integers using Euler's algorithm.
Definition hill_cipher.cpp:139
T isfinite(T... args)
Here is the call graph for this function:
@@ -615,19 +615,19 @@ Here is the call graph for this function:
Returns
std::pair<matrix<int>, matrix<int>> encryption and decryption keys as a pair
See also
generate_encryption_key
-
426 {
-
427 matrix<int> encrypt_key = generate_encryption_key(size);
-
428 matrix<int> decrypt_key = generate_decryption_key(encrypt_key);
-
429 double det2 = determinant_lu(decrypt_key);
-
430 while (std::abs(det2) < 0.1 || std::abs(det2) > 1e3) {
-
431 encrypt_key = generate_encryption_key(size, limit1, limit2);
-
432 decrypt_key = generate_decryption_key(encrypt_key);
-
433 det2 = determinant_lu(decrypt_key);
-
434 }
-
435 return std::make_pair(encrypt_key, decrypt_key);
-
436 }
-
static matrix< int > generate_encryption_key(size_t size, int limit1=0, int limit2=10)
Generate encryption matrix of a given size. Larger size matrices are difficult to generate but provid...
Definition hill_cipher.cpp:339
-
static matrix< int > generate_decryption_key(matrix< int > const &encrypt_key)
Generate decryption matrix from an encryption matrix key.
Definition hill_cipher.cpp:371
+
427 {
+
428 matrix<int> encrypt_key = generate_encryption_key(size);
+
429 matrix<int> decrypt_key = generate_decryption_key(encrypt_key);
+
430 double det2 = determinant_lu(decrypt_key);
+
431 while (std::abs(det2) < 0.1 || std::abs(det2) > 1e3) {
+
432 encrypt_key = generate_encryption_key(size, limit1, limit2);
+
433 decrypt_key = generate_decryption_key(encrypt_key);
+
434 det2 = determinant_lu(decrypt_key);
+
435 }
+
436 return std::make_pair(encrypt_key, decrypt_key);
+
437 }
+
static matrix< int > generate_encryption_key(size_t size, int limit1=0, int limit2=10)
Generate encryption matrix of a given size. Larger size matrices are difficult to generate but provid...
Definition hill_cipher.cpp:340
+
static matrix< int > generate_decryption_key(matrix< int > const &encrypt_key)
Generate decryption matrix from an encryption matrix key.
Definition hill_cipher.cpp:372
T make_pair(T... args)
Here is the call graph for this function:
@@ -668,17 +668,17 @@ Here is the call graph for this function:
Returns
index of character
-
190 {
-
191 size_t L = std::strlen(STRKEY);
-
192
-
193 for (size_t idx = 0; idx <= L; idx++)
-
194 if (STRKEY[idx] == ch)
-
195 return idx;
-
196
-
197 std::cerr << __func__ << ":" << __LINE__ << ": (" << ch
-
198 << ") Should not reach here!\n";
-
199 return 0;
-
200 }
+
191 {
+
192 size_t L = std::strlen(STRKEY);
+
193
+
194 for (size_t idx = 0; idx <= L; idx++)
+
195 if (STRKEY[idx] == ch)
+
196 return idx;
+
197
+
198 std::cerr << __func__ << ":" << __LINE__ << ": (" << ch
+
199 << ") Should not reach here!\n";
+
200 return 0;
+
201 }
Here is the call graph for this function:
@@ -718,7 +718,7 @@ Here is the call graph for this function:
Returns
character at the index
-
182{ return STRKEY[idx]; }
+
183{ return STRKEY[idx]; }
@@ -747,70 +747,70 @@ template<typename T >

@@ -181,34 +182,34 @@ template<typename T >
Returns
void
-
38 {
-
39 std::vector<T> arr(in_arr);
-
40 uint64_t lo = 0;
-
41 uint64_t hi = arr.size() - 1;
-
42 uint64_t mid = 0;
-
43
-
44 // Iterate till all the elements
-
45 // are sorted
-
46 while (mid <= hi) {
-
47 switch (arr[mid]) {
-
48 // If the element is 0
-
49 case 0:
-
50 std::swap(arr[lo++], arr[mid++]);
-
51 break;
-
52
-
53 // If the element is 1 .
-
54 case 1:
-
55 mid++;
-
56 break;
-
57
-
58 // If the element is 2
-
59 case 2:
-
60 std::swap(arr[mid], arr[hi--]);
-
61 break;
-
62 }
-
63 }
-
64 return arr;
-
65}
+
39 {
+
40 std::vector<T> arr(in_arr);
+
41 uint64_t lo = 0;
+
42 uint64_t hi = arr.size() - 1;
+
43 uint64_t mid = 0;
+
44
+
45 // Iterate till all the elements
+
46 // are sorted
+
47 while (mid <= hi) {
+
48 switch (arr[mid]) {
+
49 // If the element is 0
+
50 case 0:
+
51 std::swap(arr[lo++], arr[mid++]);
+
52 break;
+
53
+
54 // If the element is 1 .
+
55 case 1:
+
56 mid++;
+
57 break;
+
58
+
59 // If the element is 2
+
60 case 2:
+
61 std::swap(arr[mid], arr[hi--]);
+
62 break;
+
63 }
+
64 }
+
65 return arr;
+
66}
T swap(T... args)
@@ -236,11 +237,11 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
108 {
-
109 test(); // execute the test
-
110 return 0;
-
111}
-
static void test()
Self-test implementations.
Definition dnf_sort.cpp:73
+
109 {
+
110 test(); // execute the test
+
111 return 0;
+
112}
+
static void test()
Self-test implementations.
Definition dnf_sort.cpp:74
Here is the call graph for this function:
@@ -274,39 +275,39 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
73 {
-
74 // 1st test
-
75 // [1, 0, 2, 1] return [0, 1, 1, 2]
-
76 std::vector<uint64_t> array1 = {0, 1, 1, 2};
-
77 std::cout << "Test 1... ";
- -
79 assert(std::is_sorted(std::begin(arr1), std::end(arr1)));
-
80 std::cout << "passed" << std::endl;
-
81 // 2nd test
-
82 // [1, 0, 0, 1, 1, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2]
-
83 std::vector<uint64_t> array2 = {1, 0, 0, 1, 1, 0, 2, 1};
-
84 std::cout << "Test 2... ";
- -
86 assert(std::is_sorted(std::begin(arr2), std::end(arr2)));
-
87 std::cout << "passed" << std::endl;
-
88 // 3rd test
-
89 // [1, 1, 0, 0, 1, 2, 2, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]
-
90 std::vector<uint64_t> array3 = {1, 1, 0, 0, 1, 2, 2, 0, 2, 1};
-
91 std::cout << "Test 3... ";
- -
93 assert(std::is_sorted(std::begin(arr3), std::end(arr3)));
-
94 std::cout << "passed" << std::endl;
-
95 // 4th test
-
96 // [2, 2, 2, 0, 0, 1, 1] return [0, 0, 1, 1, 2, 2, 2]
-
97 std::vector<uint64_t> array4 = {2, 2, 2, 0, 0, 1, 1};
-
98 std::cout << "Test 4... ";
- -
100 assert(std::is_sorted(std::begin(arr4), std::end(arr4)));
-
101 std::cout << "passed" << std::endl;
-
102}
+
74 {
+
75 // 1st test
+
76 // [1, 0, 2, 1] return [0, 1, 1, 2]
+
77 std::vector<uint64_t> array1 = {0, 1, 1, 2};
+
78 std::cout << "Test 1... ";
+ +
80 assert(std::is_sorted(std::begin(arr1), std::end(arr1)));
+
81 std::cout << "passed" << std::endl;
+
82 // 2nd test
+
83 // [1, 0, 0, 1, 1, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2]
+
84 std::vector<uint64_t> array2 = {1, 0, 0, 1, 1, 0, 2, 1};
+
85 std::cout << "Test 2... ";
+ +
87 assert(std::is_sorted(std::begin(arr2), std::end(arr2)));
+
88 std::cout << "passed" << std::endl;
+
89 // 3rd test
+
90 // [1, 1, 0, 0, 1, 2, 2, 0, 2, 1] return [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]
+
91 std::vector<uint64_t> array3 = {1, 1, 0, 0, 1, 2, 2, 0, 2, 1};
+
92 std::cout << "Test 3... ";
+ +
94 assert(std::is_sorted(std::begin(arr3), std::end(arr3)));
+
95 std::cout << "passed" << std::endl;
+
96 // 4th test
+
97 // [2, 2, 2, 0, 0, 1, 1] return [0, 0, 1, 1, 2, 2, 2]
+
98 std::vector<uint64_t> array4 = {2, 2, 2, 0, 0, 1, 1};
+
99 std::cout << "Test 4... ";
+ +
101 assert(std::is_sorted(std::begin(arr4), std::end(arr4)));
+
102 std::cout << "passed" << std::endl;
+
103}
T begin(T... args)
-
std::vector< T > dnfSort(const std::vector< T > &in_arr)
The main function implements DNF sort.
Definition dnf_sort.cpp:38
+
std::vector< T > dnfSort(const std::vector< T > &in_arr)
The main function implements DNF sort.
Definition dnf_sort.cpp:39
T end(T... args)
T endl(T... args)
T is_sorted(T... args)
diff --git a/d6/d26/classciphers_1_1_hill_cipher.html b/d6/d26/classciphers_1_1_hill_cipher.html index 278c5624f..0dfa2f05f 100644 --- a/d6/d26/classciphers_1_1_hill_cipher.html +++ b/d6/d26/classciphers_1_1_hill_cipher.html @@ -204,42 +204,42 @@ Static Private Member Functions

Get matrix inverse using Row-transformations. Given matrix must be a square and non-singular.

Returns
inverse matrix
-
250 {
-
251 // Assuming A is square matrix
-
252 size_t N = A.size();
-
253
- -
255 for (size_t row = 0; row < N; row++) {
-
256 for (size_t col = 0; col < N; col++) {
-
257 // create identity matrix
-
258 inverse[row][col] = (row == col) ? 1.f : 0.f;
-
259 }
-
260 }
-
261
-
262 if (A.size() != A[0].size()) {
-
263 std::cerr << "A must be a square matrix!" << std::endl;
-
264 return inverse;
-
265 }
-
266
-
267 // preallocate a temporary matrix identical to A
- -
269 for (size_t row = 0; row < N; row++) {
-
270 for (size_t col = 0; col < N; col++)
-
271 temp[row][col] = static_cast<double>(A[row][col]);
-
272 }
-
273
-
274 // start transformations
-
275 for (size_t row = 0; row < N; row++) {
-
276 for (size_t row2 = row; row2 < N && temp[row][row] == 0; row2++) {
-
277 // this to ensure diagonal elements are not 0
-
278 temp[row] = temp[row] + temp[row2];
-
279 inverse[row] = inverse[row] + inverse[row2];
-
280 }
-
281
-
282 for (size_t col2 = row; col2 < N && temp[row][row] == 0; col2++) {
-
283 // this to further ensure diagonal elements are not 0
-
284 for (size_t row2 = 0; row2 < N; row2++) {
-
285 temp[row2][row] = temp[row2][row] + temp[row2][col2];
-
286 inverse[row2][row] =
-
287 inverse[row2][row] + inverse[row2][col2];
-
288 }
-
289 }
-
290
-
291 if (temp[row][row] == 0) {
-
292 // Probably a low-rank matrix and hence singular
-
293 std::cerr << "Low-rank matrix, no inverse!" << std::endl;
-
294 return inverse;
-
295 }
-
296
-
297 // set diagonal to 1
-
298 double divisor = temp[row][row];
-
299 temp[row] = temp[row] / divisor;
-
300 inverse[row] = inverse[row] / divisor;
-
301 // Row transformations
-
302 for (size_t row2 = 0; row2 < N; row2++) {
-
303 if (row2 == row)
-
304 continue;
-
305 double factor = temp[row2][row];
-
306 temp[row2] = temp[row2] - factor * temp[row];
-
307 inverse[row2] = inverse[row2] - factor * inverse[row];
-
308 }
-
309 }
-
310
-
311 return inverse;
-
312 }
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
251 {
+
252 // Assuming A is square matrix
+
253 size_t N = A.size();
+
254
+ +
256 for (size_t row = 0; row < N; row++) {
+
257 for (size_t col = 0; col < N; col++) {
+
258 // create identity matrix
+
259 inverse[row][col] = (row == col) ? 1.f : 0.f;
+
260 }
+
261 }
+
262
+
263 if (A.size() != A[0].size()) {
+
264 std::cerr << "A must be a square matrix!" << std::endl;
+
265 return inverse;
+
266 }
+
267
+
268 // preallocate a temporary matrix identical to A
+ +
270 for (size_t row = 0; row < N; row++) {
+
271 for (size_t col = 0; col < N; col++)
+
272 temp[row][col] = static_cast<double>(A[row][col]);
+
273 }
+
274
+
275 // start transformations
+
276 for (size_t row = 0; row < N; row++) {
+
277 for (size_t row2 = row; row2 < N && temp[row][row] == 0; row2++) {
+
278 // this to ensure diagonal elements are not 0
+
279 temp[row] = temp[row] + temp[row2];
+
280 inverse[row] = inverse[row] + inverse[row2];
+
281 }
+
282
+
283 for (size_t col2 = row; col2 < N && temp[row][row] == 0; col2++) {
+
284 // this to further ensure diagonal elements are not 0
+
285 for (size_t row2 = 0; row2 < N; row2++) {
+
286 temp[row2][row] = temp[row2][row] + temp[row2][col2];
+
287 inverse[row2][row] =
+
288 inverse[row2][row] + inverse[row2][col2];
+
289 }
+
290 }
+
291
+
292 if (temp[row][row] == 0) {
+
293 // Probably a low-rank matrix and hence singular
+
294 std::cerr << "Low-rank matrix, no inverse!" << std::endl;
+
295 return inverse;
+
296 }
+
297
+
298 // set diagonal to 1
+
299 double divisor = temp[row][row];
+
300 temp[row] = temp[row] / divisor;
+
301 inverse[row] = inverse[row] / divisor;
+
302 // Row transformations
+
303 for (size_t row2 = 0; row2 < N; row2++) {
+
304 if (row2 == row)
+
305 continue;
+
306 double factor = temp[row2][row];
+
307 temp[row2] = temp[row2] - factor * temp[row];
+
308 inverse[row2] = inverse[row2] - factor * inverse[row];
+
309 }
+
310 }
+
311
+
312 return inverse;
+
313 }
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T endl(T... args)
Here is the call graph for this function:
@@ -856,21 +856,21 @@ Here is the call graph for this function:
Returns
corresponding encrypted or decrypted text
-
160 {
-
161 std::valarray<uint8_t> out(vector); // make a copy
-
162
-
163 size_t L = std::strlen(STRKEY);
-
164
-
165 for (size_t i = 0; i < key.size(); i++) {
-
166 int tmp = 0;
-
167 for (size_t j = 0; j < vector.size(); j++) {
-
168 tmp += key[i][j] * vector[j];
-
169 }
-
170 out[i] = static_cast<uint8_t>(tmp % L);
-
171 }
-
172
-
173 return out;
-
174 }
+
161 {
+
162 std::valarray<uint8_t> out(vector); // make a copy
+
163
+
164 size_t L = std::strlen(STRKEY);
+
165
+
166 for (size_t i = 0; i < key.size(); i++) {
+
167 int tmp = 0;
+
168 for (size_t j = 0; j < vector.size(); j++) {
+
169 tmp += key[i][j] * vector[j];
+
170 }
+
171 out[i] = static_cast<uint8_t>(tmp % L);
+
172 }
+
173
+
174 return out;
+
175 }
Here is the call graph for this function:
@@ -905,12 +905,12 @@ Here is the call graph for this function:
-
314 {
-
315 int ret = a % b;
-
316 if (ret < 0)
-
317 ret += b;
-
318 return ret;
-
319 }
+
315 {
+
316 int ret = a % b;
+
317 if (ret < 0)
+
318 ret += b;
+
319 return ret;
+
320 }
@@ -966,16 +966,16 @@ template<typename T1 , typename T2 >
Returns
determinant of generated random matrix
Warning
There will need to be a balance between the matrix size and the range of random numbers. If the matrix is large, the range of random numbers must be small to have a well defined keys. Or if the matrix is smaller, the random numbers range can be larger. For an 8x8 matrix, range should be no more than \([0,10]\)
-
118 {
-
119 for (size_t i = 0; i < M->size(); i++) {
-
120 for (size_t j = 0; j < M[0][0].size(); j++) {
-
121 M[0][i][j] = rand_range<T1, T2>(a, b);
-
122 }
-
123 }
-
124
-
125 return determinant_lu(*M);
-
126 }
-
constexpr uint8_t M
ceil(log2(N)).
Definition sparse_table.cpp:48
+
119 {
+
120 for (size_t i = 0; i < M->size(); i++) {
+
121 for (size_t j = 0; j < M[0][0].size(); j++) {
+
122 M[0][i][j] = rand_range<T1, T2>(a, b);
+
123 }
+
124 }
+
125
+
126 return determinant_lu(*M);
+
127 }
+
constexpr uint8_t M
ceil(log2(N)).
Definition sparse_table.cpp:49
Here is the call graph for this function:
@@ -1028,13 +1028,13 @@ template<typename T1 , typename T2 >
Returns
random integer in the interval \([a,b)\)
-
92 {
-
93 // generate random number between 0 and 1
-
94 long double r = static_cast<long double>(std::rand()) / RAND_MAX;
-
95
-
96 // scale and return random number as integer
-
97 return static_cast<T2>(r * (b - a) + a);
-
98 }
+
93 {
+
94 // generate random number between 0 and 1
+
95 long double r = static_cast<long double>(std::rand()) / RAND_MAX;
+
96
+
97 // scale and return random number as integer
+
98 return static_cast<T2>(r * (b - a) + a);
+
99 }
T rand(T... args)
Here is the call graph for this function:
diff --git a/d6/d2d/modular__inverse__simple_8cpp.html b/d6/d2d/modular__inverse__simple_8cpp.html index dab25c447..721b286f0 100644 --- a/d6/d2d/modular__inverse__simple_8cpp.html +++ b/d6/d2d/modular__inverse__simple_8cpp.html @@ -113,17 +113,18 @@ $(function(){initNavTree('d6/d2d/modular__inverse__simple_8cpp.html','../../');

Simple implementation of modular multiplicative inverse More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for modular_inverse_simple.cpp:
-
+
- + @@ -155,8 +156,8 @@ Functions

Functions

uint64_t imod (uint64_t x, uint64_t y)
 for IO operations
 for assert
 
static void test ()
 self-test implementations
-

for IO operations

-

for assert

+

for assert

+

for IO operations

Function imod Calculates the modular inverse of x with respect to y, x^{-1} \mod y

Parameters
@@ -165,17 +166,17 @@ Functions
Returns
the modular inverse
-
20 {
-
21 uint64_t aux = 0; // auxiliary variable
-
22 uint64_t itr = 0; // iteration counter
-
23
-
24 do { // run the algorithm while not find the inverse
-
25 aux = y * itr + 1;
-
26 itr++;
-
27 } while (aux % x); // while module aux % x non-zero
-
28
-
29 return aux / x;
-
30}
+
21 {
+
22 uint64_t aux = 0; // auxiliary variable
+
23 uint64_t itr = 0; // iteration counter
+
24
+
25 do { // run the algorithm while not find the inverse
+
26 aux = y * itr + 1;
+
27 itr++;
+
28 } while (aux % x); // while module aux % x non-zero
+
29
+
30 return aux / x;
+
31}
@@ -196,10 +197,10 @@ Functions

Main function.

Returns
0 on exit
-
58 {
-
59 test(); // run self-test implementations
-
60};
-
static void test()
self-test implementations
Definition modular_inverse_simple.cpp:36
+
59 {
+
60 test(); // run self-test implementations
+
61};
+
static void test()
self-test implementations
Definition modular_inverse_simple.cpp:37
Here is the call graph for this function:
@@ -233,26 +234,26 @@ Here is the call graph for this function:

self-test implementations

Returns
void
-
36 {
-
37 std::cout << "First case testing... \n";
-
38 // for a = 3 and b = 11 return 4
-
39 assert(imod(3, 11) == 4);
-
40 std::cout << "\nPassed!\n";
-
41
-
42 std::cout << "Second case testing... \n";
-
43 // for a = 3 and b = 26 return 9
-
44 assert(imod(3, 26) == 9);
-
45 std::cout << "\nPassed!\n";
-
46
-
47 std::cout << "Third case testing... \n";
-
48 // for a = 7 and b = 26 return 15
-
49 assert(imod(7, 26) == 15);
-
50 std::cout << "\nPassed!\n";
-
51
-
52 std::cout << "\nAll test cases have successfully passed!\n";
-
53}
+
37 {
+
38 std::cout << "First case testing... \n";
+
39 // for a = 3 and b = 11 return 4
+
40 assert(imod(3, 11) == 4);
+
41 std::cout << "\nPassed!\n";
+
42
+
43 std::cout << "Second case testing... \n";
+
44 // for a = 3 and b = 26 return 9
+
45 assert(imod(3, 26) == 9);
+
46 std::cout << "\nPassed!\n";
+
47
+
48 std::cout << "Third case testing... \n";
+
49 // for a = 7 and b = 26 return 15
+
50 assert(imod(7, 26) == 15);
+
51 std::cout << "\nPassed!\n";
+
52
+
53 std::cout << "\nAll test cases have successfully passed!\n";
+
54}
-
uint64_t imod(uint64_t x, uint64_t y)
for IO operations
Definition modular_inverse_simple.cpp:20
+
uint64_t imod(uint64_t x, uint64_t y)
for assert
Definition modular_inverse_simple.cpp:21
Here is the call graph for this function:
diff --git a/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map b/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map index abd776830..d3f8146dd 100644 --- a/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map +++ b/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map @@ -1,5 +1,5 @@ - + diff --git a/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 b/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 index 21d966e55..5fc1c27f4 100644 --- a/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 +++ b/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 @@ -1 +1 @@ -ba9de9851f1640018e799d4fcfa97dd2 \ No newline at end of file +fbc8d68de96efc0106d4060c9e36751e \ No newline at end of file diff --git a/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg index 9c89ace80..a3d8b3ca5 100644 --- a/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg +++ b/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg @@ -31,7 +31,7 @@ Node2 - + imod diff --git a/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg b/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg index 376e9af27..4688ba046 100644 --- a/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg +++ b/d6/d2d/modular__inverse__simple_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg @@ -20,7 +20,7 @@ Node2 - + imod diff --git a/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index a93e79300..979049f6a 100644 --- a/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -2,6 +2,6 @@ - + diff --git a/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index 6048e5f3c..9cfc14253 100644 --- a/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -bccd6ac9291697dc50bf9a0d4687c625 \ No newline at end of file +8b83b67a2084fe8f4843131e415507fa \ No newline at end of file diff --git a/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index cc806548d..1e7bded6d 100644 --- a/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -49,7 +49,7 @@ Node3 - + imod diff --git a/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index 35ff59c7d..91168489f 100644 --- a/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d6/d2d/modular__inverse__simple_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -38,7 +38,7 @@ Node3 - + imod diff --git a/d6/d30/classmachine__learning_1_1adaline.html b/d6/d30/classmachine__learning_1_1adaline.html index 5f9cb7d5d..0fd79e276 100644 --- a/d6/d30/classmachine__learning_1_1adaline.html +++ b/d6/d30/classmachine__learning_1_1adaline.html @@ -447,7 +447,7 @@ template<size_t N>
173 }
174 }
double fit(const std::vector< double > &x, const int &y)
Definition adaline_learning.cpp:119
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
constexpr int MAX_ITER
Definition adaline_learning.cpp:40
Here is the call graph for this function:
diff --git a/d6/d38/find__non__repeating__number_8cpp.html b/d6/d38/find__non__repeating__number_8cpp.html index 7dbb44850..8da8c378b 100644 --- a/d6/d38/find__non__repeating__number_8cpp.html +++ b/d6/d38/find__non__repeating__number_8cpp.html @@ -125,7 +125,7 @@ Include dependency graph for find_non_repeating_number.cpp:
- + diff --git a/d6/d38/newton__raphson__method_8cpp__incl.map b/d6/d38/newton__raphson__method_8cpp__incl.map index 38dff4610..f6deb9c34 100644 --- a/d6/d38/newton__raphson__method_8cpp__incl.map +++ b/d6/d38/newton__raphson__method_8cpp__incl.map @@ -1,11 +1,13 @@ - + - - - - - - - + + + + + + + + + diff --git a/d6/d38/newton__raphson__method_8cpp__incl.md5 b/d6/d38/newton__raphson__method_8cpp__incl.md5 index 2a821420a..5b132ef6c 100644 --- a/d6/d38/newton__raphson__method_8cpp__incl.md5 +++ b/d6/d38/newton__raphson__method_8cpp__incl.md5 @@ -1 +1 @@ -93649f2a32043d469eae8cd032d2b96f \ No newline at end of file +ca16c4c2e2102852b83778a716e1b526 \ No newline at end of file diff --git a/d6/d38/newton__raphson__method_8cpp__incl.svg b/d6/d38/newton__raphson__method_8cpp__incl.svg index e17fce9e6..e2473bae5 100644 --- a/d6/d38/newton__raphson__method_8cpp__incl.svg +++ b/d6/d38/newton__raphson__method_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -numerical_methods/newton -_raphson_method.cpp + +numerical_methods/newton +_raphson_method.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -ctime + +cstdint @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -iostream + +ctime @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -limits + +iostream @@ -96,8 +96,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +limits + + + + + +Node1->Node6 + + + diff --git a/d6/d38/newton__raphson__method_8cpp__incl_org.svg b/d6/d38/newton__raphson__method_8cpp__incl_org.svg index 1e631e586..d6e56e44b 100644 --- a/d6/d38/newton__raphson__method_8cpp__incl_org.svg +++ b/d6/d38/newton__raphson__method_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + numerical_methods/newton_raphson_method.cpp Node1 - -numerical_methods/newton -_raphson_method.cpp + +numerical_methods/newton +_raphson_method.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -ctime + +cstdint @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -iostream + +ctime @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -limits + +iostream @@ -85,8 +85,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +limits + + + + + +Node1->Node6 + + + diff --git a/d6/d42/data__structures_2sparse__table_8cpp.html b/d6/d42/data__structures_2sparse__table_8cpp.html index 8f9c398f9..cf47d19bf 100644 --- a/d6/d42/data__structures_2sparse__table_8cpp.html +++ b/d6/d42/data__structures_2sparse__table_8cpp.html @@ -117,11 +117,12 @@ $(function(){initNavTree('d6/d42/data__structures_2sparse__table_8cpp.html','../ More...

#include <array>
#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for sparse_table.cpp:
-
+
xnumber

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 
namespace  find_non_repeating_integer
 Functions to find the non repeating integer in an array of repeating integers. Single Number
121 test(); // execute the test
122 return 0;
123}
-
static void test()
Test implementations.
Definition subset_sum.cpp:57
+
static void test()
Test implementations.
Definition subset_sum.cpp:58
Here is the call graph for this function:
diff --git a/d6/d9d/large__factorial_8cpp.html b/d6/d9d/large__factorial_8cpp.html index f8afc562d..fbfddf665 100644 --- a/d6/d9d/large__factorial_8cpp.html +++ b/d6/d9d/large__factorial_8cpp.html @@ -192,7 +192,7 @@ Functions
T clock(T... args)
T endl(T... args)
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T scientific(T... args)
bool test1()
Definition large_factorial.cpp:17
bool test2()
Definition large_factorial.cpp:54
@@ -247,7 +247,7 @@ Here is the call graph for this function:
42 std::cout << "Passed!" << std::endl;
43 return true;
44}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T strlen(T... args)
Here is the call graph for this function:
diff --git a/d6/dae/classothers_1_1lru__cache_1_1_l_r_u_cache.html b/d6/dae/classothers_1_1lru__cache_1_1_l_r_u_cache.html index af637d1f7..8e47be331 100644 --- a/d6/dae/classothers_1_1lru__cache_1_1_l_r_u_cache.html +++ b/d6/dae/classothers_1_1lru__cache_1_1_l_r_u_cache.html @@ -191,8 +191,8 @@ uint64_t  -
84{ pageFrame = pf; }
-
uint64_t pageFrame
Page frame, or total size of the cache.
Definition lru_cache.cpp:68
+
85{ pageFrame = pf; }
+
uint64_t pageFrame
Page frame, or total size of the cache.
Definition lru_cache.cpp:69
@@ -222,14 +222,14 @@ uint64_t A function to display the current cache.

Returns
Void
-
120 {
-
121 for (uint64_t &it : cache) {
-
122 std::cout << it << " ";
-
123 }
- -
125 }
+
121 {
+
122 for (uint64_t &it : cache) {
+
123 std::cout << it << " ";
+
124 }
+ +
126 }
-
std::list< uint64_t > cache
Cache linked list (using the STL)
Definition lru_cache.cpp:69
+
std::list< uint64_t > cache
Cache linked list (using the STL)
Definition lru_cache.cpp:70
T endl(T... args)
Here is the call graph for this function:
@@ -264,8 +264,8 @@ Here is the call graph for this function:

A function to get page hits.

Returns
int
-
130{ return hits; }
-
uint64_t hits
was found in cache.
Definition lru_cache.cpp:73
+
131{ return hits; }
+
uint64_t hits
was found in cache.
Definition lru_cache.cpp:74
@@ -294,8 +294,8 @@ Here is the call graph for this function:

A function to get page fault.

Returns
int
-
135{ return pageFault; }
-
uint64_t pageFault
Definition lru_cache.cpp:76
+
136{ return pageFault; }
+
uint64_t pageFault
Definition lru_cache.cpp:77
@@ -331,33 +331,33 @@ Here is the call graph for this function:
Returns
void

< Increase the page fault by one.

-
91 {
-
92 // If the page requested not in cache.
-
93 if (pageMap.find(page) == pageMap.end()) {
-
94 pageFault++; ///< Increase the page fault by one.
-
95
-
96 // Check if the cache is full
-
97 if (cache.size() == pageFrame) {
-
98 // delete the last page from cache
-
99 uint64_t lastPage = cache.back();
-
100 cache.pop_back();
-
101 pageMap.erase(lastPage);
-
102 }
-
103 }
-
104 // The requested page is in the cache
-
105 else {
-
106 hits++;
-
107 // present in cache, erase from current position to bring in front
-
108 cache.erase(pageMap[page]);
-
109 }
-
110 // Push it in the front of the cache and update the page reference in
-
111 // page map.
-
112 cache.push_front(page);
-
113 pageMap[page] = cache.begin();
-
114 }
+
92 {
+
93 // If the page requested not in cache.
+
94 if (pageMap.find(page) == pageMap.end()) {
+
95 pageFault++; ///< Increase the page fault by one.
+
96
+
97 // Check if the cache is full
+
98 if (cache.size() == pageFrame) {
+
99 // delete the last page from cache
+
100 uint64_t lastPage = cache.back();
+
101 cache.pop_back();
+
102 pageMap.erase(lastPage);
+
103 }
+
104 }
+
105 // The requested page is in the cache
+
106 else {
+
107 hits++;
+
108 // present in cache, erase from current position to bring in front
+
109 cache.erase(pageMap[page]);
+
110 }
+
111 // Push it in the front of the cache and update the page reference in
+
112 // page map.
+
113 cache.push_front(page);
+
114 pageMap[page] = cache.begin();
+
115 }
T back(T... args)
T begin(T... args)
-
std::unordered_map< uint64_t, std::list< uint64_t >::iterator > pageMap
Hash map containing pages and their addresses.
Definition lru_cache.cpp:71
+
std::unordered_map< uint64_t, std::list< uint64_t >::iterator > pageMap
Hash map containing pages and their addresses.
Definition lru_cache.cpp:72
T end(T... args)
T erase(T... args)
T find(T... args)
diff --git a/d6/db8/inv__sqrt_8cpp.html b/d6/db8/inv__sqrt_8cpp.html index 48d9a3920..7f1eea8ab 100644 --- a/d6/db8/inv__sqrt_8cpp.html +++ b/d6/db8/inv__sqrt_8cpp.html @@ -114,19 +114,20 @@ $(function(){initNavTree('d6/db8/inv__sqrt_8cpp.html','../../'); initResizable(t More...

#include <cassert>
#include <cmath>
+#include <cstdint>
#include <iostream>
#include <limits>
Include dependency graph for inv_sqrt.cpp:
-
+

@@ -193,11 +194,11 @@ constexpr uint8_t 

data_str
Returns
0 on exit
-
161 {
-
162 test(); // run self-test implementations
-
163 return 0;
-
164}
-
static void test()
Self-test implementations.
Definition sparse_table.cpp:128
+
162 {
+
163 test(); // run self-test implementations
+
164 return 0;
+
165}
+
static void test()
Self-test implementations.
Definition sparse_table.cpp:129
Here is the call graph for this function:
@@ -240,39 +241,39 @@ Here is the call graph for this function:

< as 1 is smallest from 1..9

< as 2 is smallest from 2..6

< as 3 is smallest from 3..8

-
128 {
-
129 /* We take an array as an input on which we need to perform the ranged
-
130 * minimum queries[RMQ](https://en.wikipedia.org/wiki/Range_minimum_query).
-
131 */
-
132 std::array<int64_t, 10> testcase = {
-
133 1, 2, 3, 4, 5,
-
134 6, 7, 8, 9, 10}; ///< array on which RMQ will be performed.
-
135 size_t testcase_size =
-
136 sizeof(testcase) / sizeof(testcase[0]); ///< size of self test's array
-
137
- -
139 st{}; ///< declaring sparse tree
-
140
-
141 std::copy(std::begin(testcase), std::end(testcase),
-
142 std::begin(st.A)); ///< copying array to the struct
-
143 st.n = testcase_size; ///< passing the array's size to the struct
-
144
-
145 st.buildST(); ///< precomputing sparse tree
-
146
-
147 // pass queries of the form: [l,r]
-
148 assert(st.query(1, 9) == 1); ///< as 1 is smallest from 1..9
-
149 assert(st.query(2, 6) == 2); ///< as 2 is smallest from 2..6
-
150 assert(st.query(3, 8) == 3); ///< as 3 is smallest from 3..8
-
151
-
152 std::cout << "Self-test implementations passed!" << std::endl;
-
153}
+
129 {
+
130 /* We take an array as an input on which we need to perform the ranged
+
131 * minimum queries[RMQ](https://en.wikipedia.org/wiki/Range_minimum_query).
+
132 */
+
133 std::array<int64_t, 10> testcase = {
+
134 1, 2, 3, 4, 5,
+
135 6, 7, 8, 9, 10}; ///< array on which RMQ will be performed.
+
136 size_t testcase_size =
+
137 sizeof(testcase) / sizeof(testcase[0]); ///< size of self test's array
+
138
+ +
140 st{}; ///< declaring sparse tree
+
141
+
142 std::copy(std::begin(testcase), std::end(testcase),
+
143 std::begin(st.A)); ///< copying array to the struct
+
144 st.n = testcase_size; ///< passing the array's size to the struct
+
145
+
146 st.buildST(); ///< precomputing sparse tree
+
147
+
148 // pass queries of the form: [l,r]
+
149 assert(st.query(1, 9) == 1); ///< as 1 is smallest from 1..9
+
150 assert(st.query(2, 6) == 2); ///< as 2 is smallest from 2..6
+
151 assert(st.query(3, 8) == 3); ///< as 3 is smallest from 3..8
+
152
+
153 std::cout << "Self-test implementations passed!" << std::endl;
+
154}
T begin(T... args)
T copy(T... args)
T end(T... args)
T endl(T... args)
-
Definition sparse_table.cpp:50
+
Definition sparse_table.cpp:51
Here is the call graph for this function:
diff --git a/d6/d42/miller__rabin_8cpp.html b/d6/d42/miller__rabin_8cpp.html index 06b6e172e..86409e1c6 100644 --- a/d6/d42/miller__rabin_8cpp.html +++ b/d6/d42/miller__rabin_8cpp.html @@ -409,7 +409,7 @@ template<typename T >
25 }
26 return result;
27}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
diff --git a/d6/d4b/hamming__distance_8cpp__incl.map b/d6/d4b/hamming__distance_8cpp__incl.map index ecced2957..ab403754c 100644 --- a/d6/d4b/hamming__distance_8cpp__incl.map +++ b/d6/d4b/hamming__distance_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/d6/d4b/hamming__distance_8cpp__incl.md5 b/d6/d4b/hamming__distance_8cpp__incl.md5 index cdfa2a8d3..aff92b559 100644 --- a/d6/d4b/hamming__distance_8cpp__incl.md5 +++ b/d6/d4b/hamming__distance_8cpp__incl.md5 @@ -1 +1 @@ -b1667788f629f29092dafc0c7e82c894 \ No newline at end of file +f8b4be1ee5a65bf383fa0f2e84f9b14e \ No newline at end of file diff --git a/d6/d4b/hamming__distance_8cpp__incl.svg b/d6/d4b/hamming__distance_8cpp__incl.svg index 5ccfce66b..b8bee0d3e 100644 --- a/d6/d4b/hamming__distance_8cpp__incl.svg +++ b/d6/d4b/hamming__distance_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -bit_manipulation/hamming -_distance.cpp + +bit_manipulation/hamming +_distance.cpp @@ -33,8 +33,8 @@ Node2 - -cassert + +cassert @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d6/d4b/hamming__distance_8cpp__incl_org.svg b/d6/d4b/hamming__distance_8cpp__incl_org.svg index 0eaef6979..e45c0ec81 100644 --- a/d6/d4b/hamming__distance_8cpp__incl_org.svg +++ b/d6/d4b/hamming__distance_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + bit_manipulation/hamming_distance.cpp Node1 - -bit_manipulation/hamming -_distance.cpp + +bit_manipulation/hamming +_distance.cpp @@ -22,8 +22,8 @@ Node2 - -cassert + +cassert @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d6/d50/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2math_2iterative_factorial_8cpp-example.html b/d6/d50/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2math_2iterative_factorial_8cpp-example.html index 6d21e6f87..07dd492b5 100644 --- a/d6/d50/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2math_2iterative_factorial_8cpp-example.html +++ b/d6/d50/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2math_2iterative_factorial_8cpp-example.html @@ -237,7 +237,7 @@ $(function(){initNavTree('d6/d50/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plu
static void test()
Self-test implementations.
Definition generate_parentheses.cpp:82
int main()
Main function.
Definition generate_parentheses.cpp:110
-
for IO operations
+
for assert
uint64_t iterativeFactorial(uint8_t n)
Calculates the factorial iteratively.
Definition iterative_factorial.cpp:47
diff --git a/d6/d5c/travelling__salesman__problem_8cpp__incl.map b/d6/d5c/travelling__salesman__problem_8cpp__incl.map index 0f9c9ee7b..de6d6982e 100644 --- a/d6/d5c/travelling__salesman__problem_8cpp__incl.map +++ b/d6/d5c/travelling__salesman__problem_8cpp__incl.map @@ -1,13 +1,15 @@ - + - + - - - - - - - + + + + + + + + + diff --git a/d6/d5c/travelling__salesman__problem_8cpp__incl.md5 b/d6/d5c/travelling__salesman__problem_8cpp__incl.md5 index 509440710..85fab1989 100644 --- a/d6/d5c/travelling__salesman__problem_8cpp__incl.md5 +++ b/d6/d5c/travelling__salesman__problem_8cpp__incl.md5 @@ -1 +1 @@ -c96a6e1d7d44a729b08b2273d53e03ea \ No newline at end of file +6f56ee33a14f3e3a914ff8c2b1577402 \ No newline at end of file diff --git a/d6/d5c/travelling__salesman__problem_8cpp__incl.svg b/d6/d5c/travelling__salesman__problem_8cpp__incl.svg index eb2606245..31134c38f 100644 --- a/d6/d5c/travelling__salesman__problem_8cpp__incl.svg +++ b/d6/d5c/travelling__salesman__problem_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -graph/travelling_salesman -_problem.cpp + +graph/travelling_salesman +_problem.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -iostream + +cstdint @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -limits + +iostream @@ -96,8 +96,8 @@ Node1->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -vector + +limits @@ -114,8 +114,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/d6/d5c/travelling__salesman__problem_8cpp__incl_org.svg b/d6/d5c/travelling__salesman__problem_8cpp__incl_org.svg index 784688fd2..e9b147763 100644 --- a/d6/d5c/travelling__salesman__problem_8cpp__incl_org.svg +++ b/d6/d5c/travelling__salesman__problem_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + graph/travelling_salesman_problem.cpp Node1 - -graph/travelling_salesman -_problem.cpp + +graph/travelling_salesman +_problem.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -iostream + +cstdint @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -limits + +iostream @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -vector + +limits @@ -103,8 +103,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/d6/d7a/golden__search__extrema_8cpp.html b/d6/d7a/golden__search__extrema_8cpp.html index c1f164d1a..e34c75165 100644 --- a/d6/d7a/golden__search__extrema_8cpp.html +++ b/d6/d7a/golden__search__extrema_8cpp.html @@ -115,13 +115,14 @@ $(function(){initNavTree('d6/d7a/golden__search__extrema_8cpp.html','../../'); i More...

#include <cassert>
#include <cmath>
+#include <cstdint>
#include <functional>
#include <iostream>
#include <limits>
Include dependency graph for golden_search_extrema.cpp:
-
+

@@ -197,50 +198,50 @@ k=\frac{3-\sqrt{5}}{2} \approx 0.381966\ldots\]
Returns
local minima found in the interval
-
30 {
-
31 uint32_t iters = 0;
-
32 double c, d;
-
33 double prev_mean, mean = std::numeric_limits<double>::infinity();
-
34
-
35 // golden ratio value
-
36 const double M_GOLDEN_RATIO = (1.f + std::sqrt(5.f)) / 2.f;
-
37
-
38 // ensure that lim_a < lim_b
-
39 if (lim_a > lim_b) {
-
40 std::swap(lim_a, lim_b);
-
41 } else if (std::abs(lim_a - lim_b) <= EPSILON) {
-
42 std::cerr << "Search range must be greater than " << EPSILON << "\n";
-
43 return lim_a;
-
44 }
-
45
-
46 do {
-
47 prev_mean = mean;
-
48
-
49 // compute the section ratio width
-
50 double ratio = (lim_b - lim_a) / M_GOLDEN_RATIO;
-
51 c = lim_b - ratio; // right-side section start
-
52 d = lim_a + ratio; // left-side section end
-
53
-
54 if (f(c) < f(d)) {
-
55 // select left section
-
56 lim_b = d;
-
57 } else {
-
58 // selct right section
-
59 lim_a = c;
-
60 }
-
61
-
62 mean = (lim_a + lim_b) / 2.f;
-
63 iters++;
-
64
-
65 // continue till the interval width is greater than sqrt(system epsilon)
-
66 } while (std::abs(lim_a - lim_b) > EPSILON);
-
67
-
68 std::cout << " (iters: " << iters << ") ";
-
69 return prev_mean;
-
70}
+
31 {
+
32 uint32_t iters = 0;
+
33 double c, d;
+
34 double prev_mean, mean = std::numeric_limits<double>::infinity();
+
35
+
36 // golden ratio value
+
37 const double M_GOLDEN_RATIO = (1.f + std::sqrt(5.f)) / 2.f;
+
38
+
39 // ensure that lim_a < lim_b
+
40 if (lim_a > lim_b) {
+
41 std::swap(lim_a, lim_b);
+
42 } else if (std::abs(lim_a - lim_b) <= EPSILON) {
+
43 std::cerr << "Search range must be greater than " << EPSILON << "\n";
+
44 return lim_a;
+
45 }
+
46
+
47 do {
+
48 prev_mean = mean;
+
49
+
50 // compute the section ratio width
+
51 double ratio = (lim_b - lim_a) / M_GOLDEN_RATIO;
+
52 c = lim_b - ratio; // right-side section start
+
53 d = lim_a + ratio; // left-side section end
+
54
+
55 if (f(c) < f(d)) {
+
56 // select left section
+
57 lim_b = d;
+
58 } else {
+
59 // selct right section
+
60 lim_a = c;
+
61 }
+
62
+
63 mean = (lim_a + lim_b) / 2.f;
+
64 iters++;
+
65
+
66 // continue till the interval width is greater than sqrt(system epsilon)
+
67 } while (std::abs(lim_a - lim_b) > EPSILON);
+
68
+
69 std::cout << " (iters: " << iters << ") ";
+
70 return prev_mean;
+
71}
double f(double x)
A function f(x) that will be used to test the method.
Definition composite_simpson_rule.cpp:113
-
#define EPSILON
solution accuracy limit
Definition golden_search_extrema.cpp:17
+
#define EPSILON
solution accuracy limit
Definition golden_search_extrema.cpp:18
T infinity(T... args)
T sqrt(T... args)
T swap(T... args)
@@ -267,21 +268,21 @@ Here is the call graph for this function:

Main function

-
139 {
-
140 std::cout.precision(9);
-
141
-
142 std::cout << "Computations performed with machine epsilon: " << EPSILON
-
143 << "\n";
-
144
-
145 test1();
-
146 test2();
-
147 test3();
-
148
-
149 return 0;
-
150}
-
void test2()
Test function to find maxima for the function in the interval Expected result: .
Definition golden_search_extrema.cpp:100
-
void test1()
Test function to find minima for the function in the interval Expected result = 2.
Definition golden_search_extrema.cpp:78
-
void test3()
Test function to find maxima for the function in the interval Expected result: .
Definition golden_search_extrema.cpp:123
+
140 {
+
141 std::cout.precision(9);
+
142
+
143 std::cout << "Computations performed with machine epsilon: " << EPSILON
+
144 << "\n";
+
145
+
146 test1();
+
147 test2();
+
148 test3();
+
149
+
150 return 0;
+
151}
+
void test2()
Test function to find maxima for the function in the interval Expected result: .
Definition golden_search_extrema.cpp:101
+
void test1()
Test function to find minima for the function in the interval Expected result = 2.
Definition golden_search_extrema.cpp:79
+
void test3()
Test function to find maxima for the function in the interval Expected result: .
Definition golden_search_extrema.cpp:124
Here is the call graph for this function:
@@ -307,23 +308,23 @@ Here is the call graph for this function:

Test function to find minima for the function \(f(x)= (x-2)^2\) in the interval \([1,5]\)
Expected result = 2.

-
78 {
-
79 // define the function to minimize as a lambda function
-
80 std::function<double(double)> f1 = [](double x) {
-
81 return (x - 2) * (x - 2);
-
82 };
-
83
-
84 std::cout << "Test 1.... ";
-
85
-
86 double minima = get_minima(f1, 1, 5);
-
87
-
88 std::cout << minima << "...";
-
89
-
90 assert(std::abs(minima - 2) < EPSILON);
-
91 std::cout << "passed\n";
-
92}
+
79 {
+
80 // define the function to minimize as a lambda function
+
81 std::function<double(double)> f1 = [](double x) {
+
82 return (x - 2) * (x - 2);
+
83 };
+
84
+
85 std::cout << "Test 1.... ";
+
86
+
87 double minima = get_minima(f1, 1, 5);
+
88
+
89 std::cout << minima << "...";
+
90
+
91 assert(std::abs(minima - 2) < EPSILON);
+
92 std::cout << "passed\n";
+
93}
-
double get_minima(const std::function< double(double)> &f, double lim_a, double lim_b)
Get the minima of a function in the given interval. To get the maxima, simply negate the function....
Definition golden_search_extrema.cpp:29
+
double get_minima(const std::function< double(double)> &f, double lim_a, double lim_b)
Get the minima of a function in the given interval. To get the maxima, simply negate the function....
Definition golden_search_extrema.cpp:30
Here is the call graph for this function:
@@ -349,22 +350,22 @@ Here is the call graph for this function:

Test function to find maxima for the function \(f(x)= x^{\frac{1}{x}}\) in the interval \([-2,10]\)
Expected result: \(e\approx 2.71828182845904509\).

-
100 {
-
101 // define the function to maximize as a lambda function
-
102 // since we are maximixing, we negated the function return value
-
103 std::function<double(double)> func = [](double x) {
-
104 return -std::pow(x, 1.f / x);
-
105 };
-
106
-
107 std::cout << "Test 2.... ";
-
108
-
109 double minima = get_minima(func, -2, 10);
-
110
-
111 std::cout << minima << " (" << M_E << ")...";
-
112
-
113 assert(std::abs(minima - M_E) < EPSILON);
-
114 std::cout << "passed\n";
-
115}
+
101 {
+
102 // define the function to maximize as a lambda function
+
103 // since we are maximixing, we negated the function return value
+
104 std::function<double(double)> func = [](double x) {
+
105 return -std::pow(x, 1.f / x);
+
106 };
+
107
+
108 std::cout << "Test 2.... ";
+
109
+
110 double minima = get_minima(func, -2, 10);
+
111
+
112 std::cout << minima << " (" << M_E << ")...";
+
113
+
114 assert(std::abs(minima - M_E) < EPSILON);
+
115 std::cout << "passed\n";
+
116}
T pow(T... args)
Here is the call graph for this function:
@@ -391,20 +392,20 @@ Here is the call graph for this function:

Test function to find maxima for the function \(f(x)= \cos x\) in the interval \([0,12]\)
Expected result: \(\pi\approx 3.14159265358979312\).

-
123 {
-
124 // define the function to maximize as a lambda function
-
125 // since we are maximixing, we negated the function return value
-
126 std::function<double(double)> func = [](double x) { return std::cos(x); };
-
127
-
128 std::cout << "Test 3.... ";
-
129
-
130 double minima = get_minima(func, -4, 12);
-
131
-
132 std::cout << minima << " (" << M_PI << ")...";
-
133
-
134 assert(std::abs(minima - M_PI) < EPSILON);
-
135 std::cout << "passed\n";
-
136}
+
124 {
+
125 // define the function to maximize as a lambda function
+
126 // since we are maximixing, we negated the function return value
+
127 std::function<double(double)> func = [](double x) { return std::cos(x); };
+
128
+
129 std::cout << "Test 3.... ";
+
130
+
131 double minima = get_minima(func, -4, 12);
+
132
+
133 std::cout << minima << " (" << M_PI << ")...";
+
134
+
135 assert(std::abs(minima - M_PI) < EPSILON);
+
136 std::cout << "passed\n";
+
137}
T cos(T... args)
Here is the call graph for this function:
diff --git a/d6/d80/double__hash__hash__table_8cpp.html b/d6/d80/double__hash__hash__table_8cpp.html index dee9c12b5..195eced74 100644 --- a/d6/d80/double__hash__hash__table_8cpp.html +++ b/d6/d80/double__hash__hash__table_8cpp.html @@ -272,7 +272,7 @@ bool 
double_hashing::rehas
T endl(T... args)
-
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:287
+
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:288
size_t hashFxn(int key)
Hash a key. Uses the STL library's std::hash() function.
Definition double_hash_hash_table.cpp:47
void display()
Definition double_hash_hash_table.cpp:143
void removalInfo(int key)
Definition double_hash_hash_table.cpp:227
diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp.html b/d6/d80/dynamic__programming_2subset__sum_8cpp.html index 0e06af50c..0fe46048a 100644 --- a/d6/d80/dynamic__programming_2subset__sum_8cpp.html +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp.html @@ -170,7 +170,7 @@ Functions
pageFrame pageFrame
- + @@ -168,8 +169,8 @@ template<typename T = double, char iterations = 2>

Functions

template<typename T = double, char iterations = 2>
Fast_InvSqrt (T x)
 for numeric_limits
 for std::sqrt
 
template<typename T = double>
Standard_InvSqrt (T number)
-

for numeric_limits

-

for assert for std::sqrt for IO operations

+

for std::sqrt

+

for assert for IO operations for numeric_limits

This is the function that calculates the fast inverse square root. The following code is the fast inverse square root implementation from Quake III Arena (Adapted for C++). More information can be found at Wikipedia

Template Parameters
@@ -247,7 +248,7 @@ template<typename T = double, char iterations = 2>
T endl(T... args)
T Standard_InvSqrt(T number)
This is the function that calculates the fast inverse square root. The following code is the fast inv...
Definition inv_sqrt.cpp:59
static void test()
Self-test implementations.
Definition inv_sqrt.cpp:68
-
T Fast_InvSqrt(T x)
for numeric_limits
Definition inv_sqrt.cpp:28
+
T Fast_InvSqrt(T x)
for std::sqrt
Definition inv_sqrt.cpp:28
Here is the call graph for this function:
diff --git a/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map b/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map index f84c635ad..c455f4080 100644 --- a/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map +++ b/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map @@ -2,7 +2,7 @@ - + diff --git a/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 b/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 index 04cd23676..23ffbadeb 100644 --- a/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 +++ b/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 @@ -1 +1 @@ -10c08706c543d14b1d3a7166cdba4af0 \ No newline at end of file +06769312eaeb707d415e3f0b084fcecd \ No newline at end of file diff --git a/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg index 72e656c48..e945cbd8c 100644 --- a/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg +++ b/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg @@ -49,7 +49,7 @@ Node3 - + Fast_InvSqrt diff --git a/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg b/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg index fffdaebd7..d29df9354 100644 --- a/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg +++ b/d6/db8/inv__sqrt_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg @@ -38,7 +38,7 @@ Node3 - + Fast_InvSqrt diff --git a/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index 46a569165..0e99660c3 100644 --- a/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -2,7 +2,7 @@ - + diff --git a/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index 3d4e7de7e..d56341161 100644 --- a/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -7c5937b1334cbfc3148ea1d000d4ec3b \ No newline at end of file +737c1b9ea92d0445059fc576a7c498c9 \ No newline at end of file diff --git a/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index b60f4468c..1ebcd3772 100644 --- a/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -49,7 +49,7 @@ Node3 - + Fast_InvSqrt diff --git a/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index f2dacdf1d..a5637cecb 100644 --- a/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d6/db8/inv__sqrt_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -38,7 +38,7 @@ Node3 - + Fast_InvSqrt diff --git a/d6/df6/n__choose__r_8cpp__incl.map b/d6/df6/n__choose__r_8cpp__incl.map index 2331f96d5..354359739 100644 --- a/d6/df6/n__choose__r_8cpp__incl.map +++ b/d6/df6/n__choose__r_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/d6/df6/n__choose__r_8cpp__incl.md5 b/d6/df6/n__choose__r_8cpp__incl.md5 index d00ccf214..6a71a698e 100644 --- a/d6/df6/n__choose__r_8cpp__incl.md5 +++ b/d6/df6/n__choose__r_8cpp__incl.md5 @@ -1 +1 @@ -181c65e9bdbfd55c6f603b5fa29f6958 \ No newline at end of file +16b175e71e3a22a30a255c715beee25e \ No newline at end of file diff --git a/d6/df6/n__choose__r_8cpp__incl.svg b/d6/df6/n__choose__r_8cpp__incl.svg index e362326dd..d1719cabd 100644 --- a/d6/df6/n__choose__r_8cpp__incl.svg +++ b/d6/df6/n__choose__r_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/n_choose_r.cpp + +math/n_choose_r.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d6/df6/n__choose__r_8cpp__incl_org.svg b/d6/df6/n__choose__r_8cpp__incl_org.svg index aea1a2b39..f6ffad5a2 100644 --- a/d6/df6/n__choose__r_8cpp__incl_org.svg +++ b/d6/df6/n__choose__r_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/n_choose_r.cpp Node1 - -math/n_choose_r.cpp + +math/n_choose_r.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d7/d00/list__array_8cpp.html b/d7/d00/list__array_8cpp.html index cd07e0c6e..79d846ee4 100644 --- a/d7/d00/list__array_8cpp.html +++ b/d7/d00/list__array_8cpp.html @@ -114,13 +114,14 @@ $(function(){initNavTree('d7/d00/list__array_8cpp.html','../../'); initResizable

Dynamic Array More...

-
#include <iostream>
-#include <array>
+
#include <array>
#include <cassert>
+#include <cstdint>
+#include <iostream>
Include dependency graph for list_array.cpp:
-
+
Tfloating type

@@ -171,11 +172,11 @@ Algorithm

Main function.

Returns
0 on exit
-
248 {
-
249 test(); // Execute the tests
-
250 return 0;
-
251}
-
static void test()
Test implementations.
Definition list_array.cpp:206
+
260 {
+
261 test(); // Execute the tests
+
262 return 0;
+
263}
+
static void test()
Test implementations.
Definition list_array.cpp:218
Here is the call graph for this function:
@@ -209,48 +210,48 @@ Here is the call graph for this function:

Test implementations.

Returns
void
-
206 {
- -
208
-
209 // Insert testing
-
210 L.insert(11);
-
211 L.insert(12);
-
212 assert(L.top == 2);
-
213 L.insert(15);
-
214 L.insert(10);
-
215 L.insert(12);
-
216 L.insert(20);
-
217 L.insert(18);
-
218 assert(L.top == 7);
-
219 L.show(); // To print the array
+
218 {
+
220
-
221 // Remove testing
-
222 L.remove(12); // Remove Duplicate value in the list
-
223 L.remove(15); // Remove the existing value in the list
-
224 assert(L.top == 5);
-
225 L.remove(50); // Try to remove the non-existing value in the list
-
226 assert(L.top == 5);
-
227
-
228 // LinearSearch testing
-
229 assert(L.search(11) == 0); // search for the existing element
-
230 assert(L.search(12) == 2);
-
231 assert(L.search(50) == -1); // search for the non-existing element
+
221 // Insert testing
+
222 L.insert(11);
+
223 L.insert(12);
+
224 assert(L.top == 2);
+
225 L.insert(15);
+
226 L.insert(10);
+
227 L.insert(12);
+
228 L.insert(20);
+
229 L.insert(18);
+
230 assert(L.top == 7);
+
231 L.show(); // To print the array
232
-
233 // Sort testing
-
234 L.sort();
-
235 assert(L.isSorted == true);
-
236 L.show();
-
237
-
238 // BinarySearch testing
-
239 assert(L.search(11) == 1); // search for the existing element
-
240 assert(L.search(12) == 2);
-
241 assert(L.search(50) == -1); // search for the non-existing element
-
242}
-
Structure of List with supporting methods.
Definition list_array.cpp:33
-
void show()
Utility function to print array.
Definition list_array.cpp:191
-
void sort()
Sort the list.
Definition list_array.cpp:111
-
void remove(const uint64_t &val)
To remove the element from the list.
Definition list_array.cpp:172
-
void insert(const uint64_t &val)
Insert the new element in the list.
Definition list_array.cpp:133
+
233 // Remove testing
+
234 L.remove(12); // Remove Duplicate value in the list
+
235 L.remove(15); // Remove the existing value in the list
+
236 assert(L.top == 5);
+
237 L.remove(50); // Try to remove the non-existing value in the list
+
238 assert(L.top == 5);
+
239
+
240 // LinearSearch testing
+
241 assert(L.search(11) == 0); // search for the existing element
+
242 assert(L.search(12) == 2);
+
243 assert(L.search(50) == -1); // search for the non-existing element
+
244
+
245 // Sort testing
+
246 L.sort();
+
247 assert(L.isSorted == true);
+
248 L.show();
+
249
+
250 // BinarySearch testing
+
251 assert(L.search(11) == 1); // search for the existing element
+
252 assert(L.search(12) == 2);
+
253 assert(L.search(50) == -1); // search for the non-existing element
+
254}
+
Structure of List with supporting methods.
Definition list_array.cpp:37
+
void show()
Utility function to print array.
Definition list_array.cpp:203
+
void sort()
Sort the list.
Definition list_array.cpp:121
+
void remove(const uint64_t &val)
To remove the element from the list.
Definition list_array.cpp:183
+
void insert(const uint64_t &val)
Insert the new element in the list.
Definition list_array.cpp:143
Here is the call graph for this function:
diff --git a/d7/d07/bidirectional__dijkstra_8cpp.html b/d7/d07/bidirectional__dijkstra_8cpp.html index 8b74d8287..46a1d06d7 100644 --- a/d7/d07/bidirectional__dijkstra_8cpp.html +++ b/d7/d07/bidirectional__dijkstra_8cpp.html @@ -115,6 +115,7 @@ $(function(){initNavTree('d7/d07/bidirectional__dijkstra_8cpp.html','../../'); i

[Bidirectional Dijkstra Shortest Path Algorithm] (https://www.coursera.org/learn/algorithms-on-graphs/lecture/7ml18/bidirectional-dijkstra) More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <limits>
#include <queue>
@@ -123,7 +124,7 @@ $(function(){initNavTree('d7/d07/bidirectional__dijkstra_8cpp.html','../../'); i
Include dependency graph for bidirectional_dijkstra.cpp:
-
+
+

@@ -156,6 +157,7 @@ Functions

Variables

constexpr int64_t INF = std::numeric_limits<int64_t>::max()
 for assert
 

Detailed Description

@@ -207,11 +209,11 @@ Variables
-
47 {
-
48 (*adj1)[u - 1].push_back(std::make_pair(v - 1, w));
-
49 (*adj2)[v - 1].push_back(std::make_pair(u - 1, w));
-
50 // (*adj)[v - 1].push_back(std::make_pair(u - 1, w));
-
51}
+
48 {
+
49 (*adj1)[u - 1].push_back(std::make_pair(v - 1, w));
+
50 (*adj2)[v - 1].push_back(std::make_pair(u - 1, w));
+
51 // (*adj)[v - 1].push_back(std::make_pair(u - 1, w));
+
52}
T make_pair(T... args)
Here is the call graph for this function:
@@ -283,111 +285,111 @@ Here is the call graph for this function:

for all the reachable vertex from the currently exploring vertex we will try to minimize the distance

minimizing distances

check if currentNode has already been visited

-
88 {
-
89 /// n denotes the number of vertices in graph
-
90 uint64_t n = adj1->size();
-
91
-
92 /// setting all the distances initially to INF
- -
94
-
95 /// creating a a vector of min heap using priority queue
-
96 /// pq[0] contains the min heap for the direct search
-
97 /// pq[1] contains the min heap for the reverse search
-
98
-
99 /// first element of pair contains the distance
-
100 /// second element of pair contains the vertex
- - - - -
105 pq(2);
-
106 /// vector for store the nodes or vertices in the shortest path
-
107 std::vector<uint64_t> workset(n);
-
108 /// vector for store the nodes or vertices visited
-
109 std::vector<bool> visited(n);
-
110
-
111 /// pushing the source vertex 's' with 0 distance in pq[0] min heap
-
112 pq[0].push(std::make_pair(0, s));
-
113
-
114 /// marking the distance of source as 0
-
115 dist[0][s] = 0;
-
116
-
117 /// pushing the target vertex 't' with 0 distance in pq[1] min heap
-
118 pq[1].push(std::make_pair(0, t));
-
119
-
120 /// marking the distance of target as 0
-
121 dist[1][t] = 0;
-
122
-
123 while (true) {
-
124 /// direct search
-
125
-
126 // If pq[0].size() is equal to zero then the node/ vertex is not
-
127 // reachable from s
-
128 if (pq[0].size() == 0) {
-
129 break;
-
130 }
-
131 /// second element of pair denotes the node / vertex
-
132 uint64_t currentNode = pq[0].top().second;
-
133
-
134 /// first element of pair denotes the distance
-
135 uint64_t currentDist = pq[0].top().first;
-
136
-
137 pq[0].pop();
-
138
-
139 /// for all the reachable vertex from the currently exploring vertex
-
140 /// we will try to minimize the distance
-
141 for (std::pair<int, int> edge : (*adj1)[currentNode]) {
-
142 /// minimizing distances
-
143 if (currentDist + edge.second < dist[0][edge.first]) {
-
144 dist[0][edge.first] = currentDist + edge.second;
-
145 pq[0].push(std::make_pair(dist[0][edge.first], edge.first));
-
146 }
-
147 }
-
148 // store the processed node/ vertex
-
149 workset.push_back(currentNode);
-
150
-
151 /// check if currentNode has already been visited
-
152 if (visited[currentNode] == 1) {
-
153 return Shortest_Path_Distance(workset, dist);
-
154 }
-
155 visited[currentNode] = true;
-
156 /// reversed search
-
157
-
158 // If pq[1].size() is equal to zero then the node/ vertex is not
-
159 // reachable from t
-
160 if (pq[1].size() == 0) {
-
161 break;
-
162 }
-
163 /// second element of pair denotes the node / vertex
-
164 currentNode = pq[1].top().second;
-
165
-
166 /// first element of pair denotes the distance
-
167 currentDist = pq[1].top().first;
-
168
-
169 pq[1].pop();
-
170
-
171 /// for all the reachable vertex from the currently exploring vertex
-
172 /// we will try to minimize the distance
-
173 for (std::pair<int, int> edge : (*adj2)[currentNode]) {
-
174 /// minimizing distances
-
175 if (currentDist + edge.second < dist[1][edge.first]) {
-
176 dist[1][edge.first] = currentDist + edge.second;
-
177 pq[1].push(std::make_pair(dist[1][edge.first], edge.first));
-
178 }
-
179 }
-
180 // store the processed node/ vertex
-
181 workset.push_back(currentNode);
-
182
-
183 /// check if currentNode has already been visited
-
184 if (visited[currentNode] == 1) {
-
185 return Shortest_Path_Distance(workset, dist);
-
186 }
-
187 visited[currentNode] = true;
-
188 }
-
189 return -1;
-
190}
-
uint64_t Shortest_Path_Distance(const std::vector< uint64_t > &workset_, const std::vector< std::vector< uint64_t > > &distance_)
This function returns the shortest distance from the source to the target if there is path between ve...
Definition bidirectional_dijkstra.cpp:61
-
constexpr int64_t INF
Definition bidirectional_dijkstra.cpp:23
+
89 {
+
90 /// n denotes the number of vertices in graph
+
91 uint64_t n = adj1->size();
+
92
+
93 /// setting all the distances initially to INF
+ +
95
+
96 /// creating a a vector of min heap using priority queue
+
97 /// pq[0] contains the min heap for the direct search
+
98 /// pq[1] contains the min heap for the reverse search
+
99
+
100 /// first element of pair contains the distance
+
101 /// second element of pair contains the vertex
+ + + + +
106 pq(2);
+
107 /// vector for store the nodes or vertices in the shortest path
+
108 std::vector<uint64_t> workset(n);
+
109 /// vector for store the nodes or vertices visited
+
110 std::vector<bool> visited(n);
+
111
+
112 /// pushing the source vertex 's' with 0 distance in pq[0] min heap
+
113 pq[0].push(std::make_pair(0, s));
+
114
+
115 /// marking the distance of source as 0
+
116 dist[0][s] = 0;
+
117
+
118 /// pushing the target vertex 't' with 0 distance in pq[1] min heap
+
119 pq[1].push(std::make_pair(0, t));
+
120
+
121 /// marking the distance of target as 0
+
122 dist[1][t] = 0;
+
123
+
124 while (true) {
+
125 /// direct search
+
126
+
127 // If pq[0].size() is equal to zero then the node/ vertex is not
+
128 // reachable from s
+
129 if (pq[0].size() == 0) {
+
130 break;
+
131 }
+
132 /// second element of pair denotes the node / vertex
+
133 uint64_t currentNode = pq[0].top().second;
+
134
+
135 /// first element of pair denotes the distance
+
136 uint64_t currentDist = pq[0].top().first;
+
137
+
138 pq[0].pop();
+
139
+
140 /// for all the reachable vertex from the currently exploring vertex
+
141 /// we will try to minimize the distance
+
142 for (std::pair<int, int> edge : (*adj1)[currentNode]) {
+
143 /// minimizing distances
+
144 if (currentDist + edge.second < dist[0][edge.first]) {
+
145 dist[0][edge.first] = currentDist + edge.second;
+
146 pq[0].push(std::make_pair(dist[0][edge.first], edge.first));
+
147 }
+
148 }
+
149 // store the processed node/ vertex
+
150 workset.push_back(currentNode);
+
151
+
152 /// check if currentNode has already been visited
+
153 if (visited[currentNode] == 1) {
+
154 return Shortest_Path_Distance(workset, dist);
+
155 }
+
156 visited[currentNode] = true;
+
157 /// reversed search
+
158
+
159 // If pq[1].size() is equal to zero then the node/ vertex is not
+
160 // reachable from t
+
161 if (pq[1].size() == 0) {
+
162 break;
+
163 }
+
164 /// second element of pair denotes the node / vertex
+
165 currentNode = pq[1].top().second;
+
166
+
167 /// first element of pair denotes the distance
+
168 currentDist = pq[1].top().first;
+
169
+
170 pq[1].pop();
+
171
+
172 /// for all the reachable vertex from the currently exploring vertex
+
173 /// we will try to minimize the distance
+
174 for (std::pair<int, int> edge : (*adj2)[currentNode]) {
+
175 /// minimizing distances
+
176 if (currentDist + edge.second < dist[1][edge.first]) {
+
177 dist[1][edge.first] = currentDist + edge.second;
+
178 pq[1].push(std::make_pair(dist[1][edge.first], edge.first));
+
179 }
+
180 }
+
181 // store the processed node/ vertex
+
182 workset.push_back(currentNode);
+
183
+
184 /// check if currentNode has already been visited
+
185 if (visited[currentNode] == 1) {
+
186 return Shortest_Path_Distance(workset, dist);
+
187 }
+
188 visited[currentNode] = true;
+
189 }
+
190 return -1;
+
191}
+
uint64_t Shortest_Path_Distance(const std::vector< uint64_t > &workset_, const std::vector< std::vector< uint64_t > > &distance_)
This function returns the shortest distance from the source to the target if there is path between ve...
Definition bidirectional_dijkstra.cpp:62
+
constexpr int64_t INF
for assert
Definition bidirectional_dijkstra.cpp:24
@@ -419,57 +421,57 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
248 {
-
249 tests(); // running predefined tests
-
250 uint64_t vertices = uint64_t();
-
251 uint64_t edges = uint64_t();
-
252 std::cout << "Enter the number of vertices : ";
-
253 std::cin >> vertices;
-
254 std::cout << "Enter the number of edges : ";
-
255 std::cin >> edges;
-
256
- - - - -
261
-
262 uint64_t u = uint64_t(), v = uint64_t(), w = uint64_t();
-
263 std::cout << "Enter the edges by three integers in this form: u v w "
-
264 << std::endl;
-
265 std::cout << "Example: if there is and edge between node 1 and node 4 with "
-
266 "weight 7 enter: 1 4 7, and then press enter"
-
267 << std::endl;
-
268 while (edges--) {
-
269 std::cin >> u >> v >> w;
-
270 graph::bidirectional_dijkstra::addEdge(&adj1, &adj2, u, v, w);
-
271 if (edges != 0) {
-
272 std::cout << "Enter the next edge" << std::endl;
-
273 }
-
274 }
-
275
-
276 uint64_t s = uint64_t(), t = uint64_t();
- -
278 << "Enter the source node and the target node separated by a space"
-
279 << std::endl;
-
280 std::cout << "Example: If the source node is 5 and the target node is 6 "
-
281 "enter: 5 6 and press enter"
-
282 << std::endl;
-
283 std::cin >> s >> t;
-
284 int dist =
-
285 graph::bidirectional_dijkstra::Bidijkstra(&adj1, &adj2, s - 1, t - 1);
-
286 if (dist == -1) {
-
287 std::cout << "Target not reachable from source" << std::endl;
-
288 } else {
-
289 std::cout << "Shortest Path Distance : " << dist << std::endl;
-
290 }
-
291
-
292 return 0;
-
293}
+
249 {
+
250 tests(); // running predefined tests
+
251 uint64_t vertices = uint64_t();
+
252 uint64_t edges = uint64_t();
+
253 std::cout << "Enter the number of vertices : ";
+
254 std::cin >> vertices;
+
255 std::cout << "Enter the number of edges : ";
+
256 std::cin >> edges;
+
257
+ + + + +
262
+
263 uint64_t u = uint64_t(), v = uint64_t(), w = uint64_t();
+
264 std::cout << "Enter the edges by three integers in this form: u v w "
+
265 << std::endl;
+
266 std::cout << "Example: if there is and edge between node 1 and node 4 with "
+
267 "weight 7 enter: 1 4 7, and then press enter"
+
268 << std::endl;
+
269 while (edges--) {
+
270 std::cin >> u >> v >> w;
+
271 graph::bidirectional_dijkstra::addEdge(&adj1, &adj2, u, v, w);
+
272 if (edges != 0) {
+
273 std::cout << "Enter the next edge" << std::endl;
+
274 }
+
275 }
+
276
+
277 uint64_t s = uint64_t(), t = uint64_t();
+ +
279 << "Enter the source node and the target node separated by a space"
+
280 << std::endl;
+
281 std::cout << "Example: If the source node is 5 and the target node is 6 "
+
282 "enter: 5 6 and press enter"
+
283 << std::endl;
+
284 std::cin >> s >> t;
+
285 int dist =
+
286 graph::bidirectional_dijkstra::Bidijkstra(&adj1, &adj2, s - 1, t - 1);
+
287 if (dist == -1) {
+
288 std::cout << "Target not reachable from source" << std::endl;
+
289 } else {
+
290 std::cout << "Shortest Path Distance : " << dist << std::endl;
+
291 }
+
292
+
293 return 0;
+
294}
-
int Bidijkstra(std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj1, std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj2, uint64_t s, uint64_t t)
Function runs the dijkstra algorithm for some source vertex and target vertex in the graph and return...
Definition bidirectional_dijkstra.cpp:86
-
static void tests()
Function to test the provided algorithm above.
Definition bidirectional_dijkstra.cpp:199
-
void addEdge(std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj1, std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj2, uint64_t u, uint64_t v, uint64_t w)
Function that add edge between two nodes or vertices of graph.
Definition bidirectional_dijkstra.cpp:45
+
int Bidijkstra(std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj1, std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj2, uint64_t s, uint64_t t)
Function runs the dijkstra algorithm for some source vertex and target vertex in the graph and return...
Definition bidirectional_dijkstra.cpp:87
+
static void tests()
Function to test the provided algorithm above.
Definition bidirectional_dijkstra.cpp:200
+
void addEdge(std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj1, std::vector< std::vector< std::pair< uint64_t, uint64_t > > > *adj2, uint64_t u, uint64_t v, uint64_t w)
Function that add edge between two nodes or vertices of graph.
Definition bidirectional_dijkstra.cpp:46
T endl(T... args)
Here is the call graph for this function:
@@ -506,15 +508,15 @@ Here is the call graph for this function:
-
63 {
-
64 int64_t distance = INF;
-
65 for (uint64_t i : workset_) {
-
66 if (distance_[0][i] + distance_[1][i] < distance) {
-
67 distance = distance_[0][i] + distance_[1][i];
-
68 }
-
69 }
-
70 return distance;
-
71}
+
64 {
+
65 int64_t distance = INF;
+
66 for (uint64_t i : workset_) {
+
67 if (distance_[0][i] + distance_[1][i] < distance) {
+
68 distance = distance_[0][i] + distance_[1][i];
+
69 }
+
70 }
+
71 return distance;
+
72}
T distance(T... args)
Here is the call graph for this function:
@@ -549,50 +551,50 @@ Here is the call graph for this function:

Function to test the provided algorithm above.

Returns
void
-
199 {
-
200 std::cout << "Initiatinig Predefined Tests..." << std::endl;
-
201 std::cout << "Initiating Test 1..." << std::endl;
- - - - -
206 graph::bidirectional_dijkstra::addEdge(&adj1_1, &adj1_2, 1, 2, 1);
-
207 graph::bidirectional_dijkstra::addEdge(&adj1_1, &adj1_2, 4, 1, 2);
-
208 graph::bidirectional_dijkstra::addEdge(&adj1_1, &adj1_2, 2, 3, 2);
-
209 graph::bidirectional_dijkstra::addEdge(&adj1_1, &adj1_2, 1, 3, 5);
-
210
-
211 uint64_t s = 1, t = 3;
-
212 assert(graph::bidirectional_dijkstra::Bidijkstra(&adj1_1, &adj1_2, s - 1,
-
213 t - 1) == 3);
-
214 std::cout << "Test 1 Passed..." << std::endl;
-
215
-
216 s = 4, t = 3;
-
217 std::cout << "Initiating Test 2..." << std::endl;
-
218 assert(graph::bidirectional_dijkstra::Bidijkstra(&adj1_1, &adj1_2, s - 1,
-
219 t - 1) == 5);
-
220 std::cout << "Test 2 Passed..." << std::endl;
-
221
- - - - -
226 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 1, 2, 4);
-
227 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 1, 3, 2);
-
228 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 2, 3, 2);
-
229 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 3, 2, 1);
-
230 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 2, 4, 2);
-
231 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 3, 5, 4);
-
232 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 5, 4, 1);
-
233 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 2, 5, 3);
-
234 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 3, 4, 4);
-
235
-
236 s = 1, t = 5;
-
237 std::cout << "Initiating Test 3..." << std::endl;
-
238 assert(graph::bidirectional_dijkstra::Bidijkstra(&adj2_1, &adj2_2, s - 1,
-
239 t - 1) == 6);
-
240 std::cout << "Test 3 Passed..." << std::endl;
-
241 std::cout << "All Test Passed..." << std::endl << std::endl;
-
242}
+
200 {
+
201 std::cout << "Initiatinig Predefined Tests..." << std::endl;
+
202 std::cout << "Initiating Test 1..." << std::endl;
+ + + + +
207 graph::bidirectional_dijkstra::addEdge(&adj1_1, &adj1_2, 1, 2, 1);
+
208 graph::bidirectional_dijkstra::addEdge(&adj1_1, &adj1_2, 4, 1, 2);
+
209 graph::bidirectional_dijkstra::addEdge(&adj1_1, &adj1_2, 2, 3, 2);
+
210 graph::bidirectional_dijkstra::addEdge(&adj1_1, &adj1_2, 1, 3, 5);
+
211
+
212 uint64_t s = 1, t = 3;
+
213 assert(graph::bidirectional_dijkstra::Bidijkstra(&adj1_1, &adj1_2, s - 1,
+
214 t - 1) == 3);
+
215 std::cout << "Test 1 Passed..." << std::endl;
+
216
+
217 s = 4, t = 3;
+
218 std::cout << "Initiating Test 2..." << std::endl;
+
219 assert(graph::bidirectional_dijkstra::Bidijkstra(&adj1_1, &adj1_2, s - 1,
+
220 t - 1) == 5);
+
221 std::cout << "Test 2 Passed..." << std::endl;
+
222
+ + + + +
227 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 1, 2, 4);
+
228 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 1, 3, 2);
+
229 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 2, 3, 2);
+
230 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 3, 2, 1);
+
231 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 2, 4, 2);
+
232 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 3, 5, 4);
+
233 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 5, 4, 1);
+
234 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 2, 5, 3);
+
235 graph::bidirectional_dijkstra::addEdge(&adj2_1, &adj2_2, 3, 4, 4);
+
236
+
237 s = 1, t = 5;
+
238 std::cout << "Initiating Test 3..." << std::endl;
+
239 assert(graph::bidirectional_dijkstra::Bidijkstra(&adj2_1, &adj2_2, s - 1,
+
240 t - 1) == 6);
+
241 std::cout << "Test 3 Passed..." << std::endl;
+
242 std::cout << "All Test Passed..." << std::endl << std::endl;
+
243}
Here is the call graph for this function:
@@ -621,7 +623,9 @@ Here is the call graph for this function:
-

for assert for io operations for variable INF for the priority_queue of distances for make_pair function for store the graph, the distances, and the path

+ +

for assert

+

for io operations for variable INF for the priority_queue of distances for make_pair function for store the graph, the distances, and the path

diff --git a/d7/d4a/fibonacci__sum_8cpp__incl.map b/d7/d4a/fibonacci__sum_8cpp__incl.map index 16b8f937e..aa8cabf65 100644 --- a/d7/d4a/fibonacci__sum_8cpp__incl.map +++ b/d7/d4a/fibonacci__sum_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/d7/d4a/fibonacci__sum_8cpp__incl.md5 b/d7/d4a/fibonacci__sum_8cpp__incl.md5 index 2170b1715..4fb686026 100644 --- a/d7/d4a/fibonacci__sum_8cpp__incl.md5 +++ b/d7/d4a/fibonacci__sum_8cpp__incl.md5 @@ -1 +1 @@ -b3ac3bdf7e5270b4ba08c72084cbd6fa \ No newline at end of file +2354e40ad8a9859ed14b96430254621d \ No newline at end of file diff --git a/d7/d4a/fibonacci__sum_8cpp__incl.svg b/d7/d4a/fibonacci__sum_8cpp__incl.svg index 46f975c8f..11ec791de 100644 --- a/d7/d4a/fibonacci__sum_8cpp__incl.svg +++ b/d7/d4a/fibonacci__sum_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/fibonacci_sum.cpp + +math/fibonacci_sum.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -vector + +iostream @@ -77,8 +77,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d7/d4a/fibonacci__sum_8cpp__incl_org.svg b/d7/d4a/fibonacci__sum_8cpp__incl_org.svg index db727b446..cb86dccd7 100644 --- a/d7/d4a/fibonacci__sum_8cpp__incl_org.svg +++ b/d7/d4a/fibonacci__sum_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/fibonacci_sum.cpp Node1 - -math/fibonacci_sum.cpp + +math/fibonacci_sum.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -vector + +iostream @@ -66,8 +66,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d7/d53/inv__sqrt_8cpp__incl.map b/d7/d53/inv__sqrt_8cpp__incl.map index b9db894e3..0517f3361 100644 --- a/d7/d53/inv__sqrt_8cpp__incl.map +++ b/d7/d53/inv__sqrt_8cpp__incl.map @@ -1,11 +1,13 @@ - + - + - - - - - + + + + + + + diff --git a/d7/d53/inv__sqrt_8cpp__incl.md5 b/d7/d53/inv__sqrt_8cpp__incl.md5 index 32917834e..713425a51 100644 --- a/d7/d53/inv__sqrt_8cpp__incl.md5 +++ b/d7/d53/inv__sqrt_8cpp__incl.md5 @@ -1 +1 @@ -6c79d44fbefb0ef08af5a8a0e0fc9b20 \ No newline at end of file +eef3c857d557ea8e8c0881f2307b2279 \ No newline at end of file diff --git a/d7/d53/inv__sqrt_8cpp__incl.svg b/d7/d53/inv__sqrt_8cpp__incl.svg index cbedbb280..090552ccc 100644 --- a/d7/d53/inv__sqrt_8cpp__incl.svg +++ b/d7/d53/inv__sqrt_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/inv_sqrt.cpp + +math/inv_sqrt.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -iostream + +cstdint @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -limits + +iostream @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +limits + + + + + +Node1->Node6 + + + diff --git a/d7/d53/inv__sqrt_8cpp__incl_org.svg b/d7/d53/inv__sqrt_8cpp__incl_org.svg index ee2282606..721569c46 100644 --- a/d7/d53/inv__sqrt_8cpp__incl_org.svg +++ b/d7/d53/inv__sqrt_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/inv_sqrt.cpp Node1 - -math/inv_sqrt.cpp + +math/inv_sqrt.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -iostream + +cstdint @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -limits + +iostream @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +limits + + + + + +Node1->Node6 + + + diff --git a/d7/d56/count__bits__flip_8cpp.html b/d7/d56/count__bits__flip_8cpp.html index 9d2104568..28956595a 100644 --- a/d7/d56/count__bits__flip_8cpp.html +++ b/d7/d56/count__bits__flip_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d7/d56/count__bits__flip_8cpp.html','../../'); initRes

Implementation to [Count number of bits to be flipped to convert A to B] (https://www.geeksforgeeks.org/count-number-of-bits-to-be-flipped-to-convert-a-to-b/) in an integer. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for count_bits_flip.cpp:
-
+
- + @@ -177,19 +178,19 @@ Functions
Returns
total number of bits needed to be flipped to convert A to B
-
44 { // int64_t is preferred over int so that
-
45 // no Overflow can be there.
-
46
-
47 int count =
-
48 0; // "count" variable is used to count number of bits flip of the
-
49 // number A to form B in binary representation of number 'n'
-
50 A = A ^ B;
-
51 while (A) {
-
52 A = A & (A - 1);
-
53 count++;
-
54 }
-
55 return count;
-
56}
+
45 { // int64_t is preferred over int so that
+
46 // no Overflow can be there.
+
47
+
48 int count =
+
49 0; // "count" variable is used to count number of bits flip of the
+
50 // number A to form B in binary representation of number 'n'
+
51 A = A ^ B;
+
52 while (A) {
+
53 A = A & (A - 1);
+
54 count++;
+
55 }
+
56 return count;
+
57}
Here is the call graph for this function:
@@ -215,11 +216,11 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
85 {
-
86 test(); // run self-test implementations
-
87 return 0;
-
88}
-
static void test()
Self-test implementations.
Definition count_bits_flip.cpp:64
+
86 {
+
87 test(); // run self-test implementations
+
88 return 0;
+
89}
+
static void test()
Self-test implementations.
Definition count_bits_flip.cpp:65
Here is the call graph for this function:
@@ -253,23 +254,23 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
64 {
-
65 // A = 10, B = 20 return 4
-
66 assert(bit_manipulation::count_bits_flip::countBitsFlip(10, 20) == 4);
-
67 // A = 20, B = 25 return 3
-
68 assert(bit_manipulation::count_bits_flip::countBitsFlip(20, 25) == 3);
-
69 // A = 7, B = 10 return 3
-
70 assert(bit_manipulation::count_bits_flip::countBitsFlip(7, 10) == 3);
-
71 // A = 17, B = 25 return 1
-
72 assert(bit_manipulation::count_bits_flip::countBitsFlip(17, 25) == 1);
-
73 // A = 11, B = 8 return 2
-
74 assert(bit_manipulation::count_bits_flip::countBitsFlip(11, 8) == 2);
-
75 // A = 21, B = 22 return 2
-
76 assert(bit_manipulation::count_bits_flip::countBitsFlip(21, 22) == 2);
-
77 // A = 7, B = 786 return 5
-
78 assert(bit_manipulation::count_bits_flip::countBitsFlip(7, 786) == 5);
-
79 std::cout << "All test cases successfully passed!" << std::endl;
-
80}
+
65 {
+
66 // A = 10, B = 20 return 4
+
67 assert(bit_manipulation::count_bits_flip::countBitsFlip(10, 20) == 4);
+
68 // A = 20, B = 25 return 3
+
69 assert(bit_manipulation::count_bits_flip::countBitsFlip(20, 25) == 3);
+
70 // A = 7, B = 10 return 3
+
71 assert(bit_manipulation::count_bits_flip::countBitsFlip(7, 10) == 3);
+
72 // A = 17, B = 25 return 1
+
73 assert(bit_manipulation::count_bits_flip::countBitsFlip(17, 25) == 1);
+
74 // A = 11, B = 8 return 2
+
75 assert(bit_manipulation::count_bits_flip::countBitsFlip(11, 8) == 2);
+
76 // A = 21, B = 22 return 2
+
77 assert(bit_manipulation::count_bits_flip::countBitsFlip(21, 22) == 2);
+
78 // A = 7, B = 786 return 5
+
79 assert(bit_manipulation::count_bits_flip::countBitsFlip(7, 786) == 5);
+
80 std::cout << "All test cases successfully passed!" << std::endl;
+
81}
T endl(T... args)
diff --git a/d7/d57/longest__increasing__subsequence_8cpp.html b/d7/d57/longest__increasing__subsequence_8cpp.html index fac14f5f7..daf190677 100644 --- a/d7/d57/longest__increasing__subsequence_8cpp.html +++ b/d7/d57/longest__increasing__subsequence_8cpp.html @@ -245,7 +245,7 @@ Here is the call graph for this function:
70
71 std::cout << "Self-test implementations passed!" << std::endl;
72}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/d7/d73/abbreviation_8cpp.html b/d7/d73/abbreviation_8cpp.html index a9b5ce64d..fe413c1aa 100644 --- a/d7/d73/abbreviation_8cpp.html +++ b/d7/d73/abbreviation_8cpp.html @@ -219,7 +219,7 @@ Algorithm
142 }
143 return memo.back().back();
144}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T size(T... args)
diff --git a/d7/d77/class_edge.html b/d7/d77/class_edge.html index d1ca39042..8811f6a00 100644 --- a/d7/d77/class_edge.html +++ b/d7/d77/class_edge.html @@ -185,7 +185,7 @@ unsigned int 

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 
namespace  count_bits_flip
 Functions for the count bits flip implementation.
dest
-
41 : src(source), dest(destination) {}
+
42 : src(source), dest(destination) {}
diff --git a/d7/d81/namespacebit__manipulation.html b/d7/d81/namespacebit__manipulation.html index 859e2152b..d5960858e 100644 --- a/d7/d81/namespacebit__manipulation.html +++ b/d7/d81/namespacebit__manipulation.html @@ -110,7 +110,7 @@ $(function(){initNavTree('d7/d81/namespacebit__manipulation.html','../../'); ini
-

for IO operations +

for assert More...

@@ -123,20 +123,19 @@ Functions

 

Detailed Description

-

for IO operations

-

Bit manipulation algorithms.

-

for io operations

+

for assert

Program to generate n-bit Gray code

storing the numbers

-

for assert

+

for IO operations

Bit manipulation algorithms

for assert for IO operations

Bit manipulation algorithms

Gray code is a binary numeral system where consecutive values differ in exactly 1 bit. The following code offers one of many possible Gray codes given some pre-determined number of bits. for gray code representation for assert for IO operations for vector data structure

Bit manipulation algorithms

-

for assert

+

for io operations

Bit Manipulation algorithms

-

for std::min for assert for IO operations for limits of integral types for std::vector

+

for std::min for IO operations for limits of integral types for std::vector

+

Bit manipulation algorithms

Function Documentation

◆ isPowerOfTwo()

@@ -161,17 +160,17 @@ Functions
Returns
either true or false
-
31 { // int64_t is preferred over int so that
-
32 // no Overflow can be there.
-
33
-
34 return n > 0 && !(n & n - 1); // If we subtract a power of 2 numbers by 1
-
35 // then all unset bits after the only set bit become set; and the set bit
-
36 // becomes unset.
-
37
-
38 // If a number n is a power of 2 then bitwise and of n-1 and n will be zero.
-
39 // The expression n&(n-1) will not work when n is 0.
-
40 // To handle this case also, our expression will become n& (!n&(n-1))
-
41}
+
32 { // int64_t is preferred over int so that
+
33 // no Overflow can be there.
+
34
+
35 return n > 0 && !(n & n - 1); // If we subtract a power of 2 numbers by 1
+
36 // then all unset bits after the only set bit become set; and the set bit
+
37 // becomes unset.
+
38
+
39 // If a number n is a power of 2 then bitwise and of n-1 and n will be zero.
+
40 // The expression n&(n-1) will not work when n is 0.
+
41 // To handle this case also, our expression will become n& (!n&(n-1))
+
42}
@@ -198,40 +197,40 @@ Functions
Returns
a number
-
32 {
-
33 uint64_t rightOne = 0;
-
34 uint64_t nextHigherOneBit = 0;
-
35 uint64_t rightOnesPattern = 0;
-
36
-
37 uint64_t next = 0;
-
38
-
39 if (x) {
-
40 // right most set bit
-
41 rightOne = x & -static_cast<signed>(x);
-
42
-
43 // reset the pattern and set next higher bit
-
44 // left part of x will be here
-
45 nextHigherOneBit = x + rightOne;
-
46
-
47 // nextHigherOneBit is now part [D] of the above explanation.
-
48
-
49 // isolate the pattern
-
50 rightOnesPattern = x ^ nextHigherOneBit;
-
51
-
52 // right adjust pattern
-
53 rightOnesPattern = (rightOnesPattern) / rightOne;
-
54
-
55 // correction factor
-
56 rightOnesPattern >>= 2;
-
57
-
58 // rightOnesPattern is now part [A] of the above explanation.
-
59
-
60 // integrate new pattern (Add [D] and [A])
-
61 next = nextHigherOneBit | rightOnesPattern;
-
62 }
-
63
-
64 return next;
-
65}
+
33 {
+
34 uint64_t rightOne = 0;
+
35 uint64_t nextHigherOneBit = 0;
+
36 uint64_t rightOnesPattern = 0;
+
37
+
38 uint64_t next = 0;
+
39
+
40 if (x) {
+
41 // right most set bit
+
42 rightOne = x & -static_cast<signed>(x);
+
43
+
44 // reset the pattern and set next higher bit
+
45 // left part of x will be here
+
46 nextHigherOneBit = x + rightOne;
+
47
+
48 // nextHigherOneBit is now part [D] of the above explanation.
+
49
+
50 // isolate the pattern
+
51 rightOnesPattern = x ^ nextHigherOneBit;
+
52
+
53 // right adjust pattern
+
54 rightOnesPattern = (rightOnesPattern) / rightOne;
+
55
+
56 // correction factor
+
57 rightOnesPattern >>= 2;
+
58
+
59 // rightOnesPattern is now part [A] of the above explanation.
+
60
+
61 // integrate new pattern (Add [D] and [A])
+
62 next = nextHigherOneBit | rightOnesPattern;
+
63 }
+
64
+
65 return next;
+
66}
diff --git a/d7/d89/double__factorial_8cpp.html b/d7/d89/double__factorial_8cpp.html index 26ff58378..c3c310167 100644 --- a/d7/d89/double__factorial_8cpp.html +++ b/d7/d89/double__factorial_8cpp.html @@ -113,11 +113,12 @@ $(function(){initNavTree('d7/d89/double__factorial_8cpp.html','../../'); initRes

Compute double factorial: \(n!!\). More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for double_factorial.cpp:
-
+

@@ -153,15 +154,15 @@ It is also called as semifactorial of a number and is denoted by \(n!!\)

Compute double factorial using iterative method

-
17 {
-
18 uint64_t res = 1;
-
19 for (uint64_t i = n;; i -= 2) {
-
20 if (i == 0 || i == 1)
-
21 return res;
-
22 res *= i;
-
23 }
-
24 return res;
-
25}
+
18 {
+
19 uint64_t res = 1;
+
20 for (uint64_t i = n;; i -= 2) {
+
21 if (i == 0 || i == 1)
+
22 return res;
+
23 res *= i;
+
24 }
+
25 return res;
+
26}
@@ -181,12 +182,12 @@ It is also called as semifactorial of a number and is denoted by \(n!!\)

Compute double factorial using resursive method.
Recursion can be costly for large numbers.

-
30 {
-
31 if (n <= 1)
-
32 return 1;
-
33 return n * double_factorial_recursive(n - 2);
-
34}
-
uint64_t double_factorial_recursive(uint64_t n)
Definition double_factorial.cpp:30
+
31 {
+
32 if (n <= 1)
+
33 return 1;
+
34 return n * double_factorial_recursive(n - 2);
+
35}
+
uint64_t double_factorial_recursive(uint64_t n)
Definition double_factorial.cpp:31
Here is the call graph for this function:
@@ -210,11 +211,11 @@ Here is the call graph for this function:

Main function

-
67 {
-
68 tests();
-
69 return 0;
-
70}
-
void tests()
Definition double_factorial.cpp:50
+
68 {
+
69 tests();
+
70 return 0;
+
71}
+
void tests()
Definition double_factorial.cpp:51
Here is the call graph for this function:
@@ -248,11 +249,11 @@ Here is the call graph for this function:
-
42 {
-
43 assert(double_factorial_iterative(n) == expected);
-
44 assert(double_factorial_recursive(n) == expected);
-
45}
-
uint64_t double_factorial_iterative(uint64_t n)
Definition double_factorial.cpp:17
+
43 {
+
44 assert(double_factorial_iterative(n) == expected);
+
45 assert(double_factorial_recursive(n) == expected);
+
46}
+
uint64_t double_factorial_iterative(uint64_t n)
Definition double_factorial.cpp:18
Here is the call graph for this function:
@@ -276,19 +277,19 @@ Here is the call graph for this function:

Test implementations

-
50 {
-
51 std::cout << "Test 1:\t n=5\t...";
-
52 test(5, 15);
-
53 std::cout << "passed\n";
-
54
-
55 std::cout << "Test 2:\t n=15\t...";
-
56 test(15, 2027025);
-
57 std::cout << "passed\n";
-
58
-
59 std::cout << "Test 3:\t n=0\t...";
-
60 test(0, 1);
-
61 std::cout << "passed\n";
-
62}
+
51 {
+
52 std::cout << "Test 1:\t n=5\t...";
+
53 test(5, 15);
+
54 std::cout << "passed\n";
+
55
+
56 std::cout << "Test 2:\t n=15\t...";
+
57 test(15, 2027025);
+
58 std::cout << "passed\n";
+
59
+
60 std::cout << "Test 3:\t n=0\t...";
+
61 test(0, 1);
+
62 std::cout << "passed\n";
+
63}
static void test()
Self-test implementations.
Definition generate_parentheses.cpp:82
diff --git a/d7/d92/sublist__search_8cpp__incl.map b/d7/d92/sublist__search_8cpp__incl.map index ceb83718e..45112f330 100644 --- a/d7/d92/sublist__search_8cpp__incl.map +++ b/d7/d92/sublist__search_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/d7/d92/sublist__search_8cpp__incl.md5 b/d7/d92/sublist__search_8cpp__incl.md5 index 9f9dabc78..35f9899fd 100644 --- a/d7/d92/sublist__search_8cpp__incl.md5 +++ b/d7/d92/sublist__search_8cpp__incl.md5 @@ -1 +1 @@ -a0ff07d62ef782f958ca6e5943637ef6 \ No newline at end of file +4470452431be0d661e991d966c4e1f43 \ No newline at end of file diff --git a/d7/d92/sublist__search_8cpp__incl.svg b/d7/d92/sublist__search_8cpp__incl.svg index c0d786577..34d58bc08 100644 --- a/d7/d92/sublist__search_8cpp__incl.svg +++ b/d7/d92/sublist__search_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -search/sublist_search.cpp + +search/sublist_search.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -vector + +iostream @@ -77,8 +77,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d7/d92/sublist__search_8cpp__incl_org.svg b/d7/d92/sublist__search_8cpp__incl_org.svg index 1f573bcda..1d482433a 100644 --- a/d7/d92/sublist__search_8cpp__incl_org.svg +++ b/d7/d92/sublist__search_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + search/sublist_search.cpp Node1 - -search/sublist_search.cpp + +search/sublist_search.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -vector + +iostream @@ -66,8 +66,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d7/da6/eratosthenes_8cpp.html b/d7/da6/eratosthenes_8cpp.html index d491ad57c..73b07a3e9 100644 --- a/d7/da6/eratosthenes_8cpp.html +++ b/d7/da6/eratosthenes_8cpp.html @@ -127,7 +127,7 @@ Include dependency graph for eratosthenes.cpp:

Namespaces

namespace  math - for IO operations
+ for assert
 

diff --git a/d7/db9/hill__cipher_8cpp.html b/d7/db9/hill__cipher_8cpp.html index 2df1a5c5a..1d05b142e 100644 --- a/d7/db9/hill__cipher_8cpp.html +++ b/d7/db9/hill__cipher_8cpp.html @@ -117,6 +117,7 @@ $(function(){initNavTree('d7/db9/hill__cipher_8cpp.html','../../'); initResizabl More...

#include <cassert>
#include <cmath>
+#include <cstdint>
#include <cstring>
#include <ctime>
#include <fstream>
@@ -189,23 +190,23 @@ The matrix generation algorithm is very rudimentary and does not guarantee an in

Main function

-
532 {
-
533 std::srand(std::time(nullptr));
-
534 std::cout << "Key dictionary: (" << std::strlen(ciphers::STRKEY) << ")\n\t"
-
535 << ciphers::STRKEY << "\n";
-
536
-
537 std::string text = "This is a simple text with numb3r5 and exclamat!0n.";
-
538
-
539 test1(text);
-
540 test2(text);
-
541
-
542 return 0;
-
543}
+
533 {
+
534 std::srand(std::time(nullptr));
+
535 std::cout << "Key dictionary: (" << std::strlen(ciphers::STRKEY) << ")\n\t"
+
536 << ciphers::STRKEY << "\n";
+
537
+
538 std::string text = "This is a simple text with numb3r5 and exclamat!0n.";
+
539
+
540 test1(text);
+
541 test2(text);
+
542
+
543 return 0;
+
544}
-
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:186
-
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:169
-
static const char * STRKEY
Definition hill_cipher.cpp:73
+
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:187
+
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:170
+
static const char * STRKEY
Definition hill_cipher.cpp:74
T srand(T... args)
T strlen(T... args)
T time(T... args)
@@ -246,19 +247,19 @@ template<typename T >

operator to print a matrix

-
54 {
-
55 const int width = 15;
-
56 const char separator = ' ';
-
57
-
58 for (size_t row = 0; row < v.size(); row++) {
-
59 for (size_t col = 0; col < v[row].size(); col++)
-
60 out << std::left << std::setw(width) << std::setfill(separator)
-
61 << v[row][col];
-
62 out << std::endl;
-
63 }
-
64
-
65 return out;
-
66}
+
55 {
+
56 const int width = 15;
+
57 const char separator = ' ';
+
58
+
59 for (size_t row = 0; row < v.size(); row++) {
+
60 for (size_t col = 0; col < v[row].size(); col++)
+
61 out << std::left << std::setw(width) << std::setfill(separator)
+
62 << v[row][col];
+
63 out << std::endl;
+
64 }
+
65
+
66 return out;
+
67}
T endl(T... args)
T left(T... args)
T setfill(T... args)
@@ -294,39 +295,39 @@ Here is the call graph for this function:
-
470 {
-
471 // std::string text = "Hello world!";
-
472 std::cout << "======Test 1 (3x3 key) ======\nOriginal text:\n\t" << text
-
473 << std::endl;
-
474
- - -
477 matrix<int> ekey = p.first;
-
478 matrix<int> dkey = p.second;
-
479
-
480 // matrix<int> ekey = {{22, 28, 25}, {5, 26, 15}, {14, 18, 9}};
-
481 // std::cout << "Encryption key: \n" << ekey;
-
482 std::string gibberish = ciphers::HillCipher::encrypt_text(text, ekey);
-
483 std::cout << "Encrypted text:\n\t" << gibberish << std::endl;
-
484
-
485 // matrix<int> dkey = ciphers::HillCipher::generate_decryption_key(ekey);
-
486 // std::cout << "Decryption key: \n" << dkey;
-
487 std::string txt_back = ciphers::HillCipher::decrypt_text(gibberish, dkey);
-
488 std::cout << "Reconstruct text:\n\t" << txt_back << std::endl;
-
489
-
490 std::ofstream out_file("hill_cipher_test1.txt");
-
491 out_file << "Block size: " << ekey.size() << "\n";
-
492 out_file << "Encryption Key:\n" << ekey;
-
493 out_file << "\nDecryption Key:\n" << dkey;
-
494 out_file.close();
-
495
-
496 assert(txt_back == text);
-
497 std::cout << "Passed :)\n";
-
498}
+
471 {
+
472 // std::string text = "Hello world!";
+
473 std::cout << "======Test 1 (3x3 key) ======\nOriginal text:\n\t" << text
+
474 << std::endl;
+
475
+ + +
478 matrix<int> ekey = p.first;
+
479 matrix<int> dkey = p.second;
+
480
+
481 // matrix<int> ekey = {{22, 28, 25}, {5, 26, 15}, {14, 18, 9}};
+
482 // std::cout << "Encryption key: \n" << ekey;
+
483 std::string gibberish = ciphers::HillCipher::encrypt_text(text, ekey);
+
484 std::cout << "Encrypted text:\n\t" << gibberish << std::endl;
+
485
+
486 // matrix<int> dkey = ciphers::HillCipher::generate_decryption_key(ekey);
+
487 // std::cout << "Decryption key: \n" << dkey;
+
488 std::string txt_back = ciphers::HillCipher::decrypt_text(gibberish, dkey);
+
489 std::cout << "Reconstruct text:\n\t" << txt_back << std::endl;
+
490
+
491 std::ofstream out_file("hill_cipher_test1.txt");
+
492 out_file << "Block size: " << ekey.size() << "\n";
+
493 out_file << "Encryption Key:\n" << ekey;
+
494 out_file << "\nDecryption Key:\n" << dkey;
+
495 out_file.close();
+
496
+
497 assert(txt_back == text);
+
498 std::cout << "Passed :)\n";
+
499}
-
static std::pair< matrix< int >, matrix< int > > generate_keys(size_t size, int limit1=0, int limit2=10)
Generate encryption and decryption key pair.
Definition hill_cipher.cpp:424
-
static const std::string decrypt_text(const std::string &text, const matrix< int > &decrypt_key)
Decrypt a given text using a given key.
Definition hill_cipher.cpp:457
-
static const std::string encrypt_text(const std::string &text, const matrix< int > &encrypt_key)
Encrypt a given text using a given key.
Definition hill_cipher.cpp:445
+
static std::pair< matrix< int >, matrix< int > > generate_keys(size_t size, int limit1=0, int limit2=10)
Generate encryption and decryption key pair.
Definition hill_cipher.cpp:425
+
static const std::string decrypt_text(const std::string &text, const matrix< int > &decrypt_key)
Decrypt a given text using a given key.
Definition hill_cipher.cpp:458
+
static const std::string encrypt_text(const std::string &text, const matrix< int > &encrypt_key)
Encrypt a given text using a given key.
Definition hill_cipher.cpp:446
@@ -359,31 +360,31 @@ Here is the call graph for this function:
-
505 {
-
506 // std::string text = "Hello world!";
-
507 std::cout << "======Test 2 (8x8 key) ======\nOriginal text:\n\t" << text
-
508 << std::endl;
-
509
- - -
512 matrix<int> ekey = p.first;
-
513 matrix<int> dkey = p.second;
-
514
-
515 std::string gibberish = ciphers::HillCipher::encrypt_text(text, ekey);
-
516 std::cout << "Encrypted text:\n\t" << gibberish << std::endl;
-
517
-
518 std::string txt_back = ciphers::HillCipher::decrypt_text(gibberish, dkey);
-
519 std::cout << "Reconstruct text:\n\t" << txt_back << std::endl;
-
520
-
521 std::ofstream out_file("hill_cipher_test2.txt");
-
522 out_file << "Block size: " << ekey.size() << "\n";
-
523 out_file << "Encryption Key:\n" << ekey;
-
524 out_file << "\nDecryption Key:\n" << dkey;
-
525 out_file.close();
-
526
-
527 assert(txt_back.compare(0, text.size(), text) == 0);
-
528 std::cout << "Passed :)\n";
-
529}
+
506 {
+
507 // std::string text = "Hello world!";
+
508 std::cout << "======Test 2 (8x8 key) ======\nOriginal text:\n\t" << text
+
509 << std::endl;
+
510
+ + +
513 matrix<int> ekey = p.first;
+
514 matrix<int> dkey = p.second;
+
515
+
516 std::string gibberish = ciphers::HillCipher::encrypt_text(text, ekey);
+
517 std::cout << "Encrypted text:\n\t" << gibberish << std::endl;
+
518
+
519 std::string txt_back = ciphers::HillCipher::decrypt_text(gibberish, dkey);
+
520 std::cout << "Reconstruct text:\n\t" << txt_back << std::endl;
+
521
+
522 std::ofstream out_file("hill_cipher_test2.txt");
+
523 out_file << "Block size: " << ekey.size() << "\n";
+
524 out_file << "Encryption Key:\n" << ekey;
+
525 out_file << "\nDecryption Key:\n" << dkey;
+
526 out_file.close();
+
527
+
528 assert(txt_back.compare(0, text.size(), text) == 0);
+
529 std::cout << "Passed :)\n";
+
530}
T compare(T... args)
Here is the call graph for this function:
diff --git a/d7/dda/dsu__union__rank_8cpp__incl.map b/d7/dda/dsu__union__rank_8cpp__incl.map index 18b631604..19ce2ce62 100644 --- a/d7/dda/dsu__union__rank_8cpp__incl.map +++ b/d7/dda/dsu__union__rank_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/d7/dda/dsu__union__rank_8cpp__incl.md5 b/d7/dda/dsu__union__rank_8cpp__incl.md5 index fa6cabc40..0e1422151 100644 --- a/d7/dda/dsu__union__rank_8cpp__incl.md5 +++ b/d7/dda/dsu__union__rank_8cpp__incl.md5 @@ -1 +1 @@ -7989b087308834ec7a089a96b7d312d4 \ No newline at end of file +9b18df4fa984f90779d6e590869be616 \ No newline at end of file diff --git a/d7/dda/dsu__union__rank_8cpp__incl.svg b/d7/dda/dsu__union__rank_8cpp__incl.svg index 6be584915..f702f2e78 100644 --- a/d7/dda/dsu__union__rank_8cpp__incl.svg +++ b/d7/dda/dsu__union__rank_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -data_structures/dsu -_union_rank.cpp + +data_structures/dsu +_union_rank.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -vector + +iostream @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d7/dda/dsu__union__rank_8cpp__incl_org.svg b/d7/dda/dsu__union__rank_8cpp__incl_org.svg index 0c61e17e9..c87cf0c2a 100644 --- a/d7/dda/dsu__union__rank_8cpp__incl_org.svg +++ b/d7/dda/dsu__union__rank_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + data_structures/dsu_union_rank.cpp Node1 - -data_structures/dsu -_union_rank.cpp + +data_structures/dsu +_union_rank.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -vector + +iostream @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/d8/d53/modular__inverse__fermat__little__theorem_8cpp.html b/d8/d53/modular__inverse__fermat__little__theorem_8cpp.html index 34afa6e66..76101c6cb 100644 --- a/d8/d53/modular__inverse__fermat__little__theorem_8cpp.html +++ b/d8/d53/modular__inverse__fermat__little__theorem_8cpp.html @@ -125,7 +125,7 @@ Include dependency graph for modular_inverse_fermat_little_theorem.cpp:

Namespaces

namespace  math - for IO operations
+ for assert
  namespace  modular_inverse_fermat  Calculate modular inverse using Fermat's Little Theorem.
diff --git a/d8/d61/radix__sort2_8cpp.html b/d8/d61/radix__sort2_8cpp.html index 4b005d41f..18a32e4c1 100644 --- a/d8/d61/radix__sort2_8cpp.html +++ b/d8/d61/radix__sort2_8cpp.html @@ -115,12 +115,13 @@ $(function(){initNavTree('d8/d61/radix__sort2_8cpp.html','../../'); initResizabl More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for radix_sort2.cpp:
-
+

Main function.

Returns
0 on exit
-
117 {
-
118 tests(); // execute the tests
-
119 return 0;
-
120}
-
static void tests()
Function to test the above algorithm.
Definition radix_sort2.cpp:102
+
119 {
+
120 tests(); // execute the tests
+
121 return 0;
+
122}
+
static void tests()
Function to test the above algorithm.
Definition radix_sort2.cpp:104
Here is the call graph for this function:
@@ -208,26 +209,26 @@ Here is the call graph for this function:
Returns
sorted vector
-
80 {
-
81 uint64_t max_ele =
-
82 *max_element(ar.begin(), ar.end()); // returns the max element.
-
83 std::vector<uint64_t> temp = ar;
-
84 for (int i = 1; max_ele / i > 0;
-
85 i *= 10) { // loop breaks when i > max_ele because no further digits
-
86 // left to makes changes in aray.
-
87 temp = step_ith(i, temp);
-
88 }
-
89 for (uint64_t i : temp) {
-
90 std::cout << i << " ";
-
91 }
-
92 std::cout << "\n";
-
93 return temp;
-
94}
+
82 {
+
83 uint64_t max_ele =
+
84 *max_element(ar.begin(), ar.end()); // returns the max element.
+
85 std::vector<uint64_t> temp = ar;
+
86 for (int i = 1; max_ele / i > 0;
+
87 i *= 10) { // loop breaks when i > max_ele because no further digits
+
88 // left to makes changes in aray.
+
89 temp = step_ith(i, temp);
+
90 }
+
91 for (uint64_t i : temp) {
+
92 std::cout << i << " ";
+
93 }
+
94 std::cout << "\n";
+
95 return temp;
+
96}
T begin(T... args)
T end(T... args)
T max_element(T... args)
-
std::vector< uint64_t > step_ith(uint16_t cur_digit, const std::vector< uint64_t > &ar)
Function to sort vector according to current digit using stable sorting.
Definition radix_sort2.cpp:49
+
std::vector< uint64_t > step_ith(uint16_t cur_digit, const std::vector< uint64_t > &ar)
Function to sort vector according to current digit using stable sorting.
Definition radix_sort2.cpp:51
Here is the call graph for this function:
@@ -265,30 +266,30 @@ Here is the call graph for this function:
Returns
std::vector sorted till ith digit
-
51 { // sorting according to current digit.
-
52 int n = ar.size();
-
53 std::vector<uint32_t> position(10, 0);
-
54 for (int i = 0; i < n; ++i) {
-
55 position[(ar[i] / cur_digit) %
-
56 10]++; // counting frequency of 0-9 at cur_digit.
-
57 }
-
58 int cur = 0;
-
59 for (int i = 0; i < 10; ++i) {
-
60 int a = position[i];
-
61 position[i] = cur; // assingning starting position of 0-9.
-
62 cur += a;
-
63 }
- -
65 for (int i = 0; i < n; ++i) {
-
66 temp[position[(ar[i] / cur_digit) % 10]] =
-
67 ar[i]; // storing ar[i] in ar[i]'s cur_digit expected position of
-
68 // this step.
-
69 position[(ar[i] / cur_digit) %
-
70 10]++; // incrementing ar[i]'s cur_digit position by 1, as
-
71 // current place used by ar[i].
-
72 }
-
73 return temp;
-
74}
+
53 { // sorting according to current digit.
+
54 int n = ar.size();
+
55 std::vector<uint32_t> position(10, 0);
+
56 for (int i = 0; i < n; ++i) {
+
57 position[(ar[i] / cur_digit) %
+
58 10]++; // counting frequency of 0-9 at cur_digit.
+
59 }
+
60 int cur = 0;
+
61 for (int i = 0; i < 10; ++i) {
+
62 int a = position[i];
+
63 position[i] = cur; // assingning starting position of 0-9.
+
64 cur += a;
+
65 }
+ +
67 for (int i = 0; i < n; ++i) {
+
68 temp[position[(ar[i] / cur_digit) % 10]] =
+
69 ar[i]; // storing ar[i] in ar[i]'s cur_digit expected position of
+
70 // this step.
+
71 position[(ar[i] / cur_digit) %
+
72 10]++; // incrementing ar[i]'s cur_digit position by 1, as
+
73 // current place used by ar[i].
+
74 }
+
75 return temp;
+
76}
T size(T... args)
Here is the call graph for this function:
@@ -325,19 +326,19 @@ Here is the call graph for this function:
Returns
none

Test 1

Test 2

-
102 {
-
103 /// Test 1
-
104 std::vector<uint64_t> ar1 = {432, 234, 143, 332, 123};
- -
106 assert(std::is_sorted(ar1.begin(), ar1.end()));
-
107 /// Test 2
-
108 std::vector<uint64_t> ar2 = {213, 3214, 123, 111, 112, 142,
-
109 133, 132, 32, 12, 113};
- -
111 assert(std::is_sorted(ar2.begin(), ar2.end()));
-
112}
+
104 {
+
105 /// Test 1
+
106 std::vector<uint64_t> ar1 = {432, 234, 143, 332, 123};
+ +
108 assert(std::is_sorted(ar1.begin(), ar1.end()));
+
109 /// Test 2
+
110 std::vector<uint64_t> ar2 = {213, 3214, 123, 111, 112, 142,
+
111 133, 132, 32, 12, 113};
+ +
113 assert(std::is_sorted(ar2.begin(), ar2.end()));
+
114}
T is_sorted(T... args)
-
std::vector< uint64_t > radix(const std::vector< uint64_t > &ar)
Function to sort vector digit by digit.
Definition radix_sort2.cpp:80
+
std::vector< uint64_t > radix(const std::vector< uint64_t > &ar)
Function to sort vector digit by digit.
Definition radix_sort2.cpp:82
Here is the call graph for this function:
diff --git a/d8/d69/classgraph_1_1_h_k_graph.html b/d8/d69/classgraph_1_1_h_k_graph.html index a4b729e46..8c4f2185d 100644 --- a/d8/d69/classgraph_1_1_h_k_graph.html +++ b/d8/d69/classgraph_1_1_h_k_graph.html @@ -446,7 +446,7 @@ Here is the call graph for this function:
124 return result;
125}
bool bfs()
This function checks for the possibility of augmented path availability.
Definition hopcroft_karp.cpp:133
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/d8/d7a/sha1_8cpp.html b/d8/d7a/sha1_8cpp.html index a93834ece..43d8777c7 100644 --- a/d8/d7a/sha1_8cpp.html +++ b/d8/d7a/sha1_8cpp.html @@ -116,6 +116,7 @@ $(function(){initNavTree('d8/d7a/sha1_8cpp.html','../../'); initResizable(true);
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstdint>
#include <cstring>
#include <iostream>
#include <string>
@@ -123,13 +124,13 @@ $(function(){initNavTree('d8/d7a/sha1_8cpp.html','../../'); initResizable(true);
Include dependency graph for sha1.cpp:
-
+

@@ -172,11 +173,11 @@ Functions

- + @@ -191,10 +192,10 @@ Algorithm
Returns
void* Pointer to the SHA-1 signature
-
210 {
-
211 return hash_bs(&message[0], message.size());
-
212}
-
void * hash_bs(const void *input_bs, uint64_t input_size)
The MD5 algorithm itself, taking in a bytestring.
Definition md5.cpp:138
+
211 {
+
212 return hash_bs(&message[0], message.size());
+
213}
+
void * hash_bs(const void *input_bs, uint64_t input_size)
The MD5 algorithm itself, taking in a bytestring.
Definition md5.cpp:139
T size(T... args)
Here is the call graph for this function:
@@ -232,131 +233,131 @@ Here is the call graph for this function:
Returns
void* Pointer to the 160-bit signature
-
83 {
-
84 auto* input = static_cast<const uint8_t*>(input_bs);
-
85
-
86 // Step 0: The initial 160-bit state
-
87 uint32_t h0 = 0x67452301, a = 0;
-
88 uint32_t h1 = 0xEFCDAB89, b = 0;
-
89 uint32_t h2 = 0x98BADCFE, c = 0;
-
90 uint32_t h3 = 0x10325476, d = 0;
-
91 uint32_t h4 = 0xC3D2E1F0, e = 0;
-
92
-
93 // Step 1: Processing the bytestring
-
94 // First compute the size the padded message will have
-
95 // so it is possible to allocate the right amount of memory
-
96 uint64_t padded_message_size = 0;
-
97 if (input_size % 64 < 56) {
-
98 padded_message_size = input_size + 64 - (input_size % 64);
-
99 } else {
-
100 padded_message_size = input_size + 128 - (input_size % 64);
-
101 }
-
102
-
103 // Allocate the memory for the padded message
-
104 std::vector<uint8_t> padded_message(padded_message_size);
-
105
-
106 // Beginning of the padded message is the original message
-
107 std::copy(input, input + input_size, padded_message.begin());
-
108
-
109 // Afterwards comes a single 1 bit and then only zeroes
-
110 padded_message[input_size] = 1 << 7; // 10000000
-
111 for (uint64_t i = input_size; i % 64 != 56; i++) {
-
112 if (i == input_size) {
-
113 continue; // pass first iteration
-
114 }
-
115 padded_message[i] = 0;
-
116 }
-
117
-
118 // We then have to add the 64-bit size of the message in bits (hence the
-
119 // times 8) in the last 8 bytes
-
120 uint64_t input_bitsize = input_size * 8;
-
121 for (uint8_t i = 0; i < 8; i++) {
-
122 padded_message[padded_message_size - 8 + i] =
-
123 (input_bitsize >> (56 - 8 * i)) & 0xFF;
-
124 }
-
125
-
126 // Already allocate memory for blocks
- -
128
-
129 // Rounds
-
130 for (uint64_t chunk = 0; chunk * 64 < padded_message_size; chunk++) {
-
131 // First, build 16 32-bits blocks from the chunk
-
132 for (uint8_t bid = 0; bid < 16; bid++) {
-
133 blocks[bid] = 0;
-
134
-
135 // Having to build a 32-bit word from 4-bit words
-
136 // Add each and shift them to the left
-
137 for (uint8_t cid = 0; cid < 4; cid++) {
-
138 blocks[bid] = (blocks[bid] << 8) +
-
139 padded_message[chunk * 64 + bid * 4 + cid];
-
140 }
-
141
-
142 // Extend the 16 32-bit words into 80 32-bit words
-
143 for (uint8_t i = 16; i < 80; i++) {
-
144 blocks[i] =
-
145 leftRotate32bits(blocks[i - 3] ^ blocks[i - 8] ^
-
146 blocks[i - 14] ^ blocks[i - 16],
-
147 1);
-
148 }
-
149 }
-
150
-
151 a = h0;
-
152 b = h1;
-
153 c = h2;
-
154 d = h3;
-
155 e = h4;
-
156
-
157 // Main "hashing" loop
-
158 for (uint8_t i = 0; i < 80; i++) {
-
159 uint32_t F = 0, g = 0;
-
160 if (i < 20) {
-
161 F = (b & c) | ((~b) & d);
-
162 g = 0x5A827999;
-
163 } else if (i < 40) {
-
164 F = b ^ c ^ d;
-
165 g = 0x6ED9EBA1;
-
166 } else if (i < 60) {
-
167 F = (b & c) | (b & d) | (c & d);
-
168 g = 0x8F1BBCDC;
-
169 } else {
-
170 F = b ^ c ^ d;
-
171 g = 0xCA62C1D6;
-
172 }
-
173
-
174 // Update the accumulators
-
175 uint32_t temp = leftRotate32bits(a, 5) + F + e + g + blocks[i];
-
176 e = d;
-
177 d = c;
-
178 c = leftRotate32bits(b, 30);
-
179 b = a;
-
180 a = temp;
-
181 }
-
182 // Update the state with this chunk's hash
-
183 h0 += a;
-
184 h1 += b;
-
185 h2 += c;
-
186 h3 += d;
-
187 h4 += e;
-
188 }
-
189
-
190 // Build signature from state
-
191 // Note, any type could be used for the signature
-
192 // uint8_t was used to make the 20 bytes obvious
-
193 auto* sig = new uint8_t[20];
-
194 for (uint8_t i = 0; i < 4; i++) {
-
195 sig[i] = (h0 >> (24 - 8 * i)) & 0xFF;
-
196 sig[i + 4] = (h1 >> (24 - 8 * i)) & 0xFF;
-
197 sig[i + 8] = (h2 >> (24 - 8 * i)) & 0xFF;
-
198 sig[i + 12] = (h3 >> (24 - 8 * i)) & 0xFF;
-
199 sig[i + 16] = (h4 >> (24 - 8 * i)) & 0xFF;
-
200 }
-
201
-
202 return sig;
-
203}
+
84 {
+
85 auto* input = static_cast<const uint8_t*>(input_bs);
+
86
+
87 // Step 0: The initial 160-bit state
+
88 uint32_t h0 = 0x67452301, a = 0;
+
89 uint32_t h1 = 0xEFCDAB89, b = 0;
+
90 uint32_t h2 = 0x98BADCFE, c = 0;
+
91 uint32_t h3 = 0x10325476, d = 0;
+
92 uint32_t h4 = 0xC3D2E1F0, e = 0;
+
93
+
94 // Step 1: Processing the bytestring
+
95 // First compute the size the padded message will have
+
96 // so it is possible to allocate the right amount of memory
+
97 uint64_t padded_message_size = 0;
+
98 if (input_size % 64 < 56) {
+
99 padded_message_size = input_size + 64 - (input_size % 64);
+
100 } else {
+
101 padded_message_size = input_size + 128 - (input_size % 64);
+
102 }
+
103
+
104 // Allocate the memory for the padded message
+
105 std::vector<uint8_t> padded_message(padded_message_size);
+
106
+
107 // Beginning of the padded message is the original message
+
108 std::copy(input, input + input_size, padded_message.begin());
+
109
+
110 // Afterwards comes a single 1 bit and then only zeroes
+
111 padded_message[input_size] = 1 << 7; // 10000000
+
112 for (uint64_t i = input_size; i % 64 != 56; i++) {
+
113 if (i == input_size) {
+
114 continue; // pass first iteration
+
115 }
+
116 padded_message[i] = 0;
+
117 }
+
118
+
119 // We then have to add the 64-bit size of the message in bits (hence the
+
120 // times 8) in the last 8 bytes
+
121 uint64_t input_bitsize = input_size * 8;
+
122 for (uint8_t i = 0; i < 8; i++) {
+
123 padded_message[padded_message_size - 8 + i] =
+
124 (input_bitsize >> (56 - 8 * i)) & 0xFF;
+
125 }
+
126
+
127 // Already allocate memory for blocks
+ +
129
+
130 // Rounds
+
131 for (uint64_t chunk = 0; chunk * 64 < padded_message_size; chunk++) {
+
132 // First, build 16 32-bits blocks from the chunk
+
133 for (uint8_t bid = 0; bid < 16; bid++) {
+
134 blocks[bid] = 0;
+
135
+
136 // Having to build a 32-bit word from 4-bit words
+
137 // Add each and shift them to the left
+
138 for (uint8_t cid = 0; cid < 4; cid++) {
+
139 blocks[bid] = (blocks[bid] << 8) +
+
140 padded_message[chunk * 64 + bid * 4 + cid];
+
141 }
+
142
+
143 // Extend the 16 32-bit words into 80 32-bit words
+
144 for (uint8_t i = 16; i < 80; i++) {
+
145 blocks[i] =
+
146 leftRotate32bits(blocks[i - 3] ^ blocks[i - 8] ^
+
147 blocks[i - 14] ^ blocks[i - 16],
+
148 1);
+
149 }
+
150 }
+
151
+
152 a = h0;
+
153 b = h1;
+
154 c = h2;
+
155 d = h3;
+
156 e = h4;
+
157
+
158 // Main "hashing" loop
+
159 for (uint8_t i = 0; i < 80; i++) {
+
160 uint32_t F = 0, g = 0;
+
161 if (i < 20) {
+
162 F = (b & c) | ((~b) & d);
+
163 g = 0x5A827999;
+
164 } else if (i < 40) {
+
165 F = b ^ c ^ d;
+
166 g = 0x6ED9EBA1;
+
167 } else if (i < 60) {
+
168 F = (b & c) | (b & d) | (c & d);
+
169 g = 0x8F1BBCDC;
+
170 } else {
+
171 F = b ^ c ^ d;
+
172 g = 0xCA62C1D6;
+
173 }
+
174
+
175 // Update the accumulators
+
176 uint32_t temp = leftRotate32bits(a, 5) + F + e + g + blocks[i];
+
177 e = d;
+
178 d = c;
+
179 c = leftRotate32bits(b, 30);
+
180 b = a;
+
181 a = temp;
+
182 }
+
183 // Update the state with this chunk's hash
+
184 h0 += a;
+
185 h1 += b;
+
186 h2 += c;
+
187 h3 += d;
+
188 h4 += e;
+
189 }
+
190
+
191 // Build signature from state
+
192 // Note, any type could be used for the signature
+
193 // uint8_t was used to make the 20 bytes obvious
+
194 auto* sig = new uint8_t[20];
+
195 for (uint8_t i = 0; i < 4; i++) {
+
196 sig[i] = (h0 >> (24 - 8 * i)) & 0xFF;
+
197 sig[i + 4] = (h1 >> (24 - 8 * i)) & 0xFF;
+
198 sig[i + 8] = (h2 >> (24 - 8 * i)) & 0xFF;
+
199 sig[i + 12] = (h3 >> (24 - 8 * i)) & 0xFF;
+
200 sig[i + 16] = (h4 >> (24 - 8 * i)) & 0xFF;
+
201 }
+
202
+
203 return sig;
+
204}
double g(double x)
Another test function.
Definition composite_simpson_rule.cpp:115
T copy(T... args)
-
uint32_t leftRotate32bits(uint32_t n, std::size_t rotate)
Rotates the bits of a 32-bit unsigned integer.
Definition md5.cpp:66
+
uint32_t leftRotate32bits(uint32_t n, std::size_t rotate)
Rotates the bits of a 32-bit unsigned integer.
Definition md5.cpp:67
Here is the call graph for this function:
@@ -391,34 +392,34 @@ Here is the call graph for this function:

Puts user in a loop where inputs can be given and SHA-1 hash will be computed and printed.

Returns
void
-
274 {
-
275 while (true) {
-
276 std::string input;
-
277 std::cout << "Enter a message to be hashed (Ctrl-C to exit): "
-
278 << std::endl;
-
279 std::getline(std::cin, input);
-
280 void* sig = hashing::sha1::hash(input);
-
281 std::cout << "Hash is: " << hashing::sha1::sig2hex(sig) << std::endl;
-
282
-
283 while (true) {
-
284 std::cout << "Want to enter another message? (y/n) ";
-
285 std::getline(std::cin, input);
-
286 if (input.compare("y") == 0) {
-
287 break;
-
288 } else if (input.compare("n") == 0) {
-
289 return;
-
290 }
-
291 }
-
292 }
-
293}
+
275 {
+
276 while (true) {
+
277 std::string input;
+
278 std::cout << "Enter a message to be hashed (Ctrl-C to exit): "
+
279 << std::endl;
+
280 std::getline(std::cin, input);
+
281 void* sig = hashing::sha1::hash(input);
+
282 std::cout << "Hash is: " << hashing::sha1::sig2hex(sig) << std::endl;
+
283
+
284 while (true) {
+
285 std::cout << "Want to enter another message? (y/n) ";
+
286 std::getline(std::cin, input);
+
287 if (input.compare("y") == 0) {
+
288 break;
+
289 } else if (input.compare("n") == 0) {
+
290 return;
+
291 }
+
292 }
+
293 }
+
294}
T compare(T... args)
T endl(T... args)
T getline(T... args)
-
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition sha1.cpp:210
-
std::string sig2hex(void *sig)
Transforms the 160-bit SHA-1 signature into a 40 char hex string.
Definition sha1.cpp:66
+
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition sha1.cpp:211
+
std::string sig2hex(void *sig)
Transforms the 160-bit SHA-1 signature into a 40 char hex string.
Definition sha1.cpp:67
Here is the call graph for this function:
@@ -455,9 +456,9 @@ Here is the call graph for this function:
Returns
uint32_t The rotated integer
-
57 {
-
58 return (n << rotate) | (n >> (32 - rotate));
-
59}
+
58 {
+
59 return (n << rotate) | (n >> (32 - rotate));
+
60}
T rotate(T... args)
@@ -479,16 +480,16 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
299 {
-
300 test(); // run self-test implementations
-
301
-
302 // Launch interactive mode where user can input messages and see
-
303 // their hash
-
304 interactive();
-
305 return 0;
-
306}
-
static void test()
Self-test implementations of well-known SHA-1 hashes.
Definition sha1.cpp:220
-
static void interactive()
Puts user in a loop where inputs can be given and SHA-1 hash will be computed and printed.
Definition sha1.cpp:274
+
300 {
+
301 test(); // run self-test implementations
+
302
+
303 // Launch interactive mode where user can input messages and see
+
304 // their hash
+
305 interactive();
+
306 return 0;
+
307}
+
static void test()
Self-test implementations of well-known SHA-1 hashes.
Definition sha1.cpp:221
+
static void interactive()
Puts user in a loop where inputs can be given and SHA-1 hash will be computed and printed.
Definition sha1.cpp:275
Here is the call graph for this function:
@@ -520,16 +521,16 @@ Here is the call graph for this function:
Returns
std::string The hex signature
-
66 {
-
67 const char* hexChars = "0123456789abcdef";
-
68 auto* intsig = static_cast<uint8_t*>(sig);
-
69 std::string hex = "";
-
70 for (uint8_t i = 0; i < 20; i++) {
-
71 hex.push_back(hexChars[(intsig[i] >> 4) & 0xF]);
-
72 hex.push_back(hexChars[(intsig[i]) & 0xF]);
-
73 }
-
74 return hex;
-
75}
+
67 {
+
68 const char* hexChars = "0123456789abcdef";
+
69 auto* intsig = static_cast<uint8_t*>(sig);
+
70 std::string hex = "";
+
71 for (uint8_t i = 0; i < 20; i++) {
+
72 hex.push_back(hexChars[(intsig[i] >> 4) & 0xF]);
+
73 hex.push_back(hexChars[(intsig[i]) & 0xF]);
+
74 }
+
75 return hex;
+
76}
T hex(T... args)
@@ -559,54 +560,54 @@ Here is the call graph for this function:

Self-test implementations of well-known SHA-1 hashes.

Returns
void
-
220 {
-
221 // Hashes empty string and stores signature
-
222 void* sig = hashing::sha1::hash("");
-
223 std::cout << "Hashing empty string" << std::endl;
-
224 // Prints signature hex representation
- -
226 // Test with cassert wether sig is correct from expected value
-
227 assert(hashing::sha1::sig2hex(sig).compare(
-
228 "da39a3ee5e6b4b0d3255bfef95601890afd80709") == 0);
-
229
-
230 // Hashes "The quick brown fox jumps over the lazy dog" and stores signature
-
231 void* sig2 =
-
232 hashing::sha1::hash("The quick brown fox jumps over the lazy dog");
-
233 std::cout << "Hashing The quick brown fox jumps over the lazy dog"
-
234 << std::endl;
-
235 // Prints signature hex representation
- -
237 // Test with cassert wether sig is correct from expected value
-
238 assert(hashing::sha1::sig2hex(sig2).compare(
-
239 "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12") == 0);
-
240
-
241 // Hashes "The quick brown fox jumps over the lazy dog." (notice the
-
242 // additional period) and stores signature
-
243 void* sig3 =
-
244 hashing::sha1::hash("The quick brown fox jumps over the lazy dog.");
-
245 std::cout << "Hashing "
-
246 "The quick brown fox jumps over the lazy dog."
-
247 << std::endl;
-
248 // Prints signature hex representation
- -
250 // Test with cassert wether sig is correct from expected value
-
251 assert(hashing::sha1::sig2hex(sig3).compare(
-
252 "408d94384216f890ff7a0c3528e8bed1e0b01621") == 0);
-
253
-
254 // Hashes "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-
255 // and stores signature
-
256 void* sig4 = hashing::sha1::hash(
-
257 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
- -
259 << "Hashing "
-
260 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-
261 << std::endl;
-
262 // Prints signature hex representation
- -
264 // Test with cassert wether sig is correct from expected value
-
265 assert(hashing::sha1::sig2hex(sig4).compare(
-
266 "761c457bf73b14d27e9e9265c46f4b4dda11f940") == 0);
-
267}
+
221 {
+
222 // Hashes empty string and stores signature
+
223 void* sig = hashing::sha1::hash("");
+
224 std::cout << "Hashing empty string" << std::endl;
+
225 // Prints signature hex representation
+ +
227 // Test with cassert wether sig is correct from expected value
+
228 assert(hashing::sha1::sig2hex(sig).compare(
+
229 "da39a3ee5e6b4b0d3255bfef95601890afd80709") == 0);
+
230
+
231 // Hashes "The quick brown fox jumps over the lazy dog" and stores signature
+
232 void* sig2 =
+
233 hashing::sha1::hash("The quick brown fox jumps over the lazy dog");
+
234 std::cout << "Hashing The quick brown fox jumps over the lazy dog"
+
235 << std::endl;
+
236 // Prints signature hex representation
+ +
238 // Test with cassert wether sig is correct from expected value
+
239 assert(hashing::sha1::sig2hex(sig2).compare(
+
240 "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12") == 0);
+
241
+
242 // Hashes "The quick brown fox jumps over the lazy dog." (notice the
+
243 // additional period) and stores signature
+
244 void* sig3 =
+
245 hashing::sha1::hash("The quick brown fox jumps over the lazy dog.");
+
246 std::cout << "Hashing "
+
247 "The quick brown fox jumps over the lazy dog."
+
248 << std::endl;
+
249 // Prints signature hex representation
+ +
251 // Test with cassert wether sig is correct from expected value
+
252 assert(hashing::sha1::sig2hex(sig3).compare(
+
253 "408d94384216f890ff7a0c3528e8bed1e0b01621") == 0);
+
254
+
255 // Hashes "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+
256 // and stores signature
+
257 void* sig4 = hashing::sha1::hash(
+
258 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+ +
260 << "Hashing "
+
261 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+
262 << std::endl;
+
263 // Prints signature hex representation
+ +
265 // Test with cassert wether sig is correct from expected value
+
266 assert(hashing::sha1::sig2hex(sig4).compare(
+
267 "761c457bf73b14d27e9e9265c46f4b4dda11f940") == 0);
+
268}
int compare(const void *a, const void *b)
Definition shell_sort2.cpp:87
Here is the call graph for this function:
diff --git a/d8/d89/namespacelinear__probing.html b/d8/d89/namespacelinear__probing.html index 134a923ce..e5fb33ac5 100644 --- a/d8/d89/namespacelinear__probing.html +++ b/d8/d89/namespacelinear__probing.html @@ -238,7 +238,7 @@ Here is the call graph for this function:
196}
T endl(T... args)
-
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:37
+
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:38
Here is the call graph for this function:
diff --git a/d8/d8a/exponential__search_8cpp.html b/d8/d8a/exponential__search_8cpp.html index 29ee87231..42be5eb29 100644 --- a/d8/d8a/exponential__search_8cpp.html +++ b/d8/d8a/exponential__search_8cpp.html @@ -114,12 +114,12 @@ $(function(){initNavTree('d8/d8a/exponential__search_8cpp.html','../../'); initR More...

#include <cassert>
#include <cmath>
-#include <iostream>
+#include <cstdint>
#include <cstring>
Include dependency graph for exponential_search.cpp:
-
+

Namespaces

namespace  hashing
 Hashing algorithms.
 Used for assert.
 
namespace  SHA
 Functions for the SHA-1 algorithm implementation.

diff --git a/d8/d90/iterative__tree__traversals_8cpp.html b/d8/d90/iterative__tree__traversals_8cpp.html index 7ce42801f..405a584f5 100644 --- a/d8/d90/iterative__tree__traversals_8cpp.html +++ b/d8/d90/iterative__tree__traversals_8cpp.html @@ -296,8 +296,8 @@ Iterative Inorder Traversal of a tree

defines the functions associated with the binary tree
Definition iterative_tree_traversals.cpp:67
Node * createNewNode(int64_t)
function that will create new node for insertion.
Definition iterative_tree_traversals.cpp:88
-
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:186
-
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:169
+
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:187
+
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:170
T endl(T... args)
static void test3()
Definition hamiltons_cycle.cpp:122
static void test4(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)
Test the computed preorder with the actual preorder on negative value.
Definition iterative_tree_traversals.cpp:291
@@ -369,7 +369,7 @@ Here is the call graph for this function:
229 }
230}
std::vector< int64_t > preOrderIterative(Node *)
preOrderIterative() function that will perform the preorder traversal iteratively,...
Definition iterative_tree_traversals.cpp:102
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/d8/d99/connected__components__with__dsu_8cpp.html b/d8/d99/connected__components__with__dsu_8cpp.html index 882d2e247..67801a304 100644 --- a/d8/d99/connected__components__with__dsu_8cpp.html +++ b/d8/d99/connected__components__with__dsu_8cpp.html @@ -114,13 +114,14 @@ $(function(){initNavTree('d8/d99/connected__components__with__dsu_8cpp.html','..

Disjoint union More...

-
#include <iostream>
+
#include <cstdint>
+#include <iostream>
#include <set>
#include <vector>
Include dependency graph for connected_components_with_dsu.cpp:
-
+

@@ -199,13 +200,13 @@ Algorithm

Returns
parent of val
-
49 {
-
50 while (parent[val] != val) {
-
51 parent[val] = parent[parent[val]];
-
52 val = parent[val];
-
53 }
-
54 return val;
-
55}
+
54 {
+
55 while (parent[val] != val) {
+
56 parent[val] = parent[parent[val]];
+
57 val = parent[val];
+
58 }
+
59 return val;
+
60}
Here is the call graph for this function:
@@ -231,11 +232,11 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
112 {
-
113 test(); // Execute the tests
-
114 return 0;
-
115}
-
static void test()
Test Implementations.
Definition connected_components_with_dsu.cpp:92
+
117 {
+
118 test(); // Execute the tests
+
119 return 0;
+
120}
+
static void test()
Test Implementations.
Definition connected_components_with_dsu.cpp:97
Here is the call graph for this function:
@@ -261,12 +262,12 @@ Here is the call graph for this function:

function the initialize every node as it's own parent

Returns
void
-
38 {
-
39 for (uint32_t i = 1; i <= number_of_nodes; i++) {
-
40 parent[i] = i;
-
41 connected_set_size[i] = 1;
-
42 }
-
43}
+
43 {
+
44 for (uint32_t i = 1; i <= number_of_nodes; i++) {
+
45 parent[i] = i;
+
46 connected_set_size[i] = 1;
+
47 }
+
48}
Here is the call graph for this function:
@@ -292,12 +293,12 @@ Here is the call graph for this function:

Find total no. of connected components.

Returns
Number of connected components
-
80 {
-
81 std::set<int64_t> temp; // temp set to count number of connected components
-
82 for (uint32_t i = 1; i <= number_of_nodes; i++) temp.insert(find_set(i));
-
83 return temp.size(); // return the size of temp set
-
84}
-
int64_t find_set(int64_t val)
Find the component where following node belongs to.
Definition connected_components_with_dsu.cpp:49
+
85 {
+
86 std::set<int64_t> temp; // temp set to count number of connected components
+
87 for (uint32_t i = 1; i <= number_of_nodes; i++) temp.insert(find_set(i));
+
88 return temp.size(); // return the size of temp set
+
89}
+
int64_t find_set(int64_t val)
Find the component where following node belongs to.
Definition connected_components_with_dsu.cpp:54
T insert(T... args)
T size(T... args)
@@ -334,24 +335,24 @@ Here is the call graph for this function:

Test Implementations.

Returns
void
-
92 {
-
93 namespace dsu = graph::disjoint_union;
-
94 std::cin >> dsu::number_of_nodes;
-
95 dsu::parent.resize(dsu::number_of_nodes + 1);
-
96 dsu::connected_set_size.resize(dsu::number_of_nodes + 1);
-
97 dsu::make_set();
-
98 uint32_t edges = 0;
-
99 std::cin >> edges; // no of edges in the graph
-
100 while (edges--) {
-
101 int64_t node_a = 0, node_b = 0;
-
102 std::cin >> node_a >> node_b;
-
103 dsu::union_sets(node_a, node_b);
-
104 }
-
105 std::cout << dsu::no_of_connected_components() << std::endl;
-
106}
+
97 {
+
98 namespace dsu = graph::disjoint_union;
+
99 std::cin >> dsu::number_of_nodes;
+
100 dsu::parent.resize(dsu::number_of_nodes + 1);
+
101 dsu::connected_set_size.resize(dsu::number_of_nodes + 1);
+
102 dsu::make_set();
+
103 uint32_t edges = 0;
+
104 std::cin >> edges; // no of edges in the graph
+
105 while (edges--) {
+
106 int64_t node_a = 0, node_b = 0;
+
107 std::cin >> node_a >> node_b;
+
108 dsu::union_sets(node_a, node_b);
+
109 }
+
110 std::cout << dsu::no_of_connected_components() << std::endl;
+
111}
-
Disjoint sets union data structure, class based representation.
Definition dsu_path_compression.cpp:33
+
Disjoint sets union data structure, class based representation.
Definition dsu_path_compression.cpp:34
T endl(T... args)
Here is the call graph for this function:
@@ -389,20 +390,20 @@ Here is the call graph for this function:
Returns
void
-
62 {
-
63 node1 = find_set(node1); // find the parent of node1
-
64 node2 = find_set(node2); // find the parent of node2
-
65
-
66 // If parents of both nodes are not same, combine them
-
67 if (node1 != node2) {
-
68 if (connected_set_size[node1] < connected_set_size[node2]) {
-
69 std::swap(node1, node2); // swap both components
-
70 }
-
71 parent[node2] = node1; // make node1 as parent of node2.
-
72 connected_set_size[node1] +=
-
73 connected_set_size[node2]; // sum the size of both as they combined
-
74 }
-
75}
+
67 {
+
68 node1 = find_set(node1); // find the parent of node1
+
69 node2 = find_set(node2); // find the parent of node2
+
70
+
71 // If parents of both nodes are not same, combine them
+
72 if (node1 != node2) {
+
73 if (connected_set_size[node1] < connected_set_size[node2]) {
+
74 std::swap(node1, node2); // swap both components
+
75 }
+
76 parent[node2] = node1; // make node1 as parent of node2.
+
77 connected_set_size[node1] +=
+
78 connected_set_size[node2]; // sum the size of both as they combined
+
79 }
+
80}
T swap(T... args)
Here is the call graph for this function:
@@ -424,7 +425,7 @@ Here is the call graph for this function:
-
33{}; // size of each set
+
38{}; // size of each set
@@ -439,7 +440,7 @@ Here is the call graph for this function:
-
32{}; // parent of each node
+
37{}; // parent of each node
diff --git a/d8/d9a/fast__fourier__transform_8cpp.html b/d8/d9a/fast__fourier__transform_8cpp.html index f235ebc84..f3124e3f7 100644 --- a/d8/d9a/fast__fourier__transform_8cpp.html +++ b/d8/d9a/fast__fourier__transform_8cpp.html @@ -116,12 +116,13 @@ $(function(){initNavTree('d8/d9a/fast__fourier__transform_8cpp.html','../../');
#include <cassert>
#include <cmath>
#include <complex>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for fast_fourier_transform.cpp:
-
+
Returns
0 on exit
-
162 {
-
163 test(); // run self-test implementations
-
164 // with 2 defined test cases
-
165 return 0;
-
166}
-
static void test()
Self-test implementations.
Definition fast_fourier_transform.cpp:104
+
163 {
+
164 test(); // run self-test implementations
+
165 // with 2 defined test cases
+
166 return 0;
+
167}
+
static void test()
Self-test implementations.
Definition fast_fourier_transform.cpp:105
Here is the call graph for this function:
@@ -221,59 +222,59 @@ Here is the call graph for this function:

Temporary variable used to delete memory location of o2

Comparing for both real and imaginary values for test case 1

Comparing for both real and imaginary values for test case 2

-
104 {
-
105 /* descriptions of the following test */
-
106
-
107 auto *t1 = new std::complex<double>[2]; /// Test case 1
-
108 auto *t2 = new std::complex<double>[4]; /// Test case 2
-
109
-
110 t1[0] = {1, 0};
-
111 t1[1] = {2, 0};
-
112 t2[0] = {1, 0};
-
113 t2[1] = {2, 0};
-
114 t2[2] = {3, 0};
-
115 t2[3] = {4, 0};
-
116
-
117 uint8_t n1 = 2;
-
118 uint8_t n2 = 4;
- -
120 {3, 0}, {-1, 0}}; /// True Answer for test case 1
-
121
- -
123 {10, 0}, {-2, -2}, {-2, 0}, {-2, 2}}; /// True Answer for test case 2
-
124
- - -
127 o1; /// Temporary variable used to delete memory location of o1
- - -
130 o2; /// Temporary variable used to delete memory location of o2
-
131 for (uint8_t i = 0; i < n1; i++) {
-
132 assert((r1[i].real() - o1->real() < 0.000000000001) &&
-
133 (r1[i].imag() - o1->imag() <
-
134 0.000000000001)); /// Comparing for both real and imaginary
-
135 /// values for test case 1
-
136 o1++;
-
137 }
-
138
-
139 for (uint8_t i = 0; i < n2; i++) {
-
140 assert((r2[i].real() - o2->real() < 0.000000000001) &&
-
141 (r2[i].imag() - o2->imag() <
-
142 0.000000000001)); /// Comparing for both real and imaginary
-
143 /// values for test case 2
-
144 o2++;
-
145 }
-
146
-
147 delete[] t1;
-
148 delete[] t2;
-
149 delete[] t3;
-
150 delete[] t4;
-
151 std::cout << "All tests have successfully passed!\n";
-
152}
+
105 {
+
106 /* descriptions of the following test */
+
107
+
108 auto *t1 = new std::complex<double>[2]; /// Test case 1
+
109 auto *t2 = new std::complex<double>[4]; /// Test case 2
+
110
+
111 t1[0] = {1, 0};
+
112 t1[1] = {2, 0};
+
113 t2[0] = {1, 0};
+
114 t2[1] = {2, 0};
+
115 t2[2] = {3, 0};
+
116 t2[3] = {4, 0};
+
117
+
118 uint8_t n1 = 2;
+
119 uint8_t n2 = 4;
+ +
121 {3, 0}, {-1, 0}}; /// True Answer for test case 1
+
122
+ +
124 {10, 0}, {-2, -2}, {-2, 0}, {-2, 2}}; /// True Answer for test case 2
+
125
+ + +
128 o1; /// Temporary variable used to delete memory location of o1
+ + +
131 o2; /// Temporary variable used to delete memory location of o2
+
132 for (uint8_t i = 0; i < n1; i++) {
+
133 assert((r1[i].real() - o1->real() < 0.000000000001) &&
+
134 (r1[i].imag() - o1->imag() <
+
135 0.000000000001)); /// Comparing for both real and imaginary
+
136 /// values for test case 1
+
137 o1++;
+
138 }
+
139
+
140 for (uint8_t i = 0; i < n2; i++) {
+
141 assert((r2[i].real() - o2->real() < 0.000000000001) &&
+
142 (r2[i].imag() - o2->imag() <
+
143 0.000000000001)); /// Comparing for both real and imaginary
+
144 /// values for test case 2
+
145 o2++;
+
146 }
+
147
+
148 delete[] t1;
+
149 delete[] t2;
+
150 delete[] t3;
+
151 delete[] t4;
+
152 std::cout << "All tests have successfully passed!\n";
+
153}
T imag(T... args)
-
std::complex< double > * FastFourierTransform(std::complex< double > *p, uint8_t n)
FastFourierTransform is a recursive function which returns list of complex numbers.
Definition fast_fourier_transform.cpp:41
+
std::complex< double > * FastFourierTransform(std::complex< double > *p, uint8_t n)
FastFourierTransform is a recursive function which returns list of complex numbers.
Definition fast_fourier_transform.cpp:42
T real(T... args)
diff --git a/d8/db1/binomial__calculate_8cpp.html b/d8/db1/binomial__calculate_8cpp.html index 1afd79a4f..0b1cdb02d 100644 --- a/d8/db1/binomial__calculate_8cpp.html +++ b/d8/db1/binomial__calculate_8cpp.html @@ -126,7 +126,7 @@ Include dependency graph for binomial_calculate.cpp:
- + @@ -194,7 +194,7 @@ Functions
47 return result;
48}
double k(double x)
Another test function.
Definition composite_simpson_rule.cpp:117
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/d8/dd5/check__factorial_8cpp.html b/d8/dd5/check__factorial_8cpp.html index e19f9fbc7..0645a568b 100644 --- a/d8/dd5/check__factorial_8cpp.html +++ b/d8/dd5/check__factorial_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d8/dd5/check__factorial_8cpp.html','../../'); initResi

A simple program to check if the given number is a factorial of some number or not. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for check_factorial.cpp:
-
+

@@ -174,12 +175,12 @@ Functions

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  binomial
 Functions for Binomial coefficients implementation.
- +

Namespaces

namespace  math
 for IO operations
 for assert
 

Main function.

Returns
0 on exit
-
70 {
-
71 tests(); // run self-test implementations
-
72 return 0;
-
73}
-
static void tests()
Self-test implementations.
Definition check_factorial.cpp:55
+
71 {
+
72 tests(); // run self-test implementations
+
73 return 0;
+
74}
+
static void tests()
Self-test implementations.
Definition check_factorial.cpp:56
Here is the call graph for this function:
@@ -201,19 +202,19 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
55 {
-
56 assert(math::is_factorial(50) == false);
-
57 assert(math::is_factorial(720) == true);
-
58 assert(math::is_factorial(0) == false);
-
59 assert(math::is_factorial(1) == true);
-
60 assert(math::is_factorial(479001600) == true);
-
61 assert(math::is_factorial(-24) == false);
-
62
-
63 std::cout << "All tests have successfully passed!" << std::endl;
-
64}
+
56 {
+
57 assert(math::is_factorial(50) == false);
+
58 assert(math::is_factorial(720) == true);
+
59 assert(math::is_factorial(0) == false);
+
60 assert(math::is_factorial(1) == true);
+
61 assert(math::is_factorial(479001600) == true);
+
62 assert(math::is_factorial(-24) == false);
+
63
+
64 std::cout << "All tests have successfully passed!" << std::endl;
+
65}
T endl(T... args)
-
bool is_factorial(uint64_t n)
Function to check if the given number is factorial of some number or not.
Definition check_factorial.cpp:27
+
bool is_factorial(uint64_t n)
Function to check if the given number is factorial of some number or not.
Definition check_factorial.cpp:28
Here is the call graph for this function:
diff --git a/d8/ddf/sieve__of__eratosthenes_8cpp.html b/d8/ddf/sieve__of__eratosthenes_8cpp.html index 061ecc611..11a11c503 100644 --- a/d8/ddf/sieve__of__eratosthenes_8cpp.html +++ b/d8/ddf/sieve__of__eratosthenes_8cpp.html @@ -113,19 +113,20 @@ $(function(){initNavTree('d8/ddf/sieve__of__eratosthenes_8cpp.html','../../'); i

Prime Numbers using Sieve of Eratosthenes More...

-
#include <cassert>
+
#include <cstdint>
+#include <cassert>
#include <iostream>
#include <vector>
Include dependency graph for sieve_of_eratosthenes.cpp:
-
+

@@ -163,11 +164,11 @@ Functions

- + @@ -174,7 +175,7 @@ Space Complexity : \(O(N)\)

120 tests();
121 return 0;
122}
-
static void tests()
Self-test implementations.
Definition sieve_of_eratosthenes.cpp:80
+
static void tests()
Self-test implementations.
Definition sieve_of_eratosthenes.cpp:81
Here is the call graph for this function:
@@ -210,16 +211,16 @@ Here is the call graph for this function:

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  sieve_of_eratosthenes
 Functions for finding Prime Numbers using Sieve of Eratosthenes.
-
64 {
-
65 for (uint32_t i = 2; i <= N; i++) {
-
66 if (is_prime[i]) {
-
67 std::cout << i << ' ';
-
68 }
-
69 }
- -
71}
+
65 {
+
66 for (uint32_t i = 2; i <= N; i++) {
+
67 if (is_prime[i]) {
+
68 std::cout << i << ' ';
+
69 }
+
70 }
+ +
72}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T endl(T... args)
Here is the call graph for this function:
@@ -253,19 +254,19 @@ Here is the call graph for this function:
Returns
is_prime a vector of N + 1 booleans identifying if i^th number is a prime or not
-
44 {
-
45 std::vector<bool> is_prime(N + 1, true); // Initialize all as prime numbers
-
46 is_prime[0] = is_prime[1] = false; // 0 and 1 are not prime numbers
-
47
-
48 for (uint32_t i = 2; i * i <= N; i++) {
-
49 if (is_prime[i]) {
-
50 for (uint32_t j = i * i; j <= N; j += i) {
-
51 is_prime[j] = false;
-
52 }
-
53 }
-
54 }
-
55 return is_prime;
-
56}
+
45 {
+
46 std::vector<bool> is_prime(N + 1, true); // Initialize all as prime numbers
+
47 is_prime[0] = is_prime[1] = false; // 0 and 1 are not prime numbers
+
48
+
49 for (uint32_t i = 2; i * i <= N; i++) {
+
50 if (is_prime[i]) {
+
51 for (uint32_t j = i * i; j <= N; j += i) {
+
52 is_prime[j] = false;
+
53 }
+
54 }
+
55 }
+
56 return is_prime;
+
57}
bool is_prime(int64_t num)
Function to check if the given number is prime or not.
Definition check_prime.cpp:31
@@ -301,41 +302,40 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
80 {
-
81 std::vector<bool> is_prime_1 =
-
82 math::sieve_of_eratosthenes::sieve(static_cast<uint32_t>(10));
-
83 std::vector<bool> is_prime_2 =
-
84 math::sieve_of_eratosthenes::sieve(static_cast<uint32_t>(20));
-
85 std::vector<bool> is_prime_3 =
-
86 math::sieve_of_eratosthenes::sieve(static_cast<uint32_t>(100));
-
87
-
88 std::vector<bool> expected_1{false, false, true, true, false, true,
-
89 false, true, false, false, false};
-
90 assert(is_prime_1 == expected_1);
-
91
-
92 std::vector<bool> expected_2{false, false, true, true, false, true,
-
93 false, true, false, false, false, true,
+
81 {
+
82 std::vector<bool> is_prime_1 =
+
83 math::sieve_of_eratosthenes::sieve(static_cast<uint32_t>(10));
+
84 std::vector<bool> is_prime_2 =
+
85 math::sieve_of_eratosthenes::sieve(static_cast<uint32_t>(20));
+
86 std::vector<bool> is_prime_3 =
+
87 math::sieve_of_eratosthenes::sieve(static_cast<uint32_t>(100));
+
88
+
89 std::vector<bool> expected_1{false, false, true, true, false, true,
+
90 false, true, false, false, false};
+
91 assert(is_prime_1 == expected_1);
+
92
+
93 std::vector<bool> expected_2{false, false, true, true, false, true,
94 false, true, false, false, false, true,
-
95 false, true, false};
-
96 assert(is_prime_2 == expected_2);
-
97
-
98 std::vector<bool> expected_3{
-
99 false, false, true, true, false, true, false, true, false, false,
-
100 false, true, false, true, false, false, false, true, false, true,
-
101 false, false, false, true, false, false, false, false, false, true,
-
102 false, true, false, false, false, false, false, true, false, false,
-
103 false, true, false, true, false, false, false, true, false, false,
-
104 false, false, false, true, false, false, false, false, false, true,
-
105 false, true, false, false, false, false, false, true, false, false,
-
106 false, true, false, true, false, false, false, false, false, true,
-
107 false, false, false, true, false, false, false, false, false, true,
-
108 false, false, false, false, false, false, false, true, false, false,
-
109 false};
-
110 assert(is_prime_3 == expected_3);
-
111
-
112 std::cout << "All tests have passed successfully!\n";
+
95 false, true, false, false, false, true,
+
96 false, true, false};
+
97 assert(is_prime_2 == expected_2);
+
98
+
99 std::vector<bool> expected_3{
+
100 false, false, true, true, false, true, false, true, false, false,
+
101 false, true, false, true, false, false, false, true, false, true,
+
102 false, false, false, true, false, false, false, false, false, true,
+
103 false, true, false, false, false, false, false, true, false, false,
+
104 false, true, false, true, false, false, false, true, false, false,
+
105 false, false, false, true, false, false, false, false, false, true,
+
106 false, true, false, false, false, false, false, true, false, false,
+
107 false, true, false, true, false, false, false, false, false, true,
+
108 false, false, false, true, false, false, false, false, false, true,
+
109 false, false, false, false, false, false, false, true, false, false,
+
110 false};
+
111 assert(is_prime_3 == expected_3);
+
112
113}
-
std::vector< bool > sieve(uint32_t N)
Function to sieve out the primes.
Definition sieve_of_eratosthenes.cpp:44
+
std::vector< bool > sieve(uint32_t N)
Function to sieve out the primes.
Definition sieve_of_eratosthenes.cpp:45
diff --git a/d8/de0/radix__sort2_8cpp__incl.map b/d8/de0/radix__sort2_8cpp__incl.map index fa76545f3..f98823732 100644 --- a/d8/de0/radix__sort2_8cpp__incl.map +++ b/d8/de0/radix__sort2_8cpp__incl.map @@ -1,11 +1,13 @@ - + - + - - - - - + + + + + + + diff --git a/d8/de0/radix__sort2_8cpp__incl.md5 b/d8/de0/radix__sort2_8cpp__incl.md5 index 7462ca3cf..e9ee4e78a 100644 --- a/d8/de0/radix__sort2_8cpp__incl.md5 +++ b/d8/de0/radix__sort2_8cpp__incl.md5 @@ -1 +1 @@ -90f1bd85f3814e84c2862815467539fd \ No newline at end of file +8d3a1876caa7461c98ac6c3ea5064a6c \ No newline at end of file diff --git a/d8/de0/radix__sort2_8cpp__incl.svg b/d8/de0/radix__sort2_8cpp__incl.svg index 554ce1fae..383e8f8b1 100644 --- a/d8/de0/radix__sort2_8cpp__incl.svg +++ b/d8/de0/radix__sort2_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -sorting/radix_sort2.cpp + +sorting/radix_sort2.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -iostream + +cstdint @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -vector + +iostream @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d8/de0/radix__sort2_8cpp__incl_org.svg b/d8/de0/radix__sort2_8cpp__incl_org.svg index afb003a1b..14c3940d8 100644 --- a/d8/de0/radix__sort2_8cpp__incl_org.svg +++ b/d8/de0/radix__sort2_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + sorting/radix_sort2.cpp Node1 - -sorting/radix_sort2.cpp + +sorting/radix_sort2.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -iostream + +cstdint @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -vector + +iostream @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d8/df0/queue__using__array_8cpp.html b/d8/df0/queue__using__array_8cpp.html index 8d82795fa..ba12b61b0 100644 --- a/d8/df0/queue__using__array_8cpp.html +++ b/d8/df0/queue__using__array_8cpp.html @@ -116,11 +116,12 @@ $(function(){initNavTree('d8/df0/queue__using__array_8cpp.html','../../'); initR

Implementation of Linear [Queue using array] (https://www.geeksforgeeks.org/array-implementation-of-queue-simple/). More...

#include <array>
+#include <cstdint>
#include <iostream>
Include dependency graph for queue_using_array.cpp:
-
+
- +

@@ -147,7 +148,7 @@ Functions

Variables

constexpr uint16_t max_size {10}
 for io operations
 for std::array
 

Detailed Description

@@ -178,41 +179,41 @@ Algorithm

Main function.

Allows the user to add and delete values from the queue. Also allows user to display values in the queue.

Returns
0 on exit
-
111 {
-
112 int op{0}, data{0};
- -
114
-
115 std::cout << "\n1. enqueue(Insertion) ";
-
116 std::cout << "\n2. dequeue(Deletion)";
-
117 std::cout << "\n3. Display";
-
118 std::cout << "\n4. Exit";
-
119 while (true) {
-
120 std::cout << "\nEnter your choice ";
-
121 std::cin >> op;
-
122 if (op == 1) {
-
123 std::cout << "Enter data ";
-
124 std::cin >> data;
-
125 ob.enqueue(data);
-
126 } else if (op == 2) {
-
127 data = ob.dequeue();
-
128 std::cout << "\ndequeue element is:\t" << data;
-
129 } else if (op == 3) {
-
130 ob.display();
-
131 } else if (op == 4) {
-
132 exit(0);
-
133 } else {
-
134 std::cout << "\nWrong choice ";
-
135 }
-
136 }
-
137
-
138 return 0;
-
139}
+
112 {
+
113 int op{0}, data{0};
+ +
115
+
116 std::cout << "\n1. enqueue(Insertion) ";
+
117 std::cout << "\n2. dequeue(Deletion)";
+
118 std::cout << "\n3. Display";
+
119 std::cout << "\n4. Exit";
+
120 while (true) {
+
121 std::cout << "\nEnter your choice ";
+
122 std::cin >> op;
+
123 if (op == 1) {
+
124 std::cout << "Enter data ";
+
125 std::cin >> data;
+
126 ob.enqueue(data);
+
127 } else if (op == 2) {
+
128 data = ob.dequeue();
+
129 std::cout << "\ndequeue element is:\t" << data;
+
130 } else if (op == 3) {
+
131 ob.display();
+
132 } else if (op == 4) {
+
133 exit(0);
+
134 } else {
+
135 std::cout << "\nWrong choice ";
+
136 }
+
137 }
+
138
+
139 return 0;
+
140}
-
Queue_Array class containing the main data and also index of head and tail of the array.
Definition queue_using_array.cpp:43
-
int dequeue()
Delete element from back of the queue.
Definition queue_using_array.cpp:75
-
void enqueue(const int16_t &)
Add element to the first of the queue.
Definition queue_using_array.cpp:58
-
void display() const
Show all saved data.
Definition queue_using_array.cpp:93
+
Queue_Array class containing the main data and also index of head and tail of the array.
Definition queue_using_array.cpp:44
+
int dequeue()
Delete element from back of the queue.
Definition queue_using_array.cpp:76
+
void enqueue(const int16_t &)
Add element to the first of the queue.
Definition queue_using_array.cpp:59
+
void display() const
Show all saved data.
Definition queue_using_array.cpp:94
T exit(T... args)
int data[MAX]
test data
Definition hash_search.cpp:24
@@ -244,9 +245,9 @@ Here is the call graph for this function:
-

for io operations

-

for std::array Maximum size of the queue

-
23{10}; ///< Maximum size of the queue
+

for std::array

+

for io operations Maximum size of the queue

+
24{10}; ///< Maximum size of the queue
diff --git a/d8/dfa/median__search2_8cpp.html b/d8/dfa/median__search2_8cpp.html index 7a5b2ba95..0d1a463f3 100644 --- a/d8/dfa/median__search2_8cpp.html +++ b/d8/dfa/median__search2_8cpp.html @@ -131,7 +131,7 @@ Classes

Namespaces

namespace  search - for std::vector
+ for std::assert
  namespace  median_search  Functions for Median search algorithm.
diff --git a/d9/d00/factorial_8cpp.html b/d9/d00/factorial_8cpp.html index 2ceb671e4..5b042c75b 100644 --- a/d9/d00/factorial_8cpp.html +++ b/d9/d00/factorial_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d9/d00/factorial_8cpp.html','../../'); initResizable(t

Find the factorial of a given number. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for factorial.cpp:
-
+
- +

Namespaces

namespace  math
 for IO operations
 for assert
 
void pop()
Definition stack.hpp:62
void push(const value_type &item)
Definition stack.hpp:47
value_type top() const
Definition stack.hpp:56
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
char stack[MAX]
Definition paranthesis_matching.cpp:20
diff --git a/d9/d31/recursive__bubble__sort_8cpp__incl.map b/d9/d31/recursive__bubble__sort_8cpp__incl.map index d5e7943f0..c9ad170b3 100644 --- a/d9/d31/recursive__bubble__sort_8cpp__incl.map +++ b/d9/d31/recursive__bubble__sort_8cpp__incl.map @@ -1,13 +1,15 @@ - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/d9/d31/recursive__bubble__sort_8cpp__incl.md5 b/d9/d31/recursive__bubble__sort_8cpp__incl.md5 index 66cf79fbd..2d413e497 100644 --- a/d9/d31/recursive__bubble__sort_8cpp__incl.md5 +++ b/d9/d31/recursive__bubble__sort_8cpp__incl.md5 @@ -1 +1 @@ -2752e718744c56fbde48c2888f9e5a6f \ No newline at end of file +a34d55f409021b818979a1fe196f30b2 \ No newline at end of file diff --git a/d9/d31/recursive__bubble__sort_8cpp__incl.svg b/d9/d31/recursive__bubble__sort_8cpp__incl.svg index ed89e1e34..f175ff9b9 100644 --- a/d9/d31/recursive__bubble__sort_8cpp__incl.svg +++ b/d9/d31/recursive__bubble__sort_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -sorting/recursive_bubble -_sort.cpp + +sorting/recursive_bubble +_sort.cpp @@ -33,8 +33,8 @@ Node2 - -cassert + +algorithm @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +array @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -vector + +cassert @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -array + +cstdint @@ -96,8 +96,8 @@ Node1->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -algorithm + +iostream @@ -114,8 +114,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/d9/d31/recursive__bubble__sort_8cpp__incl_org.svg b/d9/d31/recursive__bubble__sort_8cpp__incl_org.svg index e447db6e9..da24d29c4 100644 --- a/d9/d31/recursive__bubble__sort_8cpp__incl_org.svg +++ b/d9/d31/recursive__bubble__sort_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + sorting/recursive_bubble_sort.cpp Node1 - -sorting/recursive_bubble -_sort.cpp + +sorting/recursive_bubble +_sort.cpp @@ -22,8 +22,8 @@ Node2 - -cassert + +algorithm @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +array @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -vector + +cassert @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -array + +cstdint @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -algorithm + +iostream @@ -103,8 +103,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/d9/d37/inverse__fast__fourier__transform_8cpp.html b/d9/d37/inverse__fast__fourier__transform_8cpp.html index 5f4bcc2b6..c0bee760d 100644 --- a/d9/d37/inverse__fast__fourier__transform_8cpp.html +++ b/d9/d37/inverse__fast__fourier__transform_8cpp.html @@ -116,12 +116,13 @@ $(function(){initNavTree('d9/d37/inverse__fast__fourier__transform_8cpp.html','.
#include <cassert>
#include <cmath>
#include <complex>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for inverse_fast_fourier_transform.cpp:
-
+

diff --git a/d9/d0e/brent__method__extrema_8cpp__incl.map b/d9/d0e/brent__method__extrema_8cpp__incl.map index 469abf867..cd7308f3f 100644 --- a/d9/d0e/brent__method__extrema_8cpp__incl.map +++ b/d9/d0e/brent__method__extrema_8cpp__incl.map @@ -1,13 +1,15 @@ - + - + - - - - - - - + + + + + + + + + diff --git a/d9/d0e/brent__method__extrema_8cpp__incl.md5 b/d9/d0e/brent__method__extrema_8cpp__incl.md5 index 1e33da3ce..dd27e6581 100644 --- a/d9/d0e/brent__method__extrema_8cpp__incl.md5 +++ b/d9/d0e/brent__method__extrema_8cpp__incl.md5 @@ -1 +1 @@ -30b3b08bdb0644139b8ade385c61e2e4 \ No newline at end of file +b08a4ebdbcd96d09e811e23d5af8fcab \ No newline at end of file diff --git a/d9/d0e/brent__method__extrema_8cpp__incl.svg b/d9/d0e/brent__method__extrema_8cpp__incl.svg index 82bd67b6b..73c79ade5 100644 --- a/d9/d0e/brent__method__extrema_8cpp__incl.svg +++ b/d9/d0e/brent__method__extrema_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -numerical_methods/brent -_method_extrema.cpp + +numerical_methods/brent +_method_extrema.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -functional + +cstdint @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -iostream + +functional @@ -96,8 +96,8 @@ Node1->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -limits + +iostream @@ -114,8 +114,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +limits + + + + + +Node1->Node7 + + + diff --git a/d9/d0e/brent__method__extrema_8cpp__incl_org.svg b/d9/d0e/brent__method__extrema_8cpp__incl_org.svg index f4a48576f..8c3e06268 100644 --- a/d9/d0e/brent__method__extrema_8cpp__incl_org.svg +++ b/d9/d0e/brent__method__extrema_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + numerical_methods/brent_method_extrema.cpp Node1 - -numerical_methods/brent -_method_extrema.cpp + +numerical_methods/brent +_method_extrema.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -functional + +cstdint @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -iostream + +functional @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -limits + +iostream @@ -103,8 +103,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +limits + + + + + +Node1->Node7 + + + diff --git a/d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html b/d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html index 5a8a2fd73..f719e8ca7 100644 --- a/d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html +++ b/d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html @@ -218,7 +218,7 @@ Public Member Functions

Returns
0 on exit
-
156 {
-
157 test(); // run self-test implementations
-
158 // with 2 defined test cases
-
159 return 0;
-
160}
-
static void test()
Self-test implementations.
Definition inverse_fast_fourier_transform.cpp:100
+
157 {
+
158 test(); // run self-test implementations
+
159 // with 2 defined test cases
+
160 return 0;
+
161}
+
static void test()
Self-test implementations.
Definition inverse_fast_fourier_transform.cpp:101
Here is the call graph for this function:
@@ -219,56 +220,56 @@ Here is the call graph for this function:

True Answer for test case 2

Comparing for both real and imaginary values for test case 1

Comparing for both real and imaginary values for test case 2

-
100 {
-
101 /* descriptions of the following test */
-
102
-
103 auto *t1 = new std::complex<double>[2]; /// Test case 1
-
104 auto *t2 = new std::complex<double>[4]; /// Test case 2
-
105
-
106 t1[0] = {3, 0};
-
107 t1[1] = {-1, 0};
-
108 t2[0] = {10, 0};
-
109 t2[1] = {-2, -2};
-
110 t2[2] = {-2, 0};
-
111 t2[3] = {-2, 2};
-
112
-
113 uint8_t n1 = 2;
-
114 uint8_t n2 = 4;
- -
116 {1, 0}, {2, 0}}; /// True Answer for test case 1
-
117
- -
119 {1, 0}, {2, 0}, {3, 0}, {4, 0}}; /// True Answer for test case 2
-
120
- - -
123
- - -
126
-
127 for (uint8_t i = 0; i < n1; i++) {
-
128 assert((r1[i].real() - o1[i].real() < 0.000000000001) &&
-
129 (r1[i].imag() - o1[i].imag() <
-
130 0.000000000001)); /// Comparing for both real and imaginary
-
131 /// values for test case 1
-
132 }
-
133
-
134 for (uint8_t i = 0; i < n2; i++) {
-
135 assert((r2[i].real() - o2[i].real() < 0.000000000001) &&
-
136 (r2[i].imag() - o2[i].imag() <
-
137 0.000000000001)); /// Comparing for both real and imaginary
-
138 /// values for test case 2
-
139 }
-
140
-
141 delete[] t1;
-
142 delete[] t2;
-
143 delete[] o1;
-
144 delete[] o2;
-
145 std::cout << "All tests have successfully passed!\n";
-
146}
+
101 {
+
102 /* descriptions of the following test */
+
103
+
104 auto *t1 = new std::complex<double>[2]; /// Test case 1
+
105 auto *t2 = new std::complex<double>[4]; /// Test case 2
+
106
+
107 t1[0] = {3, 0};
+
108 t1[1] = {-1, 0};
+
109 t2[0] = {10, 0};
+
110 t2[1] = {-2, -2};
+
111 t2[2] = {-2, 0};
+
112 t2[3] = {-2, 2};
+
113
+
114 uint8_t n1 = 2;
+
115 uint8_t n2 = 4;
+ +
117 {1, 0}, {2, 0}}; /// True Answer for test case 1
+
118
+ +
120 {1, 0}, {2, 0}, {3, 0}, {4, 0}}; /// True Answer for test case 2
+
121
+ + +
124
+ + +
127
+
128 for (uint8_t i = 0; i < n1; i++) {
+
129 assert((r1[i].real() - o1[i].real() < 0.000000000001) &&
+
130 (r1[i].imag() - o1[i].imag() <
+
131 0.000000000001)); /// Comparing for both real and imaginary
+
132 /// values for test case 1
+
133 }
+
134
+
135 for (uint8_t i = 0; i < n2; i++) {
+
136 assert((r2[i].real() - o2[i].real() < 0.000000000001) &&
+
137 (r2[i].imag() - o2[i].imag() <
+
138 0.000000000001)); /// Comparing for both real and imaginary
+
139 /// values for test case 2
+
140 }
+
141
+
142 delete[] t1;
+
143 delete[] t2;
+
144 delete[] o1;
+
145 delete[] o2;
+
146 std::cout << "All tests have successfully passed!\n";
+
147}
-
std::complex< double > * InverseFastFourierTransform(std::complex< double > *p, uint8_t n)
InverseFastFourierTransform is a recursive function which returns list of complex numbers.
Definition inverse_fast_fourier_transform.cpp:33
+
std::complex< double > * InverseFastFourierTransform(std::complex< double > *p, uint8_t n)
InverseFastFourierTransform is a recursive function which returns list of complex numbers.
Definition inverse_fast_fourier_transform.cpp:34
Here is the call graph for this function:
diff --git a/d9/d43/set__kth__bit_8cpp__incl.map b/d9/d43/set__kth__bit_8cpp__incl.map index 88137e1cf..1b5f68a0a 100644 --- a/d9/d43/set__kth__bit_8cpp__incl.map +++ b/d9/d43/set__kth__bit_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/d9/d43/set__kth__bit_8cpp__incl.md5 b/d9/d43/set__kth__bit_8cpp__incl.md5 index c102c97a4..86c157b75 100644 --- a/d9/d43/set__kth__bit_8cpp__incl.md5 +++ b/d9/d43/set__kth__bit_8cpp__incl.md5 @@ -1 +1 @@ -f5b269a54b5b1bfaaf779a9dd088f26d \ No newline at end of file +206692311770460bcf934dfac031af62 \ No newline at end of file diff --git a/d9/d43/set__kth__bit_8cpp__incl.svg b/d9/d43/set__kth__bit_8cpp__incl.svg index 41ab0542e..aa1a426c2 100644 --- a/d9/d43/set__kth__bit_8cpp__incl.svg +++ b/d9/d43/set__kth__bit_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -bit_manipulation/set -_kth_bit.cpp + +bit_manipulation/set +_kth_bit.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d9/d43/set__kth__bit_8cpp__incl_org.svg b/d9/d43/set__kth__bit_8cpp__incl_org.svg index 6c13d6420..225804732 100644 --- a/d9/d43/set__kth__bit_8cpp__incl_org.svg +++ b/d9/d43/set__kth__bit_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + bit_manipulation/set_kth_bit.cpp Node1 - -bit_manipulation/set -_kth_bit.cpp + +bit_manipulation/set +_kth_bit.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d9/d44/magic__number_8cpp.html b/d9/d44/magic__number_8cpp.html index 36ad7a220..d4718dc3f 100644 --- a/d9/d44/magic__number_8cpp.html +++ b/d9/d44/magic__number_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('d9/d44/magic__number_8cpp.html','../../'); initResizab

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. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for magic_number.cpp:
-
+

@@ -174,12 +175,12 @@ Functions

- +

Namespaces

namespace  math
 for IO operations
 for assert
 

Main function.

Returns
0 on exit
-
77 {
-
78 tests(); // execute the tests
-
79 return 0;
-
80}
-
static void tests()
Test function.
Definition magic_number.cpp:51
+
78 {
+
79 tests(); // execute the tests
+
80 return 0;
+
81}
+
static void tests()
Test function.
Definition magic_number.cpp:52
Here is the call graph for this function:
@@ -197,29 +198,29 @@ Here is the call graph for this function:

Test function.

Returns
void
-
51 {
-
52 std::cout << "Test 1:\t n=60\n";
-
53 assert(math::magic_number(60) == false);
-
54 std::cout << "passed\n";
-
55
-
56 std::cout << "Test 2:\t n=730\n";
-
57 assert(math::magic_number(730) == true);
-
58 std::cout << "passed\n";
-
59
-
60 std::cout << "Test 3:\t n=0\n";
-
61 assert(math::magic_number(0) == false);
-
62 std::cout << "passed\n";
-
63
-
64 std::cout << "Test 4:\t n=479001600\n";
-
65 assert(math::magic_number(479001600) == false);
-
66 std::cout << "passed\n";
-
67
-
68 std::cout << "Test 5:\t n=-35\n";
-
69 assert(math::magic_number(-35) == false);
-
70 std::cout << "passed\n";
-
71}
+
52 {
+
53 std::cout << "Test 1:\t n=60\n";
+
54 assert(math::magic_number(60) == false);
+
55 std::cout << "passed\n";
+
56
+
57 std::cout << "Test 2:\t n=730\n";
+
58 assert(math::magic_number(730) == true);
+
59 std::cout << "passed\n";
+
60
+
61 std::cout << "Test 3:\t n=0\n";
+
62 assert(math::magic_number(0) == false);
+
63 std::cout << "passed\n";
+
64
+
65 std::cout << "Test 4:\t n=479001600\n";
+
66 assert(math::magic_number(479001600) == false);
+
67 std::cout << "passed\n";
+
68
+
69 std::cout << "Test 5:\t n=-35\n";
+
70 assert(math::magic_number(-35) == false);
+
71 std::cout << "passed\n";
+
72}
-
bool magic_number(const uint64_t &n)
Definition magic_number.cpp:32
+
bool magic_number(const uint64_t &n)
Definition magic_number.cpp:33
Here is the call graph for this function:
diff --git a/d9/d49/kohonen__som__trace_8cpp.html b/d9/d49/kohonen__som__trace_8cpp.html index 3b61b88e8..687c6b277 100644 --- a/d9/d49/kohonen__som__trace_8cpp.html +++ b/d9/d49/kohonen__som__trace_8cpp.html @@ -327,7 +327,7 @@ Here is the call graph for this function:
260 kohonen_som_tracer(X, &W, 0.1); // train the SOM
261 save_nd_data("w12.csv", W); // save the resultant weights
262}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
int save_nd_data(const char *fname, const std::vector< std::valarray< double > > &X)
Definition kohonen_som_trace.cpp:58
double _random(double a, double b)
Definition kohonen_som_topology.cpp:53
void test_circle(std::vector< std::valarray< double > > *data)
Definition kohonen_som_trace.cpp:196
diff --git a/d9/d69/median__search_8cpp.html b/d9/d69/median__search_8cpp.html index 72fea945c..36138e6f6 100644 --- a/d9/d69/median__search_8cpp.html +++ b/d9/d69/median__search_8cpp.html @@ -126,7 +126,7 @@ Include dependency graph for median_search.cpp:
- + diff --git a/d9/d78/factorial_8cpp__incl.map b/d9/d78/factorial_8cpp__incl.map index 3a474d901..e5e06521d 100644 --- a/d9/d78/factorial_8cpp__incl.map +++ b/d9/d78/factorial_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/d9/d78/factorial_8cpp__incl.md5 b/d9/d78/factorial_8cpp__incl.md5 index 662da89f3..510a681b7 100644 --- a/d9/d78/factorial_8cpp__incl.md5 +++ b/d9/d78/factorial_8cpp__incl.md5 @@ -1 +1 @@ -789daeea744a90e333e62d594e739138 \ No newline at end of file +eb6cb8609c7fb8f9c6130a08ace3d45d \ No newline at end of file diff --git a/d9/d78/factorial_8cpp__incl.svg b/d9/d78/factorial_8cpp__incl.svg index f4a29be19..9d99c65c1 100644 --- a/d9/d78/factorial_8cpp__incl.svg +++ b/d9/d78/factorial_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/factorial.cpp + +math/factorial.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d9/d78/factorial_8cpp__incl_org.svg b/d9/d78/factorial_8cpp__incl_org.svg index c540dcdd2..f9132ed52 100644 --- a/d9/d78/factorial_8cpp__incl_org.svg +++ b/d9/d78/factorial_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/factorial.cpp Node1 - -math/factorial.cpp + +math/factorial.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d9/d89/fibonacci_8cpp.html b/d9/d89/fibonacci_8cpp.html index 30c8c06f9..c2156b90e 100644 --- a/d9/d89/fibonacci_8cpp.html +++ b/d9/d89/fibonacci_8cpp.html @@ -113,18 +113,19 @@ $(function(){initNavTree('d9/d89/fibonacci_8cpp.html','../../'); initResizable(t

n-th Fibonacci number. More...

-
#include <cassert>
+
#include <cstdint>
+#include <cassert>
#include <iostream>
Include dependency graph for fibonacci.cpp:
-
+

@@ -159,11 +160,11 @@ Functions

Namespaces

namespace  search
 for std::vector
 for std::assert
 
namespace  median_search
- + @@ -172,16 +173,16 @@ Functions
Returns
n-th element of the Fibonacci's sequence
-
30 {
-
31 // If the input is 0 or 1 just return the same (Base Case)
-
32 // This will set the first 2 values of the sequence
-
33 if (n <= 1) {
-
34 return n;
-
35 }
-
36
-
37 // Add the preceding 2 values of the sequence to get next
-
38 return fibonacci(n - 1) + fibonacci(n - 2);
-
39}
+
32 {
+
33 // If the input is 0 or 1 just return the same (Base Case)
+
34 // This will set the first 2 values of the sequence
+
35 if (n <= 1) {
+
36 return n;
+
37 }
+
38
+
39 // Add the preceding 2 values of the sequence to get next
+
40 return fibonacci(n - 1) + fibonacci(n - 2);
+
41}
Functions for Fibonacci sequence.
@@ -203,11 +204,11 @@ Functions

Main function.

Returns
0 on exit
-
62 {
-
63 test(); // run self-test implementations
-
64 return 0;
-
65}
-
static void test()
Self-test implementation.
Definition fibonacci.cpp:47
+
64 {
+
65 test(); // run self-test implementations
+
66 return 0;
+
67}
+
static void test()
Self-test implementation.
Definition fibonacci.cpp:49
Here is the call graph for this function:
@@ -241,16 +242,16 @@ Here is the call graph for this function:

Self-test implementation.

Returns
void
-
47 {
-
48 assert(math::fibonacci::fibonacci(0) == 0);
-
49 assert(math::fibonacci::fibonacci(1) == 1);
-
50 assert(math::fibonacci::fibonacci(2) == 1);
-
51 assert(math::fibonacci::fibonacci(3) == 2);
-
52 assert(math::fibonacci::fibonacci(4) == 3);
-
53 assert(math::fibonacci::fibonacci(15) == 610);
-
54 assert(math::fibonacci::fibonacci(20) == 6765);
-
55 std::cout << "All tests have passed successfully!\n";
-
56}
+
49 {
+
50 assert(math::fibonacci::fibonacci(0) == 0);
+
51 assert(math::fibonacci::fibonacci(1) == 1);
+
52 assert(math::fibonacci::fibonacci(2) == 1);
+
53 assert(math::fibonacci::fibonacci(3) == 2);
+
54 assert(math::fibonacci::fibonacci(4) == 3);
+
55 assert(math::fibonacci::fibonacci(15) == 610);
+
56 assert(math::fibonacci::fibonacci(20) == 6765);
+
57 std::cout << "All tests have passed successfully!\n";
+
58}
diff --git a/d9/d94/golden__search__extrema_8cpp__incl.map b/d9/d94/golden__search__extrema_8cpp__incl.map index eb063410c..c7b720ccf 100644 --- a/d9/d94/golden__search__extrema_8cpp__incl.map +++ b/d9/d94/golden__search__extrema_8cpp__incl.map @@ -1,13 +1,15 @@ - + - + - - - - - - - + + + + + + + + + diff --git a/d9/d94/golden__search__extrema_8cpp__incl.md5 b/d9/d94/golden__search__extrema_8cpp__incl.md5 index beb9df3e0..6d17fb51d 100644 --- a/d9/d94/golden__search__extrema_8cpp__incl.md5 +++ b/d9/d94/golden__search__extrema_8cpp__incl.md5 @@ -1 +1 @@ -e9d95b68df351593d5d25da0a4b5fa00 \ No newline at end of file +50ae9791aca62fcfcccc4b60d0bff34b \ No newline at end of file diff --git a/d9/d94/golden__search__extrema_8cpp__incl.svg b/d9/d94/golden__search__extrema_8cpp__incl.svg index 417dcd304..d41850adf 100644 --- a/d9/d94/golden__search__extrema_8cpp__incl.svg +++ b/d9/d94/golden__search__extrema_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -numerical_methods/golden -_search_extrema.cpp + +numerical_methods/golden +_search_extrema.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -functional + +cstdint @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -iostream + +functional @@ -96,8 +96,8 @@ Node1->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -limits + +iostream @@ -114,8 +114,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +limits + + + + + +Node1->Node7 + + + diff --git a/d9/d94/golden__search__extrema_8cpp__incl_org.svg b/d9/d94/golden__search__extrema_8cpp__incl_org.svg index 3d1be590f..6e04d66d4 100644 --- a/d9/d94/golden__search__extrema_8cpp__incl_org.svg +++ b/d9/d94/golden__search__extrema_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + numerical_methods/golden_search_extrema.cpp Node1 - -numerical_methods/golden -_search_extrema.cpp + +numerical_methods/golden +_search_extrema.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -functional + +cstdint @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -iostream + +functional @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -limits + +iostream @@ -103,8 +103,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +limits + + + + + +Node1->Node7 + + + diff --git a/d9/dca/namespacesearch.html b/d9/dca/namespacesearch.html index 79302f000..3bcdcb52e 100644 --- a/d9/dca/namespacesearch.html +++ b/d9/dca/namespacesearch.html @@ -108,17 +108,18 @@ $(function(){initNavTree('d9/dca/namespacesearch.html','../../'); initResizable(
-

for std::vector +

for std::assert More...

Detailed Description

-

for std::vector

+

for std::assert

Search algorithms.

-

for std::sort function for std::assert for IO operations

-

for assert for IO operations

+

for assert

+

for std::sort function for IO operations for std::vector

+

for IO operations for std::vector

Search algorithms

-

for assert for io operations, and std::pair

+

for io operations, and std::pair for std::vector

Algorithms for searching

-

for assert for IO operations

+

for IO operations for std::vector

Searching algorithms

diff --git a/d9/dde/classbinary__search__tree.html b/d9/dde/classbinary__search__tree.html index ca193809a..2707dec1b 100644 --- a/d9/dde/classbinary__search__tree.html +++ b/d9/dde/classbinary__search__tree.html @@ -587,7 +587,7 @@ template<class T >
325 return result;
326 }
void traverse_inorder(std::function< void(T)> callback, std::unique_ptr< bst_node > &node)
Recursive function to traverse the tree in in-order order.
Definition binary_search_tree2.cpp:197
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/d9/deb/cycle__sort_8cpp__incl.map b/d9/deb/cycle__sort_8cpp__incl.map index e8a7db7e1..7334aa464 100644 --- a/d9/deb/cycle__sort_8cpp__incl.map +++ b/d9/deb/cycle__sort_8cpp__incl.map @@ -1,11 +1,13 @@ - + - + - - - - - + + + + + + + diff --git a/d9/deb/cycle__sort_8cpp__incl.md5 b/d9/deb/cycle__sort_8cpp__incl.md5 index 24e2dbe0e..7787c5bf7 100644 --- a/d9/deb/cycle__sort_8cpp__incl.md5 +++ b/d9/deb/cycle__sort_8cpp__incl.md5 @@ -1 +1 @@ -faddab79872840f27bb2c1f2aaa89646 \ No newline at end of file +11918686b85fe74e21e6348111cfeff0 \ No newline at end of file diff --git a/d9/deb/cycle__sort_8cpp__incl.svg b/d9/deb/cycle__sort_8cpp__incl.svg index 84650e905..ddac26d04 100644 --- a/d9/deb/cycle__sort_8cpp__incl.svg +++ b/d9/deb/cycle__sort_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -sorting/cycle_sort.cpp + +sorting/cycle_sort.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -iostream + +cstdint @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -vector + +iostream @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d9/deb/cycle__sort_8cpp__incl_org.svg b/d9/deb/cycle__sort_8cpp__incl_org.svg index e8d5f2c93..0a93307d1 100644 --- a/d9/deb/cycle__sort_8cpp__incl_org.svg +++ b/d9/deb/cycle__sort_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + sorting/cycle_sort.cpp Node1 - -sorting/cycle_sort.cpp + +sorting/cycle_sort.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -iostream + +cstdint @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -vector + +iostream @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.map b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.map index 3c8d8d782..73eeba7c6 100644 --- a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.map +++ b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.md5 b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.md5 index a00bf9ded..232f3876b 100644 --- a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.md5 +++ b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.md5 @@ -1 +1 @@ -cee136b162973d12df81f1bb9920b6e9 \ No newline at end of file +9f630aa36c57eb33dca241415ebc2595 \ No newline at end of file diff --git a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.svg b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.svg index 525cec3aa..1e07250f9 100644 --- a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.svg +++ b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,10 +23,10 @@ Node1 - -bit_manipulation/next -_higher_number_with_same -_number_of_set_bits.cpp + +bit_manipulation/next +_higher_number_with_same +_number_of_set_bits.cpp @@ -34,8 +34,8 @@ Node2 - -cassert + +cassert @@ -43,8 +43,8 @@ Node1->Node2 - - + + @@ -52,8 +52,8 @@ Node3 - -iostream + +cstdint @@ -61,8 +61,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl_org.svg b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl_org.svg index 2592a2d15..404fffaea 100644 --- a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl_org.svg +++ b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl_org.svg @@ -4,18 +4,18 @@ - + bit_manipulation/next_higher_number_with_same_number_of_set_bits.cpp Node1 - -bit_manipulation/next -_higher_number_with_same -_number_of_set_bits.cpp + +bit_manipulation/next +_higher_number_with_same +_number_of_set_bits.cpp @@ -23,8 +23,8 @@ Node2 - -cassert + +cassert @@ -32,8 +32,8 @@ Node1->Node2 - - + + @@ -41,8 +41,8 @@ Node3 - -iostream + +cstdint @@ -50,8 +50,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/d9/df4/namespacetests.html b/d9/df4/namespacetests.html index 0b25816f5..7c9cc243b 100644 --- a/d9/df4/namespacetests.html +++ b/d9/df4/namespacetests.html @@ -444,7 +444,7 @@ Here is the call graph for this function:
180}
T begin(T... args)
T end(T... args)
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T sort(T... args)
Here is the call graph for this function:
diff --git a/d9/dfd/uint128__t_8hpp__incl.map b/d9/dfd/uint128__t_8hpp__incl.map index 789cda48f..ad940ef50 100644 --- a/d9/dfd/uint128__t_8hpp__incl.map +++ b/d9/dfd/uint128__t_8hpp__incl.map @@ -1,11 +1,13 @@ - + - - - - - - - + + + + + + + + + diff --git a/d9/dfd/uint128__t_8hpp__incl.md5 b/d9/dfd/uint128__t_8hpp__incl.md5 index 18a2151e5..3d15e4b43 100644 --- a/d9/dfd/uint128__t_8hpp__incl.md5 +++ b/d9/dfd/uint128__t_8hpp__incl.md5 @@ -1 +1 @@ -8ddb0a1613632c64d7f77f487b1d0720 \ No newline at end of file +9de7203be1318ebaeeaab3336c3ed3db \ No newline at end of file diff --git a/d9/dfd/uint128__t_8hpp__incl.svg b/d9/dfd/uint128__t_8hpp__incl.svg index 34c15af16..e32ce10ac 100644 --- a/d9/dfd/uint128__t_8hpp__incl.svg +++ b/d9/dfd/uint128__t_8hpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -ciphers/uint128_t.hpp + +ciphers/uint128_t.hpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -ostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -string + +ostream @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -utility + +string @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +utility + + + + + +Node1->Node6 + + + diff --git a/d9/dfd/uint128__t_8hpp__incl_org.svg b/d9/dfd/uint128__t_8hpp__incl_org.svg index 969d0e363..e3381bfa6 100644 --- a/d9/dfd/uint128__t_8hpp__incl_org.svg +++ b/d9/dfd/uint128__t_8hpp__incl_org.svg @@ -4,16 +4,16 @@ - + ciphers/uint128_t.hpp Node1 - -ciphers/uint128_t.hpp + +ciphers/uint128_t.hpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -ostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -string + +ostream @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -utility + +string @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +utility + + + + + +Node1->Node6 + + + diff --git a/da/d18/quadratic__equations__complex__numbers_8cpp.html b/da/d18/quadratic__equations__complex__numbers_8cpp.html index a99157e16..58f45d219 100644 --- a/da/d18/quadratic__equations__complex__numbers_8cpp.html +++ b/da/d18/quadratic__equations__complex__numbers_8cpp.html @@ -129,7 +129,7 @@ Include dependency graph for quadratic_equations_complex_numbers.cpp:

Namespaces

- +

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  fibonacci
 Functions for Fibonacci sequence.
namespace  math
 for IO operations
 for assert
 
Returns
string denoting the addition of both the strings
-
37 {
-
38 std::string third;
-
39 int16_t sum = 0, carry = 0;
-
40 for (int32_t i = static_cast<int32_t>(first.size()) - 1,
-
41 j = static_cast<int32_t>(second.size()) - 1;
-
42 i >= 0 || j >= 0; --i, --j) {
-
43 sum = ((i >= 0 ? first[i] - '0' : 0) + (j >= 0 ? second[j] - '0' : 0) +
-
44 carry);
-
45 carry = sum / 10;
-
46 sum %= 10;
-
47 third.push_back(sum + '0');
-
48 }
-
49 if (carry) {
-
50 third.push_back('1');
-
51 }
-
52 std::reverse(third.begin(), third.end());
-
53 return third;
-
54}
+
38 {
+
39 std::string third;
+
40 int16_t sum = 0, carry = 0;
+
41 for (int32_t i = static_cast<int32_t>(first.size()) - 1,
+
42 j = static_cast<int32_t>(second.size()) - 1;
+
43 i >= 0 || j >= 0; --i, --j) {
+
44 sum = ((i >= 0 ? first[i] - '0' : 0) + (j >= 0 ? second[j] - '0' : 0) +
+
45 carry);
+
46 carry = sum / 10;
+
47 sum %= 10;
+
48 third.push_back(sum + '0');
+
49 }
+
50 if (carry) {
+
51 third.push_back('1');
+
52 }
+
53 std::reverse(third.begin(), third.end());
+
54 return third;
+
55}
T begin(T... args)
T end(T... args)
@@ -308,10 +312,10 @@ template<typename T , typename = typename std::enable_if<

diff --git a/da/d23/eulers__totient__function_8cpp.html b/da/d23/eulers__totient__function_8cpp.html index 564e862c4..7ec181b22 100644 --- a/da/d23/eulers__totient__function_8cpp.html +++ b/da/d23/eulers__totient__function_8cpp.html @@ -113,18 +113,19 @@ $(function(){initNavTree('da/d23/eulers__totient__function_8cpp.html','../../');

Implementation of Euler's Totient @description Euler Totient Function is also known as phi function. More...

-
#include <iostream>
-#include <cassert>
+
#include <cassert>
+#include <cstdint>
+#include <iostream>
Include dependency graph for eulers_totient_function.cpp:
-
+
- +

Namespaces

namespace  math
 for IO operations
 for assert
 

< represents minimum value over the range [g,l]

< represents minimum value over the range [g, r - pow(2,g) + 1]

< represents minimum value over the whole range [l,r]

-
109 {
-
110 int64_t g = LOG[r - l + 1]; ///< smallest power of 2 covering [l,r]
-
111 int64_t x = ST[g][l]; ///< represents minimum value over the range
-
112 ///< [g,l]
-
113 int64_t y =
-
114 ST[g][r - (1 << g) + 1]; ///< represents minimum value over the
-
115 ///< range [g, r - pow(2,g) + 1]
-
116
-
117 return (A[x] <= A[y] ? x : y); ///< represents minimum value over
-
118 ///< the whole range [l,r]
-
119 }
+
110 {
+
111 int64_t g = LOG[r - l + 1]; ///< smallest power of 2 covering [l,r]
+
112 int64_t x = ST[g][l]; ///< represents minimum value over the range
+
113 ///< [g,l]
+
114 int64_t y =
+
115 ST[g][r - (1 << g) + 1]; ///< represents minimum value over the
+
116 ///< range [g, r - pow(2,g) + 1]
+
117
+
118 return (A[x] <= A[y] ? x : y); ///< represents minimum value over
+
119 ///< the whole range [l,r]
+
120 }
double g(double x)
Another test function.
Definition composite_simpson_rule.cpp:115
double l(double x)
Another test function.
Definition composite_simpson_rule.cpp:119
-
std::array< int64_t, N > LOG
where floor(log2(i)) are precomputed.
Definition sparse_table.cpp:59
-
std::array< int64_t, N > A
input array to perform RMQ.
Definition sparse_table.cpp:56
-
std::array< std::array< int64_t, N >, M > ST
the sparse table storing min() values for given interval.
Definition sparse_table.cpp:58
+
std::array< int64_t, N > LOG
where floor(log2(i)) are precomputed.
Definition sparse_table.cpp:60
+
std::array< int64_t, N > A
input array to perform RMQ.
Definition sparse_table.cpp:57
+
std::array< std::array< int64_t, N >, M > ST
the sparse table storing min() values for given interval.
Definition sparse_table.cpp:59
@@ -214,7 +214,7 @@ size_t 

input array to perform RMQ.

Warning
check if N is not less than n. if so, manually increase the value of N
-
56{}; ///< input array to perform RMQ.
+
57{}; ///< input array to perform RMQ.
@@ -231,7 +231,7 @@ size_t 

where floor(log2(i)) are precomputed.

-
59{}; ///< where floor(log2(i)) are precomputed.
+
60{}; ///< where floor(log2(i)) are precomputed.
@@ -248,7 +248,7 @@ size_t 

the sparse table storing min() values for given interval.

-
58{}; ///< the sparse table storing `min()` values for given interval.
+
59{}; ///< the sparse table storing `min()` values for given interval.
diff --git a/da/d39/volume_8cpp.html b/da/d39/volume_8cpp.html index 6f3502e03..0b8987a93 100644 --- a/da/d39/volume_8cpp.html +++ b/da/d39/volume_8cpp.html @@ -126,7 +126,7 @@ Include dependency graph for volume.cpp: - +

@@ -192,11 +193,11 @@ Some known values are:

    Returns
    0 on exit
    -
    75 {
    -
    76 test();
    -
    77 return 0;
    -
    78}
    -
    static void test()
    Self-test implementations.
    Definition eulers_totient_function.cpp:57
    +
    79 {
    +
    80 test();
    +
    81 return 0;
    +
    82}
    +
    static void test()
    Self-test implementations.
    Definition eulers_totient_function.cpp:61
    Here is the call graph for this function:
    @@ -230,19 +231,19 @@ Here is the call graph for this function:

    Self-test implementations.

    Returns
    void
    -
    57 {
    -
    58 assert(math::phiFunction(1) == 1);
    -
    59 assert(math::phiFunction(2) == 1);
    -
    60 assert(math::phiFunction(10) == 4);
    -
    61 assert(math::phiFunction(123456) == 41088);
    -
    62 assert(math::phiFunction(808017424794) == 263582333856);
    -
    63 assert(math::phiFunction(3141592) == 1570792);
    -
    64 assert(math::phiFunction(27182818) == 12545904);
    -
    65
    -
    66 std::cout << "All tests have successfully passed!\n";
    -
    67}
    +
    61 {
    +
    62 assert(math::phiFunction(1) == 1);
    +
    63 assert(math::phiFunction(2) == 1);
    +
    64 assert(math::phiFunction(10) == 4);
    +
    65 assert(math::phiFunction(123456) == 41088);
    +
    66 assert(math::phiFunction(808017424794) == 263582333856);
    +
    67 assert(math::phiFunction(3141592) == 1570792);
    +
    68 assert(math::phiFunction(27182818) == 12545904);
    +
    69
    +
    70 std::cout << "All tests have successfully passed!\n";
    +
    71}
    -
    uint64_t phiFunction(uint64_t n)
    Function to calculate Euler's Totient.
    Definition eulers_totient_function.cpp:39
    +
    uint64_t phiFunction(uint64_t n)
    Function to calculate Euler's Totient.
    Definition eulers_totient_function.cpp:41
    Here is the call graph for this function:
    diff --git a/da/d35/sieve__of__eratosthenes_8cpp__incl.map b/da/d35/sieve__of__eratosthenes_8cpp__incl.map index 43075086d..ab7c45c2e 100644 --- a/da/d35/sieve__of__eratosthenes_8cpp__incl.map +++ b/da/d35/sieve__of__eratosthenes_8cpp__incl.map @@ -1,9 +1,11 @@ - - - - - - - + + + + + + + + + diff --git a/da/d35/sieve__of__eratosthenes_8cpp__incl.md5 b/da/d35/sieve__of__eratosthenes_8cpp__incl.md5 index d654830ea..6e62a7622 100644 --- a/da/d35/sieve__of__eratosthenes_8cpp__incl.md5 +++ b/da/d35/sieve__of__eratosthenes_8cpp__incl.md5 @@ -1 +1 @@ -c510a1dd2e2b310a22dcf1d80796b667 \ No newline at end of file +afee453b5d2a79e4dd5095be827357ec \ No newline at end of file diff --git a/da/d35/sieve__of__eratosthenes_8cpp__incl.svg b/da/d35/sieve__of__eratosthenes_8cpp__incl.svg index 92b7fb2cc..c65f3a848 100644 --- a/da/d35/sieve__of__eratosthenes_8cpp__incl.svg +++ b/da/d35/sieve__of__eratosthenes_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/sieve_of_eratosthenes.cpp + +math/sieve_of_eratosthenes.cpp @@ -32,8 +32,8 @@ Node2 - -cassert + +cstdint @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cassert @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -vector + +iostream @@ -77,8 +77,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/da/d35/sieve__of__eratosthenes_8cpp__incl_org.svg b/da/d35/sieve__of__eratosthenes_8cpp__incl_org.svg index 6f1be5dd1..c14e35bc3 100644 --- a/da/d35/sieve__of__eratosthenes_8cpp__incl_org.svg +++ b/da/d35/sieve__of__eratosthenes_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/sieve_of_eratosthenes.cpp Node1 - -math/sieve_of_eratosthenes.cpp + +math/sieve_of_eratosthenes.cpp @@ -21,8 +21,8 @@ Node2 - -cassert + +cstdint @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cassert @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -vector + +iostream @@ -66,8 +66,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/da/d37/structdata__structures_1_1sparse__table_1_1_sparse__table.html b/da/d37/structdata__structures_1_1sparse__table_1_1_sparse__table.html index 5fd99e99e..0dcdc6168 100644 --- a/da/d37/structdata__structures_1_1sparse__table_1_1_sparse__table.html +++ b/da/d37/structdata__structures_1_1sparse__table_1_1_sparse__table.html @@ -180,22 +180,22 @@ size_t 

n = 0
n = 0
n = 0
n = 0

Namespaces

namespace  math
 for IO operations
 for assert
 
+

diff --git a/da/d41/uint128__t_8hpp.html b/da/d41/uint128__t_8hpp.html index 856923020..4be03fba3 100644 --- a/da/d41/uint128__t_8hpp.html +++ b/da/d41/uint128__t_8hpp.html @@ -112,13 +112,14 @@ $(function(){initNavTree('da/d41/uint128__t_8hpp.html','../../'); initResizable(
#include <algorithm>
+#include <cstdint>
#include <ostream>
#include <string>
#include <utility>
Include dependency graph for uint128_t.hpp:
-
+
This graph shows which files directly or indirectly include this file:
@@ -143,6 +144,7 @@ Classes

Macros

#define CIPHERS_UINT128_T_HPP_
 for std::reverse and other operations
 

@@ -214,7 +216,9 @@ Functions

-

for std::reverse and other operations for std::cout overload for std::string for std::pair library

+ +

for std::reverse and other operations

+

for std::cout overload for std::string for std::pair library

@@ -247,24 +251,24 @@ Functions

-
1078 {
-
1079 return uint128_t(p) != q;
-
1080}
-
class for 128-bit unsigned integer
Definition uint128_t.hpp:59
+
1079 {
+
1080 return uint128_t(p) != q;
+
1081}
+
class for 128-bit unsigned integer
Definition uint128_t.hpp:60
@@ -343,9 +347,9 @@ template<typename T , typename = typename std::enable_if<
-
1033 {
-
1034 return uint128_t(p) % q;
-
1035}
+
1034 {
+
1035 return uint128_t(p) % q;
+
1036}
@@ -377,9 +381,9 @@ template<typename T , typename = typename std::enable_if<
-
1040 {
-
1041 return uint128_t(p) & q;
-
1042}
+
1041 {
+
1042 return uint128_t(p) & q;
+
1043}
@@ -411,9 +415,9 @@ template<typename T , typename = typename std::enable_if<
-
1059 {
-
1060 return uint128_t(p) && q;
-
1061}
+
1060 {
+
1061 return uint128_t(p) && q;
+
1062}
@@ -445,9 +449,9 @@ template<typename T , typename = typename std::enable_if<
-
1021 {
-
1022 return uint128_t(p) * q;
-
1023}
+
1022 {
+
1023 return uint128_t(p) * q;
+
1024}
@@ -479,9 +483,9 @@ template<typename T , typename = typename std::enable_if<
-
1009 {
-
1010 return uint128_t(p) + q;
-
1011}
+
1010 {
+
1011 return uint128_t(p) + q;
+
1012}
@@ -513,9 +517,9 @@ template<typename T , typename = typename std::enable_if<
-
1015 {
-
1016 return uint128_t(p) - q;
-
1017}
+
1016 {
+
1017 return uint128_t(p) - q;
+
1018}
@@ -547,9 +551,9 @@ template<typename T , typename = typename std::enable_if<
-
1027 {
-
1028 return uint128_t(p) / q;
-
1029}
+
1028 {
+
1029 return uint128_t(p) / q;
+
1030}
@@ -581,9 +585,9 @@ template<typename T , typename = typename std::enable_if<
-
1084 {
-
1085 return uint128_t(p) < q;
-
1086}
+
1085 {
+
1086 return uint128_t(p) < q;
+
1087}
@@ -615,9 +619,9 @@ template<typename T , typename = typename std::enable_if<
-
1090 {
-
1091 return uint128_t(p) <= q;
-
1092}
+
1091 {
+
1092 return uint128_t(p) <= q;
+
1093}
@@ -649,9 +653,9 @@ template<typename T , typename = typename std::enable_if<
-
1072 {
-
1073 return uint128_t(p) == q;
-
1074}
+
1073 {
+
1074 return uint128_t(p) == q;
+
1075}
@@ -683,9 +687,9 @@ template<typename T , typename = typename std::enable_if<
-
1096 {
-
1097 return uint128_t(p) > q;
-
1098}
+
1097 {
+
1098 return uint128_t(p) > q;
+
1099}
@@ -717,9 +721,9 @@ template<typename T , typename = typename std::enable_if<
-
1102 {
-
1103 return uint128_t(p) >= q;
-
1104}
+
1103 {
+
1104 return uint128_t(p) >= q;
+
1105}
@@ -751,9 +755,9 @@ template<typename T , typename = typename std::enable_if<
-
1052 {
-
1053 return uint128_t(p) ^ q;
-
1054}
+
1053 {
+
1054 return uint128_t(p) ^ q;
+
1055}
@@ -785,9 +789,9 @@ template<typename T , typename = typename std::enable_if<
-
1046 {
-
1047 return uint128_t(p) | q;
-
1048}
+
1047 {
+
1048 return uint128_t(p) | q;
+
1049}
@@ -819,9 +823,9 @@ template<typename T , typename = typename std::enable_if<
-
1065 {
-
1066 return uint128_t(p) || q;
-
1067}
+
1066 {
+
1067 return uint128_t(p) || q;
+
1068}
diff --git a/da/d41/uint128__t_8hpp_source.html b/da/d41/uint128__t_8hpp_source.html index b3ce04189..92f4e0686 100644 --- a/da/d41/uint128__t_8hpp_source.html +++ b/da/d41/uint128__t_8hpp_source.html @@ -117,1313 +117,1314 @@ $(function(){initNavTree('da/d41/uint128__t_8hpp_source.html','../../'); initRes
8 */
9
10#include <algorithm> /// for `std::reverse` and other operations
-
11#include <ostream> /// for `std::cout` overload
-
12#include <string> /// for `std::string`
-
13#include <utility> /// for `std::pair` library
-
14
-
15#ifdef _MSC_VER
-
16#include <intrin.h> /// for _BitScanForward64 and __BitScanReverse64 operation
-
17#endif
-
18
-
19#ifndef CIPHERS_UINT128_T_HPP_
-
20#define CIPHERS_UINT128_T_HPP_
-
21class uint128_t;
-
22
-
23template <>
- -
25template <>
- -
27template <>
- -
29
-
30/**
-
31 * @brief Adding two string
-
32 * @details Adds two long integer, only used for printing numbers
-
33 * @param first First integer string
-
34 * @param second Second integer string
-
35 * @returns string denoting the addition of both the strings
-
36 */
-
-
37std::string add(const std::string &first, const std::string &second) {
-
38 std::string third;
-
39 int16_t sum = 0, carry = 0;
-
40 for (int32_t i = static_cast<int32_t>(first.size()) - 1,
-
41 j = static_cast<int32_t>(second.size()) - 1;
-
42 i >= 0 || j >= 0; --i, --j) {
-
43 sum = ((i >= 0 ? first[i] - '0' : 0) + (j >= 0 ? second[j] - '0' : 0) +
-
44 carry);
-
45 carry = sum / 10;
-
46 sum %= 10;
-
47 third.push_back(sum + '0');
-
48 }
-
49 if (carry) {
-
50 third.push_back('1');
-
51 }
-
52 std::reverse(third.begin(), third.end());
-
53 return third;
-
54}
-
-
55/**
-
56 * @class uint128_t
-
57 * @brief class for 128-bit unsigned integer
-
58 */
-
-
59class uint128_t {
-
60 uint64_t f{}, s{}; /// First and second half of 128 bit number
-
61
-
62 /**
-
63 * @brief Get integer from given string.
-
64 * @details Create an integer from a given string
-
65 * @param str integer string, can be hexadecimal (starting on 0x... or
-
66 * number)
-
67 * @returns void
-
68 */
-
- -
70 this->f = this->s = 0;
-
71 if (str.size() > 1 && str[1] == 'x') { // if hexadecimal
-
72 for (auto i = 2; i < str.size(); ++i) {
-
73 *this *= 16LL;
-
74 if (str[i] >= '0' && str[i] <= '9') {
-
75 *this += (str[i] - '0');
-
76 } else if (str[i] >= 'A' && str[i] <= 'F') {
-
77 *this += (str[i] - 'A' + 10);
-
78 } else if (str[i] >= 'a' && str[i] <= 'f') {
-
79 *this += (str[i] - 'a' + 10);
-
80 }
-
81 }
-
82 } else { // if decimal
-
83 for (auto &x : str) {
-
84 *this *= 10LL;
-
85 *this += (x - '0');
-
86 }
-
87 }
-
88 }
-
-
89
-
90 public:
-
91 uint128_t() = default;
-
92
-
93 /**
-
94 * @brief Parameterized constructor
-
95 * @tparam T integral type
-
96 * @param low lower part 8-bit unisgned integer
-
97 */
-
98 template <typename T, typename = typename std::enable_if<
- -
100 explicit uint128_t(T low) : s(low) {}
-
101
-
102 /**
-
103 * @brief Parameterized constructor
-
104 * @param str Integer string (hexadecimal starting with 0x.. or decimal)
-
105 */
-
-
106 explicit uint128_t(const std::string &str) {
- -
108 }
-
-
109
-
110 /**
-
111 * @brief Parameterized constructor
-
112 * @param high higher part 64-bit unsigned integer
-
113 * @param low lower part 64-bit unsigned integer
-
114 */
-
115 uint128_t(const uint64_t high, const uint64_t low) : f(high), s(low) {}
-
116
-
117 /**
-
118 * @brief Copy constructor
-
119 * @param num 128-bit unsigned integer
-
120 */
-
121 uint128_t(const uint128_t &num) = default;
-
122
-
123 /**
-
124 * @brief Move constructor
-
125 * @param num 128-bit unsigned integer
-
126 */
-
127 uint128_t(uint128_t &&num) noexcept : f(num.f), s(num.s) {}
-
128
-
129 /**
-
130 * @brief Destructor for uint128_t
-
131 */
-
132 ~uint128_t() = default;
-
133
-
134 /**
-
135 * @brief Leading zeroes in binary
-
136 * @details Calculates leading zeros in 128-bit integer
-
137 * @returns Integer denoting leading zeroes
-
138 */
-
-
139 inline uint32_t _lez() {
-
140#ifndef _MSC_VER
-
141 if (f) {
-
142 return __builtin_clzll(f);
-
143 }
-
144 return 64 + __builtin_clzll(s);
-
145#else
-
146 unsigned long r = 0;
-
147 _BitScanForward64(&r, f);
-
148 if (r == 64) {
-
149 unsigned long l = 0;
-
150 _BitScanForward64(&l, s);
-
151 return 64 + l;
-
152 }
-
153 return r;
-
154#endif
-
155 }
-
-
156
-
157 /**
-
158 * @brief Trailing zeroes in binary
-
159 * @details Calculates leading zeros in 128-bit integer
-
160 * @returns Integer denoting Trailing zeroes
-
161 */
-
-
162 inline uint32_t _trz() {
-
163#ifndef _MSC_VER
-
164 if (f) {
-
165 return __builtin_ctzll(f);
-
166 }
-
167 return 64 + __builtin_ctzll(s);
-
168#else
-
169 unsigned long r = 0;
-
170 _BitScanReverse64(&r, s);
-
171 if (r == 64) {
-
172 unsigned long l = 0;
-
173 _BitScanReverse64(&l, f);
-
174 return 64 + l;
-
175 }
-
176 return r;
-
177#endif
-
178 }
-
-
179
-
180 /**
-
181 * @brief casting operator to boolean value
-
182 * @returns true if value of this is non-zero, else false
-
183 */
-
184 inline explicit operator bool() const { return (f || s); }
-
185
-
186 /**
-
187 * @brief casting operator to any integer valu
-
188 * @tparam T any integer type
-
189 * @returns integer value casted to mentioned type
-
190 */
-
191 template <typename T, typename = typename std::enable_if<
- -
-
193 inline explicit operator T() const {
-
194 return static_cast<T>(s);
-
195 }
-
-
196
-
197 /**
-
198 * @brief returns lower 64-bit integer part
-
199 * @returns returns lower 64-bit integer part
-
200 */
-
201 inline uint64_t lower() const { return s; }
-
202
-
203 /**
-
204 * @brief returns upper 64-bit integer part
-
205 * @returns returns upper 64-bit integer part
-
206 */
-
207 inline uint64_t upper() const { return f; }
-
208
-
209 /**
-
210 * @brief operator = for other types
-
211 * @tparam T denoting any integer type
-
212 * @param p an integer to assign it's value
-
213 * @returns this pointer with it's value equal to `p`
-
214 */
-
215 template <typename T, typename = typename std::enable_if<
- -
-
217 inline uint128_t &operator=(const T &p) {
-
218 this->s = p;
-
219 return *this;
-
220 }
-
-
221
-
222 /**
-
223 * @brief operator = for type string
-
224 * @param p a string to assign it's value to equivalent integer
-
225 * @returns this pointer with it's value equal to `p`
-
226 */
-
-
227 inline uint128_t &operator=(const std::string &p) {
- -
229 return *this;
-
230 }
-
-
231
-
232 /**
-
233 * @brief operator = for uint128_t
-
234 * @param p an 128-bit integer to assign it's value
-
235 * @returns this pointer with it's value equal to `p`
-
236 */
-
237 inline uint128_t &operator=(const uint128_t &p) = default;
-
238
-
239 /**
-
240 * @brief Move assignment operator
-
241 */
-
242 inline uint128_t &operator=(uint128_t &&p) = default;
-
243
-
244 /**
-
245 * @brief operator + for uint128_t and other integer types.
-
246 * @tparam T denoting integral type
-
247 * @param p a type of integer variable
-
248 * @returns addition of this and p, returning uint128_t integer
-
249 */
-
250 template <typename T, typename = typename std::enable_if<
- -
-
252 inline uint128_t operator+(const T p) {
-
253 return uint128_t(f + (p + s < s), p + s);
-
254 }
-
-
255
-
256 /**
-
257 * @brief operator + for uint128_t and other integer types.
-
258 * @param p 128-bit unsigned integer
-
259 * @returns addition of this and p, returning uint128_t integer
-
260 */
-
-
261 inline uint128_t operator+(const uint128_t &p) {
-
262 return uint128_t(f + (p.s + s < s) + p.f, p.s + s);
-
263 }
-
-
264
-
265 /**
-
266 * @brief operator += for uint128_t and other integer types.
-
267 * @tparam T denoting integral type
-
268 * @param p a type of integer variable
-
269 * @returns addition of this and p, returning this
-
270 */
-
271 template <typename T, typename = typename std::enable_if<
- -
-
273 inline uint128_t &operator+=(const T p) {
-
274 bool app = p + s < s;
-
275 this->f += app;
-
276 this->s += p;
-
277 return *this;
-
278 }
-
-
279
-
280 /**
-
281 * @brief operator += for uint128_t
-
282 * @param p 128-bit unsigned integer
-
283 * @returns addition of this and p, returning this
-
284 */
-
- -
286 bool app = p.s + s < s;
-
287 f = f + app + p.f;
-
288 s = p.s + s;
-
289 return *this;
-
290 }
-
-
291
-
292 /**
-
293 * @brief pre-increment operator
-
294 * @returns incremented value of this.
-
295 */
-
- -
297 *this += 1;
-
298 return *this;
-
299 }
-
-
300
-
301 /**
-
302 * @brief post-increment operator
-
303 * @returns incremented value of this.
-
304 */
-
-
305 inline uint128_t operator++(int) {
-
306 ++*this;
-
307 return *this;
-
308 }
-
-
309
-
310 /**
-
311 * @brief operator - for uint128_t and other integer types.
-
312 * @tparam T denoting integral type
-
313 * @param p a type of integer variable
-
314 * @returns subtraction of this and p, returning uint128_t integer
-
315 */
-
316 template <typename T, typename = typename std::enable_if<
- -
-
318 inline uint128_t operator-(const T &p) {
-
319 bool app = p > s;
-
320 return uint128_t(f - app, s - p);
-
321 }
-
-
322
-
323 /**
-
324 * @brief operator - for uint128_t
-
325 * @param p a type of integer variable
-
326 * @returns subtraction of this and p, returning uint128_t integer
-
327 */
-
-
328 inline uint128_t operator-(const uint128_t &p) {
-
329 bool app = p.s > s;
-
330 return uint128_t(f - p.f - app, s - p.s);
-
331 }
-
-
332
-
333 /**
-
334 * @brief operator - using twos complement
-
335 * @returns 2's complement of this.
-
336 */
-
337 inline uint128_t operator-() { return ~*this + uint128_t(1); }
-
338
-
339 /**
-
340 * @brief operator -- (pre-decrement)
-
341 * @returns decremented value of this
-
342 */
-
- -
344 *this -= 1;
-
345 return *this;
-
346 }
-
-
347
-
348 /**
-
349 * @brief operator -- (post-decrement)
-
350 * @returns decremented value of this
-
351 */
-
-
352 inline uint128_t operator--(int p) {
-
353 --*this;
-
354 return *this;
-
355 }
-
-
356
-
357 /**
-
358 * @brief operator -= for uint128_t and other integer types.
-
359 * @tparam T denoting integral type
-
360 * @param p a type of integer variable
-
361 * @returns subtraction of this and p, returning this
-
362 */
-
363 template <typename T, typename = typename std::enable_if<
- -
-
365 uint128_t &operator-=(const T &p) {
-
366 bool app = p > s;
-
367 f -= app;
-
368 s -= p;
-
369 return *this;
-
370 }
-
-
371
-
372 /**
-
373 * @brief operator -= for uint128_t
-
374 * @param p 128-bit unsigned integer
-
375 * @returns subtraction of this and p, returning this
-
376 */
-
- -
378 bool app = p.s > s;
-
379 f = f - p.f - app;
-
380 s = s - p.s;
-
381 return *this;
-
382 }
-
-
383
-
384 /**
-
385 * @brief operator * for uint128_t and other integer types.
-
386 * @tparam T denoting integral type
-
387 * @param p a type of integer variable
-
388 * @returns multiplication of this and p, returning uint128_t integer
-
389 */
-
390 template <typename T, typename = typename std::enable_if<
- -
-
392 inline uint128_t operator*(const T p) {
-
393 return *this * uint128_t(p);
-
394 }
-
-
395
-
396 /**
-
397 * @brief operator * for uint128_t and other integer types.
-
398 * @param p 128-bit unsigned integer
-
399 * @returns multiplication of this and p, returning uint128_t integer
-
400 */
-
- -
402 uint64_t f_first = s >> 32, f_second = s & 0xFFFFFFFF,
-
403 s_first = p.s >> 32, s_second = p.s & 0xFFFFFFFF;
-
404 uint64_t fi = f_first * s_first, se = f_first * s_second,
-
405 th = s_first * f_second, fo = s_second * f_second;
-
406 uint64_t tmp = ((se & 0xFFFFFFFF) << 32), tmp2 = (th & 0xFFFFFFFF)
-
407 << 32;
-
408 int cc = (tmp + tmp2 < tmp);
-
409 tmp += tmp2;
-
410 cc += (tmp + fo < tmp);
-
411 uint64_t carry = fi + (se >> 32) + (th >> 32);
-
412 return uint128_t(this->f * p.s + this->s * p.f + carry + cc, tmp + fo);
-
413 }
-
-
414
-
415 /**
-
416 * @brief operator *= for uint128_t and other integer types.
-
417 * @tparam T denoting integral type
-
418 * @param p a type of integer variable
-
419 * @returns multiplication of this and p, returning this
-
420 */
-
421 template <typename T, typename = typename std::enable_if<
- -
-
423 inline uint128_t &operator*=(const T p) {
-
424 *this *= uint128_t(p);
-
425 return *this;
-
426 }
-
-
427
-
428 /**
-
429 * @brief operator *= for uint128_t and other integer types.
-
430 * @param p 128-bit unsigned integer
-
431 * @returns multiplication of this and p, returning this
-
432 */
-
- -
434 uint64_t f_first = s >> 32, f_second = s & 0xFFFFFFFF,
-
435 s_first = p.s >> 32, s_second = p.s & 0xFFFFFFFF;
-
436 uint64_t fi = f_first * s_first, se = f_first * s_second,
-
437 th = s_first * f_second, fo = s_second * f_second;
-
438 uint64_t tmp = (se << 32), tmp2 = (th << 32);
-
439 int cc = (tmp + tmp2 < tmp);
-
440 tmp += tmp2;
-
441 cc += (tmp + fo < tmp);
-
442 uint64_t carry = fi + (se >> 32) + (th >> 32);
-
443 f = this->f * p.s + this->s * p.f + carry + cc;
-
444 s = tmp + fo;
-
445 return *this;
-
446 }
-
-
447
-
448 /**
-
449 * @brief divide function for uint128_t and other integer types.
-
450 * @details divide this value and
-
451 * @param p 128-bit unsigned integer
-
452 * @returns pair denoting quotient and remainder.
-
453 */
-
- -
455 if (*this < p) { // if this is less than divisor
-
456 return {uint128_t(0), *this};
-
457 } else if (*this == p) { // if this is equal to divisor
-
458 return {uint128_t(1), uint128_t(0)};
-
459 }
-
460 uint128_t tmp = p, tmp2 = *this;
-
461 uint16_t left = tmp._lez() - _lez();
-
462 tmp <<= left;
-
463 uint128_t quotient(0);
-
464 uint128_t zero(0);
-
465 while (tmp2 >= p) {
-
466 uint16_t shf = tmp2._lez() - tmp._lez();
-
467 if (shf) {
-
468 tmp >>= shf;
-
469 quotient <<= shf;
-
470 left -= shf;
-
471 }
-
472 if (tmp2 < tmp) {
-
473 tmp >>= 1;
-
474 quotient <<= 1;
-
475 --left;
-
476 }
-
477 tmp2 -= tmp;
-
478 ++quotient;
-
479 }
-
480 return {quotient << left, tmp2};
-
481 }
-
-
482
-
483 /**
-
484 * @brief operator / for uint128_t and other integer types.
-
485 * @param p 128-bit unsigned integer
-
486 * @returns unsigned 128-bit quotient.
-
487 */
-
488 inline uint128_t operator/(const uint128_t &p) { return divide(p).first; }
-
489
-
490 /**
-
491 * @brief operator / for uint128_t and other integer types.
-
492 * @tparam T denoting integral type
-
493 * @param p a type of integer variable
-
494 * @returns unsigned 128-bit quotient.
-
495 */
-
496 template <typename T, typename = typename std::enable_if<
- -
-
498 inline uint128_t operator/(const T p) {
-
499 uint128_t tmp = *this;
-
500 tmp /= uint128_t(0, p);
-
501 return tmp;
-
502 }
-
-
503
-
504 /**
-
505 * @brief operator /= for uint128_t
-
506 * @param p 128-bit unsigned integer
-
507 * @returns this set as unsigned 128-bit quotient.
-
508 */
-
-
509 inline uint128_t &operator/=(const uint128_t &p) {
-
510 *this = divide(p).first;
-
511 return *this;
-
512 }
-
-
513
-
514 /**
-
515 * @brief operator /= for uint128_t and other integer types.
-
516 * @tparam T denoting integral type
-
517 * @param p a type of integer variable
-
518 * @returns this set as unsigned 128-bit quotient.
-
519 */
-
520 template <typename T, typename = typename std::enable_if<
- -
-
522 inline uint128_t &operator/=(const T p) {
-
523 *this /= uint128_t(0, p);
-
524 return *this;
-
525 }
-
-
526
-
527 /**
-
528 * @brief operator % for uint128_t
-
529 * @param p 128-bit unsigned integer
-
530 * @returns unsigned 128-bit remainder.
-
531 */
-
532 inline uint128_t operator%(const uint128_t &p) { return divide(p).second; }
-
533
-
534 /**
-
535 * @brief operator % for uint128_t and other integer types.
-
536 * @tparam T denoting integral type
-
537 * @param p a type of integer variable
-
538 * @returns unsigned 128-bit remainder.
-
539 */
-
540 template <typename T, typename = typename std::enable_if<
- -
-
542 inline uint128_t operator%(const T &p) {
-
543 return *this % uint128_t(p);
-
544 }
-
-
545
-
546 /**
-
547 * @brief operator %= for uint128_t
-
548 * @param p 128-bit unsigned integer
-
549 * @returns this set as unsigned 128-bit remainder.
-
550 */
-
-
551 inline uint128_t &operator%=(const uint128_t &p) {
-
552 *this = divide(p).second;
-
553 return *this;
-
554 }
-
-
555
-
556 /**
-
557 * @brief operator %= for uint128_t
-
558 * @tparam T denoting integral type
-
559 * @param p a type of integer variable
-
560 * @returns this set as unsigned 128-bit remainder.
-
561 */
-
562 template <typename T, typename = typename std::enable_if<
- -
-
564 inline uint128_t &operator%=(const T &p) {
-
565 *this %= uint128_t(p);
-
566 return *this;
-
567 }
-
-
568
-
569 /**
-
570 * @brief operator < for uint128_t
-
571 * @param other number to be compared with this
-
572 * @returns true if this is less than other, else false
-
573 */
-
-
574 inline bool operator<(const uint128_t &other) {
-
575 return f < other.f || (f == other.f && s < other.s);
-
576 }
-
-
577
-
578 /**
-
579 * @brief operator <= for uint128_t
-
580 * @param other number to be compared with this
-
581 * @returns true if this is less than or equal to other, else false
-
582 */
-
-
583 inline bool operator<=(const uint128_t &other) {
-
584 return f < other.f || (f == other.f && s <= other.s);
-
585 }
-
-
586
-
587 /**
-
588 * @brief operator > for uint128_t
-
589 * @param other number to be compared with this
-
590 * @returns true if this is greater than other, else false
-
591 */
-
-
592 inline bool operator>(const uint128_t &other) {
-
593 return f > other.f || (f == other.f && s > other.s);
-
594 }
-
-
595
-
596 /**
-
597 * @brief operator >= for uint128_t
-
598 * @param other number to be compared with this
-
599 * @returns true if this is greater than or equal than other, else false
-
600 */
-
-
601 inline bool operator>=(const uint128_t &other) {
-
602 return (f > other.f) || (f == other.f && s >= other.s);
-
603 }
-
-
604
-
605 /**
-
606 * @brief operator == for uint128_t
-
607 * @param other number to be compared with this
-
608 * @returns true if this is equal than other, else false
-
609 */
-
-
610 inline bool operator==(const uint128_t &other) {
-
611 return f == other.f && s == other.s;
-
612 }
-
-
613
-
614 /**
-
615 * @brief operator != for uint128_t
-
616 * @param other number to be compared with this
-
617 * @returns true if this is not equal than other, else false
-
618 */
-
-
619 inline bool operator!=(const uint128_t &other) {
-
620 return f != other.f || s != other.s;
-
621 }
-
-
622
-
623 /**
-
624 * @brief operator ! for uint128_t
-
625 * @returns true if this has zero value, else false
-
626 */
-
627 inline bool operator!() { return !f && !s; }
-
628
-
629 /**
-
630 * @brief operator && for uint128_t
-
631 * @param b number to be compared with this
-
632 * @returns true if both of the values are not zero, else false
-
633 */
-
-
634 inline bool operator&&(const uint128_t &b) {
-
635 return (s || f) && (b.s || b.f);
-
636 }
-
-
637
-
638 /**
-
639 * @brief operator || for uint128_t
-
640 * @param b number to be compared with this
-
641 * @returns true if one of the values are not zero, else false
-
642 */
-
-
643 inline bool operator||(const uint128_t &b) {
-
644 return (s || f) || (b.s || b.f);
-
645 }
-
-
646
-
647 /**
-
648 * @brief operator () for uint128_t
-
649 * @returns true if this value is non-zero, else false
-
650 */
-
651 inline bool operator()() { return s || f; }
-
652
-
653 /**
-
654 * @brief operator < for other types
-
655 * @tparam T integral type
-
656 * @param other number to be compared with this
-
657 * @returns true if this is less than other, else false
-
658 */
-
659 template <typename T, typename = typename std::enable_if<
- -
-
661 inline bool operator<(const T other) {
-
662 return *this < uint128_t(other);
-
663 }
-
-
664
-
665 /**
-
666 * @brief operator <= for other types
-
667 * @tparam T integral type
-
668 * @param other number to be compared with this
-
669 * @returns true if this is less than or equal to other, else false
-
670 */
-
671 template <typename T, typename = typename std::enable_if<
- -
-
673 inline bool operator<=(const T other) {
-
674 return *this <= uint128_t(other);
-
675 }
-
-
676
-
677 /**
-
678 * @brief operator > for other types
-
679 * @tparam T integral type
-
680 * @param other number to be compared with this
-
681 * @returns true if this is greater than other, else false
-
682 */
-
683 template <typename T, typename = typename std::enable_if<
- -
-
685 inline bool operator>(const T other) {
-
686 return *this > uint128_t(other);
-
687 }
-
-
688
-
689 /**
-
690 * @brief operator >= for other types
-
691 * @tparam T integral type
-
692 * @param other number to be compared with this
-
693 * @returns true if this is greater than or equal other, else false
-
694 */
-
695 template <typename T, typename = typename std::enable_if<
- -
-
697 inline bool operator>=(const T other) {
-
698 return *this >= uint128_t(other);
-
699 }
-
-
700
-
701 /**
-
702 * @brief operator == for other types
-
703 * @tparam T integral type
-
704 * @param other number to be compared with this
-
705 * @returns true if this is equal to other, else false
-
706 */
-
707 template <typename T, typename = typename std::enable_if<
- -
-
709 inline bool operator==(const T other) {
-
710 return *this == uint128_t(other);
-
711 }
-
-
712
-
713 /**
-
714 * @brief operator != for other types
-
715 * @tparam T integral type
-
716 * @param other number to be compared with this
-
717 * @returns true if this is not equal to other, else false
-
718 */
-
719 template <typename T, typename = typename std::enable_if<
- -
-
721 inline bool operator!=(const T other) {
-
722 return *this != uint128_t(other);
-
723 }
-
-
724
-
725 /**
-
726 * @brief operator && for other types
-
727 * @tparam T integral type
-
728 * @param other number to be compared with this
-
729 * @returns true if this is both values are non-zero, else false
-
730 */
-
731 template <typename T, typename = typename std::enable_if<
- -
-
733 inline bool operator&&(const T b) {
-
734 return (f || s) && b;
-
735 }
-
-
736
-
737 /**
-
738 * @brief operator || for other types
-
739 * @tparam T integral type
-
740 * @param other number to be compared with this
-
741 * @returns true if this is either one of the values are non-zero, else
-
742 * false
-
743 */
-
744 template <typename T, typename = typename std::enable_if<
- -
-
746 inline bool operator||(const T b) {
-
747 return (f || s) || b;
-
748 }
-
-
749
-
750 /**
-
751 * @brief operator ~ for uint128_t
-
752 * @returns 1's complement of this number
-
753 */
-
754 uint128_t operator~() { return uint128_t(~this->f, ~this->s); }
-
755
-
756 /**
-
757 * @brief operator << for uint128_t
-
758 * @tparam T integral type
-
759 * @param p number denoting number of shifts
-
760 * @returns value of this shifted by p to left
-
761 */
-
762 template <typename T, typename = typename std::enable_if<
- -
- -
765 if (!p) {
-
766 return uint128_t(f, s);
-
767 } else if (p >= 64 && p <= 128) {
-
768 return uint128_t((this->s << (p - 64)), 0);
-
769 } else if (p < 64 && p > 0) {
-
770 return uint128_t((this->f << p) + ((this->s >> (64 - p))),
-
771 this->s << p);
-
772 }
-
773 return uint128_t(0);
-
774 }
-
-
775
-
776 /**
-
777 * @brief operator <<= for uint128_t
-
778 * @tparam T integral type
-
779 * @param p number denoting number of shifts
-
780 * @returns this shifted by p to left
-
781 */
-
782 template <typename T, typename = typename std::enable_if<
- -
-
784 uint128_t &operator<<=(const T p) {
-
785 if (p) {
-
786 if (p >= 64 && p <= 128) {
-
787 this->f = (this->s << (p - 64));
-
788 this->s = 0;
-
789 } else {
-
790 f = ((this->f << p) + (this->s >> (64 - p)));
-
791 s = (this->s << p);
-
792 }
-
793 }
-
794 return *this;
-
795 }
-
-
796
-
797 /**
-
798 * @brief operator >> for uint128_t
-
799 * @tparam T integral type
-
800 * @param p number denoting number of shifts
-
801 * @returns value of this shifted by p to right
-
802 */
-
803 template <typename T, typename = typename std::enable_if<
- -
- -
806 if (!p) {
-
807 return uint128_t(this->f, this->s);
-
808 } else if (p >= 64 && p <= 128) {
-
809 return uint128_t(0, (this->f >> (p - 64)));
-
810 } else if (p < 64 && p > 0) {
-
811 return uint128_t((this->f >> p),
-
812 (this->s >> p) + (this->f << (64 - p)));
-
813 }
-
814 return uint128_t(0);
-
815 }
-
-
816
-
817 /**
-
818 * @brief operator >>= for uint128_t
-
819 * @tparam T integral type
-
820 * @param p number denoting number of shifts
-
821 * @returns this shifted by p to right
-
822 */
-
823 template <typename T, typename = typename std::enable_if<
- -
-
825 uint128_t &operator>>=(const T p) {
-
826 if (p) {
-
827 if (p >= 64) {
-
828 f = 0;
-
829 s = (this->f >> (p - 64));
-
830 } else {
-
831 s = (this->s >> p) + (this->f << (64 - p));
-
832 f = (this->f >> p);
-
833 }
-
834 }
-
835 return *this;
-
836 }
-
-
837
-
838 /**
-
839 * @brief operator & for uint128_t (bitwise operator)
-
840 * @param p number to be operated
-
841 * @returns value of this & p (& is bit-wise operator)
-
842 */
-
-
843 inline uint128_t operator&(const uint128_t &p) {
-
844 return uint128_t(this->f & p.f, this->s & p.s);
-
845 }
-
-
846
-
847 /**
-
848 * @brief operator & for other types (bitwise operator)
-
849 * @tparam T integral type
-
850 * @param p number to be operated
-
851 * @returns value of this & p (& is bit-wise operator)
-
852 */
-
853 template <typename T, typename = typename std::enable_if<
- -
-
855 uint128_t operator&(const T p) {
-
856 uint128_t tmp = *this;
-
857 return tmp & uint128_t(p);
-
858 }
-
-
859
-
860 /**
-
861 * @brief operator &= for uint128_t (bitwise operator)
-
862 * @param p number to be operated
-
863 * @returns this = this & p (& is bit-wise operator)
-
864 */
-
- -
866 this->f &= p.f;
-
867 this->s &= p.s;
-
868 return *this;
-
869 }
-
-
870
-
871 /**
-
872 * @brief operator &= for other types (bitwise operator)
-
873 * @tparam T integral type
-
874 * @param p number to be operated
-
875 * @returns this = this & p (& is bit-wise operator)
-
876 */
-
877 template <typename T, typename = typename std::enable_if<
- -
-
879 uint128_t &operator&=(const T p) {
-
880 *this &= uint128_t(p);
-
881 return *this;
-
882 }
-
-
883
-
884 /**
-
885 * @brief operator | for other types (bitwise operator)
-
886 * @tparam T integral type
-
887 * @param p number to be operated
-
888 * @returns value of this | p (| is bit-wise operator)
-
889 */
-
890 template <typename T, typename = typename std::enable_if<
- -
-
892 inline uint128_t operator|(const T p) {
-
893 return uint128_t(p | s);
-
894 }
-
-
895
-
896 /**
-
897 * @brief operator | for uint128_t (bitwise operator)
-
898 * @param p number to be operated
-
899 * @returns value of this | p (| is bit-wise OR operator)
-
900 */
-
-
901 inline uint128_t operator|(const uint128_t &p) {
-
902 return uint128_t(this->f | p.f, this->s | p.s);
-
903 }
-
-
904
-
905 /**
-
906 * @brief operator |= for uint128_t (bitwise operator)
-
907 * @param p number to be operated
-
908 * @returns this = this | p (| is bit-wise OR operator)
-
909 */
-
- -
911 f |= p.f;
-
912 s |= p.s;
-
913 return *this;
-
914 }
-
-
915
-
916 /**
-
917 * @brief operator |= for other types (bitwise operator)
-
918 * @tparam T integral type
-
919 * @param p number to be operated
-
920 * @returns this = this | p (| is bit-wise OR operator)
-
921 */
-
922 template <typename T, typename = typename std::enable_if<
- -
-
924 inline uint128_t &operator|=(const T p) {
-
925 s |= p.s;
-
926 return *this;
-
927 }
-
-
928
-
929 /**
-
930 * @brief operator ^ for other types (bitwise operator)
-
931 * @tparam T integral type
-
932 * @param p number to be operated
-
933 * @returns value of this ^ p (^ is bit-wise XOR operator)
-
934 */
-
935 template <typename T, typename = typename std::enable_if<
- -
-
937 inline uint128_t operator^(const T p) {
-
938 return uint128_t(this->f, this->s ^ p);
-
939 }
-
-
940
-
941 /**
-
942 * @brief operator ^ for uint128_t (bitwise operator)
-
943 * @param p number to be operated
-
944 * @returns value of this ^ p (^ is bit-wise XOR operator)
-
945 */
-
-
946 inline uint128_t operator^(const uint128_t &p) {
-
947 return uint128_t(this->f ^ p.f, this->s ^ p.s);
-
948 }
-
-
949
-
950 /**
-
951 * @brief operator ^= for uint128_t (bitwise operator)
-
952 * @param p number to be operated
-
953 * @returns this = this ^ p (^ is bit-wise XOR operator)
-
954 */
-
- -
956 f ^= p.f;
-
957 s ^= p.s;
-
958 return *this;
-
959 }
-
-
960
-
961 /**
-
962 * @brief operator ^= for other types (bitwise operator)
-
963 * @tparam T integral type
-
964 * @param p number to be operated
-
965 * @returns this = this ^ p (^ is bit-wise XOR operator)
-
966 */
-
967 template <typename T, typename = typename std::enable_if<
- -
-
969 inline uint128_t &operator^=(const T &p) {
-
970 s ^= p;
-
971 return *this;
-
972 }
-
-
973
-
974 /**
-
975 * @brief operator << for printing uint128_t integer
-
976 * @details Prints the uint128_t integer in decimal form
-
977 * @note Note that this operator is costly since it uses strings to print
-
978 * the value
-
979 * @param op ostream object
-
980 * @param p 128-bit integer
-
981 * @returns op, ostream object.
-
982 */
-
- -
984 if (!p.f) {
-
985 op << p.s;
-
986 } else {
-
987 std::string out = "0", p_2 = "1";
-
988 for (int i = 0; i < 64; ++i) {
-
989 if (p.s & (1LL << i)) {
-
990 out = add(out, p_2);
-
991 }
-
992 p_2 = add(p_2, p_2);
-
993 }
-
994 for (int i = 0; i < 64; ++i) {
-
995 if (p.f & (1LL << i)) {
-
996 out = add(out, p_2);
-
997 }
-
998 p_2 = add(p_2, p_2);
-
999 }
-
1000 op << out;
-
1001 }
-
1002 return op;
-
1003 }
-
-
1004};
-
-
1005
-
1006// Arithmetic operators
-
1007template <typename T, typename = typename std::enable_if<
- -
1009inline uint128_t operator+(const T &p, const uint128_t &q) {
-
1010 return uint128_t(p) + q;
-
1011}
-
1012
-
1013template <typename T, typename = typename std::enable_if<
- -
1015inline uint128_t operator-(const T p, const uint128_t &q) {
-
1016 return uint128_t(p) - q;
-
1017}
-
1018
-
1019template <typename T, typename = typename std::enable_if<
- -
1021inline uint128_t operator*(const T p, const uint128_t &q) {
-
1022 return uint128_t(p) * q;
-
1023}
-
1024
-
1025template <typename T, typename = typename std::enable_if<
- -
1027inline uint128_t operator/(const T p, const uint128_t &q) {
-
1028 return uint128_t(p) / q;
-
1029}
-
1030
-
1031template <typename T, typename = typename std::enable_if<
- -
1033inline uint128_t operator%(const T p, const uint128_t &q) {
-
1034 return uint128_t(p) % q;
-
1035}
-
1036
-
1037// Bitwise operators
-
1038template <typename T, typename = typename std::enable_if<
- -
1040inline uint128_t operator&(const T &p, const uint128_t &q) {
-
1041 return uint128_t(p) & q;
-
1042}
-
1043
-
1044template <typename T, typename = typename std::enable_if<
- -
1046inline uint128_t operator|(const T p, const uint128_t &q) {
-
1047 return uint128_t(p) | q;
-
1048}
-
1049
-
1050template <typename T, typename = typename std::enable_if<
- -
1052inline uint128_t operator^(const T p, const uint128_t &q) {
-
1053 return uint128_t(p) ^ q;
-
1054}
-
1055
-
1056// Boolean operators
-
1057template <typename T, typename = typename std::enable_if<
- -
1059inline bool operator&&(const T p, const uint128_t &q) {
-
1060 return uint128_t(p) && q;
-
1061}
-
1062
-
1063template <typename T, typename = typename std::enable_if<
- -
1065inline bool operator||(const T p, const uint128_t &q) {
-
1066 return uint128_t(p) || q;
-
1067}
-
1068
-
1069// Comparison operators
-
1070template <typename T, typename = typename std::enable_if<
- -
1072inline bool operator==(const T p, const uint128_t &q) {
-
1073 return uint128_t(p) == q;
-
1074}
-
1075
-
1076template <typename T, typename = typename std::enable_if<
- -
1078inline bool operator!=(const T p, const uint128_t &q) {
-
1079 return uint128_t(p) != q;
-
1080}
-
1081
-
1082template <typename T, typename = typename std::enable_if<
- -
1084inline bool operator<(const T p, const uint128_t &q) {
-
1085 return uint128_t(p) < q;
-
1086}
-
1087
-
1088template <typename T, typename = typename std::enable_if<
- -
1090inline bool operator<=(const T p, const uint128_t &q) {
-
1091 return uint128_t(p) <= q;
-
1092}
-
1093
-
1094template <typename T, typename = typename std::enable_if<
- -
1096inline bool operator>(const T p, const uint128_t &q) {
-
1097 return uint128_t(p) > q;
-
1098}
-
1099
-
1100template <typename T, typename = typename std::enable_if<
- -
1102inline bool operator>=(const T p, const uint128_t &q) {
-
1103 return uint128_t(p) >= q;
-
1104}
-
1105
-
1106#endif // CIPHERS_UINT128_T_HPP_
+
11#include <cstdint>
+
12#include <ostream> /// for `std::cout` overload
+
13#include <string> /// for `std::string`
+
14#include <utility> /// for `std::pair` library
+
15
+
16#ifdef _MSC_VER
+
17#include <intrin.h> /// for _BitScanForward64 and __BitScanReverse64 operation
+
18#endif
+
19
+
20#ifndef CIPHERS_UINT128_T_HPP_
+
21#define CIPHERS_UINT128_T_HPP_
+
22class uint128_t;
+
23
+
24template <>
+ +
26template <>
+ +
28template <>
+ +
30
+
31/**
+
32 * @brief Adding two string
+
33 * @details Adds two long integer, only used for printing numbers
+
34 * @param first First integer string
+
35 * @param second Second integer string
+
36 * @returns string denoting the addition of both the strings
+
37 */
+
+
38std::string add(const std::string &first, const std::string &second) {
+
39 std::string third;
+
40 int16_t sum = 0, carry = 0;
+
41 for (int32_t i = static_cast<int32_t>(first.size()) - 1,
+
42 j = static_cast<int32_t>(second.size()) - 1;
+
43 i >= 0 || j >= 0; --i, --j) {
+
44 sum = ((i >= 0 ? first[i] - '0' : 0) + (j >= 0 ? second[j] - '0' : 0) +
+
45 carry);
+
46 carry = sum / 10;
+
47 sum %= 10;
+
48 third.push_back(sum + '0');
+
49 }
+
50 if (carry) {
+
51 third.push_back('1');
+
52 }
+
53 std::reverse(third.begin(), third.end());
+
54 return third;
+
55}
+
+
56/**
+
57 * @class uint128_t
+
58 * @brief class for 128-bit unsigned integer
+
59 */
+
+
60class uint128_t {
+
61 uint64_t f{}, s{}; /// First and second half of 128 bit number
+
62
+
63 /**
+
64 * @brief Get integer from given string.
+
65 * @details Create an integer from a given string
+
66 * @param str integer string, can be hexadecimal (starting on 0x... or
+
67 * number)
+
68 * @returns void
+
69 */
+
+ +
71 this->f = this->s = 0;
+
72 if (str.size() > 1 && str[1] == 'x') { // if hexadecimal
+
73 for (auto i = 2; i < str.size(); ++i) {
+
74 *this *= 16LL;
+
75 if (str[i] >= '0' && str[i] <= '9') {
+
76 *this += (str[i] - '0');
+
77 } else if (str[i] >= 'A' && str[i] <= 'F') {
+
78 *this += (str[i] - 'A' + 10);
+
79 } else if (str[i] >= 'a' && str[i] <= 'f') {
+
80 *this += (str[i] - 'a' + 10);
+
81 }
+
82 }
+
83 } else { // if decimal
+
84 for (auto &x : str) {
+
85 *this *= 10LL;
+
86 *this += (x - '0');
+
87 }
+
88 }
+
89 }
+
+
90
+
91 public:
+
92 uint128_t() = default;
+
93
+
94 /**
+
95 * @brief Parameterized constructor
+
96 * @tparam T integral type
+
97 * @param low lower part 8-bit unisgned integer
+
98 */
+
99 template <typename T, typename = typename std::enable_if<
+ +
101 explicit uint128_t(T low) : s(low) {}
+
102
+
103 /**
+
104 * @brief Parameterized constructor
+
105 * @param str Integer string (hexadecimal starting with 0x.. or decimal)
+
106 */
+
+
107 explicit uint128_t(const std::string &str) {
+ +
109 }
+
+
110
+
111 /**
+
112 * @brief Parameterized constructor
+
113 * @param high higher part 64-bit unsigned integer
+
114 * @param low lower part 64-bit unsigned integer
+
115 */
+
116 uint128_t(const uint64_t high, const uint64_t low) : f(high), s(low) {}
+
117
+
118 /**
+
119 * @brief Copy constructor
+
120 * @param num 128-bit unsigned integer
+
121 */
+
122 uint128_t(const uint128_t &num) = default;
+
123
+
124 /**
+
125 * @brief Move constructor
+
126 * @param num 128-bit unsigned integer
+
127 */
+
128 uint128_t(uint128_t &&num) noexcept : f(num.f), s(num.s) {}
+
129
+
130 /**
+
131 * @brief Destructor for uint128_t
+
132 */
+
133 ~uint128_t() = default;
+
134
+
135 /**
+
136 * @brief Leading zeroes in binary
+
137 * @details Calculates leading zeros in 128-bit integer
+
138 * @returns Integer denoting leading zeroes
+
139 */
+
+
140 inline uint32_t _lez() {
+
141#ifndef _MSC_VER
+
142 if (f) {
+
143 return __builtin_clzll(f);
+
144 }
+
145 return 64 + __builtin_clzll(s);
+
146#else
+
147 unsigned long r = 0;
+
148 _BitScanForward64(&r, f);
+
149 if (r == 64) {
+
150 unsigned long l = 0;
+
151 _BitScanForward64(&l, s);
+
152 return 64 + l;
+
153 }
+
154 return r;
+
155#endif
+
156 }
+
+
157
+
158 /**
+
159 * @brief Trailing zeroes in binary
+
160 * @details Calculates leading zeros in 128-bit integer
+
161 * @returns Integer denoting Trailing zeroes
+
162 */
+
+
163 inline uint32_t _trz() {
+
164#ifndef _MSC_VER
+
165 if (f) {
+
166 return __builtin_ctzll(f);
+
167 }
+
168 return 64 + __builtin_ctzll(s);
+
169#else
+
170 unsigned long r = 0;
+
171 _BitScanReverse64(&r, s);
+
172 if (r == 64) {
+
173 unsigned long l = 0;
+
174 _BitScanReverse64(&l, f);
+
175 return 64 + l;
+
176 }
+
177 return r;
+
178#endif
+
179 }
+
+
180
+
181 /**
+
182 * @brief casting operator to boolean value
+
183 * @returns true if value of this is non-zero, else false
+
184 */
+
185 inline explicit operator bool() const { return (f || s); }
+
186
+
187 /**
+
188 * @brief casting operator to any integer valu
+
189 * @tparam T any integer type
+
190 * @returns integer value casted to mentioned type
+
191 */
+
192 template <typename T, typename = typename std::enable_if<
+ +
+
194 inline explicit operator T() const {
+
195 return static_cast<T>(s);
+
196 }
+
+
197
+
198 /**
+
199 * @brief returns lower 64-bit integer part
+
200 * @returns returns lower 64-bit integer part
+
201 */
+
202 inline uint64_t lower() const { return s; }
+
203
+
204 /**
+
205 * @brief returns upper 64-bit integer part
+
206 * @returns returns upper 64-bit integer part
+
207 */
+
208 inline uint64_t upper() const { return f; }
+
209
+
210 /**
+
211 * @brief operator = for other types
+
212 * @tparam T denoting any integer type
+
213 * @param p an integer to assign it's value
+
214 * @returns this pointer with it's value equal to `p`
+
215 */
+
216 template <typename T, typename = typename std::enable_if<
+ +
+
218 inline uint128_t &operator=(const T &p) {
+
219 this->s = p;
+
220 return *this;
+
221 }
+
+
222
+
223 /**
+
224 * @brief operator = for type string
+
225 * @param p a string to assign it's value to equivalent integer
+
226 * @returns this pointer with it's value equal to `p`
+
227 */
+
+
228 inline uint128_t &operator=(const std::string &p) {
+ +
230 return *this;
+
231 }
+
+
232
+
233 /**
+
234 * @brief operator = for uint128_t
+
235 * @param p an 128-bit integer to assign it's value
+
236 * @returns this pointer with it's value equal to `p`
+
237 */
+
238 inline uint128_t &operator=(const uint128_t &p) = default;
+
239
+
240 /**
+
241 * @brief Move assignment operator
+
242 */
+
243 inline uint128_t &operator=(uint128_t &&p) = default;
+
244
+
245 /**
+
246 * @brief operator + for uint128_t and other integer types.
+
247 * @tparam T denoting integral type
+
248 * @param p a type of integer variable
+
249 * @returns addition of this and p, returning uint128_t integer
+
250 */
+
251 template <typename T, typename = typename std::enable_if<
+ +
+
253 inline uint128_t operator+(const T p) {
+
254 return uint128_t(f + (p + s < s), p + s);
+
255 }
+
+
256
+
257 /**
+
258 * @brief operator + for uint128_t and other integer types.
+
259 * @param p 128-bit unsigned integer
+
260 * @returns addition of this and p, returning uint128_t integer
+
261 */
+
+
262 inline uint128_t operator+(const uint128_t &p) {
+
263 return uint128_t(f + (p.s + s < s) + p.f, p.s + s);
+
264 }
+
+
265
+
266 /**
+
267 * @brief operator += for uint128_t and other integer types.
+
268 * @tparam T denoting integral type
+
269 * @param p a type of integer variable
+
270 * @returns addition of this and p, returning this
+
271 */
+
272 template <typename T, typename = typename std::enable_if<
+ +
+
274 inline uint128_t &operator+=(const T p) {
+
275 bool app = p + s < s;
+
276 this->f += app;
+
277 this->s += p;
+
278 return *this;
+
279 }
+
+
280
+
281 /**
+
282 * @brief operator += for uint128_t
+
283 * @param p 128-bit unsigned integer
+
284 * @returns addition of this and p, returning this
+
285 */
+
+ +
287 bool app = p.s + s < s;
+
288 f = f + app + p.f;
+
289 s = p.s + s;
+
290 return *this;
+
291 }
+
+
292
+
293 /**
+
294 * @brief pre-increment operator
+
295 * @returns incremented value of this.
+
296 */
+
+ +
298 *this += 1;
+
299 return *this;
+
300 }
+
+
301
+
302 /**
+
303 * @brief post-increment operator
+
304 * @returns incremented value of this.
+
305 */
+
+
306 inline uint128_t operator++(int) {
+
307 ++*this;
+
308 return *this;
+
309 }
+
+
310
+
311 /**
+
312 * @brief operator - for uint128_t and other integer types.
+
313 * @tparam T denoting integral type
+
314 * @param p a type of integer variable
+
315 * @returns subtraction of this and p, returning uint128_t integer
+
316 */
+
317 template <typename T, typename = typename std::enable_if<
+ +
+
319 inline uint128_t operator-(const T &p) {
+
320 bool app = p > s;
+
321 return uint128_t(f - app, s - p);
+
322 }
+
+
323
+
324 /**
+
325 * @brief operator - for uint128_t
+
326 * @param p a type of integer variable
+
327 * @returns subtraction of this and p, returning uint128_t integer
+
328 */
+
+
329 inline uint128_t operator-(const uint128_t &p) {
+
330 bool app = p.s > s;
+
331 return uint128_t(f - p.f - app, s - p.s);
+
332 }
+
+
333
+
334 /**
+
335 * @brief operator - using twos complement
+
336 * @returns 2's complement of this.
+
337 */
+
338 inline uint128_t operator-() { return ~*this + uint128_t(1); }
+
339
+
340 /**
+
341 * @brief operator -- (pre-decrement)
+
342 * @returns decremented value of this
+
343 */
+
+ +
345 *this -= 1;
+
346 return *this;
+
347 }
+
+
348
+
349 /**
+
350 * @brief operator -- (post-decrement)
+
351 * @returns decremented value of this
+
352 */
+
+
353 inline uint128_t operator--(int p) {
+
354 --*this;
+
355 return *this;
+
356 }
+
+
357
+
358 /**
+
359 * @brief operator -= for uint128_t and other integer types.
+
360 * @tparam T denoting integral type
+
361 * @param p a type of integer variable
+
362 * @returns subtraction of this and p, returning this
+
363 */
+
364 template <typename T, typename = typename std::enable_if<
+ +
+
366 uint128_t &operator-=(const T &p) {
+
367 bool app = p > s;
+
368 f -= app;
+
369 s -= p;
+
370 return *this;
+
371 }
+
+
372
+
373 /**
+
374 * @brief operator -= for uint128_t
+
375 * @param p 128-bit unsigned integer
+
376 * @returns subtraction of this and p, returning this
+
377 */
+
+ +
379 bool app = p.s > s;
+
380 f = f - p.f - app;
+
381 s = s - p.s;
+
382 return *this;
+
383 }
+
+
384
+
385 /**
+
386 * @brief operator * for uint128_t and other integer types.
+
387 * @tparam T denoting integral type
+
388 * @param p a type of integer variable
+
389 * @returns multiplication of this and p, returning uint128_t integer
+
390 */
+
391 template <typename T, typename = typename std::enable_if<
+ +
+
393 inline uint128_t operator*(const T p) {
+
394 return *this * uint128_t(p);
+
395 }
+
+
396
+
397 /**
+
398 * @brief operator * for uint128_t and other integer types.
+
399 * @param p 128-bit unsigned integer
+
400 * @returns multiplication of this and p, returning uint128_t integer
+
401 */
+
+ +
403 uint64_t f_first = s >> 32, f_second = s & 0xFFFFFFFF,
+
404 s_first = p.s >> 32, s_second = p.s & 0xFFFFFFFF;
+
405 uint64_t fi = f_first * s_first, se = f_first * s_second,
+
406 th = s_first * f_second, fo = s_second * f_second;
+
407 uint64_t tmp = ((se & 0xFFFFFFFF) << 32), tmp2 = (th & 0xFFFFFFFF)
+
408 << 32;
+
409 int cc = (tmp + tmp2 < tmp);
+
410 tmp += tmp2;
+
411 cc += (tmp + fo < tmp);
+
412 uint64_t carry = fi + (se >> 32) + (th >> 32);
+
413 return uint128_t(this->f * p.s + this->s * p.f + carry + cc, tmp + fo);
+
414 }
+
+
415
+
416 /**
+
417 * @brief operator *= for uint128_t and other integer types.
+
418 * @tparam T denoting integral type
+
419 * @param p a type of integer variable
+
420 * @returns multiplication of this and p, returning this
+
421 */
+
422 template <typename T, typename = typename std::enable_if<
+ +
+
424 inline uint128_t &operator*=(const T p) {
+
425 *this *= uint128_t(p);
+
426 return *this;
+
427 }
+
+
428
+
429 /**
+
430 * @brief operator *= for uint128_t and other integer types.
+
431 * @param p 128-bit unsigned integer
+
432 * @returns multiplication of this and p, returning this
+
433 */
+
+ +
435 uint64_t f_first = s >> 32, f_second = s & 0xFFFFFFFF,
+
436 s_first = p.s >> 32, s_second = p.s & 0xFFFFFFFF;
+
437 uint64_t fi = f_first * s_first, se = f_first * s_second,
+
438 th = s_first * f_second, fo = s_second * f_second;
+
439 uint64_t tmp = (se << 32), tmp2 = (th << 32);
+
440 int cc = (tmp + tmp2 < tmp);
+
441 tmp += tmp2;
+
442 cc += (tmp + fo < tmp);
+
443 uint64_t carry = fi + (se >> 32) + (th >> 32);
+
444 f = this->f * p.s + this->s * p.f + carry + cc;
+
445 s = tmp + fo;
+
446 return *this;
+
447 }
+
+
448
+
449 /**
+
450 * @brief divide function for uint128_t and other integer types.
+
451 * @details divide this value and
+
452 * @param p 128-bit unsigned integer
+
453 * @returns pair denoting quotient and remainder.
+
454 */
+
+ +
456 if (*this < p) { // if this is less than divisor
+
457 return {uint128_t(0), *this};
+
458 } else if (*this == p) { // if this is equal to divisor
+
459 return {uint128_t(1), uint128_t(0)};
+
460 }
+
461 uint128_t tmp = p, tmp2 = *this;
+
462 uint16_t left = tmp._lez() - _lez();
+
463 tmp <<= left;
+
464 uint128_t quotient(0);
+
465 uint128_t zero(0);
+
466 while (tmp2 >= p) {
+
467 uint16_t shf = tmp2._lez() - tmp._lez();
+
468 if (shf) {
+
469 tmp >>= shf;
+
470 quotient <<= shf;
+
471 left -= shf;
+
472 }
+
473 if (tmp2 < tmp) {
+
474 tmp >>= 1;
+
475 quotient <<= 1;
+
476 --left;
+
477 }
+
478 tmp2 -= tmp;
+
479 ++quotient;
+
480 }
+
481 return {quotient << left, tmp2};
+
482 }
+
+
483
+
484 /**
+
485 * @brief operator / for uint128_t and other integer types.
+
486 * @param p 128-bit unsigned integer
+
487 * @returns unsigned 128-bit quotient.
+
488 */
+
489 inline uint128_t operator/(const uint128_t &p) { return divide(p).first; }
+
490
+
491 /**
+
492 * @brief operator / for uint128_t and other integer types.
+
493 * @tparam T denoting integral type
+
494 * @param p a type of integer variable
+
495 * @returns unsigned 128-bit quotient.
+
496 */
+
497 template <typename T, typename = typename std::enable_if<
+ +
+
499 inline uint128_t operator/(const T p) {
+
500 uint128_t tmp = *this;
+
501 tmp /= uint128_t(0, p);
+
502 return tmp;
+
503 }
+
+
504
+
505 /**
+
506 * @brief operator /= for uint128_t
+
507 * @param p 128-bit unsigned integer
+
508 * @returns this set as unsigned 128-bit quotient.
+
509 */
+
+
510 inline uint128_t &operator/=(const uint128_t &p) {
+
511 *this = divide(p).first;
+
512 return *this;
+
513 }
+
+
514
+
515 /**
+
516 * @brief operator /= for uint128_t and other integer types.
+
517 * @tparam T denoting integral type
+
518 * @param p a type of integer variable
+
519 * @returns this set as unsigned 128-bit quotient.
+
520 */
+
521 template <typename T, typename = typename std::enable_if<
+ +
+
523 inline uint128_t &operator/=(const T p) {
+
524 *this /= uint128_t(0, p);
+
525 return *this;
+
526 }
+
+
527
+
528 /**
+
529 * @brief operator % for uint128_t
+
530 * @param p 128-bit unsigned integer
+
531 * @returns unsigned 128-bit remainder.
+
532 */
+
533 inline uint128_t operator%(const uint128_t &p) { return divide(p).second; }
+
534
+
535 /**
+
536 * @brief operator % for uint128_t and other integer types.
+
537 * @tparam T denoting integral type
+
538 * @param p a type of integer variable
+
539 * @returns unsigned 128-bit remainder.
+
540 */
+
541 template <typename T, typename = typename std::enable_if<
+ +
+
543 inline uint128_t operator%(const T &p) {
+
544 return *this % uint128_t(p);
+
545 }
+
+
546
+
547 /**
+
548 * @brief operator %= for uint128_t
+
549 * @param p 128-bit unsigned integer
+
550 * @returns this set as unsigned 128-bit remainder.
+
551 */
+
+
552 inline uint128_t &operator%=(const uint128_t &p) {
+
553 *this = divide(p).second;
+
554 return *this;
+
555 }
+
+
556
+
557 /**
+
558 * @brief operator %= for uint128_t
+
559 * @tparam T denoting integral type
+
560 * @param p a type of integer variable
+
561 * @returns this set as unsigned 128-bit remainder.
+
562 */
+
563 template <typename T, typename = typename std::enable_if<
+ +
+
565 inline uint128_t &operator%=(const T &p) {
+
566 *this %= uint128_t(p);
+
567 return *this;
+
568 }
+
+
569
+
570 /**
+
571 * @brief operator < for uint128_t
+
572 * @param other number to be compared with this
+
573 * @returns true if this is less than other, else false
+
574 */
+
+
575 inline bool operator<(const uint128_t &other) {
+
576 return f < other.f || (f == other.f && s < other.s);
+
577 }
+
+
578
+
579 /**
+
580 * @brief operator <= for uint128_t
+
581 * @param other number to be compared with this
+
582 * @returns true if this is less than or equal to other, else false
+
583 */
+
+
584 inline bool operator<=(const uint128_t &other) {
+
585 return f < other.f || (f == other.f && s <= other.s);
+
586 }
+
+
587
+
588 /**
+
589 * @brief operator > for uint128_t
+
590 * @param other number to be compared with this
+
591 * @returns true if this is greater than other, else false
+
592 */
+
+
593 inline bool operator>(const uint128_t &other) {
+
594 return f > other.f || (f == other.f && s > other.s);
+
595 }
+
+
596
+
597 /**
+
598 * @brief operator >= for uint128_t
+
599 * @param other number to be compared with this
+
600 * @returns true if this is greater than or equal than other, else false
+
601 */
+
+
602 inline bool operator>=(const uint128_t &other) {
+
603 return (f > other.f) || (f == other.f && s >= other.s);
+
604 }
+
+
605
+
606 /**
+
607 * @brief operator == for uint128_t
+
608 * @param other number to be compared with this
+
609 * @returns true if this is equal than other, else false
+
610 */
+
+
611 inline bool operator==(const uint128_t &other) {
+
612 return f == other.f && s == other.s;
+
613 }
+
+
614
+
615 /**
+
616 * @brief operator != for uint128_t
+
617 * @param other number to be compared with this
+
618 * @returns true if this is not equal than other, else false
+
619 */
+
+
620 inline bool operator!=(const uint128_t &other) {
+
621 return f != other.f || s != other.s;
+
622 }
+
+
623
+
624 /**
+
625 * @brief operator ! for uint128_t
+
626 * @returns true if this has zero value, else false
+
627 */
+
628 inline bool operator!() { return !f && !s; }
+
629
+
630 /**
+
631 * @brief operator && for uint128_t
+
632 * @param b number to be compared with this
+
633 * @returns true if both of the values are not zero, else false
+
634 */
+
+
635 inline bool operator&&(const uint128_t &b) {
+
636 return (s || f) && (b.s || b.f);
+
637 }
+
+
638
+
639 /**
+
640 * @brief operator || for uint128_t
+
641 * @param b number to be compared with this
+
642 * @returns true if one of the values are not zero, else false
+
643 */
+
+
644 inline bool operator||(const uint128_t &b) {
+
645 return (s || f) || (b.s || b.f);
+
646 }
+
+
647
+
648 /**
+
649 * @brief operator () for uint128_t
+
650 * @returns true if this value is non-zero, else false
+
651 */
+
652 inline bool operator()() { return s || f; }
+
653
+
654 /**
+
655 * @brief operator < for other types
+
656 * @tparam T integral type
+
657 * @param other number to be compared with this
+
658 * @returns true if this is less than other, else false
+
659 */
+
660 template <typename T, typename = typename std::enable_if<
+ +
+
662 inline bool operator<(const T other) {
+
663 return *this < uint128_t(other);
+
664 }
+
+
665
+
666 /**
+
667 * @brief operator <= for other types
+
668 * @tparam T integral type
+
669 * @param other number to be compared with this
+
670 * @returns true if this is less than or equal to other, else false
+
671 */
+
672 template <typename T, typename = typename std::enable_if<
+ +
+
674 inline bool operator<=(const T other) {
+
675 return *this <= uint128_t(other);
+
676 }
+
+
677
+
678 /**
+
679 * @brief operator > for other types
+
680 * @tparam T integral type
+
681 * @param other number to be compared with this
+
682 * @returns true if this is greater than other, else false
+
683 */
+
684 template <typename T, typename = typename std::enable_if<
+ +
+
686 inline bool operator>(const T other) {
+
687 return *this > uint128_t(other);
+
688 }
+
+
689
+
690 /**
+
691 * @brief operator >= for other types
+
692 * @tparam T integral type
+
693 * @param other number to be compared with this
+
694 * @returns true if this is greater than or equal other, else false
+
695 */
+
696 template <typename T, typename = typename std::enable_if<
+ +
+
698 inline bool operator>=(const T other) {
+
699 return *this >= uint128_t(other);
+
700 }
+
+
701
+
702 /**
+
703 * @brief operator == for other types
+
704 * @tparam T integral type
+
705 * @param other number to be compared with this
+
706 * @returns true if this is equal to other, else false
+
707 */
+
708 template <typename T, typename = typename std::enable_if<
+ +
+
710 inline bool operator==(const T other) {
+
711 return *this == uint128_t(other);
+
712 }
+
+
713
+
714 /**
+
715 * @brief operator != for other types
+
716 * @tparam T integral type
+
717 * @param other number to be compared with this
+
718 * @returns true if this is not equal to other, else false
+
719 */
+
720 template <typename T, typename = typename std::enable_if<
+ +
+
722 inline bool operator!=(const T other) {
+
723 return *this != uint128_t(other);
+
724 }
+
+
725
+
726 /**
+
727 * @brief operator && for other types
+
728 * @tparam T integral type
+
729 * @param other number to be compared with this
+
730 * @returns true if this is both values are non-zero, else false
+
731 */
+
732 template <typename T, typename = typename std::enable_if<
+ +
+
734 inline bool operator&&(const T b) {
+
735 return (f || s) && b;
+
736 }
+
+
737
+
738 /**
+
739 * @brief operator || for other types
+
740 * @tparam T integral type
+
741 * @param other number to be compared with this
+
742 * @returns true if this is either one of the values are non-zero, else
+
743 * false
+
744 */
+
745 template <typename T, typename = typename std::enable_if<
+ +
+
747 inline bool operator||(const T b) {
+
748 return (f || s) || b;
+
749 }
+
+
750
+
751 /**
+
752 * @brief operator ~ for uint128_t
+
753 * @returns 1's complement of this number
+
754 */
+
755 uint128_t operator~() { return uint128_t(~this->f, ~this->s); }
+
756
+
757 /**
+
758 * @brief operator << for uint128_t
+
759 * @tparam T integral type
+
760 * @param p number denoting number of shifts
+
761 * @returns value of this shifted by p to left
+
762 */
+
763 template <typename T, typename = typename std::enable_if<
+ +
+ +
766 if (!p) {
+
767 return uint128_t(f, s);
+
768 } else if (p >= 64 && p <= 128) {
+
769 return uint128_t((this->s << (p - 64)), 0);
+
770 } else if (p < 64 && p > 0) {
+
771 return uint128_t((this->f << p) + ((this->s >> (64 - p))),
+
772 this->s << p);
+
773 }
+
774 return uint128_t(0);
+
775 }
+
+
776
+
777 /**
+
778 * @brief operator <<= for uint128_t
+
779 * @tparam T integral type
+
780 * @param p number denoting number of shifts
+
781 * @returns this shifted by p to left
+
782 */
+
783 template <typename T, typename = typename std::enable_if<
+ +
+
785 uint128_t &operator<<=(const T p) {
+
786 if (p) {
+
787 if (p >= 64 && p <= 128) {
+
788 this->f = (this->s << (p - 64));
+
789 this->s = 0;
+
790 } else {
+
791 f = ((this->f << p) + (this->s >> (64 - p)));
+
792 s = (this->s << p);
+
793 }
+
794 }
+
795 return *this;
+
796 }
+
+
797
+
798 /**
+
799 * @brief operator >> for uint128_t
+
800 * @tparam T integral type
+
801 * @param p number denoting number of shifts
+
802 * @returns value of this shifted by p to right
+
803 */
+
804 template <typename T, typename = typename std::enable_if<
+ +
+ +
807 if (!p) {
+
808 return uint128_t(this->f, this->s);
+
809 } else if (p >= 64 && p <= 128) {
+
810 return uint128_t(0, (this->f >> (p - 64)));
+
811 } else if (p < 64 && p > 0) {
+
812 return uint128_t((this->f >> p),
+
813 (this->s >> p) + (this->f << (64 - p)));
+
814 }
+
815 return uint128_t(0);
+
816 }
+
+
817
+
818 /**
+
819 * @brief operator >>= for uint128_t
+
820 * @tparam T integral type
+
821 * @param p number denoting number of shifts
+
822 * @returns this shifted by p to right
+
823 */
+
824 template <typename T, typename = typename std::enable_if<
+ +
+
826 uint128_t &operator>>=(const T p) {
+
827 if (p) {
+
828 if (p >= 64) {
+
829 f = 0;
+
830 s = (this->f >> (p - 64));
+
831 } else {
+
832 s = (this->s >> p) + (this->f << (64 - p));
+
833 f = (this->f >> p);
+
834 }
+
835 }
+
836 return *this;
+
837 }
+
+
838
+
839 /**
+
840 * @brief operator & for uint128_t (bitwise operator)
+
841 * @param p number to be operated
+
842 * @returns value of this & p (& is bit-wise operator)
+
843 */
+
+
844 inline uint128_t operator&(const uint128_t &p) {
+
845 return uint128_t(this->f & p.f, this->s & p.s);
+
846 }
+
+
847
+
848 /**
+
849 * @brief operator & for other types (bitwise operator)
+
850 * @tparam T integral type
+
851 * @param p number to be operated
+
852 * @returns value of this & p (& is bit-wise operator)
+
853 */
+
854 template <typename T, typename = typename std::enable_if<
+ +
+
856 uint128_t operator&(const T p) {
+
857 uint128_t tmp = *this;
+
858 return tmp & uint128_t(p);
+
859 }
+
+
860
+
861 /**
+
862 * @brief operator &= for uint128_t (bitwise operator)
+
863 * @param p number to be operated
+
864 * @returns this = this & p (& is bit-wise operator)
+
865 */
+
+ +
867 this->f &= p.f;
+
868 this->s &= p.s;
+
869 return *this;
+
870 }
+
+
871
+
872 /**
+
873 * @brief operator &= for other types (bitwise operator)
+
874 * @tparam T integral type
+
875 * @param p number to be operated
+
876 * @returns this = this & p (& is bit-wise operator)
+
877 */
+
878 template <typename T, typename = typename std::enable_if<
+ +
+
880 uint128_t &operator&=(const T p) {
+
881 *this &= uint128_t(p);
+
882 return *this;
+
883 }
+
+
884
+
885 /**
+
886 * @brief operator | for other types (bitwise operator)
+
887 * @tparam T integral type
+
888 * @param p number to be operated
+
889 * @returns value of this | p (| is bit-wise operator)
+
890 */
+
891 template <typename T, typename = typename std::enable_if<
+ +
+
893 inline uint128_t operator|(const T p) {
+
894 return uint128_t(p | s);
+
895 }
+
+
896
+
897 /**
+
898 * @brief operator | for uint128_t (bitwise operator)
+
899 * @param p number to be operated
+
900 * @returns value of this | p (| is bit-wise OR operator)
+
901 */
+
+
902 inline uint128_t operator|(const uint128_t &p) {
+
903 return uint128_t(this->f | p.f, this->s | p.s);
+
904 }
+
+
905
+
906 /**
+
907 * @brief operator |= for uint128_t (bitwise operator)
+
908 * @param p number to be operated
+
909 * @returns this = this | p (| is bit-wise OR operator)
+
910 */
+
+ +
912 f |= p.f;
+
913 s |= p.s;
+
914 return *this;
+
915 }
+
+
916
+
917 /**
+
918 * @brief operator |= for other types (bitwise operator)
+
919 * @tparam T integral type
+
920 * @param p number to be operated
+
921 * @returns this = this | p (| is bit-wise OR operator)
+
922 */
+
923 template <typename T, typename = typename std::enable_if<
+ +
+
925 inline uint128_t &operator|=(const T p) {
+
926 s |= p.s;
+
927 return *this;
+
928 }
+
+
929
+
930 /**
+
931 * @brief operator ^ for other types (bitwise operator)
+
932 * @tparam T integral type
+
933 * @param p number to be operated
+
934 * @returns value of this ^ p (^ is bit-wise XOR operator)
+
935 */
+
936 template <typename T, typename = typename std::enable_if<
+ +
+
938 inline uint128_t operator^(const T p) {
+
939 return uint128_t(this->f, this->s ^ p);
+
940 }
+
+
941
+
942 /**
+
943 * @brief operator ^ for uint128_t (bitwise operator)
+
944 * @param p number to be operated
+
945 * @returns value of this ^ p (^ is bit-wise XOR operator)
+
946 */
+
+
947 inline uint128_t operator^(const uint128_t &p) {
+
948 return uint128_t(this->f ^ p.f, this->s ^ p.s);
+
949 }
+
+
950
+
951 /**
+
952 * @brief operator ^= for uint128_t (bitwise operator)
+
953 * @param p number to be operated
+
954 * @returns this = this ^ p (^ is bit-wise XOR operator)
+
955 */
+
+ +
957 f ^= p.f;
+
958 s ^= p.s;
+
959 return *this;
+
960 }
+
+
961
+
962 /**
+
963 * @brief operator ^= for other types (bitwise operator)
+
964 * @tparam T integral type
+
965 * @param p number to be operated
+
966 * @returns this = this ^ p (^ is bit-wise XOR operator)
+
967 */
+
968 template <typename T, typename = typename std::enable_if<
+ +
+
970 inline uint128_t &operator^=(const T &p) {
+
971 s ^= p;
+
972 return *this;
+
973 }
+
+
974
+
975 /**
+
976 * @brief operator << for printing uint128_t integer
+
977 * @details Prints the uint128_t integer in decimal form
+
978 * @note Note that this operator is costly since it uses strings to print
+
979 * the value
+
980 * @param op ostream object
+
981 * @param p 128-bit integer
+
982 * @returns op, ostream object.
+
983 */
+
+ +
985 if (!p.f) {
+
986 op << p.s;
+
987 } else {
+
988 std::string out = "0", p_2 = "1";
+
989 for (int i = 0; i < 64; ++i) {
+
990 if (p.s & (1LL << i)) {
+
991 out = add(out, p_2);
+
992 }
+
993 p_2 = add(p_2, p_2);
+
994 }
+
995 for (int i = 0; i < 64; ++i) {
+
996 if (p.f & (1LL << i)) {
+
997 out = add(out, p_2);
+
998 }
+
999 p_2 = add(p_2, p_2);
+
1000 }
+
1001 op << out;
+
1002 }
+
1003 return op;
+
1004 }
+
+
1005};
+
+
1006
+
1007// Arithmetic operators
+
1008template <typename T, typename = typename std::enable_if<
+ +
1010inline uint128_t operator+(const T &p, const uint128_t &q) {
+
1011 return uint128_t(p) + q;
+
1012}
+
1013
+
1014template <typename T, typename = typename std::enable_if<
+ +
1016inline uint128_t operator-(const T p, const uint128_t &q) {
+
1017 return uint128_t(p) - q;
+
1018}
+
1019
+
1020template <typename T, typename = typename std::enable_if<
+ +
1022inline uint128_t operator*(const T p, const uint128_t &q) {
+
1023 return uint128_t(p) * q;
+
1024}
+
1025
+
1026template <typename T, typename = typename std::enable_if<
+ +
1028inline uint128_t operator/(const T p, const uint128_t &q) {
+
1029 return uint128_t(p) / q;
+
1030}
+
1031
+
1032template <typename T, typename = typename std::enable_if<
+ +
1034inline uint128_t operator%(const T p, const uint128_t &q) {
+
1035 return uint128_t(p) % q;
+
1036}
+
1037
+
1038// Bitwise operators
+
1039template <typename T, typename = typename std::enable_if<
+ +
1041inline uint128_t operator&(const T &p, const uint128_t &q) {
+
1042 return uint128_t(p) & q;
+
1043}
+
1044
+
1045template <typename T, typename = typename std::enable_if<
+ +
1047inline uint128_t operator|(const T p, const uint128_t &q) {
+
1048 return uint128_t(p) | q;
+
1049}
+
1050
+
1051template <typename T, typename = typename std::enable_if<
+ +
1053inline uint128_t operator^(const T p, const uint128_t &q) {
+
1054 return uint128_t(p) ^ q;
+
1055}
+
1056
+
1057// Boolean operators
+
1058template <typename T, typename = typename std::enable_if<
+ +
1060inline bool operator&&(const T p, const uint128_t &q) {
+
1061 return uint128_t(p) && q;
+
1062}
+
1063
+
1064template <typename T, typename = typename std::enable_if<
+ +
1066inline bool operator||(const T p, const uint128_t &q) {
+
1067 return uint128_t(p) || q;
+
1068}
+
1069
+
1070// Comparison operators
+
1071template <typename T, typename = typename std::enable_if<
+ +
1073inline bool operator==(const T p, const uint128_t &q) {
+
1074 return uint128_t(p) == q;
+
1075}
+
1076
+
1077template <typename T, typename = typename std::enable_if<
+ +
1079inline bool operator!=(const T p, const uint128_t &q) {
+
1080 return uint128_t(p) != q;
+
1081}
+
1082
+
1083template <typename T, typename = typename std::enable_if<
+ +
1085inline bool operator<(const T p, const uint128_t &q) {
+
1086 return uint128_t(p) < q;
+
1087}
+
1088
+
1089template <typename T, typename = typename std::enable_if<
+ +
1091inline bool operator<=(const T p, const uint128_t &q) {
+
1092 return uint128_t(p) <= q;
+
1093}
+
1094
+
1095template <typename T, typename = typename std::enable_if<
+ +
1097inline bool operator>(const T p, const uint128_t &q) {
+
1098 return uint128_t(p) > q;
+
1099}
+
1100
+
1101template <typename T, typename = typename std::enable_if<
+ +
1103inline bool operator>=(const T p, const uint128_t &q) {
+
1104 return uint128_t(p) >= q;
+
1105}
+
1106
+
1107#endif // CIPHERS_UINT128_T_HPP_
T begin(T... args)
-
class for 128-bit unsigned integer
Definition uint128_t.hpp:59
-
uint128_t & operator%=(const T &p)
operator %= for uint128_t
Definition uint128_t.hpp:564
-
uint128_t operator-()
operator - using twos complement
Definition uint128_t.hpp:337
-
uint128_t & operator-=(const T &p)
operator -= for uint128_t and other integer types.
Definition uint128_t.hpp:365
-
bool operator&&(const T b)
operator && for other types
Definition uint128_t.hpp:733
-
uint128_t & operator>>=(const T p)
operator >>= for uint128_t
Definition uint128_t.hpp:825
-
uint128_t(const std::string &str)
Parameterized constructor.
Definition uint128_t.hpp:106
-
uint128_t operator+(const uint128_t &p)
operator + for uint128_t and other integer types.
Definition uint128_t.hpp:261
-
uint128_t operator<<(const T p)
operator << for uint128_t
Definition uint128_t.hpp:764
-
bool operator<=(const uint128_t &other)
operator <= for uint128_t
Definition uint128_t.hpp:583
-
uint128_t & operator--()
operator – (pre-decrement)
Definition uint128_t.hpp:343
-
uint64_t upper() const
returns upper 64-bit integer part
Definition uint128_t.hpp:207
-
uint128_t & operator&=(const T p)
operator &= for other types (bitwise operator)
Definition uint128_t.hpp:879
-
uint128_t & operator%=(const uint128_t &p)
operator %= for uint128_t
Definition uint128_t.hpp:551
-
bool operator>(const uint128_t &other)
operator > for uint128_t
Definition uint128_t.hpp:592
-
uint128_t operator--(int p)
operator – (post-decrement)
Definition uint128_t.hpp:352
-
uint128_t operator|(const uint128_t &p)
operator | for uint128_t (bitwise operator)
Definition uint128_t.hpp:901
-
uint128_t & operator/=(const uint128_t &p)
operator /= for uint128_t
Definition uint128_t.hpp:509
-
uint128_t & operator*=(const T p)
operator *= for uint128_t and other integer types.
Definition uint128_t.hpp:423
-
uint128_t operator/(const uint128_t &p)
operator / for uint128_t and other integer types.
Definition uint128_t.hpp:488
-
bool operator||(const uint128_t &b)
operator || for uint128_t
Definition uint128_t.hpp:643
-
bool operator>=(const T other)
operator >= for other types
Definition uint128_t.hpp:697
+
class for 128-bit unsigned integer
Definition uint128_t.hpp:60
+
uint128_t & operator%=(const T &p)
operator %= for uint128_t
Definition uint128_t.hpp:565
+
uint128_t operator-()
operator - using twos complement
Definition uint128_t.hpp:338
+
uint128_t & operator-=(const T &p)
operator -= for uint128_t and other integer types.
Definition uint128_t.hpp:366
+
bool operator&&(const T b)
operator && for other types
Definition uint128_t.hpp:734
+
uint128_t & operator>>=(const T p)
operator >>= for uint128_t
Definition uint128_t.hpp:826
+
uint128_t(const std::string &str)
Parameterized constructor.
Definition uint128_t.hpp:107
+
uint128_t operator+(const uint128_t &p)
operator + for uint128_t and other integer types.
Definition uint128_t.hpp:262
+
uint128_t operator<<(const T p)
operator << for uint128_t
Definition uint128_t.hpp:765
+
bool operator<=(const uint128_t &other)
operator <= for uint128_t
Definition uint128_t.hpp:584
+
uint128_t & operator--()
operator – (pre-decrement)
Definition uint128_t.hpp:344
+
uint64_t upper() const
returns upper 64-bit integer part
Definition uint128_t.hpp:208
+
uint128_t & operator&=(const T p)
operator &= for other types (bitwise operator)
Definition uint128_t.hpp:880
+
uint128_t & operator%=(const uint128_t &p)
operator %= for uint128_t
Definition uint128_t.hpp:552
+
bool operator>(const uint128_t &other)
operator > for uint128_t
Definition uint128_t.hpp:593
+
uint128_t operator--(int p)
operator – (post-decrement)
Definition uint128_t.hpp:353
+
uint128_t operator|(const uint128_t &p)
operator | for uint128_t (bitwise operator)
Definition uint128_t.hpp:902
+
uint128_t & operator/=(const uint128_t &p)
operator /= for uint128_t
Definition uint128_t.hpp:510
+
uint128_t & operator*=(const T p)
operator *= for uint128_t and other integer types.
Definition uint128_t.hpp:424
+
uint128_t operator/(const uint128_t &p)
operator / for uint128_t and other integer types.
Definition uint128_t.hpp:489
+
bool operator||(const uint128_t &b)
operator || for uint128_t
Definition uint128_t.hpp:644
+
bool operator>=(const T other)
operator >= for other types
Definition uint128_t.hpp:698
uint128_t & operator=(uint128_t &&p)=default
Move assignment operator.
-
uint128_t operator|(const T p)
operator | for other types (bitwise operator)
Definition uint128_t.hpp:892
+
uint128_t operator|(const T p)
operator | for other types (bitwise operator)
Definition uint128_t.hpp:893
~uint128_t()=default
Destructor for uint128_t.
-
uint128_t operator~()
operator ~ for uint128_t
Definition uint128_t.hpp:754
-
uint128_t operator*(const uint128_t &p)
operator * for uint128_t and other integer types.
Definition uint128_t.hpp:401
-
uint128_t & operator^=(const T &p)
operator ^= for other types (bitwise operator)
Definition uint128_t.hpp:969
-
bool operator<=(const T other)
operator <= for other types
Definition uint128_t.hpp:673
-
uint128_t operator*(const T p)
operator * for uint128_t and other integer types.
Definition uint128_t.hpp:392
-
uint128_t operator+(const T p)
operator + for uint128_t and other integer types.
Definition uint128_t.hpp:252
-
uint128_t & operator+=(const T p)
operator += for uint128_t and other integer types.
Definition uint128_t.hpp:273
-
bool operator<(const T other)
operator < for other types
Definition uint128_t.hpp:661
-
friend std::ostream & operator<<(std::ostream &op, const uint128_t &p)
operator << for printing uint128_t integer
Definition uint128_t.hpp:983
+
uint128_t operator~()
operator ~ for uint128_t
Definition uint128_t.hpp:755
+
uint128_t operator*(const uint128_t &p)
operator * for uint128_t and other integer types.
Definition uint128_t.hpp:402
+
uint128_t & operator^=(const T &p)
operator ^= for other types (bitwise operator)
Definition uint128_t.hpp:970
+
bool operator<=(const T other)
operator <= for other types
Definition uint128_t.hpp:674
+
uint128_t operator*(const T p)
operator * for uint128_t and other integer types.
Definition uint128_t.hpp:393
+
uint128_t operator+(const T p)
operator + for uint128_t and other integer types.
Definition uint128_t.hpp:253
+
uint128_t & operator+=(const T p)
operator += for uint128_t and other integer types.
Definition uint128_t.hpp:274
+
bool operator<(const T other)
operator < for other types
Definition uint128_t.hpp:662
+
friend std::ostream & operator<<(std::ostream &op, const uint128_t &p)
operator << for printing uint128_t integer
Definition uint128_t.hpp:984
uint128_t(const uint128_t &num)=default
Copy constructor.
-
uint128_t & operator|=(const T p)
operator |= for other types (bitwise operator)
Definition uint128_t.hpp:924
-
uint128_t operator-(const T &p)
operator - for uint128_t and other integer types.
Definition uint128_t.hpp:318
-
uint128_t operator>>(const T p)
operator >> for uint128_t
Definition uint128_t.hpp:805
-
bool operator!=(const T other)
operator != for other types
Definition uint128_t.hpp:721
-
bool operator==(const T other)
operator == for other types
Definition uint128_t.hpp:709
-
bool operator==(const uint128_t &other)
operator == for uint128_t
Definition uint128_t.hpp:610
-
uint32_t _trz()
Trailing zeroes in binary.
Definition uint128_t.hpp:162
-
uint128_t(uint128_t &&num) noexcept
Move constructor.
Definition uint128_t.hpp:127
-
bool operator||(const T b)
operator || for other types
Definition uint128_t.hpp:746
-
uint128_t operator-(const uint128_t &p)
operator - for uint128_t
Definition uint128_t.hpp:328
-
bool operator>(const T other)
operator > for other types
Definition uint128_t.hpp:685
-
void __get_integer_from_string(const std::string &str)
First and second half of 128 bit number.
Definition uint128_t.hpp:69
-
std::pair< uint128_t, uint128_t > divide(const uint128_t &p)
divide function for uint128_t and other integer types.
Definition uint128_t.hpp:454
-
uint128_t operator^(const uint128_t &p)
operator ^ for uint128_t (bitwise operator)
Definition uint128_t.hpp:946
-
uint128_t(const uint64_t high, const uint64_t low)
Parameterized constructor.
Definition uint128_t.hpp:115
-
uint128_t & operator*=(const uint128_t &p)
operator *= for uint128_t and other integer types.
Definition uint128_t.hpp:433
-
uint128_t & operator+=(const uint128_t &p)
operator += for uint128_t
Definition uint128_t.hpp:285
-
uint128_t operator&(const T p)
operator & for other types (bitwise operator)
Definition uint128_t.hpp:855
-
uint128_t & operator<<=(const T p)
operator <<= for uint128_t
Definition uint128_t.hpp:784
-
uint64_t lower() const
returns lower 64-bit integer part
Definition uint128_t.hpp:201
-
uint128_t & operator/=(const T p)
operator /= for uint128_t and other integer types.
Definition uint128_t.hpp:522
-
uint128_t operator^(const T p)
operator ^ for other types (bitwise operator)
Definition uint128_t.hpp:937
-
bool operator&&(const uint128_t &b)
operator && for uint128_t
Definition uint128_t.hpp:634
-
bool operator!=(const uint128_t &other)
operator != for uint128_t
Definition uint128_t.hpp:619
+
uint128_t & operator|=(const T p)
operator |= for other types (bitwise operator)
Definition uint128_t.hpp:925
+
uint128_t operator-(const T &p)
operator - for uint128_t and other integer types.
Definition uint128_t.hpp:319
+
uint128_t operator>>(const T p)
operator >> for uint128_t
Definition uint128_t.hpp:806
+
bool operator!=(const T other)
operator != for other types
Definition uint128_t.hpp:722
+
bool operator==(const T other)
operator == for other types
Definition uint128_t.hpp:710
+
bool operator==(const uint128_t &other)
operator == for uint128_t
Definition uint128_t.hpp:611
+
uint32_t _trz()
Trailing zeroes in binary.
Definition uint128_t.hpp:163
+
uint128_t(uint128_t &&num) noexcept
Move constructor.
Definition uint128_t.hpp:128
+
bool operator||(const T b)
operator || for other types
Definition uint128_t.hpp:747
+
uint128_t operator-(const uint128_t &p)
operator - for uint128_t
Definition uint128_t.hpp:329
+
bool operator>(const T other)
operator > for other types
Definition uint128_t.hpp:686
+
void __get_integer_from_string(const std::string &str)
First and second half of 128 bit number.
Definition uint128_t.hpp:70
+
std::pair< uint128_t, uint128_t > divide(const uint128_t &p)
divide function for uint128_t and other integer types.
Definition uint128_t.hpp:455
+
uint128_t operator^(const uint128_t &p)
operator ^ for uint128_t (bitwise operator)
Definition uint128_t.hpp:947
+
uint128_t(const uint64_t high, const uint64_t low)
Parameterized constructor.
Definition uint128_t.hpp:116
+
uint128_t & operator*=(const uint128_t &p)
operator *= for uint128_t and other integer types.
Definition uint128_t.hpp:434
+
uint128_t & operator+=(const uint128_t &p)
operator += for uint128_t
Definition uint128_t.hpp:286
+
uint128_t operator&(const T p)
operator & for other types (bitwise operator)
Definition uint128_t.hpp:856
+
uint128_t & operator<<=(const T p)
operator <<= for uint128_t
Definition uint128_t.hpp:785
+
uint64_t lower() const
returns lower 64-bit integer part
Definition uint128_t.hpp:202
+
uint128_t & operator/=(const T p)
operator /= for uint128_t and other integer types.
Definition uint128_t.hpp:523
+
uint128_t operator^(const T p)
operator ^ for other types (bitwise operator)
Definition uint128_t.hpp:938
+
bool operator&&(const uint128_t &b)
operator && for uint128_t
Definition uint128_t.hpp:635
+
bool operator!=(const uint128_t &other)
operator != for uint128_t
Definition uint128_t.hpp:620
uint128_t & operator=(const uint128_t &p)=default
operator = for uint128_t
-
uint128_t & operator|=(const uint128_t &p)
operator |= for uint128_t (bitwise operator)
Definition uint128_t.hpp:910
-
uint128_t & operator=(const std::string &p)
operator = for type string
Definition uint128_t.hpp:227
-
uint128_t & operator-=(const uint128_t &p)
operator -= for uint128_t
Definition uint128_t.hpp:377
-
uint128_t operator%(const uint128_t &p)
operator % for uint128_t
Definition uint128_t.hpp:532
-
uint128_t & operator&=(const uint128_t &p)
operator &= for uint128_t (bitwise operator)
Definition uint128_t.hpp:865
-
uint128_t & operator++()
pre-increment operator
Definition uint128_t.hpp:296
-
uint128_t & operator=(const T &p)
operator = for other types
Definition uint128_t.hpp:217
-
bool operator<(const uint128_t &other)
operator < for uint128_t
Definition uint128_t.hpp:574
-
uint128_t operator&(const uint128_t &p)
operator & for uint128_t (bitwise operator)
Definition uint128_t.hpp:843
-
bool operator!()
operator ! for uint128_t
Definition uint128_t.hpp:627
-
uint128_t(T low)
Parameterized constructor.
Definition uint128_t.hpp:100
-
uint128_t operator%(const T &p)
operator % for uint128_t and other integer types.
Definition uint128_t.hpp:542
-
uint128_t & operator^=(const uint128_t &p)
operator ^= for uint128_t (bitwise operator)
Definition uint128_t.hpp:955
-
bool operator>=(const uint128_t &other)
operator >= for uint128_t
Definition uint128_t.hpp:601
-
uint128_t operator/(const T p)
operator / for uint128_t and other integer types.
Definition uint128_t.hpp:498
-
uint32_t _lez()
Leading zeroes in binary.
Definition uint128_t.hpp:139
-
bool operator()()
operator () for uint128_t
Definition uint128_t.hpp:651
-
uint128_t operator++(int)
post-increment operator
Definition uint128_t.hpp:305
+
uint128_t & operator|=(const uint128_t &p)
operator |= for uint128_t (bitwise operator)
Definition uint128_t.hpp:911
+
uint128_t & operator=(const std::string &p)
operator = for type string
Definition uint128_t.hpp:228
+
uint128_t & operator-=(const uint128_t &p)
operator -= for uint128_t
Definition uint128_t.hpp:378
+
uint128_t operator%(const uint128_t &p)
operator % for uint128_t
Definition uint128_t.hpp:533
+
uint128_t & operator&=(const uint128_t &p)
operator &= for uint128_t (bitwise operator)
Definition uint128_t.hpp:866
+
uint128_t & operator++()
pre-increment operator
Definition uint128_t.hpp:297
+
uint128_t & operator=(const T &p)
operator = for other types
Definition uint128_t.hpp:218
+
bool operator<(const uint128_t &other)
operator < for uint128_t
Definition uint128_t.hpp:575
+
uint128_t operator&(const uint128_t &p)
operator & for uint128_t (bitwise operator)
Definition uint128_t.hpp:844
+
bool operator!()
operator ! for uint128_t
Definition uint128_t.hpp:628
+
uint128_t(T low)
Parameterized constructor.
Definition uint128_t.hpp:101
+
uint128_t operator%(const T &p)
operator % for uint128_t and other integer types.
Definition uint128_t.hpp:543
+
uint128_t & operator^=(const uint128_t &p)
operator ^= for uint128_t (bitwise operator)
Definition uint128_t.hpp:956
+
bool operator>=(const uint128_t &other)
operator >= for uint128_t
Definition uint128_t.hpp:602
+
uint128_t operator/(const T p)
operator / for uint128_t and other integer types.
Definition uint128_t.hpp:499
+
uint32_t _lez()
Leading zeroes in binary.
Definition uint128_t.hpp:140
+
bool operator()()
operator () for uint128_t
Definition uint128_t.hpp:652
+
uint128_t operator++(int)
post-increment operator
Definition uint128_t.hpp:306
T end(T... args)
@@ -1435,7 +1436,7 @@ $(function(){initNavTree('da/d41/uint128__t_8hpp_source.html','../../'); initRes
T push_back(T... args)
T reverse(T... args)
T size(T... args)
-
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:37
+
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:38
diff --git a/da/d49/classgreedy__algorithms_1_1_digit_separation.html b/da/d49/classgreedy__algorithms_1_1_digit_separation.html index 178e109ce..2c007897a 100644 --- a/da/d49/classgreedy__algorithms_1_1_digit_separation.html +++ b/da/d49/classgreedy__algorithms_1_1_digit_separation.html @@ -196,7 +196,7 @@ Public Member Functions
73 return result;
74 }
std::vector< std::int64_t > digitSeparationReverseOrder(std::int64_t largeNumber) const
Implementation of digitSeparationReverseOrder method.
Definition digit_separation.cpp:48
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T reverse(T... args)
diff --git a/da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html b/da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html index b6ab89bc1..9df44571a 100644 --- a/da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html +++ b/da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('da/d50/count__of__trailing__ciphers__in__factorial__n_

Count the number of ciphers in n! implementation More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for count_of_trailing_ciphers_in_factorial_n.cpp:
-
+
- + @@ -164,11 +165,11 @@ Functions

Main function.

Returns
0 on exit
-
95 {
-
96 test(); // run self-test implementations
-
97 return 0;
-
98}
-
static void test()
Self-test implementations.
Definition count_of_trailing_ciphers_in_factorial_n.cpp:59
+
96 {
+
97 test(); // run self-test implementations
+
98 return 0;
+
99}
+
static void test()
Self-test implementations.
Definition count_of_trailing_ciphers_in_factorial_n.cpp:60
Here is the call graph for this function:
@@ -200,18 +201,18 @@ Here is the call graph for this function:
Returns
count, Number of ciphers in n!.
-
40 {
-
41 // count is to store the number of 5's in factorial(n)
-
42 uint64_t count = 0;
-
43
-
44 // Keep dividing n by powers of
-
45 // 5 and update count
-
46 for (uint64_t i = 5; n / i >= 1; i *= 5) {
-
47 count += static_cast<uint64_t>(n) / i;
-
48 }
-
49
-
50 return count;
-
51}
+
41 {
+
42 // count is to store the number of 5's in factorial(n)
+
43 uint64_t count = 0;
+
44
+
45 // Keep dividing n by powers of
+
46 // 5 and update count
+
47 for (uint64_t i = 5; n / i >= 1; i *= 5) {
+
48 count += static_cast<uint64_t>(n) / i;
+
49 }
+
50
+
51 return count;
+
52}
Here is the call graph for this function:
@@ -245,39 +246,39 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
59 {
-
60 // 1st test
-
61 std::cout << "1st test ";
-
62 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
- -
64 std::cout << "passed" << std::endl;
-
65
-
66 // 2nd test
-
67 std::cout << "2nd test ";
-
68 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
-
69 numberOfCiphersInFactorialN(977) == 242);
-
70 std::cout << "passed" << std::endl;
-
71
-
72 // 3rd test
-
73 std::cout << "3rd test ";
-
74 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
-
75 numberOfCiphersInFactorialN(871) == 215);
-
76 std::cout << "passed" << std::endl;
-
77
-
78 // 4th test
-
79 std::cout << "4th test ";
-
80 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
- -
82 std::cout << "passed" << std::endl;
-
83
-
84 // 5th test
-
85 std::cout << "5th test ";
-
86 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
- -
88 std::cout << "passed" << std::endl;
-
89}
+
60 {
+
61 // 1st test
+
62 std::cout << "1st test ";
+
63 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
+ +
65 std::cout << "passed" << std::endl;
+
66
+
67 // 2nd test
+
68 std::cout << "2nd test ";
+
69 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
+
70 numberOfCiphersInFactorialN(977) == 242);
+
71 std::cout << "passed" << std::endl;
+
72
+
73 // 3rd test
+
74 std::cout << "3rd test ";
+
75 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
+
76 numberOfCiphersInFactorialN(871) == 215);
+
77 std::cout << "passed" << std::endl;
+
78
+
79 // 4th test
+
80 std::cout << "4th test ";
+
81 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
+ +
83 std::cout << "passed" << std::endl;
+
84
+
85 // 5th test
+
86 std::cout << "5th test ";
+
87 assert(bit_manipulation::count_of_trailing_ciphers_in_factorial_n::
+ +
89 std::cout << "passed" << std::endl;
+
90}
-
uint64_t numberOfCiphersInFactorialN(uint64_t n)
Function to count the number of the trailing ciphers.
Definition count_of_trailing_ciphers_in_factorial_n.cpp:40
+
uint64_t numberOfCiphersInFactorialN(uint64_t n)
Function to count the number of the trailing ciphers.
Definition count_of_trailing_ciphers_in_factorial_n.cpp:41
T endl(T... args)
Here is the call graph for this function:
diff --git a/da/d5a/class_complex.html b/da/d5a/class_complex.html index 1a5622ab5..3b48dec90 100644 --- a/da/d5a/class_complex.html +++ b/da/d5a/class_complex.html @@ -401,7 +401,7 @@ Here is the call graph for this function:
120 return result;
121 }
Class Complex to represent complex numbers as a field.
Definition complex_numbers.cpp:20
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
diff --git a/da/d61/structsearch_1_1sublist__search_1_1_node.html b/da/d61/structsearch_1_1sublist__search_1_1_node.html index 6ab68dde5..57d016c89 100644 --- a/da/d61/structsearch_1_1sublist__search_1_1_node.html +++ b/da/d61/structsearch_1_1sublist__search_1_1_node.html @@ -145,7 +145,7 @@ uint32_t 

pointer to the next node

-
49{}; ///< pointer to the next node
+
50{}; ///< pointer to the next node
diff --git a/da/d74/connected__components__with__dsu_8cpp__incl.map b/da/d74/connected__components__with__dsu_8cpp__incl.map index a494eea6f..b85124de1 100644 --- a/da/d74/connected__components__with__dsu_8cpp__incl.map +++ b/da/d74/connected__components__with__dsu_8cpp__incl.map @@ -1,9 +1,11 @@ - - - - - - - + + + + + + + + + diff --git a/da/d74/connected__components__with__dsu_8cpp__incl.md5 b/da/d74/connected__components__with__dsu_8cpp__incl.md5 index bff3a554a..be0f63b3f 100644 --- a/da/d74/connected__components__with__dsu_8cpp__incl.md5 +++ b/da/d74/connected__components__with__dsu_8cpp__incl.md5 @@ -1 +1 @@ -ae97e5013bd56e82b3e35fbe158b6e15 \ No newline at end of file +4f851bb142229ec74c66db41c8b32528 \ No newline at end of file diff --git a/da/d74/connected__components__with__dsu_8cpp__incl.svg b/da/d74/connected__components__with__dsu_8cpp__incl.svg index a7f83e38d..e46f27f6d 100644 --- a/da/d74/connected__components__with__dsu_8cpp__incl.svg +++ b/da/d74/connected__components__with__dsu_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -graph/connected_components -_with_dsu.cpp + +graph/connected_components +_with_dsu.cpp @@ -33,8 +33,8 @@ Node2 - -iostream + +cstdint @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -set + +iostream @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -vector + +set @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/da/d74/connected__components__with__dsu_8cpp__incl_org.svg b/da/d74/connected__components__with__dsu_8cpp__incl_org.svg index 08190a826..9fabe3521 100644 --- a/da/d74/connected__components__with__dsu_8cpp__incl_org.svg +++ b/da/d74/connected__components__with__dsu_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + graph/connected_components_with_dsu.cpp Node1 - -graph/connected_components -_with_dsu.cpp + +graph/connected_components +_with_dsu.cpp @@ -22,8 +22,8 @@ Node2 - -iostream + +cstdint @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -set + +iostream @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -vector + +set @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/da/d9a/class_graph.html b/da/d9a/class_graph.html index 15f2a777f..47badc1e3 100644 --- a/da/d9a/class_graph.html +++ b/da/d9a/class_graph.html @@ -348,7 +348,7 @@ int max_flow = 0<

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 
namespace  count_of_trailing_ciphers_in_factorial_n
 Functions for the Count the number of ciphers in n! implementation.
data = 0
-
56: m_adjList({}) {}
+
57: m_adjList({}) {}
@@ -386,7 +386,7 @@ int max_flow = 0< -
69 : m_vertices(vertices), m_adjList(std::move(adjList)) {}
+
70 : m_vertices(vertices), m_adjList(std::move(adjList)) {}
T move(T... args)
@@ -425,7 +425,7 @@ int max_flow = 0< -
77 : m_vertices(vertices), m_adjList(std::move(adjList)) {}
+
78 : m_vertices(vertices), m_adjList(std::move(adjList)) {}
@@ -464,15 +464,15 @@ int max_flow = 0< -
89 : m_vertices(vertices) {
-
90 for (auto const& edge : edges) {
-
91 if (edge.src >= vertices || edge.dest >= vertices) {
-
92 throw std::range_error(
-
93 "Either src or dest of edge out of range");
-
94 }
-
95 m_adjList[edge.src].emplace_back(edge.dest);
-
96 }
-
97 }
+
90 : m_vertices(vertices) {
+
91 for (auto const& edge : edges) {
+
92 if (edge.src >= vertices || edge.dest >= vertices) {
+
93 throw std::range_error(
+
94 "Either src or dest of edge out of range");
+
95 }
+
96 m_adjList[edge.src].emplace_back(edge.dest);
+
97 }
+
98 }
@@ -507,12 +507,12 @@ int max_flow = 0< -
124 {
-
125 if (edge.src >= m_vertices || edge.dest >= m_vertices) {
-
126 throw std::range_error("Either src or dest of edge out of range");
-
127 }
-
128 m_adjList[edge.src].emplace_back(edge.dest);
-
129 }
+
125 {
+
126 if (edge.src >= m_vertices || edge.dest >= m_vertices) {
+
127 throw std::range_error("Either src or dest of edge out of range");
+
128 }
+
129 m_adjList[edge.src].emplace_back(edge.dest);
+
130 }
@@ -631,13 +631,13 @@ int max_flow = 0< -
136 {
-
137 if (source >= m_vertices || destination >= m_vertices) {
-
138 throw std::range_error(
-
139 "Either source or destination of edge out of range");
-
140 }
-
141 m_adjList[source].emplace_back(destination);
-
142 }
+
137 {
+
138 if (source >= m_vertices || destination >= m_vertices) {
+
139 throw std::range_error(
+
140 "Either source or destination of edge out of range");
+
141 }
+
142 m_adjList[source].emplace_back(destination);
+
143 }
@@ -670,7 +670,7 @@ int max_flow = 0< -
118{ m_vertices += num; }
+
119{ m_vertices += num; }
@@ -798,9 +798,9 @@ int max_flow = 0<

Return a const reference of the adjacency list.

Returns
const reference to the adjacency list
-
103 {
-
104 return m_adjList;
-
105 }
+
104 {
+
105 return m_adjList;
+
106 }
@@ -827,7 +827,7 @@ int max_flow = 0<
Returns
number of vertices in the graph.
-
110{ return m_vertices; }
+
111{ return m_vertices; }
diff --git a/da/da3/uint256__t_8hpp.html b/da/da3/uint256__t_8hpp.html index 51299aa4e..21f23f8bc 100644 --- a/da/da3/uint256__t_8hpp.html +++ b/da/da3/uint256__t_8hpp.html @@ -117,7 +117,7 @@ $(function(){initNavTree('da/da3/uint256__t_8hpp.html','../../'); initResizable(
Include dependency graph for uint256_t.hpp:
-
+
This graph shows which files directly or indirectly include this file:
diff --git a/da/da3/uint256__t_8hpp_source.html b/da/da3/uint256__t_8hpp_source.html index ea84a4b62..c1a161f4c 100644 --- a/da/da3/uint256__t_8hpp_source.html +++ b/da/da3/uint256__t_8hpp_source.html @@ -1315,11 +1315,11 @@ $(function(){initNavTree('da/da3/uint256__t_8hpp_source.html','../../'); initRes
1074#endif // CIPHERS_UINT256_T_HPP_
-
class for 128-bit unsigned integer
Definition uint128_t.hpp:59
-
uint64_t upper() const
returns upper 64-bit integer part
Definition uint128_t.hpp:207
-
uint32_t _trz()
Trailing zeroes in binary.
Definition uint128_t.hpp:162
-
uint64_t lower() const
returns lower 64-bit integer part
Definition uint128_t.hpp:201
-
uint32_t _lez()
Leading zeroes in binary.
Definition uint128_t.hpp:139
+
class for 128-bit unsigned integer
Definition uint128_t.hpp:60
+
uint64_t upper() const
returns upper 64-bit integer part
Definition uint128_t.hpp:208
+
uint32_t _trz()
Trailing zeroes in binary.
Definition uint128_t.hpp:163
+
uint64_t lower() const
returns lower 64-bit integer part
Definition uint128_t.hpp:202
+
uint32_t _lez()
Leading zeroes in binary.
Definition uint128_t.hpp:140
class for 256-bit unsigned integer
Definition uint256_t.hpp:33
uint256_t(uint128_t high, uint128_t low)
Parameterized constructor.
Definition uint256_t.hpp:103
bool operator!()
operator ! for uint256_t
Definition uint256_t.hpp:596
@@ -1410,7 +1410,7 @@ $(function(){initNavTree('da/da3/uint256__t_8hpp_source.html','../../'); initRes
T size(T... args)
-
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:37
+
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:38
diff --git a/da/db8/count__of__set__bits_8cpp.html b/da/db8/count__of__set__bits_8cpp.html index 28b830566..81a32e205 100644 --- a/da/db8/count__of__set__bits_8cpp.html +++ b/da/db8/count__of__set__bits_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('da/db8/count__of__set__bits_8cpp.html','../../'); init

Implementation to [count number of set bits of a number] (https://www.geeksforgeeks.org/count-set-bits-in-an-integer/) in an integer. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for count_of_set_bits.cpp:
-
+
- + @@ -171,21 +172,21 @@ Functions
Returns
total number of set-bits in the binary representation of number n
-
38 { // int64_t is preferred over int so that
-
39 // no Overflow can be there.
-
40
-
41 int count = 0; // "count" variable is used to count number of set-bits('1')
-
42 // in binary representation of number 'n'
-
43 while (n != 0) {
-
44 ++count;
-
45 n = (n & (n - 1));
-
46 }
-
47 return count;
-
48 // Why this algorithm is better than the standard one?
-
49 // Because this algorithm runs the same number of times as the number of
-
50 // set-bits in it. Means if my number is having "3" set bits, then this
-
51 // while loop will run only "3" times!!
-
52}
+
39 { // int64_t is preferred over int so that
+
40 // no Overflow can be there.
+
41
+
42 int count = 0; // "count" variable is used to count number of set-bits('1')
+
43 // in binary representation of number 'n'
+
44 while (n != 0) {
+
45 ++count;
+
46 n = (n & (n - 1));
+
47 }
+
48 return count;
+
49 // Why this algorithm is better than the standard one?
+
50 // Because this algorithm runs the same number of times as the number of
+
51 // set-bits in it. Means if my number is having "3" set bits, then this
+
52 // while loop will run only "3" times!!
+
53}
Here is the call graph for this function:
@@ -211,10 +212,10 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
79 {
-
80 test(); // run self-test implementations
-
81 return 0;
-
82}
+
80 {
+
81 test(); // run self-test implementations
+
82 return 0;
+
83}
@@ -240,25 +241,25 @@ Here is the call graph for this function:

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 
namespace  count_of_set_bits
 Functions for the count sets bits implementation.
-
56 {
-
57 // n = 4 return 1
-
58 assert(bit_manipulation::count_of_set_bits::countSetBits(4) == 1);
-
59 // n = 6 return 2
-
60 assert(bit_manipulation::count_of_set_bits::countSetBits(6) == 2);
-
61 // n = 13 return 3
-
62 assert(bit_manipulation::count_of_set_bits::countSetBits(13) == 3);
-
63 // n = 9 return 2
-
64 assert(bit_manipulation::count_of_set_bits::countSetBits(9) == 2);
-
65 // n = 15 return 4
-
66 assert(bit_manipulation::count_of_set_bits::countSetBits(15) == 4);
-
67 // n = 25 return 3
-
68 assert(bit_manipulation::count_of_set_bits::countSetBits(25) == 3);
-
69 // n = 97 return 3
-
70 assert(bit_manipulation::count_of_set_bits::countSetBits(97) == 3);
-
71 // n = 31 return 5
-
72 assert(bit_manipulation::count_of_set_bits::countSetBits(31) == 5);
-
73 std::cout << "All test cases successfully passed!" << std::endl;
-
74}
+
57 {
+
58 // n = 4 return 1
+
59 assert(bit_manipulation::count_of_set_bits::countSetBits(4) == 1);
+
60 // n = 6 return 2
+
61 assert(bit_manipulation::count_of_set_bits::countSetBits(6) == 2);
+
62 // n = 13 return 3
+
63 assert(bit_manipulation::count_of_set_bits::countSetBits(13) == 3);
+
64 // n = 9 return 2
+
65 assert(bit_manipulation::count_of_set_bits::countSetBits(9) == 2);
+
66 // n = 15 return 4
+
67 assert(bit_manipulation::count_of_set_bits::countSetBits(15) == 4);
+
68 // n = 25 return 3
+
69 assert(bit_manipulation::count_of_set_bits::countSetBits(25) == 3);
+
70 // n = 97 return 3
+
71 assert(bit_manipulation::count_of_set_bits::countSetBits(97) == 3);
+
72 // n = 31 return 5
+
73 assert(bit_manipulation::count_of_set_bits::countSetBits(31) == 5);
+
74 std::cout << "All test cases successfully passed!" << std::endl;
+
75}
T endl(T... args)
diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp.html b/da/dc9/fibonacci__matrix__exponentiation_8cpp.html index 4702560fa..6e08ab355 100644 --- a/da/dc9/fibonacci__matrix__exponentiation_8cpp.html +++ b/da/dc9/fibonacci__matrix__exponentiation_8cpp.html @@ -112,21 +112,22 @@ $(function(){initNavTree('da/dc9/fibonacci__matrix__exponentiation_8cpp.html','.

This program computes the N^th Fibonacci number in modulo mod input argument . More...

-
#include <iostream>
+
#include <cassert>
+#include <cstdint>
+#include <iostream>
#include <vector>
-#include <cassert>
Include dependency graph for fibonacci_matrix_exponentiation.cpp:
-
+
- - + +

Functions

uint64_t fibo (uint64_t n, uint64_t mod)
 
void test ()
 
static void test ()
 
int main ()
 
@@ -163,68 +164,70 @@ Functions -
24{
- - - -
28 n--;
-
29 result[0]=1, result[1]=1;
-
30 Identity[0][0]=1; Identity[0][1]=0;
-
31 Identity[1][0]=0; Identity[1][1]=1;
-
32
-
33 transition[0][0]=0;
-
34 transition[1][0]=transition[1][1]=transition[0][1]=1;
-
35
-
36 while(n)
-
37 {
-
38 if(n%2)
-
39 {
- -
41 for(int i=0;i<2;i++)
-
42 {
-
43 for(int j=0;j<2;j++)
-
44 {
-
45 for(int k=0;k<2;k++)
-
46 {
-
47 res[i][j]=(res[i][j]%mod+((Identity[i][k]%mod*transition[k][j]%mod))%mod)%mod;
-
48 }
-
49 }
-
50 }
-
51 for(int i=0;i<2;i++)
-
52 {
-
53 for(int j=0;j<2;j++)
-
54 {
-
55 Identity[i][j]=res[i][j];
-
56 }
-
57 }
-
58 n--;
-
59 }
-
60 else{
- -
62 for(int i=0;i<2;i++)
-
63 {
-
64 for(int j=0;j<2;j++)
-
65 {
-
66 for(int k=0;k<2;k++)
-
67 {
-
68 res1[i][j]=(res1[i][j]%mod+((transition[i][k]%mod*transition[k][j]%mod))%mod)%mod;
-
69 }
-
70 }
-
71 }
-
72 for(int i=0;i<2;i++)
-
73 {
-
74 for(int j=0;j<2;j++)
-
75 {
-
76 transition[i][j]=res1[i][j];
-
77 }
-
78 }
-
79 n=n/2;
-
80 }
-
81 }
-
82 return ((result[0]%mod*Identity[0][0]%mod)%mod+(result[1]%mod*Identity[1][0]%mod)%mod)%mod;
-
83}
+
25 {
+ + + + +
30 n--;
+
31 result[0] = 1, result[1] = 1;
+
32 Identity[0][0] = 1;
+
33 Identity[0][1] = 0;
+
34 Identity[1][0] = 0;
+
35 Identity[1][1] = 1;
+
36
+
37 transition[0][0] = 0;
+
38 transition[1][0] = transition[1][1] = transition[0][1] = 1;
+
39
+
40 while (n) {
+
41 if (n % 2) {
+ + +
44 for (int i = 0; i < 2; i++) {
+
45 for (int j = 0; j < 2; j++) {
+
46 for (int k = 0; k < 2; k++) {
+
47 res[i][j] =
+
48 (res[i][j] % mod +
+
49 ((Identity[i][k] % mod * transition[k][j] % mod)) %
+
50 mod) %
+
51 mod;
+
52 }
+
53 }
+
54 }
+
55 for (int i = 0; i < 2; i++) {
+
56 for (int j = 0; j < 2; j++) {
+
57 Identity[i][j] = res[i][j];
+
58 }
+
59 }
+
60 n--;
+
61 } else {
+ +
63 2, std::vector<uint64_t>(2, 0));
+
64 for (int i = 0; i < 2; i++) {
+
65 for (int j = 0; j < 2; j++) {
+
66 for (int k = 0; k < 2; k++) {
+
67 res1[i][j] =
+
68 (res1[i][j] % mod + ((transition[i][k] % mod *
+
69 transition[k][j] % mod)) %
+
70 mod) %
+
71 mod;
+
72 }
+
73 }
+
74 }
+
75 for (int i = 0; i < 2; i++) {
+
76 for (int j = 0; j < 2; j++) {
+
77 transition[i][j] = res1[i][j];
+
78 }
+
79 }
+
80 n = n / 2;
+
81 }
+
82 }
+
83 return ((result[0] % mod * Identity[0][0] % mod) % mod +
+
84 (result[1] % mod * Identity[1][0] % mod) % mod) %
+
85 mod;
+
86}
double k(double x)
Another test function.
Definition composite_simpson_rule.cpp:117
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
@@ -244,18 +247,20 @@ Functions

Main function

-
107{
-
108 test();
-
109 uint64_t mod=1000000007;
-
110 std::cout<<"Enter the value of N: ";
-
111 uint64_t n=0; std::cin>>n;
-
112 std::cout<<n<<"th Fibonacci number in modulo " << mod << ": "<< fibo( n , mod) << std::endl;
-
113}
+
108 {
+
109 test();
+
110 uint64_t mod = 1000000007;
+
111 std::cout << "Enter the value of N: ";
+
112 uint64_t n = 0;
+
113 std::cin >> n;
+
114 std::cout << n << "th Fibonacci number in modulo " << mod << ": "
+
115 << fibo(n, mod) << std::endl;
+
116}
T endl(T... args)
-
uint64_t fibo(uint64_t n, uint64_t mod)
Definition fibonacci_matrix_exponentiation.cpp:23
-
void test()
Definition fibonacci_matrix_exponentiation.cpp:88
+
static void test()
Definition fibonacci_matrix_exponentiation.cpp:91
+
uint64_t fibo(uint64_t n, uint64_t mod)
Definition fibonacci_matrix_exponentiation.cpp:25
Here is the call graph for this function:
@@ -264,38 +269,46 @@ Here is the call graph for this function:
- -

◆ test()

+ +

◆ test()

+ + + + + +
- +
void test static void test ( )
+
+static

Function to test above algorithm

-
89{
-
90 assert(fibo(6, 1000000007 ) == 8);
-
91 std::cout << "test case:1 passed\n";
-
92 assert(fibo(5, 1000000007 ) == 5);
-
93 std::cout << "test case:2 passed\n";
-
94 assert(fibo(10 , 1000000007) == 55);
-
95 std::cout << "test case:3 passed\n";
-
96 assert(fibo(500 , 100) == 25);
+
91 {
+
92 assert(fibo(6, 1000000007) == 8);
+
93 std::cout << "test case:1 passed\n";
+
94 assert(fibo(5, 1000000007) == 5);
+
95 std::cout << "test case:2 passed\n";
+
96 assert(fibo(10, 1000000007) == 55);
97 std::cout << "test case:3 passed\n";
-
98 assert(fibo(500 , 10000) == 4125);
+
98 assert(fibo(500, 100) == 25);
99 std::cout << "test case:3 passed\n";
-
100 std::cout << "--All tests passed--\n";
-
101}
+
100 assert(fibo(500, 10000) == 4125);
+
101 std::cout << "test case:3 passed\n";
+
102 std::cout << "--All tests passed--\n";
+
103}
Here is the call graph for this function:
-
+
diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp.js b/da/dc9/fibonacci__matrix__exponentiation_8cpp.js index b4eee1a34..518008a46 100644 --- a/da/dc9/fibonacci__matrix__exponentiation_8cpp.js +++ b/da/dc9/fibonacci__matrix__exponentiation_8cpp.js @@ -2,5 +2,5 @@ var fibonacci__matrix__exponentiation_8cpp = [ [ "fibo", "da/dc9/fibonacci__matrix__exponentiation_8cpp.html#abc3bc08249058d57cfc8f54a29d9cf9f", null ], [ "main", "da/dc9/fibonacci__matrix__exponentiation_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], - [ "test", "da/dc9/fibonacci__matrix__exponentiation_8cpp.html#ae1a3968e7947464bee7714f6d43b7002", null ] + [ "test", "da/dc9/fibonacci__matrix__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ] ]; \ No newline at end of file diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map b/da/dc9/fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map similarity index 100% rename from da/dc9/fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map rename to da/dc9/fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 b/da/dc9/fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 similarity index 100% rename from da/dc9/fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 rename to da/dc9/fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg b/da/dc9/fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg similarity index 100% rename from da/dc9/fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg rename to da/dc9/fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg b/da/dc9/fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg similarity index 100% rename from da/dc9/fibonacci__matrix__exponentiation_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg rename to da/dc9/fibonacci__matrix__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index c295d4cb3..6e181a731 100644 --- a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -4,7 +4,7 @@ - + diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index 5faf8cf2d..faaa4c9dd 100644 --- a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -1ab027398e1d305d5f47e3a4a91e624d \ No newline at end of file +0b4e69227131474b2c14d2ac8d188dfc \ No newline at end of file diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index 6b87459a0..6be1219af 100644 --- a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -67,7 +67,7 @@ Node4 - + test diff --git a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index ec4fab367..2fad053d3 100644 --- a/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/da/dc9/fibonacci__matrix__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -56,7 +56,7 @@ Node4 - + test diff --git a/da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html b/da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html index 4a6c710d5..186c30f05 100644 --- a/da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html +++ b/da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html @@ -225,7 +225,7 @@ Functions
75}
T at(T... args)
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T max(T... args)
T sum(const std::vector< std::valarray< T > > &A)
Definition vector_ops.hpp:232
T size(T... args)
diff --git a/da/de6/treap_8cpp__incl.map b/da/de6/treap_8cpp__incl.map index f2e1085b6..e9d631a17 100644 --- a/da/de6/treap_8cpp__incl.map +++ b/da/de6/treap_8cpp__incl.map @@ -1,9 +1,11 @@ - + - + - - - + + + + + diff --git a/da/de6/treap_8cpp__incl.md5 b/da/de6/treap_8cpp__incl.md5 index 133f350a3..fb7d3b21c 100644 --- a/da/de6/treap_8cpp__incl.md5 +++ b/da/de6/treap_8cpp__incl.md5 @@ -1 +1 @@ -8eccd6d756ca12df3d1d31f78b2b8149 \ No newline at end of file +8d50f0b3008818625dcd9ebaece7c341 \ No newline at end of file diff --git a/da/de6/treap_8cpp__incl.svg b/da/de6/treap_8cpp__incl.svg index 079c44ae9..0b8ccc3d7 100644 --- a/da/de6/treap_8cpp__incl.svg +++ b/da/de6/treap_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -data_structures/treap.cpp + +data_structures/treap.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -iostream + +cstdint @@ -77,8 +77,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + diff --git a/da/de6/treap_8cpp__incl_org.svg b/da/de6/treap_8cpp__incl_org.svg index edb43f65c..34bc47b5c 100644 --- a/da/de6/treap_8cpp__incl_org.svg +++ b/da/de6/treap_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + data_structures/treap.cpp Node1 - -data_structures/treap.cpp + +data_structures/treap.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -iostream + +cstdint @@ -66,8 +66,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + diff --git a/da/df2/durand__kerner__roots_8cpp.html b/da/df2/durand__kerner__roots_8cpp.html index ebe2bd4b6..7dae5de80 100644 --- a/da/df2/durand__kerner__roots_8cpp.html +++ b/da/df2/durand__kerner__roots_8cpp.html @@ -117,6 +117,7 @@ $(function(){initNavTree('da/df2/durand__kerner__roots_8cpp.html','../../'); ini #include <cassert>
#include <cmath>
#include <complex>
+#include <cstdint>
#include <cstdlib>
#include <ctime>
#include <fstream>
@@ -209,14 +210,14 @@ Functions
Returns
false if termination not reached
true if termination reached
-
91 {
-
92 static long double past_delta = INFINITY;
-
93 if (std::abs(past_delta - delta) <= ACCURACY || delta < ACCURACY)
-
94 return true;
-
95 past_delta = delta;
-
96 return false;
-
97}
-
#define ACCURACY
Definition durand_kerner_roots.cpp:45
+
92 {
+
93 static long double past_delta = INFINITY;
+
94 if (std::abs(past_delta - delta) <= ACCURACY || delta < ACCURACY)
+
95 return true;
+
96 past_delta = delta;
+
97 return false;
+
98}
+
#define ACCURACY
Definition durand_kerner_roots.cpp:46
@@ -241,14 +242,14 @@ Functions
Returns
pointer to converted string
-
76 {
-
77#define MAX_BUFF_SIZE 50
-
78 static char msg[MAX_BUFF_SIZE];
-
79
-
80 std::snprintf(msg, MAX_BUFF_SIZE, "% 7.04g%+7.04gj", x.real(), x.imag());
-
81
-
82 return msg;
-
83}
+
77 {
+
78#define MAX_BUFF_SIZE 50
+
79 static char msg[MAX_BUFF_SIZE];
+
80
+
81 std::snprintf(msg, MAX_BUFF_SIZE, "% 7.04g%+7.04gj", x.real(), x.imag());
+
82
+
83 return msg;
+
84}
T snprintf(T... args)
T imag(T... args)
T real(T... args)
@@ -293,103 +294,103 @@ Here is the call graph for this function:
Returns
pair of values - number of iterations taken and final accuracy achieved
-
111 {
-
112 long double tol_condition = 1;
-
113 uint32_t iter = 0;
-
114 int n;
-
115 std::ofstream log_file;
-
116
-
117 if (write_log) {
-
118 /*
-
119 * store intermediate values to a CSV file
-
120 */
-
121 log_file.open("durand_kerner.log.csv");
-
122 if (!log_file.is_open()) {
-
123 perror("Unable to create a storage log file!");
-
124 std::exit(EXIT_FAILURE);
-
125 }
-
126 log_file << "iter#,";
-
127
-
128 for (n = 0; n < roots->size(); n++) log_file << "root_" << n << ",";
-
129
-
130 log_file << "avg. correction";
-
131 log_file << "\n0,";
-
132 for (n = 0; n < roots->size(); n++)
-
133 log_file << complex_str((*roots)[n]) << ",";
-
134 }
-
135
-
136 bool break_loop = false;
-
137 while (!check_termination(tol_condition) && iter < INT16_MAX &&
-
138 !break_loop) {
-
139 tol_condition = 0;
-
140 iter++;
-
141 break_loop = false;
-
142
-
143 if (log_file.is_open())
-
144 log_file << "\n" << iter << ",";
-
145
-
146#ifdef _OPENMP
-
147#pragma omp parallel for shared(break_loop, tol_condition)
-
148#endif
-
149 for (n = 0; n < roots->size(); n++) {
-
150 if (break_loop)
-
151 continue;
-
152
-
153 std::complex<double> numerator, denominator;
-
154 numerator = poly_function(coeffs, (*roots)[n]);
-
155 denominator = 1.0;
-
156 for (int i = 0; i < roots->size(); i++)
-
157 if (i != n)
-
158 denominator *= (*roots)[n] - (*roots)[i];
-
159
-
160 std::complex<long double> delta = numerator / denominator;
-
161
-
162 if (std::isnan(std::abs(delta)) || std::isinf(std::abs(delta))) {
-
163 std::cerr << "\n\nOverflow/underrun error - got value = "
-
164 << std::abs(delta) << "\n";
-
165 // return std::pair<uint32_t, double>(iter, tol_condition);
-
166 break_loop = true;
-
167 }
-
168
-
169 (*roots)[n] -= delta;
-
170
-
171#ifdef _OPENMP
-
172#pragma omp critical
-
173#endif
-
174 tol_condition = std::max(tol_condition, std::abs(std::abs(delta)));
-
175 }
-
176 // tol_condition /= (degree - 1);
-
177
-
178 if (break_loop)
-
179 break;
-
180
-
181 if (log_file.is_open()) {
-
182 for (n = 0; n < roots->size(); n++)
-
183 log_file << complex_str((*roots)[n]) << ",";
-
184 }
-
185
-
186#if defined(DEBUG) || !defined(NDEBUG)
-
187 if (iter % 500 == 0) {
-
188 std::cout << "Iter: " << iter << "\t";
-
189 for (n = 0; n < roots->size(); n++)
-
190 std::cout << "\t" << complex_str((*roots)[n]);
-
191 std::cout << "\t\tabsolute average change: " << tol_condition
-
192 << "\n";
-
193 }
-
194#endif
-
195
-
196 if (log_file.is_open())
-
197 log_file << tol_condition;
-
198 }
-
199
-
200 return std::pair<uint32_t, long double>(iter, tol_condition);
-
201}
+
112 {
+
113 long double tol_condition = 1;
+
114 uint32_t iter = 0;
+
115 int n;
+
116 std::ofstream log_file;
+
117
+
118 if (write_log) {
+
119 /*
+
120 * store intermediate values to a CSV file
+
121 */
+
122 log_file.open("durand_kerner.log.csv");
+
123 if (!log_file.is_open()) {
+
124 perror("Unable to create a storage log file!");
+
125 std::exit(EXIT_FAILURE);
+
126 }
+
127 log_file << "iter#,";
+
128
+
129 for (n = 0; n < roots->size(); n++) log_file << "root_" << n << ",";
+
130
+
131 log_file << "avg. correction";
+
132 log_file << "\n0,";
+
133 for (n = 0; n < roots->size(); n++)
+
134 log_file << complex_str((*roots)[n]) << ",";
+
135 }
+
136
+
137 bool break_loop = false;
+
138 while (!check_termination(tol_condition) && iter < INT16_MAX &&
+
139 !break_loop) {
+
140 tol_condition = 0;
+
141 iter++;
+
142 break_loop = false;
+
143
+
144 if (log_file.is_open())
+
145 log_file << "\n" << iter << ",";
+
146
+
147#ifdef _OPENMP
+
148#pragma omp parallel for shared(break_loop, tol_condition)
+
149#endif
+
150 for (n = 0; n < roots->size(); n++) {
+
151 if (break_loop)
+
152 continue;
+
153
+
154 std::complex<double> numerator, denominator;
+
155 numerator = poly_function(coeffs, (*roots)[n]);
+
156 denominator = 1.0;
+
157 for (int i = 0; i < roots->size(); i++)
+
158 if (i != n)
+
159 denominator *= (*roots)[n] - (*roots)[i];
+
160
+
161 std::complex<long double> delta = numerator / denominator;
+
162
+
163 if (std::isnan(std::abs(delta)) || std::isinf(std::abs(delta))) {
+
164 std::cerr << "\n\nOverflow/underrun error - got value = "
+
165 << std::abs(delta) << "\n";
+
166 // return std::pair<uint32_t, double>(iter, tol_condition);
+
167 break_loop = true;
+
168 }
+
169
+
170 (*roots)[n] -= delta;
+
171
+
172#ifdef _OPENMP
+
173#pragma omp critical
+
174#endif
+
175 tol_condition = std::max(tol_condition, std::abs(std::abs(delta)));
+
176 }
+
177 // tol_condition /= (degree - 1);
+
178
+
179 if (break_loop)
+
180 break;
+
181
+
182 if (log_file.is_open()) {
+
183 for (n = 0; n < roots->size(); n++)
+
184 log_file << complex_str((*roots)[n]) << ",";
+
185 }
+
186
+
187#if defined(DEBUG) || !defined(NDEBUG)
+
188 if (iter % 500 == 0) {
+
189 std::cout << "Iter: " << iter << "\t";
+
190 for (n = 0; n < roots->size(); n++)
+
191 std::cout << "\t" << complex_str((*roots)[n]);
+
192 std::cout << "\t\tabsolute average change: " << tol_condition
+
193 << "\n";
+
194 }
+
195#endif
+
196
+
197 if (log_file.is_open())
+
198 log_file << tol_condition;
+
199 }
+
200
+
201 return std::pair<uint32_t, long double>(iter, tol_condition);
+
202}
-
bool check_termination(long double delta)
Definition durand_kerner_roots.cpp:91
-
const char * complex_str(const std::complex< double > &x)
Definition durand_kerner_roots.cpp:76
-
std::complex< double > poly_function(const std::valarray< double > &coeffs, std::complex< double > x)
Definition durand_kerner_roots.cpp:53
+
bool check_termination(long double delta)
Definition durand_kerner_roots.cpp:92
+
const char * complex_str(const std::complex< double > &x)
Definition durand_kerner_roots.cpp:77
+
std::complex< double > poly_function(const std::valarray< double > &coeffs, std::complex< double > x)
Definition durand_kerner_roots.cpp:54
T exit(T... args)
T is_open(T... args)
T isinf(T... args)
@@ -424,68 +425,68 @@ Here is the call graph for this function:
-
283 {
-
284 /* initialize random seed: */
-
285 std::srand(std::time(nullptr));
-
286
-
287 if (argc < 2) {
-
288 test1(); // run tests when no input is provided
-
289 test2(); // and skip tests when input polynomial is provided
-
290 std::cout << "Please pass the coefficients of the polynomial as "
-
291 "commandline "
-
292 "arguments.\n";
-
293 return 0;
-
294 }
-
295
-
296 int n, degree = argc - 1; // detected polynomial degree
-
297 std::valarray<double> coeffs(degree); // create coefficiencts array
-
298
-
299 // number of roots = degree - 1
- -
301
-
302 std::cout << "Computing the roots for:\n\t";
-
303 for (n = 0; n < degree; n++) {
-
304 coeffs[n] = strtod(argv[n + 1], nullptr);
-
305 if (n < degree - 1 && coeffs[n] != 0)
-
306 std::cout << "(" << coeffs[n] << ") x^" << degree - n - 1 << " + ";
-
307 else if (coeffs[n] != 0)
-
308 std::cout << "(" << coeffs[n] << ") x^" << degree - n - 1
-
309 << " = 0\n";
-
310
-
311 /* initialize root approximations with random values */
-
312 if (n < degree - 1) {
-
313 s0[n] = std::complex<double>(std::rand() % 100, std::rand() % 100);
-
314 s0[n] -= 50.f;
-
315 s0[n] /= 50.f;
-
316 }
-
317 }
-
318
-
319 // numerical errors less when the first coefficient is "1"
-
320 // hence, we normalize the first coefficient
-
321 {
-
322 double tmp = coeffs[0];
-
323 coeffs /= tmp;
-
324 }
-
325
-
326 clock_t end_time, start_time = clock();
-
327 auto result = durand_kerner_algo(coeffs, &s0, true);
-
328 end_time = clock();
-
329
-
330 std::cout << "\nIterations: " << result.first << "\n";
-
331 for (n = 0; n < degree - 1; n++)
-
332 std::cout << "\t" << complex_str(s0[n]) << "\n";
-
333 std::cout << "absolute average change: " << result.second << "\n";
-
334 std::cout << "Time taken: "
-
335 << static_cast<double>(end_time - start_time) / CLOCKS_PER_SEC
-
336 << " sec\n";
-
337
-
338 return 0;
-
339}
+
284 {
+
285 /* initialize random seed: */
+
286 std::srand(std::time(nullptr));
+
287
+
288 if (argc < 2) {
+
289 test1(); // run tests when no input is provided
+
290 test2(); // and skip tests when input polynomial is provided
+
291 std::cout << "Please pass the coefficients of the polynomial as "
+
292 "commandline "
+
293 "arguments.\n";
+
294 return 0;
+
295 }
+
296
+
297 int n, degree = argc - 1; // detected polynomial degree
+
298 std::valarray<double> coeffs(degree); // create coefficiencts array
+
299
+
300 // number of roots = degree - 1
+ +
302
+
303 std::cout << "Computing the roots for:\n\t";
+
304 for (n = 0; n < degree; n++) {
+
305 coeffs[n] = strtod(argv[n + 1], nullptr);
+
306 if (n < degree - 1 && coeffs[n] != 0)
+
307 std::cout << "(" << coeffs[n] << ") x^" << degree - n - 1 << " + ";
+
308 else if (coeffs[n] != 0)
+
309 std::cout << "(" << coeffs[n] << ") x^" << degree - n - 1
+
310 << " = 0\n";
+
311
+
312 /* initialize root approximations with random values */
+
313 if (n < degree - 1) {
+
314 s0[n] = std::complex<double>(std::rand() % 100, std::rand() % 100);
+
315 s0[n] -= 50.f;
+
316 s0[n] /= 50.f;
+
317 }
+
318 }
+
319
+
320 // numerical errors less when the first coefficient is "1"
+
321 // hence, we normalize the first coefficient
+
322 {
+
323 double tmp = coeffs[0];
+
324 coeffs /= tmp;
+
325 }
+
326
+
327 clock_t end_time, start_time = clock();
+
328 auto result = durand_kerner_algo(coeffs, &s0, true);
+
329 end_time = clock();
+
330
+
331 std::cout << "\nIterations: " << result.first << "\n";
+
332 for (n = 0; n < degree - 1; n++)
+
333 std::cout << "\t" << complex_str(s0[n]) << "\n";
+
334 std::cout << "absolute average change: " << result.second << "\n";
+
335 std::cout << "Time taken: "
+
336 << static_cast<double>(end_time - start_time) / CLOCKS_PER_SEC
+
337 << " sec\n";
+
338
+
339 return 0;
+
340}
T clock(T... args)
-
void test2()
Definition durand_kerner_roots.cpp:242
-
void test1()
Definition durand_kerner_roots.cpp:207
-
std::pair< uint32_t, double > durand_kerner_algo(const std::valarray< double > &coeffs, std::valarray< std::complex< double > > *roots, bool write_log=false)
Definition durand_kerner_roots.cpp:109
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
void test2()
Definition durand_kerner_roots.cpp:243
+
void test1()
Definition durand_kerner_roots.cpp:208
+
std::pair< uint32_t, double > durand_kerner_algo(const std::valarray< double > &coeffs, std::valarray< std::complex< double > > *roots, bool write_log=false)
Definition durand_kerner_roots.cpp:110
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T rand(T... args)
T srand(T... args)
T strtod(T... args)
@@ -520,22 +521,22 @@ Here is the call graph for this function:
Returns
\(f(x)\)
-
54 {
-
55 double real = 0.f, imag = 0.f;
-
56 int n;
-
57
-
58 // #ifdef _OPENMP
-
59 // #pragma omp target teams distribute reduction(+ : real, imag)
-
60 // #endif
-
61 for (n = 0; n < coeffs.size(); n++) {
- -
63 coeffs[n] * std::pow(x, coeffs.size() - n - 1);
-
64 real += tmp.real();
-
65 imag += tmp.imag();
-
66 }
-
67
-
68 return std::complex<double>(real, imag);
-
69}
+
55 {
+
56 double real = 0.f, imag = 0.f;
+
57 int n;
+
58
+
59 // #ifdef _OPENMP
+
60 // #pragma omp target teams distribute reduction(+ : real, imag)
+
61 // #endif
+
62 for (n = 0; n < coeffs.size(); n++) {
+ +
64 coeffs[n] * std::pow(x, coeffs.size() - n - 1);
+
65 real += tmp.real();
+
66 imag += tmp.imag();
+
67 }
+
68
+
69 return std::complex<double>(real, imag);
+
70}
T pow(T... args)
Here is the call graph for this function:
@@ -560,36 +561,36 @@ Here is the call graph for this function:

Self test the algorithm by checking the roots for \(x^2+4=0\) to which the roots are \(0 \pm 2i\)

-
207 {
-
208 const std::valarray<double> coeffs = {1, 0, 4}; // x^2 - 2 = 0
- - -
211 std::complex<double>(0., 2.),
-
212 std::complex<double>(0., -2.) // known expected roots
-
213 };
-
214
-
215 /* initialize root approximations with random values */
-
216 for (int n = 0; n < roots.size(); n++) {
-
217 roots[n] = std::complex<double>(std::rand() % 100, std::rand() % 100);
-
218 roots[n] -= 50.f;
-
219 roots[n] /= 25.f;
-
220 }
-
221
-
222 auto result = durand_kerner_algo(coeffs, &roots, false);
-
223
-
224 for (int i = 0; i < roots.size(); i++) {
-
225 // check if approximations are have < 0.1% error with one of the
-
226 // expected roots
-
227 bool err1 = false;
-
228 for (int j = 0; j < roots.size(); j++)
-
229 err1 |= std::abs(std::abs(roots[i] - expected[j])) < 1e-3;
-
230 assert(err1);
-
231 }
-
232
-
233 std::cout << "Test 1 passed! - " << result.first << " iterations, "
-
234 << result.second << " accuracy"
-
235 << "\n";
-
236}
+
208 {
+
209 const std::valarray<double> coeffs = {1, 0, 4}; // x^2 - 2 = 0
+ + +
212 std::complex<double>(0., 2.),
+
213 std::complex<double>(0., -2.) // known expected roots
+
214 };
+
215
+
216 /* initialize root approximations with random values */
+
217 for (int n = 0; n < roots.size(); n++) {
+
218 roots[n] = std::complex<double>(std::rand() % 100, std::rand() % 100);
+
219 roots[n] -= 50.f;
+
220 roots[n] /= 25.f;
+
221 }
+
222
+
223 auto result = durand_kerner_algo(coeffs, &roots, false);
+
224
+
225 for (int i = 0; i < roots.size(); i++) {
+
226 // check if approximations are have < 0.1% error with one of the
+
227 // expected roots
+
228 bool err1 = false;
+
229 for (int j = 0; j < roots.size(); j++)
+
230 err1 |= std::abs(std::abs(roots[i] - expected[j])) < 1e-3;
+
231 assert(err1);
+
232 }
+
233
+
234 std::cout << "Test 1 passed! - " << result.first << " iterations, "
+
235 << result.second << " accuracy"
+
236 << "\n";
+
237}
Here is the call graph for this function:
@@ -613,37 +614,37 @@ Here is the call graph for this function:

Self test the algorithm by checking the roots for \(0.015625x^3-1=0\) to which the roots are \((4+0i),\,(-2\pm3.464i)\)

-
242 {
-
243 const std::valarray<double> coeffs = {// 0.015625 x^3 - 1 = 0
-
244 1. / 64., 0., 0., -1.};
- -
246 const std::valarray<std::complex<double>> expected = {
-
247 std::complex<double>(4., 0.), std::complex<double>(-2., 3.46410162),
-
248 std::complex<double>(-2., -3.46410162) // known expected roots
-
249 };
-
250
-
251 /* initialize root approximations with random values */
-
252 for (int n = 0; n < roots.size(); n++) {
-
253 roots[n] = std::complex<double>(std::rand() % 100, std::rand() % 100);
-
254 roots[n] -= 50.f;
-
255 roots[n] /= 25.f;
-
256 }
-
257
-
258 auto result = durand_kerner_algo(coeffs, &roots, false);
-
259
-
260 for (int i = 0; i < roots.size(); i++) {
-
261 // check if approximations are have < 0.1% error with one of the
-
262 // expected roots
-
263 bool err1 = false;
-
264 for (int j = 0; j < roots.size(); j++)
-
265 err1 |= std::abs(std::abs(roots[i] - expected[j])) < 1e-3;
-
266 assert(err1);
-
267 }
-
268
-
269 std::cout << "Test 2 passed! - " << result.first << " iterations, "
-
270 << result.second << " accuracy"
-
271 << "\n";
-
272}
+
243 {
+
244 const std::valarray<double> coeffs = {// 0.015625 x^3 - 1 = 0
+
245 1. / 64., 0., 0., -1.};
+ +
247 const std::valarray<std::complex<double>> expected = {
+
248 std::complex<double>(4., 0.), std::complex<double>(-2., 3.46410162),
+
249 std::complex<double>(-2., -3.46410162) // known expected roots
+
250 };
+
251
+
252 /* initialize root approximations with random values */
+
253 for (int n = 0; n < roots.size(); n++) {
+
254 roots[n] = std::complex<double>(std::rand() % 100, std::rand() % 100);
+
255 roots[n] -= 50.f;
+
256 roots[n] /= 25.f;
+
257 }
+
258
+
259 auto result = durand_kerner_algo(coeffs, &roots, false);
+
260
+
261 for (int i = 0; i < roots.size(); i++) {
+
262 // check if approximations are have < 0.1% error with one of the
+
263 // expected roots
+
264 bool err1 = false;
+
265 for (int j = 0; j < roots.size(); j++)
+
266 err1 |= std::abs(std::abs(roots[i] - expected[j])) < 1e-3;
+
267 assert(err1);
+
268 }
+
269
+
270 std::cout << "Test 2 passed! - " << result.first << " iterations, "
+
271 << result.second << " accuracy"
+
272 << "\n";
+
273}
Here is the call graph for this function:
diff --git a/db/d01/brent__method__extrema_8cpp.html b/db/d01/brent__method__extrema_8cpp.html index f56d6c70d..21df81c9b 100644 --- a/db/d01/brent__method__extrema_8cpp.html +++ b/db/d01/brent__method__extrema_8cpp.html @@ -115,13 +115,14 @@ $(function(){initNavTree('db/d01/brent__method__extrema_8cpp.html','../../'); in More...

#include <cassert>
#include <cmath>
+#include <cstdint>
#include <functional>
#include <iostream>
#include <limits>
Include dependency graph for brent_method_extrema.cpp:
-
+
T sqrt(T... args)

system accuracy limit

-
23#define EPSILON \
-
24 std::sqrt( \
-
25 std::numeric_limits<double>::epsilon()) ///< system accuracy limit
+
24#define EPSILON \
+
25 std::sqrt( \
+
26 std::numeric_limits<double>::epsilon()) ///< system accuracy limit
@@ -220,108 +221,108 @@ Functions
Returns
root found in the interval
-
36 {
-
37 uint32_t iters = 0;
-
38
-
39 if (lim_a > lim_b) {
-
40 std::swap(lim_a, lim_b);
-
41 } else if (std::abs(lim_a - lim_b) <= EPSILON) {
-
42 std::cerr << "Search range must be greater than " << EPSILON << "\n";
-
43 return lim_a;
-
44 }
-
45
-
46 // golden ratio value
-
47 const double M_GOLDEN_RATIO = (3.f - std::sqrt(5.f)) / 2.f;
-
48
-
49 double v = lim_a + M_GOLDEN_RATIO * (lim_b - lim_a);
-
50 double u, w = v, x = v;
-
51 double fu, fv = f(v);
-
52 double fw = fv, fx = fv;
-
53
-
54 double mid_point = (lim_a + lim_b) / 2.f;
-
55 double p = 0, q = 0, r = 0;
-
56
-
57 double d, e = 0;
-
58 double tolerance, tolerance2;
-
59
-
60 do {
-
61 mid_point = (lim_a + lim_b) / 2.f;
-
62 tolerance = EPSILON * std::abs(x);
-
63 tolerance2 = 2 * tolerance;
-
64
-
65 if (std::abs(e) > tolerance2) {
-
66 // fit parabola
-
67 r = (x - w) * (fx - fv);
-
68 q = (x - v) * (fx - fw);
-
69 p = (x - v) * q - (x - w) * r;
-
70 q = 2.f * (q - r);
-
71 if (q > 0)
-
72 p = -p;
-
73 else
-
74 q = -q;
-
75 r = e;
-
76 e = d;
-
77 }
-
78
-
79 if (std::abs(p) < std::abs(0.5 * q * r) && p < q * (lim_b - x)) {
-
80 // parabolic interpolation step
-
81 d = p / q;
-
82 u = x + d;
-
83 if (u - lim_a < tolerance2 || lim_b - u < tolerance2)
-
84 d = x < mid_point ? tolerance : -tolerance;
-
85 } else {
-
86 // golden section interpolation step
-
87 e = (x < mid_point ? lim_b : lim_a) - x;
-
88 d = M_GOLDEN_RATIO * e;
-
89 }
-
90
-
91 // evaluate not too close to x
-
92 if (std::abs(d) >= tolerance)
-
93 u = d;
-
94 else if (d > 0)
-
95 u = tolerance;
-
96 else
-
97 u = -tolerance;
-
98 u += x;
-
99 fu = f(u);
-
100
-
101 // update variables
-
102 if (fu <= fx) {
-
103 if (u < x)
-
104 lim_b = x;
-
105 else
-
106 lim_a = x;
-
107 v = w;
-
108 fv = fw;
-
109 w = x;
-
110 fw = fx;
-
111 x = u;
-
112 fx = fu;
-
113 } else {
-
114 if (u < x)
-
115 lim_a = u;
-
116 else
-
117 lim_b = u;
-
118 if (fu <= fw || x == w) {
-
119 v = w;
-
120 fv = fw;
-
121 w = u;
-
122 fw = fu;
-
123 } else if (fu <= fv || v == x || v == w) {
-
124 v = u;
-
125 fv = fu;
-
126 }
-
127 }
-
128
-
129 iters++;
-
130 } while (std::abs(x - mid_point) > (tolerance - (lim_b - lim_a) / 2.f));
-
131
-
132 std::cout << " (iters: " << iters << ") ";
-
133
-
134 return x;
-
135}
+
37 {
+
38 uint32_t iters = 0;
+
39
+
40 if (lim_a > lim_b) {
+
41 std::swap(lim_a, lim_b);
+
42 } else if (std::abs(lim_a - lim_b) <= EPSILON) {
+
43 std::cerr << "Search range must be greater than " << EPSILON << "\n";
+
44 return lim_a;
+
45 }
+
46
+
47 // golden ratio value
+
48 const double M_GOLDEN_RATIO = (3.f - std::sqrt(5.f)) / 2.f;
+
49
+
50 double v = lim_a + M_GOLDEN_RATIO * (lim_b - lim_a);
+
51 double u, w = v, x = v;
+
52 double fu, fv = f(v);
+
53 double fw = fv, fx = fv;
+
54
+
55 double mid_point = (lim_a + lim_b) / 2.f;
+
56 double p = 0, q = 0, r = 0;
+
57
+
58 double d, e = 0;
+
59 double tolerance, tolerance2;
+
60
+
61 do {
+
62 mid_point = (lim_a + lim_b) / 2.f;
+
63 tolerance = EPSILON * std::abs(x);
+
64 tolerance2 = 2 * tolerance;
+
65
+
66 if (std::abs(e) > tolerance2) {
+
67 // fit parabola
+
68 r = (x - w) * (fx - fv);
+
69 q = (x - v) * (fx - fw);
+
70 p = (x - v) * q - (x - w) * r;
+
71 q = 2.f * (q - r);
+
72 if (q > 0)
+
73 p = -p;
+
74 else
+
75 q = -q;
+
76 r = e;
+
77 e = d;
+
78 }
+
79
+
80 if (std::abs(p) < std::abs(0.5 * q * r) && p < q * (lim_b - x)) {
+
81 // parabolic interpolation step
+
82 d = p / q;
+
83 u = x + d;
+
84 if (u - lim_a < tolerance2 || lim_b - u < tolerance2)
+
85 d = x < mid_point ? tolerance : -tolerance;
+
86 } else {
+
87 // golden section interpolation step
+
88 e = (x < mid_point ? lim_b : lim_a) - x;
+
89 d = M_GOLDEN_RATIO * e;
+
90 }
+
91
+
92 // evaluate not too close to x
+
93 if (std::abs(d) >= tolerance)
+
94 u = d;
+
95 else if (d > 0)
+
96 u = tolerance;
+
97 else
+
98 u = -tolerance;
+
99 u += x;
+
100 fu = f(u);
+
101
+
102 // update variables
+
103 if (fu <= fx) {
+
104 if (u < x)
+
105 lim_b = x;
+
106 else
+
107 lim_a = x;
+
108 v = w;
+
109 fv = fw;
+
110 w = x;
+
111 fw = fx;
+
112 x = u;
+
113 fx = fu;
+
114 } else {
+
115 if (u < x)
+
116 lim_a = u;
+
117 else
+
118 lim_b = u;
+
119 if (fu <= fw || x == w) {
+
120 v = w;
+
121 fv = fw;
+
122 w = u;
+
123 fw = fu;
+
124 } else if (fu <= fv || v == x || v == w) {
+
125 v = u;
+
126 fv = fu;
+
127 }
+
128 }
+
129
+
130 iters++;
+
131 } while (std::abs(x - mid_point) > (tolerance - (lim_b - lim_a) / 2.f));
+
132
+
133 std::cout << " (iters: " << iters << ") ";
+
134
+
135 return x;
+
136}
-
#define EPSILON
system accuracy limit
Definition brent_method_extrema.cpp:23
+
#define EPSILON
system accuracy limit
Definition brent_method_extrema.cpp:24
double f(double x)
A function f(x) that will be used to test the method.
Definition composite_simpson_rule.cpp:113
T swap(T... args)
@@ -347,21 +348,21 @@ Here is the call graph for this function:

@@ -179,9 +180,9 @@ Functions

Main function

-
204 {
-
205 std::cout.precision(18);
-
206
-
207 std::cout << "Computations performed with machine epsilon: " << EPSILON
-
208 << "\n";
-
209
-
210 test1();
-
211 test2();
-
212 test3();
-
213
-
214 return 0;
-
215}
-
void test2()
Test function to find root for the function in the interval Expected result: .
Definition brent_method_extrema.cpp:165
-
void test1()
Test function to find root for the function in the interval Expected result = 2.
Definition brent_method_extrema.cpp:143
-
void test3()
Test function to find maxima for the function in the interval Expected result: .
Definition brent_method_extrema.cpp:188
+
205 {
+
206 std::cout.precision(18);
+
207
+
208 std::cout << "Computations performed with machine epsilon: " << EPSILON
+
209 << "\n";
+
210
+
211 test1();
+
212 test2();
+
213 test3();
+
214
+
215 return 0;
+
216}
+
void test2()
Test function to find root for the function in the interval Expected result: .
Definition brent_method_extrema.cpp:166
+
void test1()
Test function to find root for the function in the interval Expected result = 2.
Definition brent_method_extrema.cpp:144
+
void test3()
Test function to find maxima for the function in the interval Expected result: .
Definition brent_method_extrema.cpp:189
Here is the call graph for this function:
@@ -387,22 +388,22 @@ Here is the call graph for this function:

Test function to find root for the function \(f(x)= (x-2)^2\) in the interval \([1,5]\)
Expected result = 2.

-
143 {
-
144 // define the function to minimize as a lambda function
-
145 std::function<double(double)> f1 = [](double x) {
-
146 return (x - 2) * (x - 2);
-
147 };
-
148
-
149 std::cout << "Test 1.... ";
-
150
-
151 double minima = get_minima(f1, -1, 5);
-
152
-
153 std::cout << minima << "...";
-
154
-
155 assert(std::abs(minima - 2) < EPSILON);
-
156 std::cout << "passed\n";
-
157}
-
double get_minima(const std::function< double(double)> &f, double lim_a, double lim_b)
Get the real root of a function in the given interval.
Definition brent_method_extrema.cpp:35
+
144 {
+
145 // define the function to minimize as a lambda function
+
146 std::function<double(double)> f1 = [](double x) {
+
147 return (x - 2) * (x - 2);
+
148 };
+
149
+
150 std::cout << "Test 1.... ";
+
151
+
152 double minima = get_minima(f1, -1, 5);
+
153
+
154 std::cout << minima << "...";
+
155
+
156 assert(std::abs(minima - 2) < EPSILON);
+
157 std::cout << "passed\n";
+
158}
+
double get_minima(const std::function< double(double)> &f, double lim_a, double lim_b)
Get the real root of a function in the given interval.
Definition brent_method_extrema.cpp:36
Here is the call graph for this function:
@@ -429,22 +430,22 @@ Here is the call graph for this function:

Test function to find root for the function \(f(x)= x^{\frac{1}{x}}\) in the interval \([-2,10]\)
Expected result: \(e\approx 2.71828182845904509\).

-
165 {
-
166 // define the function to maximize as a lambda function
-
167 // since we are maximixing, we negated the function return value
-
168 std::function<double(double)> func = [](double x) {
-
169 return -std::pow(x, 1.f / x);
-
170 };
-
171
-
172 std::cout << "Test 2.... ";
-
173
-
174 double minima = get_minima(func, -2, 5);
-
175
-
176 std::cout << minima << " (" << M_E << ")...";
-
177
-
178 assert(std::abs(minima - M_E) < EPSILON);
-
179 std::cout << "passed\n";
-
180}
+
166 {
+
167 // define the function to maximize as a lambda function
+
168 // since we are maximixing, we negated the function return value
+
169 std::function<double(double)> func = [](double x) {
+
170 return -std::pow(x, 1.f / x);
+
171 };
+
172
+
173 std::cout << "Test 2.... ";
+
174
+
175 double minima = get_minima(func, -2, 5);
+
176
+
177 std::cout << minima << " (" << M_E << ")...";
+
178
+
179 assert(std::abs(minima - M_E) < EPSILON);
+
180 std::cout << "passed\n";
+
181}
T pow(T... args)
Here is the call graph for this function:
@@ -471,20 +472,20 @@ Here is the call graph for this function:

Test function to find maxima for the function \(f(x)= \cos x\) in the interval \([0,12]\)
Expected result: \(\pi\approx 3.14159265358979312\).

-
188 {
-
189 // define the function to maximize as a lambda function
-
190 // since we are maximixing, we negated the function return value
-
191 std::function<double(double)> func = [](double x) { return std::cos(x); };
-
192
-
193 std::cout << "Test 3.... ";
-
194
-
195 double minima = get_minima(func, -4, 12);
-
196
-
197 std::cout << minima << " (" << M_PI << ")...";
-
198
-
199 assert(std::abs(minima - M_PI) < EPSILON);
-
200 std::cout << "passed\n";
-
201}
+
189 {
+
190 // define the function to maximize as a lambda function
+
191 // since we are maximixing, we negated the function return value
+
192 std::function<double(double)> func = [](double x) { return std::cos(x); };
+
193
+
194 std::cout << "Test 3.... ";
+
195
+
196 double minima = get_minima(func, -4, 12);
+
197
+
198 std::cout << minima << " (" << M_PI << ")...";
+
199
+
200 assert(std::abs(minima - M_PI) < EPSILON);
+
201 std::cout << "passed\n";
+
202}
T cos(T... args)
Here is the call graph for this function:
diff --git a/db/d0d/prime__factorization_8cpp.html b/db/d0d/prime__factorization_8cpp.html index 4db7d70c5..f5d206a57 100644 --- a/db/d0d/prime__factorization_8cpp.html +++ b/db/d0d/prime__factorization_8cpp.html @@ -265,7 +265,7 @@ Here is the call graph for this function:
36 }
37}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T memset(T... args)
bool isprime[1000006]
Definition prime_factorization.cpp:13
T push_back(T... args)
diff --git a/db/d13/modular__inverse__simple_8cpp__incl.map b/db/d13/modular__inverse__simple_8cpp__incl.map index 1832145ad..c15431f40 100644 --- a/db/d13/modular__inverse__simple_8cpp__incl.map +++ b/db/d13/modular__inverse__simple_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/db/d13/modular__inverse__simple_8cpp__incl.md5 b/db/d13/modular__inverse__simple_8cpp__incl.md5 index 82b4047ad..401778434 100644 --- a/db/d13/modular__inverse__simple_8cpp__incl.md5 +++ b/db/d13/modular__inverse__simple_8cpp__incl.md5 @@ -1 +1 @@ -f5cac79dc8afa77735502d3f85e0cf3d \ No newline at end of file +babb4010e4c1446993b211da51d9bc35 \ No newline at end of file diff --git a/db/d13/modular__inverse__simple_8cpp__incl.svg b/db/d13/modular__inverse__simple_8cpp__incl.svg index 266cd6307..692e77991 100644 --- a/db/d13/modular__inverse__simple_8cpp__incl.svg +++ b/db/d13/modular__inverse__simple_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -math/modular_inverse -_simple.cpp + +math/modular_inverse +_simple.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/db/d13/modular__inverse__simple_8cpp__incl_org.svg b/db/d13/modular__inverse__simple_8cpp__incl_org.svg index a8b48c8db..3e57f9bf8 100644 --- a/db/d13/modular__inverse__simple_8cpp__incl_org.svg +++ b/db/d13/modular__inverse__simple_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + math/modular_inverse_simple.cpp Node1 - -math/modular_inverse -_simple.cpp + +math/modular_inverse +_simple.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/db/d27/n__bonacci_8cpp.html b/db/d27/n__bonacci_8cpp.html index 62edfeaab..fb3dc7759 100644 --- a/db/d27/n__bonacci_8cpp.html +++ b/db/d27/n__bonacci_8cpp.html @@ -114,18 +114,19 @@ $(function(){initNavTree('db/d27/n__bonacci_8cpp.html','../../'); initResizable(

Implementation of the N-bonacci series. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for n_bonacci.cpp:
-
+
- + diff --git a/db/d40/integral__approximation2_8cpp.html b/db/d40/integral__approximation2_8cpp.html index 8fb961af8..ef1a45ab2 100644 --- a/db/d40/integral__approximation2_8cpp.html +++ b/db/d40/integral__approximation2_8cpp.html @@ -131,7 +131,7 @@ Include dependency graph for integral_approximation2.cpp: - + diff --git a/db/d4a/aliquot__sum_8cpp__incl.map b/db/d4a/aliquot__sum_8cpp__incl.map index 9215b0e68..9b07e101c 100644 --- a/db/d4a/aliquot__sum_8cpp__incl.map +++ b/db/d4a/aliquot__sum_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/db/d4a/aliquot__sum_8cpp__incl.md5 b/db/d4a/aliquot__sum_8cpp__incl.md5 index 965644481..4495b6cea 100644 --- a/db/d4a/aliquot__sum_8cpp__incl.md5 +++ b/db/d4a/aliquot__sum_8cpp__incl.md5 @@ -1 +1 @@ -9881b3fd0b0ae51e863ab5892a350d0c \ No newline at end of file +24593d0c77480bf6580bf0183d64cef9 \ No newline at end of file diff --git a/db/d4a/aliquot__sum_8cpp__incl.svg b/db/d4a/aliquot__sum_8cpp__incl.svg index 041b1396c..bb7c2ce52 100644 --- a/db/d4a/aliquot__sum_8cpp__incl.svg +++ b/db/d4a/aliquot__sum_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/aliquot_sum.cpp + +math/aliquot_sum.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/db/d4a/aliquot__sum_8cpp__incl_org.svg b/db/d4a/aliquot__sum_8cpp__incl_org.svg index 5df26f069..9613ae13b 100644 --- a/db/d4a/aliquot__sum_8cpp__incl_org.svg +++ b/db/d4a/aliquot__sum_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/aliquot_sum.cpp Node1 - -math/aliquot_sum.cpp + +math/aliquot_sum.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/db/d5b/structdata__structures_1_1stack__using__queue_1_1_stack.html b/db/d5b/structdata__structures_1_1stack__using__queue_1_1_stack.html index c757c16ab..e05df6efa 100644 --- a/db/d5b/structdata__structures_1_1stack__using__queue_1_1_stack.html +++ b/db/d5b/structdata__structures_1_1stack__using__queue_1_1_stack.html @@ -175,17 +175,17 @@ uint32_t current_size

Removes the topmost element from the stack.

Returns
void
-
61 {
-
62 if (main_q.empty()) {
-
63 return;
-
64 }
-
65 main_q.pop();
- -
67 }
+
62 {
+
63 if (main_q.empty()) {
+
64 return;
+
65 }
+
66 main_q.pop();
+ +
68 }
T empty(T... args)
T pop(T... args)
-
std::queue< int64_t > main_q
stores the current state of the stack
Definition stack_using_queue.cpp:31
-
uint32_t current_size
stores the current size of the stack
Definition stack_using_queue.cpp:34
+
std::queue< int64_t > main_q
stores the current state of the stack
Definition stack_using_queue.cpp:32
+
uint32_t current_size
stores the current size of the stack
Definition stack_using_queue.cpp:35
Here is the call graph for this function:
@@ -225,18 +225,18 @@ Here is the call graph for this function:
Returns
void
-
47 {
-
48 auxiliary_q.push(val);
-
49 while (!main_q.empty()) {
- -
51 main_q.pop();
-
52 }
- - -
55 }
+
48 {
+
49 auxiliary_q.push(val);
+
50 while (!main_q.empty()) {
+ +
52 main_q.pop();
+
53 }
+ + +
56 }
T front(T... args)
T push(T... args)
-
std::queue< int64_t > auxiliary_q
Definition stack_using_queue.cpp:32
+
std::queue< int64_t > auxiliary_q
Definition stack_using_queue.cpp:33
T swap(T... args)
Here is the call graph for this function:
@@ -271,7 +271,7 @@ Here is the call graph for this function:

Utility function to return the current size of the stack.

Returns
current size of stack
-
73{ return current_size; }
+
74{ return current_size; }
@@ -298,7 +298,7 @@ Here is the call graph for this function:

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  n_bonacci
 Functions for the N-bonacci implementation.

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  monte_carlo
 Functions for the Monte Carlo Integration implementation.

Returns the top most element of the stack

Returns
top element of the queue
-
40{ return main_q.front(); }
+
41{ return main_q.front(); }
Here is the call graph for this function:
diff --git a/db/d71/quadratic__probing__hash__table_8cpp.html b/db/d71/quadratic__probing__hash__table_8cpp.html index 9bb7a8088..83ef9e0b1 100644 --- a/db/d71/quadratic__probing__hash__table_8cpp.html +++ b/db/d71/quadratic__probing__hash__table_8cpp.html @@ -264,7 +264,7 @@ bool quadratic_probing::re
T endl(T... args)
-
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:287
+
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:288
size_t hashFxn(int key)
Definition quadratic_probing_hash_table.cpp:46
void addInfo(int key)
Definition quadratic_probing_hash_table.cpp:207
void display()
Definition quadratic_probing_hash_table.cpp:142
diff --git a/db/d80/gale__shapley_8cpp.html b/db/d80/gale__shapley_8cpp.html index ae94d3015..21b64e28b 100644 --- a/db/d80/gale__shapley_8cpp.html +++ b/db/d80/gale__shapley_8cpp.html @@ -113,14 +113,14 @@ $(function(){initNavTree('db/d80/gale__shapley_8cpp.html','../../'); initResizab

Gale Shapley Algorithm More...

-
#include <iostream>
-#include <vector>
-#include <algorithm>
+
#include <algorithm>
#include <cassert>
+#include <cstdint>
+#include <vector>
Include dependency graph for gale_shapley.cpp:
-
+

Main function.

Returns
0 on exit
-
126 {
-
127 tests(); // Run self-test implementations
-
128 return 0;
-
129}
-
static void tests()
Self-test implementations.
Definition gale_shapley.cpp:100
+
152 {
+
153 tests(); // Run self-test implementations
+
154 return 0;
+
155}
+
static void tests()
Self-test implementations.
Definition gale_shapley.cpp:114
Here is the call graph for this function:
@@ -206,28 +206,40 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
100 {
-
101 // Test Case 1
-
102 std::vector<std::vector<std::uint32_t>> primary_preferences = {{0, 1, 2, 3}, {2, 1, 3, 0}, {1, 2, 0, 3}, {3, 0, 1, 2}};
-
103 std::vector<std::vector<std::uint32_t>> secondary_preferences = {{1, 0, 2, 3}, {3, 0, 1, 2}, {0, 2, 1, 3}, {1, 2, 0, 3}};
-
104 assert(greedy_algorithms::stable_matching::gale_shapley(secondary_preferences, primary_preferences) == std::vector<std::uint32_t>({0, 2, 1, 3}));
-
105
-
106 // Test Case 2
-
107 primary_preferences = {{0, 2, 1, 3}, {2, 3, 0, 1}, {3, 1, 2, 0}, {2, 1, 0, 3}};
-
108 secondary_preferences = {{1, 0, 2, 3}, {3, 0, 1, 2}, {0, 2, 1, 3}, {1, 2, 0, 3}};
-
109 assert(greedy_algorithms::stable_matching::gale_shapley(secondary_preferences, primary_preferences) == std::vector<std::uint32_t>({0, 3, 1, 2}));
-
110
-
111 // Test Case 3
-
112 primary_preferences = {{0, 1, 2}, {2, 1, 0}, {1, 2, 0}};
-
113 secondary_preferences = {{1, 0, 2}, {2, 0, 1}, {0, 2, 1}};
-
114 assert(greedy_algorithms::stable_matching::gale_shapley(secondary_preferences, primary_preferences) == std::vector<std::uint32_t>({0, 2, 1}));
-
115
-
116 // Test Case 4
-
117 primary_preferences = {};
-
118 secondary_preferences = {};
-
119 assert(greedy_algorithms::stable_matching::gale_shapley(secondary_preferences, primary_preferences) == std::vector<std::uint32_t>({}));
-
120}
-
std::vector< std::uint32_t > gale_shapley(const std::vector< std::vector< std::uint32_t > > &secondary_preferences, const std::vector< std::vector< std::uint32_t > > &primary_preferences)
The main function that finds the stable matching between two sets of elements using the Gale-Shapley ...
Definition gale_shapley.cpp:42
+
114 {
+
115 // Test Case 1
+
116 std::vector<std::vector<std::uint32_t>> primary_preferences = {
+
117 {0, 1, 2, 3}, {2, 1, 3, 0}, {1, 2, 0, 3}, {3, 0, 1, 2}};
+
118 std::vector<std::vector<std::uint32_t>> secondary_preferences = {
+
119 {1, 0, 2, 3}, {3, 0, 1, 2}, {0, 2, 1, 3}, {1, 2, 0, 3}};
+ +
121 secondary_preferences, primary_preferences) ==
+
122 std::vector<std::uint32_t>({0, 2, 1, 3}));
+
123
+
124 // Test Case 2
+
125 primary_preferences = {
+
126 {0, 2, 1, 3}, {2, 3, 0, 1}, {3, 1, 2, 0}, {2, 1, 0, 3}};
+
127 secondary_preferences = {
+
128 {1, 0, 2, 3}, {3, 0, 1, 2}, {0, 2, 1, 3}, {1, 2, 0, 3}};
+ +
130 secondary_preferences, primary_preferences) ==
+
131 std::vector<std::uint32_t>({0, 3, 1, 2}));
+
132
+
133 // Test Case 3
+
134 primary_preferences = {{0, 1, 2}, {2, 1, 0}, {1, 2, 0}};
+
135 secondary_preferences = {{1, 0, 2}, {2, 0, 1}, {0, 2, 1}};
+ +
137 secondary_preferences, primary_preferences) ==
+
138 std::vector<std::uint32_t>({0, 2, 1}));
+
139
+
140 // Test Case 4
+
141 primary_preferences = {};
+
142 secondary_preferences = {};
+ +
144 secondary_preferences, primary_preferences) ==
+ +
146}
+
std::vector< std::uint32_t > gale_shapley(const std::vector< std::vector< std::uint32_t > > &secondary_preferences, const std::vector< std::vector< std::uint32_t > > &primary_preferences)
The main function that finds the stable matching between two sets of elements using the Gale-Shapley ...
Definition gale_shapley.cpp:46
Here is the call graph for this function:
diff --git a/db/d82/classlarge__number.html b/db/d82/classlarge__number.html index 06fae8f67..804e07685 100644 --- a/db/d82/classlarge__number.html +++ b/db/d82/classlarge__number.html @@ -997,7 +997,7 @@ template<class T >
161 return false;
162 return true;
163 }
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
diff --git a/db/d83/backtracking_2subset__sum_8cpp__incl.map b/db/d83/backtracking_2subset__sum_8cpp__incl.map index 46b253eb9..be68bb197 100644 --- a/db/d83/backtracking_2subset__sum_8cpp__incl.map +++ b/db/d83/backtracking_2subset__sum_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/db/d83/backtracking_2subset__sum_8cpp__incl.md5 b/db/d83/backtracking_2subset__sum_8cpp__incl.md5 index ffdd91840..396e1b8b1 100644 --- a/db/d83/backtracking_2subset__sum_8cpp__incl.md5 +++ b/db/d83/backtracking_2subset__sum_8cpp__incl.md5 @@ -1 +1 @@ -e9d866cab98e9c791b2c97dd081b6804 \ No newline at end of file +17fb6dc173be73159771b24047e6a159 \ No newline at end of file diff --git a/db/d83/backtracking_2subset__sum_8cpp__incl.svg b/db/d83/backtracking_2subset__sum_8cpp__incl.svg index f924cd602..eef549f8c 100644 --- a/db/d83/backtracking_2subset__sum_8cpp__incl.svg +++ b/db/d83/backtracking_2subset__sum_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -backtracking/subset -_sum.cpp + +backtracking/subset +_sum.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -vector + +iostream @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/db/d83/backtracking_2subset__sum_8cpp__incl_org.svg b/db/d83/backtracking_2subset__sum_8cpp__incl_org.svg index 0936ba6e8..f8fd32805 100644 --- a/db/d83/backtracking_2subset__sum_8cpp__incl_org.svg +++ b/db/d83/backtracking_2subset__sum_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + backtracking/subset_sum.cpp Node1 - -backtracking/subset -_sum.cpp + +backtracking/subset +_sum.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -vector + +iostream @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/db/d93/check__prime_8cpp.html b/db/d93/check__prime_8cpp.html index d5b0d41f4..3a5ddd593 100644 --- a/db/d93/check__prime_8cpp.html +++ b/db/d93/check__prime_8cpp.html @@ -124,7 +124,7 @@ Include dependency graph for check_prime.cpp:

Namespaces

- +

@@ -168,11 +168,11 @@ Functions

namespace  math
 for IO operations
 for assert
 

diff --git a/db/d9a/classuint128__t.html b/db/d9a/classuint128__t.html index 9f0d13338..dc5f9ab5d 100644 --- a/db/d9a/classuint128__t.html +++ b/db/d9a/classuint128__t.html @@ -446,7 +446,7 @@ template<typename T , typename = typename std::enable_if<

-
100: s(low) {}
+
101: s(low) {}
@@ -480,10 +480,10 @@ template<typename T , typename = typename std::enable_if< -
106 {
- -
108 }
-
void __get_integer_from_string(const std::string &str)
First and second half of 128 bit number.
Definition uint128_t.hpp:69
+
107 {
+ +
109 }
+
void __get_integer_from_string(const std::string &str)
First and second half of 128 bit number.
Definition uint128_t.hpp:70
Here is the call graph for this function:
@@ -527,7 +527,7 @@ Here is the call graph for this function:
-
115: f(high), s(low) {}
+
116: f(high), s(low) {}
@@ -594,7 +594,7 @@ Here is the call graph for this function:
-
127: f(num.f), s(num.s) {}
+
128: f(num.f), s(num.s) {}
@@ -631,26 +631,26 @@ Here is the call graph for this function:
Returns
void
-
69 {
-
70 this->f = this->s = 0;
-
71 if (str.size() > 1 && str[1] == 'x') { // if hexadecimal
-
72 for (auto i = 2; i < str.size(); ++i) {
-
73 *this *= 16LL;
-
74 if (str[i] >= '0' && str[i] <= '9') {
-
75 *this += (str[i] - '0');
-
76 } else if (str[i] >= 'A' && str[i] <= 'F') {
-
77 *this += (str[i] - 'A' + 10);
-
78 } else if (str[i] >= 'a' && str[i] <= 'f') {
-
79 *this += (str[i] - 'a' + 10);
-
80 }
-
81 }
-
82 } else { // if decimal
-
83 for (auto &x : str) {
-
84 *this *= 10LL;
-
85 *this += (x - '0');
-
86 }
-
87 }
-
88 }
+
70 {
+
71 this->f = this->s = 0;
+
72 if (str.size() > 1 && str[1] == 'x') { // if hexadecimal
+
73 for (auto i = 2; i < str.size(); ++i) {
+
74 *this *= 16LL;
+
75 if (str[i] >= '0' && str[i] <= '9') {
+
76 *this += (str[i] - '0');
+
77 } else if (str[i] >= 'A' && str[i] <= 'F') {
+
78 *this += (str[i] - 'A' + 10);
+
79 } else if (str[i] >= 'a' && str[i] <= 'f') {
+
80 *this += (str[i] - 'a' + 10);
+
81 }
+
82 }
+
83 } else { // if decimal
+
84 for (auto &x : str) {
+
85 *this *= 10LL;
+
86 *this += (x - '0');
+
87 }
+
88 }
+
89 }
T size(T... args)
Here is the call graph for this function:
@@ -685,23 +685,23 @@ Here is the call graph for this function:

Leading zeroes in binary.

Calculates leading zeros in 128-bit integer

Returns
Integer denoting leading zeroes
-
139 {
-
140#ifndef _MSC_VER
-
141 if (f) {
-
142 return __builtin_clzll(f);
-
143 }
-
144 return 64 + __builtin_clzll(s);
-
145#else
-
146 unsigned long r = 0;
-
147 _BitScanForward64(&r, f);
-
148 if (r == 64) {
-
149 unsigned long l = 0;
-
150 _BitScanForward64(&l, s);
-
151 return 64 + l;
-
152 }
-
153 return r;
-
154#endif
-
155 }
+
140 {
+
141#ifndef _MSC_VER
+
142 if (f) {
+
143 return __builtin_clzll(f);
+
144 }
+
145 return 64 + __builtin_clzll(s);
+
146#else
+
147 unsigned long r = 0;
+
148 _BitScanForward64(&r, f);
+
149 if (r == 64) {
+
150 unsigned long l = 0;
+
151 _BitScanForward64(&l, s);
+
152 return 64 + l;
+
153 }
+
154 return r;
+
155#endif
+
156 }
double l(double x)
Another test function.
Definition composite_simpson_rule.cpp:119
@@ -731,23 +731,23 @@ Here is the call graph for this function:

Trailing zeroes in binary.

Calculates leading zeros in 128-bit integer

Returns
Integer denoting Trailing zeroes
-
162 {
-
163#ifndef _MSC_VER
-
164 if (f) {
-
165 return __builtin_ctzll(f);
-
166 }
-
167 return 64 + __builtin_ctzll(s);
-
168#else
-
169 unsigned long r = 0;
-
170 _BitScanReverse64(&r, s);
-
171 if (r == 64) {
-
172 unsigned long l = 0;
-
173 _BitScanReverse64(&l, f);
-
174 return 64 + l;
-
175 }
-
176 return r;
-
177#endif
-
178 }
+
163 {
+
164#ifndef _MSC_VER
+
165 if (f) {
+
166 return __builtin_ctzll(f);
+
167 }
+
168 return 64 + __builtin_ctzll(s);
+
169#else
+
170 unsigned long r = 0;
+
171 _BitScanReverse64(&r, s);
+
172 if (r == 64) {
+
173 unsigned long l = 0;
+
174 _BitScanReverse64(&l, f);
+
175 return 64 + l;
+
176 }
+
177 return r;
+
178#endif
+
179 }
@@ -782,36 +782,36 @@ Here is the call graph for this function:
Returns
pair denoting quotient and remainder.
-
454 {
-
455 if (*this < p) { // if this is less than divisor
-
456 return {uint128_t(0), *this};
-
457 } else if (*this == p) { // if this is equal to divisor
-
458 return {uint128_t(1), uint128_t(0)};
-
459 }
-
460 uint128_t tmp = p, tmp2 = *this;
-
461 uint16_t left = tmp._lez() - _lez();
-
462 tmp <<= left;
-
463 uint128_t quotient(0);
-
464 uint128_t zero(0);
-
465 while (tmp2 >= p) {
-
466 uint16_t shf = tmp2._lez() - tmp._lez();
-
467 if (shf) {
-
468 tmp >>= shf;
-
469 quotient <<= shf;
-
470 left -= shf;
-
471 }
-
472 if (tmp2 < tmp) {
-
473 tmp >>= 1;
-
474 quotient <<= 1;
-
475 --left;
-
476 }
-
477 tmp2 -= tmp;
-
478 ++quotient;
-
479 }
-
480 return {quotient << left, tmp2};
-
481 }
-
class for 128-bit unsigned integer
Definition uint128_t.hpp:59
-
uint32_t _lez()
Leading zeroes in binary.
Definition uint128_t.hpp:139
+
455 {
+
456 if (*this < p) { // if this is less than divisor
+
457 return {uint128_t(0), *this};
+
458 } else if (*this == p) { // if this is equal to divisor
+
459 return {uint128_t(1), uint128_t(0)};
+
460 }
+
461 uint128_t tmp = p, tmp2 = *this;
+
462 uint16_t left = tmp._lez() - _lez();
+
463 tmp <<= left;
+
464 uint128_t quotient(0);
+
465 uint128_t zero(0);
+
466 while (tmp2 >= p) {
+
467 uint16_t shf = tmp2._lez() - tmp._lez();
+
468 if (shf) {
+
469 tmp >>= shf;
+
470 quotient <<= shf;
+
471 left -= shf;
+
472 }
+
473 if (tmp2 < tmp) {
+
474 tmp >>= 1;
+
475 quotient <<= 1;
+
476 --left;
+
477 }
+
478 tmp2 -= tmp;
+
479 ++quotient;
+
480 }
+
481 return {quotient << left, tmp2};
+
482 }
+
class for 128-bit unsigned integer
Definition uint128_t.hpp:60
+
uint32_t _lez()
Leading zeroes in binary.
Definition uint128_t.hpp:140
Here is the call graph for this function:
@@ -845,7 +845,7 @@ Here is the call graph for this function:

returns lower 64-bit integer part

Returns
returns lower 64-bit integer part
-
201{ return s; }
+
202{ return s; }
@@ -874,7 +874,7 @@ Here is the call graph for this function:

casting operator to boolean value

Returns
true if value of this is non-zero, else false
-
184{ return (f || s); }
+
185{ return (f || s); }
@@ -911,9 +911,9 @@ template<typename T , typename = typename std::enable_if<
Returns
integer value casted to mentioned type
-
193 {
-
194 return static_cast<T>(s);
-
195 }
+
194 {
+
195 return static_cast<T>(s);
+
196 }
@@ -942,7 +942,7 @@ template<typename T , typename = typename std::enable_if<

operator ! for uint128_t

Returns
true if this has zero value, else false
-
627{ return !f && !s; }
+
628{ return !f && !s; }
@@ -985,9 +985,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is not equal to other, else false
-
721 {
-
722 return *this != uint128_t(other);
-
723 }
+
722 {
+
723 return *this != uint128_t(other);
+
724 }
@@ -1022,9 +1022,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is not equal than other, else false
-
619 {
-
620 return f != other.f || s != other.s;
-
621 }
+
620 {
+
621 return f != other.f || s != other.s;
+
622 }
@@ -1067,9 +1067,9 @@ template<typename T , typename = typename std::enable_if<
Returns
unsigned 128-bit remainder.
-
542 {
-
543 return *this % uint128_t(p);
-
544 }
+
543 {
+
544 return *this % uint128_t(p);
+
545 }
@@ -1104,8 +1104,8 @@ template<typename T , typename = typename std::enable_if<
Returns
unsigned 128-bit remainder.
-
532{ return divide(p).second; }
-
std::pair< uint128_t, uint128_t > divide(const uint128_t &p)
divide function for uint128_t and other integer types.
Definition uint128_t.hpp:454
+
533{ return divide(p).second; }
+
std::pair< uint128_t, uint128_t > divide(const uint128_t &p)
divide function for uint128_t and other integer types.
Definition uint128_t.hpp:455
Here is the call graph for this function:
@@ -1153,10 +1153,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this set as unsigned 128-bit remainder.
-
564 {
-
565 *this %= uint128_t(p);
-
566 return *this;
-
567 }
+
565 {
+
566 *this %= uint128_t(p);
+
567 return *this;
+
568 }
@@ -1191,10 +1191,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this set as unsigned 128-bit remainder.
-
551 {
-
552 *this = divide(p).second;
-
553 return *this;
-
554 }
+
552 {
+
553 *this = divide(p).second;
+
554 return *this;
+
555 }
Here is the call graph for this function:
@@ -1242,10 +1242,10 @@ template<typename T , typename = typename std::enable_if<
Returns
value of this & p (& is bit-wise operator)
-
855 {
-
856 uint128_t tmp = *this;
-
857 return tmp & uint128_t(p);
-
858 }
+
856 {
+
857 uint128_t tmp = *this;
+
858 return tmp & uint128_t(p);
+
859 }
@@ -1280,9 +1280,9 @@ template<typename T , typename = typename std::enable_if<
Returns
value of this & p (& is bit-wise operator)
-
843 {
-
844 return uint128_t(this->f & p.f, this->s & p.s);
-
845 }
+
844 {
+
845 return uint128_t(this->f & p.f, this->s & p.s);
+
846 }
@@ -1325,9 +1325,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is both values are non-zero, else false
-
733 {
-
734 return (f || s) && b;
-
735 }
+
734 {
+
735 return (f || s) && b;
+
736 }
@@ -1362,9 +1362,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if both of the values are not zero, else false
-
634 {
-
635 return (s || f) && (b.s || b.f);
-
636 }
+
635 {
+
636 return (s || f) && (b.s || b.f);
+
637 }
@@ -1407,10 +1407,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this = this & p (& is bit-wise operator)
-
879 {
-
880 *this &= uint128_t(p);
-
881 return *this;
-
882 }
+
880 {
+
881 *this &= uint128_t(p);
+
882 return *this;
+
883 }
@@ -1445,11 +1445,11 @@ template<typename T , typename = typename std::enable_if<
Returns
this = this & p (& is bit-wise operator)
-
865 {
-
866 this->f &= p.f;
-
867 this->s &= p.s;
-
868 return *this;
-
869 }
+
866 {
+
867 this->f &= p.f;
+
868 this->s &= p.s;
+
869 return *this;
+
870 }
@@ -1478,7 +1478,7 @@ template<typename T , typename = typename std::enable_if<

operator () for uint128_t

Returns
true if this value is non-zero, else false
-
651{ return s || f; }
+
652{ return s || f; }
@@ -1521,9 +1521,9 @@ template<typename T , typename = typename std::enable_if<
Returns
multiplication of this and p, returning uint128_t integer
-
392 {
-
393 return *this * uint128_t(p);
-
394 }
+
393 {
+
394 return *this * uint128_t(p);
+
395 }
@@ -1558,19 +1558,19 @@ template<typename T , typename = typename std::enable_if<
Returns
multiplication of this and p, returning uint128_t integer
-
401 {
-
402 uint64_t f_first = s >> 32, f_second = s & 0xFFFFFFFF,
-
403 s_first = p.s >> 32, s_second = p.s & 0xFFFFFFFF;
-
404 uint64_t fi = f_first * s_first, se = f_first * s_second,
-
405 th = s_first * f_second, fo = s_second * f_second;
-
406 uint64_t tmp = ((se & 0xFFFFFFFF) << 32), tmp2 = (th & 0xFFFFFFFF)
-
407 << 32;
-
408 int cc = (tmp + tmp2 < tmp);
-
409 tmp += tmp2;
-
410 cc += (tmp + fo < tmp);
-
411 uint64_t carry = fi + (se >> 32) + (th >> 32);
-
412 return uint128_t(this->f * p.s + this->s * p.f + carry + cc, tmp + fo);
-
413 }
+
402 {
+
403 uint64_t f_first = s >> 32, f_second = s & 0xFFFFFFFF,
+
404 s_first = p.s >> 32, s_second = p.s & 0xFFFFFFFF;
+
405 uint64_t fi = f_first * s_first, se = f_first * s_second,
+
406 th = s_first * f_second, fo = s_second * f_second;
+
407 uint64_t tmp = ((se & 0xFFFFFFFF) << 32), tmp2 = (th & 0xFFFFFFFF)
+
408 << 32;
+
409 int cc = (tmp + tmp2 < tmp);
+
410 tmp += tmp2;
+
411 cc += (tmp + fo < tmp);
+
412 uint64_t carry = fi + (se >> 32) + (th >> 32);
+
413 return uint128_t(this->f * p.s + this->s * p.f + carry + cc, tmp + fo);
+
414 }
@@ -1613,10 +1613,10 @@ template<typename T , typename = typename std::enable_if<
Returns
multiplication of this and p, returning this
-
423 {
-
424 *this *= uint128_t(p);
-
425 return *this;
-
426 }
+
424 {
+
425 *this *= uint128_t(p);
+
426 return *this;
+
427 }
@@ -1651,20 +1651,20 @@ template<typename T , typename = typename std::enable_if<
Returns
multiplication of this and p, returning this
-
433 {
-
434 uint64_t f_first = s >> 32, f_second = s & 0xFFFFFFFF,
-
435 s_first = p.s >> 32, s_second = p.s & 0xFFFFFFFF;
-
436 uint64_t fi = f_first * s_first, se = f_first * s_second,
-
437 th = s_first * f_second, fo = s_second * f_second;
-
438 uint64_t tmp = (se << 32), tmp2 = (th << 32);
-
439 int cc = (tmp + tmp2 < tmp);
-
440 tmp += tmp2;
-
441 cc += (tmp + fo < tmp);
-
442 uint64_t carry = fi + (se >> 32) + (th >> 32);
-
443 f = this->f * p.s + this->s * p.f + carry + cc;
-
444 s = tmp + fo;
-
445 return *this;
-
446 }
+
434 {
+
435 uint64_t f_first = s >> 32, f_second = s & 0xFFFFFFFF,
+
436 s_first = p.s >> 32, s_second = p.s & 0xFFFFFFFF;
+
437 uint64_t fi = f_first * s_first, se = f_first * s_second,
+
438 th = s_first * f_second, fo = s_second * f_second;
+
439 uint64_t tmp = (se << 32), tmp2 = (th << 32);
+
440 int cc = (tmp + tmp2 < tmp);
+
441 tmp += tmp2;
+
442 cc += (tmp + fo < tmp);
+
443 uint64_t carry = fi + (se >> 32) + (th >> 32);
+
444 f = this->f * p.s + this->s * p.f + carry + cc;
+
445 s = tmp + fo;
+
446 return *this;
+
447 }
@@ -1707,9 +1707,9 @@ template<typename T , typename = typename std::enable_if<
Returns
addition of this and p, returning uint128_t integer
-
252 {
-
253 return uint128_t(f + (p + s < s), p + s);
-
254 }
+
253 {
+
254 return uint128_t(f + (p + s < s), p + s);
+
255 }
@@ -1744,9 +1744,9 @@ template<typename T , typename = typename std::enable_if<
Returns
addition of this and p, returning uint128_t integer
-
261 {
-
262 return uint128_t(f + (p.s + s < s) + p.f, p.s + s);
-
263 }
+
262 {
+
263 return uint128_t(f + (p.s + s < s) + p.f, p.s + s);
+
264 }
@@ -1775,10 +1775,10 @@ template<typename T , typename = typename std::enable_if<

pre-increment operator

Returns
incremented value of this.
-
296 {
-
297 *this += 1;
-
298 return *this;
-
299 }
+
297 {
+
298 *this += 1;
+
299 return *this;
+
300 }
@@ -1807,10 +1807,10 @@ template<typename T , typename = typename std::enable_if<

post-increment operator

Returns
incremented value of this.
-
305 {
-
306 ++*this;
-
307 return *this;
-
308 }
+
306 {
+
307 ++*this;
+
308 return *this;
+
309 }
@@ -1853,12 +1853,12 @@ template<typename T , typename = typename std::enable_if<
Returns
addition of this and p, returning this
-
273 {
-
274 bool app = p + s < s;
-
275 this->f += app;
-
276 this->s += p;
-
277 return *this;
-
278 }
+
274 {
+
275 bool app = p + s < s;
+
276 this->f += app;
+
277 this->s += p;
+
278 return *this;
+
279 }
@@ -1893,12 +1893,12 @@ template<typename T , typename = typename std::enable_if<
Returns
addition of this and p, returning this
-
285 {
-
286 bool app = p.s + s < s;
-
287 f = f + app + p.f;
-
288 s = p.s + s;
-
289 return *this;
-
290 }
+
286 {
+
287 bool app = p.s + s < s;
+
288 f = f + app + p.f;
+
289 s = p.s + s;
+
290 return *this;
+
291 }
@@ -1927,7 +1927,7 @@ template<typename T , typename = typename std::enable_if<

operator - using twos complement

Returns
2's complement of this.
-
337{ return ~*this + uint128_t(1); }
+
338{ return ~*this + uint128_t(1); }
@@ -1970,10 +1970,10 @@ template<typename T , typename = typename std::enable_if<
Returns
subtraction of this and p, returning uint128_t integer
-
318 {
-
319 bool app = p > s;
-
320 return uint128_t(f - app, s - p);
-
321 }
+
319 {
+
320 bool app = p > s;
+
321 return uint128_t(f - app, s - p);
+
322 }
@@ -2008,10 +2008,10 @@ template<typename T , typename = typename std::enable_if<
Returns
subtraction of this and p, returning uint128_t integer
-
328 {
-
329 bool app = p.s > s;
-
330 return uint128_t(f - p.f - app, s - p.s);
-
331 }
+
329 {
+
330 bool app = p.s > s;
+
331 return uint128_t(f - p.f - app, s - p.s);
+
332 }
@@ -2040,10 +2040,10 @@ template<typename T , typename = typename std::enable_if<

operator – (pre-decrement)

Returns
decremented value of this
-
343 {
-
344 *this -= 1;
-
345 return *this;
-
346 }
+
344 {
+
345 *this -= 1;
+
346 return *this;
+
347 }
@@ -2072,10 +2072,10 @@ template<typename T , typename = typename std::enable_if<

operator – (post-decrement)

Returns
decremented value of this
-
352 {
-
353 --*this;
-
354 return *this;
-
355 }
+
353 {
+
354 --*this;
+
355 return *this;
+
356 }
@@ -2118,12 +2118,12 @@ template<typename T , typename = typename std::enable_if<
Returns
subtraction of this and p, returning this
-
365 {
-
366 bool app = p > s;
-
367 f -= app;
-
368 s -= p;
-
369 return *this;
-
370 }
+
366 {
+
367 bool app = p > s;
+
368 f -= app;
+
369 s -= p;
+
370 return *this;
+
371 }
@@ -2158,12 +2158,12 @@ template<typename T , typename = typename std::enable_if<
Returns
subtraction of this and p, returning this
-
377 {
-
378 bool app = p.s > s;
-
379 f = f - p.f - app;
-
380 s = s - p.s;
-
381 return *this;
-
382 }
+
378 {
+
379 bool app = p.s > s;
+
380 f = f - p.f - app;
+
381 s = s - p.s;
+
382 return *this;
+
383 }
@@ -2206,11 +2206,11 @@ template<typename T , typename = typename std::enable_if<
Returns
unsigned 128-bit quotient.
-
498 {
-
499 uint128_t tmp = *this;
-
500 tmp /= uint128_t(0, p);
-
501 return tmp;
-
502 }
+
499 {
+
500 uint128_t tmp = *this;
+
501 tmp /= uint128_t(0, p);
+
502 return tmp;
+
503 }
@@ -2245,7 +2245,7 @@ template<typename T , typename = typename std::enable_if<
Returns
unsigned 128-bit quotient.
-
488{ return divide(p).first; }
+
489{ return divide(p).first; }
Here is the call graph for this function:
@@ -2293,10 +2293,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this set as unsigned 128-bit quotient.
-
522 {
-
523 *this /= uint128_t(0, p);
-
524 return *this;
-
525 }
+
523 {
+
524 *this /= uint128_t(0, p);
+
525 return *this;
+
526 }
@@ -2331,10 +2331,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this set as unsigned 128-bit quotient.
-
509 {
-
510 *this = divide(p).first;
-
511 return *this;
-
512 }
+
510 {
+
511 *this = divide(p).first;
+
512 return *this;
+
513 }
Here is the call graph for this function:
@@ -2382,9 +2382,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is less than other, else false
-
661 {
-
662 return *this < uint128_t(other);
-
663 }
+
662 {
+
663 return *this < uint128_t(other);
+
664 }
@@ -2419,9 +2419,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is less than other, else false
-
574 {
-
575 return f < other.f || (f == other.f && s < other.s);
-
576 }
+
575 {
+
576 return f < other.f || (f == other.f && s < other.s);
+
577 }
@@ -2464,17 +2464,17 @@ template<typename T , typename = typename std::enable_if<
Returns
value of this shifted by p to left
-
764 {
-
765 if (!p) {
-
766 return uint128_t(f, s);
-
767 } else if (p >= 64 && p <= 128) {
-
768 return uint128_t((this->s << (p - 64)), 0);
-
769 } else if (p < 64 && p > 0) {
-
770 return uint128_t((this->f << p) + ((this->s >> (64 - p))),
-
771 this->s << p);
-
772 }
-
773 return uint128_t(0);
-
774 }
+
765 {
+
766 if (!p) {
+
767 return uint128_t(f, s);
+
768 } else if (p >= 64 && p <= 128) {
+
769 return uint128_t((this->s << (p - 64)), 0);
+
770 } else if (p < 64 && p > 0) {
+
771 return uint128_t((this->f << p) + ((this->s >> (64 - p))),
+
772 this->s << p);
+
773 }
+
774 return uint128_t(0);
+
775 }
@@ -2517,18 +2517,18 @@ template<typename T , typename = typename std::enable_if<
Returns
this shifted by p to left
-
784 {
-
785 if (p) {
-
786 if (p >= 64 && p <= 128) {
-
787 this->f = (this->s << (p - 64));
-
788 this->s = 0;
-
789 } else {
-
790 f = ((this->f << p) + (this->s >> (64 - p)));
-
791 s = (this->s << p);
-
792 }
-
793 }
-
794 return *this;
-
795 }
+
785 {
+
786 if (p) {
+
787 if (p >= 64 && p <= 128) {
+
788 this->f = (this->s << (p - 64));
+
789 this->s = 0;
+
790 } else {
+
791 f = ((this->f << p) + (this->s >> (64 - p)));
+
792 s = (this->s << p);
+
793 }
+
794 }
+
795 return *this;
+
796 }
@@ -2571,9 +2571,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is less than or equal to other, else false
-
673 {
-
674 return *this <= uint128_t(other);
-
675 }
+
674 {
+
675 return *this <= uint128_t(other);
+
676 }
@@ -2608,9 +2608,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is less than or equal to other, else false
-
583 {
-
584 return f < other.f || (f == other.f && s <= other.s);
-
585 }
+
584 {
+
585 return f < other.f || (f == other.f && s <= other.s);
+
586 }
@@ -2645,10 +2645,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this pointer with it's value equal to p
-
227 {
- -
229 return *this;
-
230 }
+
228 {
+ +
230 return *this;
+
231 }
Here is the call graph for this function:
@@ -2696,10 +2696,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this pointer with it's value equal to p
-
217 {
-
218 this->s = p;
-
219 return *this;
-
220 }
+
218 {
+
219 this->s = p;
+
220 return *this;
+
221 }
@@ -2776,9 +2776,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is equal to other, else false
-
709 {
-
710 return *this == uint128_t(other);
-
711 }
+
710 {
+
711 return *this == uint128_t(other);
+
712 }
@@ -2813,9 +2813,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is equal than other, else false
-
610 {
-
611 return f == other.f && s == other.s;
-
612 }
+
611 {
+
612 return f == other.f && s == other.s;
+
613 }
@@ -2858,9 +2858,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is greater than other, else false
-
685 {
-
686 return *this > uint128_t(other);
-
687 }
+
686 {
+
687 return *this > uint128_t(other);
+
688 }
@@ -2895,9 +2895,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is greater than other, else false
-
592 {
-
593 return f > other.f || (f == other.f && s > other.s);
-
594 }
+
593 {
+
594 return f > other.f || (f == other.f && s > other.s);
+
595 }
@@ -2940,9 +2940,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is greater than or equal other, else false
-
697 {
-
698 return *this >= uint128_t(other);
-
699 }
+
698 {
+
699 return *this >= uint128_t(other);
+
700 }
@@ -2977,9 +2977,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is greater than or equal than other, else false
-
601 {
-
602 return (f > other.f) || (f == other.f && s >= other.s);
-
603 }
+
602 {
+
603 return (f > other.f) || (f == other.f && s >= other.s);
+
604 }
@@ -3022,17 +3022,17 @@ template<typename T , typename = typename std::enable_if<
Returns
value of this shifted by p to right
-
805 {
-
806 if (!p) {
-
807 return uint128_t(this->f, this->s);
-
808 } else if (p >= 64 && p <= 128) {
-
809 return uint128_t(0, (this->f >> (p - 64)));
-
810 } else if (p < 64 && p > 0) {
-
811 return uint128_t((this->f >> p),
-
812 (this->s >> p) + (this->f << (64 - p)));
-
813 }
-
814 return uint128_t(0);
-
815 }
+
806 {
+
807 if (!p) {
+
808 return uint128_t(this->f, this->s);
+
809 } else if (p >= 64 && p <= 128) {
+
810 return uint128_t(0, (this->f >> (p - 64)));
+
811 } else if (p < 64 && p > 0) {
+
812 return uint128_t((this->f >> p),
+
813 (this->s >> p) + (this->f << (64 - p)));
+
814 }
+
815 return uint128_t(0);
+
816 }
@@ -3075,18 +3075,18 @@ template<typename T , typename = typename std::enable_if<
Returns
this shifted by p to right
-
825 {
-
826 if (p) {
-
827 if (p >= 64) {
-
828 f = 0;
-
829 s = (this->f >> (p - 64));
-
830 } else {
-
831 s = (this->s >> p) + (this->f << (64 - p));
-
832 f = (this->f >> p);
-
833 }
-
834 }
-
835 return *this;
-
836 }
+
826 {
+
827 if (p) {
+
828 if (p >= 64) {
+
829 f = 0;
+
830 s = (this->f >> (p - 64));
+
831 } else {
+
832 s = (this->s >> p) + (this->f << (64 - p));
+
833 f = (this->f >> p);
+
834 }
+
835 }
+
836 return *this;
+
837 }
@@ -3129,9 +3129,9 @@ template<typename T , typename = typename std::enable_if<
Returns
value of this ^ p (^ is bit-wise XOR operator)
-
937 {
-
938 return uint128_t(this->f, this->s ^ p);
-
939 }
+
938 {
+
939 return uint128_t(this->f, this->s ^ p);
+
940 }
@@ -3166,9 +3166,9 @@ template<typename T , typename = typename std::enable_if<
Returns
value of this ^ p (^ is bit-wise XOR operator)
-
946 {
-
947 return uint128_t(this->f ^ p.f, this->s ^ p.s);
-
948 }
+
947 {
+
948 return uint128_t(this->f ^ p.f, this->s ^ p.s);
+
949 }
@@ -3211,10 +3211,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this = this ^ p (^ is bit-wise XOR operator)
-
969 {
-
970 s ^= p;
-
971 return *this;
-
972 }
+
970 {
+
971 s ^= p;
+
972 return *this;
+
973 }
@@ -3249,11 +3249,11 @@ template<typename T , typename = typename std::enable_if<
Returns
this = this ^ p (^ is bit-wise XOR operator)
-
955 {
-
956 f ^= p.f;
-
957 s ^= p.s;
-
958 return *this;
-
959 }
+
956 {
+
957 f ^= p.f;
+
958 s ^= p.s;
+
959 return *this;
+
960 }
@@ -3296,9 +3296,9 @@ template<typename T , typename = typename std::enable_if<
Returns
value of this | p (| is bit-wise operator)
-
892 {
-
893 return uint128_t(p | s);
-
894 }
+
893 {
+
894 return uint128_t(p | s);
+
895 }
@@ -3333,9 +3333,9 @@ template<typename T , typename = typename std::enable_if<
Returns
value of this | p (| is bit-wise OR operator)
-
901 {
-
902 return uint128_t(this->f | p.f, this->s | p.s);
-
903 }
+
902 {
+
903 return uint128_t(this->f | p.f, this->s | p.s);
+
904 }
@@ -3378,10 +3378,10 @@ template<typename T , typename = typename std::enable_if<
Returns
this = this | p (| is bit-wise OR operator)
-
924 {
-
925 s |= p.s;
-
926 return *this;
-
927 }
+
925 {
+
926 s |= p.s;
+
927 return *this;
+
928 }
@@ -3416,11 +3416,11 @@ template<typename T , typename = typename std::enable_if<
Returns
this = this | p (| is bit-wise OR operator)
-
910 {
-
911 f |= p.f;
-
912 s |= p.s;
-
913 return *this;
-
914 }
+
911 {
+
912 f |= p.f;
+
913 s |= p.s;
+
914 return *this;
+
915 }
@@ -3463,9 +3463,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if this is either one of the values are non-zero, else false
-
746 {
-
747 return (f || s) || b;
-
748 }
+
747 {
+
748 return (f || s) || b;
+
749 }
@@ -3500,9 +3500,9 @@ template<typename T , typename = typename std::enable_if<
Returns
true if one of the values are not zero, else false
-
643 {
-
644 return (s || f) || (b.s || b.f);
-
645 }
+
644 {
+
645 return (s || f) || (b.s || b.f);
+
646 }
@@ -3531,7 +3531,7 @@ template<typename T , typename = typename std::enable_if<

operator ~ for uint128_t

Returns
1's complement of this number
-
754{ return uint128_t(~this->f, ~this->s); }
+
755{ return uint128_t(~this->f, ~this->s); }
@@ -3560,7 +3560,7 @@ template<typename T , typename = typename std::enable_if<

returns upper 64-bit integer part

Returns
returns upper 64-bit integer part
-
207{ return f; }
+
208{ return f; }
@@ -3602,29 +3602,29 @@ template<typename T , typename = typename std::enable_if<
Returns
op, ostream object.
-
983 {
-
984 if (!p.f) {
-
985 op << p.s;
-
986 } else {
-
987 std::string out = "0", p_2 = "1";
-
988 for (int i = 0; i < 64; ++i) {
-
989 if (p.s & (1LL << i)) {
-
990 out = add(out, p_2);
-
991 }
-
992 p_2 = add(p_2, p_2);
-
993 }
-
994 for (int i = 0; i < 64; ++i) {
-
995 if (p.f & (1LL << i)) {
-
996 out = add(out, p_2);
-
997 }
-
998 p_2 = add(p_2, p_2);
-
999 }
-
1000 op << out;
-
1001 }
-
1002 return op;
-
1003 }
+
984 {
+
985 if (!p.f) {
+
986 op << p.s;
+
987 } else {
+
988 std::string out = "0", p_2 = "1";
+
989 for (int i = 0; i < 64; ++i) {
+
990 if (p.s & (1LL << i)) {
+
991 out = add(out, p_2);
+
992 }
+
993 p_2 = add(p_2, p_2);
+
994 }
+
995 for (int i = 0; i < 64; ++i) {
+
996 if (p.f & (1LL << i)) {
+
997 out = add(out, p_2);
+
998 }
+
999 p_2 = add(p_2, p_2);
+
1000 }
+
1001 op << out;
+
1002 }
+
1003 return op;
+
1004 }
-
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:37
+
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:38
@@ -3648,7 +3648,7 @@ template<typename T , typename = typename std::enable_if<
-
60{}, s{}; /// First and second half of 128 bit number
+
61{}, s{}; /// First and second half of 128 bit number
@@ -3671,7 +3671,7 @@ template<typename T , typename = typename std::enable_if<
-
60{}, s{}; /// First and second half of 128 bit number
+
61{}, s{}; /// First and second half of 128 bit number
diff --git a/db/d9f/iterative__factorial_8cpp.html b/db/d9f/iterative__factorial_8cpp.html index e2fb12d34..9818a29b4 100644 --- a/db/d9f/iterative__factorial_8cpp.html +++ b/db/d9f/iterative__factorial_8cpp.html @@ -126,7 +126,7 @@ Include dependency graph for iterative_factorial.cpp:

Namespaces

namespace  math - for IO operations
+ for assert
 
1304
1305 return 0;
1306}
-
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:186
+
static void test2()
Self-implementations, 2nd test.
Definition dsu_path_compression.cpp:187
T stoi(T... args)
static void test1()
simple test to insert a given array and delete some item, and print the tree
Definition tree_234.cpp:1263
diff --git a/db/dc0/namespacebacktracking.html b/db/dc0/namespacebacktracking.html index 1cd7fecd0..c6aee77a8 100644 --- a/db/dc0/namespacebacktracking.html +++ b/db/dc0/namespacebacktracking.html @@ -129,6 +129,7 @@ Functions

diff --git a/db/dbc/tree__234_8cpp.html b/db/dbc/tree__234_8cpp.html index 31b621c00..491fe1c62 100644 --- a/db/dbc/tree__234_8cpp.html +++ b/db/dbc/tree__234_8cpp.html @@ -198,7 +198,7 @@ Functions

Detailed Description

for vector container

+

for assert

Backtracking algorithms.

for IO operations

for std::vector

@@ -143,9 +144,9 @@ Functions

Backtracking algorithms

for std::array for assert

Backtracking algorithms

-

for assert for IO operations for unordered_map

+

for IO operations for unordered_map for std::vector

Backtracking algorithms

-

for assert for IO operations

+

for IO operations for std::vector

Backtracking algorithms

for assert

Backtracking algorithms

diff --git a/db/dc4/floyd__cycle__detection__algo_8cpp.html b/db/dc4/floyd__cycle__detection__algo_8cpp.html index e980b8506..57d15f71f 100644 --- a/db/dc4/floyd__cycle__detection__algo_8cpp.html +++ b/db/dc4/floyd__cycle__detection__algo_8cpp.html @@ -114,18 +114,19 @@ $(function(){initNavTree('db/dc4/floyd__cycle__detection__algo_8cpp.html','../..

Implementation of Floyd's Cycle Detection algorithm. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for floyd_cycle_detection_algo.cpp:
-
+
- + diff --git a/db/dca/kadane2_8cpp.html b/db/dca/kadane2_8cpp.html index 78bcc2889..5bfd4e938 100644 --- a/db/dca/kadane2_8cpp.html +++ b/db/dca/kadane2_8cpp.html @@ -184,7 +184,7 @@ Algorithm -
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
diff --git a/db/de3/dsu__path__compression_8cpp__incl.map b/db/de3/dsu__path__compression_8cpp__incl.map index 9bf4c48c8..a28cce94d 100644 --- a/db/de3/dsu__path__compression_8cpp__incl.map +++ b/db/de3/dsu__path__compression_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/db/de3/dsu__path__compression_8cpp__incl.md5 b/db/de3/dsu__path__compression_8cpp__incl.md5 index 7985d780a..fe57a6477 100644 --- a/db/de3/dsu__path__compression_8cpp__incl.md5 +++ b/db/de3/dsu__path__compression_8cpp__incl.md5 @@ -1 +1 @@ -fb6f344a2a941001f68b3ab43c964487 \ No newline at end of file +4b3a3f755dea5858e0203d1513edbe8f \ No newline at end of file diff --git a/db/de3/dsu__path__compression_8cpp__incl.svg b/db/de3/dsu__path__compression_8cpp__incl.svg index 03aaeca35..763ba385e 100644 --- a/db/de3/dsu__path__compression_8cpp__incl.svg +++ b/db/de3/dsu__path__compression_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -data_structures/dsu -_path_compression.cpp + +data_structures/dsu +_path_compression.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -vector + +iostream @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/db/de3/dsu__path__compression_8cpp__incl_org.svg b/db/de3/dsu__path__compression_8cpp__incl_org.svg index 26577f91c..bb2c1febc 100644 --- a/db/de3/dsu__path__compression_8cpp__incl_org.svg +++ b/db/de3/dsu__path__compression_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + data_structures/dsu_path_compression.cpp Node1 - -data_structures/dsu -_path_compression.cpp + +data_structures/dsu +_path_compression.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -vector + +iostream @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/dc/d13/classdivide__and__conquer_1_1strassens__multiplication_1_1_matrix.html b/dc/d13/classdivide__and__conquer_1_1strassens__multiplication_1_1_matrix.html index ddf05b40e..4409fac74 100644 --- a/dc/d13/classdivide__and__conquer_1_1strassens__multiplication_1_1_matrix.html +++ b/dc/d13/classdivide__and__conquer_1_1strassens__multiplication_1_1_matrix.html @@ -1057,7 +1057,7 @@ template<typename T , typename = typename std::enable_if< st
120 }
121 return result;
122 }
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/dc/d14/wildcard__matching_8cpp.html b/dc/d14/wildcard__matching_8cpp.html index 588e7d642..a66509009 100644 --- a/dc/d14/wildcard__matching_8cpp.html +++ b/dc/d14/wildcard__matching_8cpp.html @@ -115,12 +115,13 @@ $(function(){initNavTree('dc/d14/wildcard__matching_8cpp.html','../../'); initRe

Implementation of the Wildcard Matching problem. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for wildcard_matching.cpp:
-
+

Namespaces

namespace  search
 for std::vector
 for std::assert
 
namespace  cycle_detection
 Functions for the Floyd's Cycle Detection algorithm.

Main function.

Returns
0 on exit
-
152 {
-
153 test(); // run self-test implementations
-
154 return 0;
-
155}
-
static void test()
Self-test implementations.
Definition wildcard_matching.cpp:101
+
153 {
+
154 test(); // run self-test implementations
+
155 return 0;
+
156}
+
static void test()
Self-test implementations.
Definition wildcard_matching.cpp:102
Here is the call graph for this function:
@@ -208,52 +209,52 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
101 {
-
102 // 1st test
-
103 std::cout << "1st test ";
-
104 std::string matching1 = "baaabab";
-
105 std::string pattern1 = "*****ba*****ab";
-
106 assert(backtracking::wildcard_matching::wildcard_matching(matching1,
-
107 pattern1, 0, 0) ==
-
108 1); // here the pattern matches with given string
-
109 std::cout << "passed" << std::endl;
-
110
-
111 // 2nd test
-
112 std::cout << "2nd test ";
-
113 std::string matching2 = "baaabab";
-
114 std::string pattern2 = "ba*****ab";
-
115 assert(backtracking::wildcard_matching::wildcard_matching(matching2,
-
116 pattern2, 0, 0) ==
-
117 1); // here the pattern matches with given string
-
118 std::cout << "passed" << std::endl;
-
119
-
120 // 3rd test
-
121 std::cout << "3rd test ";
-
122 std::string matching3 = "baaabab";
-
123 std::string pattern3 = "ba*ab";
-
124 assert(backtracking::wildcard_matching::wildcard_matching(matching3,
-
125 pattern3, 0, 0) ==
-
126 1); // here the pattern matches with given string
-
127 std::cout << "passed" << std::endl;
-
128
-
129 // 4th test
-
130 std::cout << "4th test ";
-
131 std::string matching4 = "baaabab";
-
132 std::string pattern4 = "a*ab";
-
133 assert(backtracking::wildcard_matching::wildcard_matching(matching4,
-
134 pattern4, 0, 0) ==
-
135 1); // here the pattern matches with given string
-
136 std::cout << "passed" << std::endl;
-
137
-
138 // 5th test
-
139 std::cout << "5th test ";
-
140 std::string matching5 = "baaabab";
-
141 std::string pattern5 = "aa?ab";
-
142 assert(backtracking::wildcard_matching::wildcard_matching(matching5,
-
143 pattern5, 0, 0) ==
-
144 1); // here the pattern matches with given string
-
145 std::cout << "passed" << std::endl;
-
146}
+
102 {
+
103 // 1st test
+
104 std::cout << "1st test ";
+
105 std::string matching1 = "baaabab";
+
106 std::string pattern1 = "*****ba*****ab";
+
107 assert(backtracking::wildcard_matching::wildcard_matching(matching1,
+
108 pattern1, 0, 0) ==
+
109 1); // here the pattern matches with given string
+
110 std::cout << "passed" << std::endl;
+
111
+
112 // 2nd test
+
113 std::cout << "2nd test ";
+
114 std::string matching2 = "baaabab";
+
115 std::string pattern2 = "ba*****ab";
+
116 assert(backtracking::wildcard_matching::wildcard_matching(matching2,
+
117 pattern2, 0, 0) ==
+
118 1); // here the pattern matches with given string
+
119 std::cout << "passed" << std::endl;
+
120
+
121 // 3rd test
+
122 std::cout << "3rd test ";
+
123 std::string matching3 = "baaabab";
+
124 std::string pattern3 = "ba*ab";
+
125 assert(backtracking::wildcard_matching::wildcard_matching(matching3,
+
126 pattern3, 0, 0) ==
+
127 1); // here the pattern matches with given string
+
128 std::cout << "passed" << std::endl;
+
129
+
130 // 4th test
+
131 std::cout << "4th test ";
+
132 std::string matching4 = "baaabab";
+
133 std::string pattern4 = "a*ab";
+
134 assert(backtracking::wildcard_matching::wildcard_matching(matching4,
+
135 pattern4, 0, 0) ==
+
136 1); // here the pattern matches with given string
+
137 std::cout << "passed" << std::endl;
+
138
+
139 // 5th test
+
140 std::cout << "5th test ";
+
141 std::string matching5 = "baaabab";
+
142 std::string pattern5 = "aa?ab";
+
143 assert(backtracking::wildcard_matching::wildcard_matching(matching5,
+
144 pattern5, 0, 0) ==
+
145 1); // here the pattern matches with given string
+
146 std::cout << "passed" << std::endl;
+
147}
T endl(T... args)
@@ -293,59 +294,59 @@ Here is the call graph for this function:

@@ -170,11 +171,11 @@ Variables

-
40 {
-
41 uint32_t n = s.length();
-
42 uint32_t m = p.length();
-
43 // matching is successfull if both strings are done
-
44 if (pos1 == n && pos2 == m) {
-
45 return true;
-
46 }
-
47
-
48 // matching is unsuccessfull if pattern is not finished but matching string
-
49 // is
-
50 if (pos1 != n && pos2 == m) {
-
51 return false;
-
52 }
-
53
-
54 // all the remaining characters of patterns must be * inorder to match with
-
55 // finished string
-
56 if (pos1 == n && pos2 != m) {
-
57 while (pos2 < m && p[pos2] == '*') {
-
58 pos2++;
-
59 }
-
60
-
61 return pos2 == m;
-
62 }
-
63
-
64 // if already calculted for these positions
-
65 if (dpTable[pos1][pos2] != -1) {
-
66 return dpTable[pos1][pos2];
-
67 }
-
68
-
69 // if the characters are same just go ahead in both the string
-
70 if (s[pos1] == p[pos2]) {
-
71 return dpTable[pos1][pos2] =
-
72 wildcard_matching(s, p, pos1 + 1, pos2 + 1);
-
73 }
-
74
-
75 else {
-
76 // can only single character
-
77 if (p[pos2] == '?') {
-
78 return dpTable[pos1][pos2] =
-
79 wildcard_matching(s, p, pos1 + 1, pos2 + 1);
-
80 }
-
81 // have choice either to match one or more charcters
-
82 else if (p[pos2] == '*') {
-
83 return dpTable[pos1][pos2] =
-
84 wildcard_matching(s, p, pos1, pos2 + 1) ||
-
85 wildcard_matching(s, p, pos1 + 1, pos2);
-
86 }
-
87 // not possible to match
-
88 else {
-
89 return dpTable[pos1][pos2] = 0;
-
90 }
-
91 }
-
92}
+
41 {
+
42 uint32_t n = s.length();
+
43 uint32_t m = p.length();
+
44 // matching is successfull if both strings are done
+
45 if (pos1 == n && pos2 == m) {
+
46 return true;
+
47 }
+
48
+
49 // matching is unsuccessfull if pattern is not finished but matching string
+
50 // is
+
51 if (pos1 != n && pos2 == m) {
+
52 return false;
+
53 }
+
54
+
55 // all the remaining characters of patterns must be * inorder to match with
+
56 // finished string
+
57 if (pos1 == n && pos2 != m) {
+
58 while (pos2 < m && p[pos2] == '*') {
+
59 pos2++;
+
60 }
+
61
+
62 return pos2 == m;
+
63 }
+
64
+
65 // if already calculted for these positions
+
66 if (dpTable[pos1][pos2] != -1) {
+
67 return dpTable[pos1][pos2];
+
68 }
+
69
+
70 // if the characters are same just go ahead in both the string
+
71 if (s[pos1] == p[pos2]) {
+
72 return dpTable[pos1][pos2] =
+
73 wildcard_matching(s, p, pos1 + 1, pos2 + 1);
+
74 }
+
75
+
76 else {
+
77 // can only single character
+
78 if (p[pos2] == '?') {
+
79 return dpTable[pos1][pos2] =
+
80 wildcard_matching(s, p, pos1 + 1, pos2 + 1);
+
81 }
+
82 // have choice either to match one or more charcters
+
83 else if (p[pos2] == '*') {
+
84 return dpTable[pos1][pos2] =
+
85 wildcard_matching(s, p, pos1, pos2 + 1) ||
+
86 wildcard_matching(s, p, pos1 + 1, pos2);
+
87 }
+
88 // not possible to match
+
89 else {
+
90 return dpTable[pos1][pos2] = 0;
+
91 }
+
92 }
+
93}
Functions for the Wildcard Matching problem.
T length(T... args)
std::vector< std::vector< int64_t > > dpTable(1000, std::vector< int64_t >(1000, -1))
The main function implements if pattern can be matched with given string.
diff --git a/dc/d38/ordinary__least__squares__regressor_8cpp.html b/dc/d38/ordinary__least__squares__regressor_8cpp.html index 1c95852b7..c7044cdc6 100644 --- a/dc/d38/ordinary__least__squares__regressor_8cpp.html +++ b/dc/d38/ordinary__least__squares__regressor_8cpp.html @@ -325,7 +325,7 @@ template<typename T >
292 return inverse;
293}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T endl(T... args)
bool is_square(std::vector< std::vector< T > > const &A)
Definition ordinary_least_squares_regressor.cpp:59
@@ -364,7 +364,7 @@ template<typename T >
309 }
310 return result;
311}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
diff --git a/dc/d57/inverse__fast__fourier__transform_8cpp__incl.map b/dc/d57/inverse__fast__fourier__transform_8cpp__incl.map index 666253018..5abcd1ca8 100644 --- a/dc/d57/inverse__fast__fourier__transform_8cpp__incl.map +++ b/dc/d57/inverse__fast__fourier__transform_8cpp__incl.map @@ -1,13 +1,15 @@ - + - + - + - - - - - + + + + + + + diff --git a/dc/d57/inverse__fast__fourier__transform_8cpp__incl.md5 b/dc/d57/inverse__fast__fourier__transform_8cpp__incl.md5 index cd7262d0b..f1e439659 100644 --- a/dc/d57/inverse__fast__fourier__transform_8cpp__incl.md5 +++ b/dc/d57/inverse__fast__fourier__transform_8cpp__incl.md5 @@ -1 +1 @@ -4045be0752b4101a3e0e378e3fcdd7cd \ No newline at end of file +6f50b67e218c0fd81124e8055e4e925d \ No newline at end of file diff --git a/dc/d57/inverse__fast__fourier__transform_8cpp__incl.svg b/dc/d57/inverse__fast__fourier__transform_8cpp__incl.svg index 718b20c18..205c041d7 100644 --- a/dc/d57/inverse__fast__fourier__transform_8cpp__incl.svg +++ b/dc/d57/inverse__fast__fourier__transform_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -numerical_methods/inverse -_fast_fourier_transform.cpp + +numerical_methods/inverse +_fast_fourier_transform.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -iostream + +cstdint @@ -96,8 +96,8 @@ Node1->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -vector + +iostream @@ -114,8 +114,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/dc/d57/inverse__fast__fourier__transform_8cpp__incl_org.svg b/dc/d57/inverse__fast__fourier__transform_8cpp__incl_org.svg index 782efe720..b65994215 100644 --- a/dc/d57/inverse__fast__fourier__transform_8cpp__incl_org.svg +++ b/dc/d57/inverse__fast__fourier__transform_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + numerical_methods/inverse_fast_fourier_transform.cpp Node1 - -numerical_methods/inverse -_fast_fourier_transform.cpp + +numerical_methods/inverse +_fast_fourier_transform.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -iostream + +cstdint @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -vector + +iostream @@ -103,8 +103,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/dc/d6d/power__of__2_8cpp.html b/dc/d6d/power__of__2_8cpp.html index c67ed2bde..0670ad26d 100644 --- a/dc/d6d/power__of__2_8cpp.html +++ b/dc/d6d/power__of__2_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('dc/d6d/power__of__2_8cpp.html','../../'); initResizabl

[Find whether a given number is power of 2] (https://www.geeksforgeeks.org/program-to-find-whether-a-given-number-is-power-of-2/) implementation More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for power_of_2.cpp:
-
+
- +

Namespaces

namespace  bit_manipulation
 for IO operations
 for assert
 

Main function.

Returns
0 on exit
-
71 {
-
72 test(); // run self-test implementations
-
73 return 0;
-
74}
-
static void test()
Self-test implementations.
Definition power_of_2.cpp:48
+
72 {
+
73 test(); // run self-test implementations
+
74 return 0;
+
75}
+
static void test()
Self-test implementations.
Definition power_of_2.cpp:49
Here is the call graph for this function:
@@ -199,28 +200,28 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
48 {
-
49 // n = 4 return true
-
50 assert(bit_manipulation::isPowerOfTwo(4) == true);
-
51 // n = 6 return false
-
52 assert(bit_manipulation::isPowerOfTwo(6) == false);
-
53 // n = 13 return false
-
54 assert(bit_manipulation::isPowerOfTwo(13) == false);
-
55 // n = 64 return true
-
56 assert(bit_manipulation::isPowerOfTwo(64) == true);
-
57 // n = 15 return false
-
58 assert(bit_manipulation::isPowerOfTwo(15) == false);
-
59 // n = 32 return true
-
60 assert(bit_manipulation::isPowerOfTwo(32) == true);
-
61 // n = 97 return false
-
62 assert(bit_manipulation::isPowerOfTwo(97) == false);
-
63 // n = 1024 return true
-
64 assert(bit_manipulation::isPowerOfTwo(1024) == true);
-
65 std::cout << "All test cases successfully passed!" << std::endl;
-
66}
+
49 {
+
50 // n = 4 return true
+
51 assert(bit_manipulation::isPowerOfTwo(4) == true);
+
52 // n = 6 return false
+
53 assert(bit_manipulation::isPowerOfTwo(6) == false);
+
54 // n = 13 return false
+
55 assert(bit_manipulation::isPowerOfTwo(13) == false);
+
56 // n = 64 return true
+
57 assert(bit_manipulation::isPowerOfTwo(64) == true);
+
58 // n = 15 return false
+
59 assert(bit_manipulation::isPowerOfTwo(15) == false);
+
60 // n = 32 return true
+
61 assert(bit_manipulation::isPowerOfTwo(32) == true);
+
62 // n = 97 return false
+
63 assert(bit_manipulation::isPowerOfTwo(97) == false);
+
64 // n = 1024 return true
+
65 assert(bit_manipulation::isPowerOfTwo(1024) == true);
+
66 std::cout << "All test cases successfully passed!" << std::endl;
+
67}
T endl(T... args)
-
bool isPowerOfTwo(std ::int64_t n)
The main function implements check for power of 2.
Definition power_of_2.cpp:31
+
bool isPowerOfTwo(std ::int64_t n)
The main function implements check for power of 2.
Definition power_of_2.cpp:32
Here is the call graph for this function:
diff --git a/dc/d7e/largest__power_8cpp__incl.map b/dc/d7e/largest__power_8cpp__incl.map index 1d5b15732..57a06cc8b 100644 --- a/dc/d7e/largest__power_8cpp__incl.map +++ b/dc/d7e/largest__power_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/dc/d7e/largest__power_8cpp__incl.md5 b/dc/d7e/largest__power_8cpp__incl.md5 index 45fb3c485..b628839b6 100644 --- a/dc/d7e/largest__power_8cpp__incl.md5 +++ b/dc/d7e/largest__power_8cpp__incl.md5 @@ -1 +1 @@ -4c3150ef91940af98c3d3e5940e5c623 \ No newline at end of file +450f52cf668ae23aa93218d6e91f9621 \ No newline at end of file diff --git a/dc/d7e/largest__power_8cpp__incl.svg b/dc/d7e/largest__power_8cpp__incl.svg index 03b9c6d73..7ecd9c020 100644 --- a/dc/d7e/largest__power_8cpp__incl.svg +++ b/dc/d7e/largest__power_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/largest_power.cpp + +math/largest_power.cpp @@ -32,8 +32,8 @@ Node2 - -iostream + +cassert @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -cassert + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/dc/d7e/largest__power_8cpp__incl_org.svg b/dc/d7e/largest__power_8cpp__incl_org.svg index 9ec5d0859..2751817fc 100644 --- a/dc/d7e/largest__power_8cpp__incl_org.svg +++ b/dc/d7e/largest__power_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/largest_power.cpp Node1 - -math/largest_power.cpp + +math/largest_power.cpp @@ -21,8 +21,8 @@ Node2 - -iostream + +cassert @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -cassert + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/dc/d82/area_8cpp.html b/dc/d82/area_8cpp.html index 0ce9efb94..3c202715f 100644 --- a/dc/d82/area_8cpp.html +++ b/dc/d82/area_8cpp.html @@ -127,7 +127,7 @@ Include dependency graph for area.cpp:
- +

@@ -161,11 +162,11 @@ Functions

Namespaces

namespace  math
 for IO operations
 for assert
 
138 ternary_search(N, A, _target);
139 return 0;
140}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
#define _target
Definition ternary_search.cpp:27
void get_input()
Definition ternary_search.cpp:36
void ternary_search(int N, int A[], int target)
Definition ternary_search.cpp:127
diff --git a/dd/d05/manacher__algorithm_8cpp__incl.map b/dd/d05/manacher__algorithm_8cpp__incl.map index be34989ae..8057948de 100644 --- a/dd/d05/manacher__algorithm_8cpp__incl.map +++ b/dd/d05/manacher__algorithm_8cpp__incl.map @@ -1,11 +1,13 @@ - + - - - - - - - + + + + + + + + + diff --git a/dd/d05/manacher__algorithm_8cpp__incl.md5 b/dd/d05/manacher__algorithm_8cpp__incl.md5 index c094e0480..12ee31ae2 100644 --- a/dd/d05/manacher__algorithm_8cpp__incl.md5 +++ b/dd/d05/manacher__algorithm_8cpp__incl.md5 @@ -1 +1 @@ -aab2b3689da1a5ae6d3627d8d69e536b \ No newline at end of file +2a360ef311c672b1b0b82b08d8a6d8a0 \ No newline at end of file diff --git a/dd/d05/manacher__algorithm_8cpp__incl.svg b/dd/d05/manacher__algorithm_8cpp__incl.svg index 35fba0d70..ebfc6beae 100644 --- a/dd/d05/manacher__algorithm_8cpp__incl.svg +++ b/dd/d05/manacher__algorithm_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -strings/manacher_algorithm.cpp + +strings/manacher_algorithm.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -vector + +iostream @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -cstring + +vector @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +cstring + + + + + +Node1->Node6 + + + diff --git a/dd/d05/manacher__algorithm_8cpp__incl_org.svg b/dd/d05/manacher__algorithm_8cpp__incl_org.svg index ef8c6dec6..ea292b177 100644 --- a/dd/d05/manacher__algorithm_8cpp__incl_org.svg +++ b/dd/d05/manacher__algorithm_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + strings/manacher_algorithm.cpp Node1 - -strings/manacher_algorithm.cpp + +strings/manacher_algorithm.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -vector + +iostream @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -cstring + +vector @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +cstring + + + + + +Node1->Node6 + + + diff --git a/dd/d0d/insertion__sort_8cpp.html b/dd/d0d/insertion__sort_8cpp.html index 52caa5a6c..bfd44aa38 100644 --- a/dd/d0d/insertion__sort_8cpp.html +++ b/dd/d0d/insertion__sort_8cpp.html @@ -226,7 +226,7 @@ template<typename T >
104 arr[N] = static_cast<T>(r);
105 }
106}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T rand(T... args)
Here is the call graph for this function:
diff --git a/dd/d0e/double__factorial_8cpp__incl.map b/dd/d0e/double__factorial_8cpp__incl.map index 91088f57b..d21b12cca 100644 --- a/dd/d0e/double__factorial_8cpp__incl.map +++ b/dd/d0e/double__factorial_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/dd/d0e/double__factorial_8cpp__incl.md5 b/dd/d0e/double__factorial_8cpp__incl.md5 index bc2a447cd..71311ded7 100644 --- a/dd/d0e/double__factorial_8cpp__incl.md5 +++ b/dd/d0e/double__factorial_8cpp__incl.md5 @@ -1 +1 @@ -b29ff5ed8a72d264d31b89d383afba32 \ No newline at end of file +76637a127bde2cf8c889ec27996f819e \ No newline at end of file diff --git a/dd/d0e/double__factorial_8cpp__incl.svg b/dd/d0e/double__factorial_8cpp__incl.svg index e4a959abb..bfe4f69e9 100644 --- a/dd/d0e/double__factorial_8cpp__incl.svg +++ b/dd/d0e/double__factorial_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/double_factorial.cpp + +math/double_factorial.cpp @@ -32,8 +32,8 @@ Node2 - -cassert + +cassert @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/dd/d0e/double__factorial_8cpp__incl_org.svg b/dd/d0e/double__factorial_8cpp__incl_org.svg index 07047fe00..b3f611e08 100644 --- a/dd/d0e/double__factorial_8cpp__incl_org.svg +++ b/dd/d0e/double__factorial_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/double_factorial.cpp Node1 - -math/double_factorial.cpp + +math/double_factorial.cpp @@ -21,8 +21,8 @@ Node2 - -cassert + +cassert @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/dd/d0f/md5_8cpp__incl.map b/dd/d0f/md5_8cpp__incl.map index a19c6c49c..309d445f8 100644 --- a/dd/d0f/md5_8cpp__incl.map +++ b/dd/d0f/md5_8cpp__incl.map @@ -1,17 +1,19 @@ - + - + - + - + - - - - - - - + + + + + + + + + diff --git a/dd/d0f/md5_8cpp__incl.md5 b/dd/d0f/md5_8cpp__incl.md5 index d3b82499a..df22a7591 100644 --- a/dd/d0f/md5_8cpp__incl.md5 +++ b/dd/d0f/md5_8cpp__incl.md5 @@ -1 +1 @@ -2ae14e8ced0fe8992eed9e1363d9d414 \ No newline at end of file +de51628c8054f9e518798769428e9e21 \ No newline at end of file diff --git a/dd/d0f/md5_8cpp__incl.svg b/dd/d0f/md5_8cpp__incl.svg index ccf14fe45..f8b1a3e34 100644 --- a/dd/d0f/md5_8cpp__incl.svg +++ b/dd/d0f/md5_8cpp__incl.svg @@ -4,10 +4,9 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + hashing/md5.cpp Node1 - -hashing/md5.cpp + +hashing/md5.cpp @@ -41,8 +77,8 @@ Node1->Node2 - - + + @@ -59,8 +95,8 @@ Node1->Node3 - - + + @@ -77,8 +113,8 @@ Node1->Node4 - - + + @@ -87,7 +123,7 @@ Node5 -cstring +cstdint @@ -95,8 +131,8 @@ Node1->Node5 - - + + @@ -104,8 +140,8 @@ Node6 - -iostream + +cstring @@ -113,8 +149,8 @@ Node1->Node6 - - + + @@ -122,8 +158,8 @@ Node7 - -string + +iostream @@ -131,8 +167,8 @@ Node1->Node7 - - + + @@ -140,8 +176,8 @@ Node8 - -vector + +string @@ -149,13 +185,52 @@ Node1->Node8 - - + + + + + + + +Node9 + + +vector + + + + + +Node1->Node9 + + + + + + + + + + + + + + + + + + + + +

initially, all of them are their own parents

initially all have depth are equals to zero

initially set size will be equals to one

-
45 {
-
46 p.assign(n, 0);
-
47 /// initially, all of them are their own parents
-
48 for (uint64_t i = 0; i < n; i++) {
-
49 p[i] = i;
-
50 }
-
51 /// initially all have depth are equals to zero
-
52 depth.assign(n, 0);
-
53 maxElement.assign(n, 0);
-
54 minElement.assign(n, 0);
-
55 for (uint64_t i = 0; i < n; i++) {
-
56 depth[i] = 0;
-
57 maxElement[i] = i;
-
58 minElement[i] = i;
-
59 }
-
60 setSize.assign(n, 0);
-
61 /// initially set size will be equals to one
-
62 for (uint64_t i = 0; i < n; i++) {
-
63 setSize[i] = 1;
-
64 }
-
65 }
-
vector< uint64_t > minElement
minimum of each set to which i belongs to
Definition dsu_path_compression.cpp:39
-
vector< uint64_t > p
keeps track of the parent of ith element
Definition dsu_path_compression.cpp:35
-
vector< uint64_t > maxElement
maximum of each set to which i belongs to
Definition dsu_path_compression.cpp:38
-
vector< uint64_t > depth
tracks the depth(rank) of i in the tree
Definition dsu_path_compression.cpp:36
-
vector< uint64_t > setSize
size of each chunk(set)
Definition dsu_path_compression.cpp:37
+
46 {
+
47 p.assign(n, 0);
+
48 /// initially, all of them are their own parents
+
49 for (uint64_t i = 0; i < n; i++) {
+
50 p[i] = i;
+
51 }
+
52 /// initially all have depth are equals to zero
+
53 depth.assign(n, 0);
+
54 maxElement.assign(n, 0);
+
55 minElement.assign(n, 0);
+
56 for (uint64_t i = 0; i < n; i++) {
+
57 depth[i] = 0;
+
58 maxElement[i] = i;
+
59 minElement[i] = i;
+
60 }
+
61 setSize.assign(n, 0);
+
62 /// initially set size will be equals to one
+
63 for (uint64_t i = 0; i < n; i++) {
+
64 setSize[i] = 1;
+
65 }
+
66 }
+
vector< uint64_t > minElement
minimum of each set to which i belongs to
Definition dsu_path_compression.cpp:40
+
vector< uint64_t > p
keeps track of the parent of ith element
Definition dsu_path_compression.cpp:36
+
vector< uint64_t > maxElement
maximum of each set to which i belongs to
Definition dsu_path_compression.cpp:39
+
vector< uint64_t > depth
tracks the depth(rank) of i in the tree
Definition dsu_path_compression.cpp:37
+
vector< uint64_t > setSize
size of each chunk(set)
Definition dsu_path_compression.cpp:38
@@ -287,17 +287,17 @@ Private Attributes

initially all of them are their own parents

-
44 {
-
45 p.assign(n, 0);
-
46 /// initially all of them are their own parents
-
47 depth.assign(n, 0);
-
48 setSize.assign(n, 0);
-
49 for (uint64_t i = 0; i < n; i++) {
-
50 p[i] = i;
-
51 depth[i] = 0;
-
52 setSize[i] = 1;
-
53 }
-
54 }
+
45 {
+
46 p.assign(n, 0);
+
47 /// initially all of them are their own parents
+
48 depth.assign(n, 0);
+
49 setSize.assign(n, 0);
+
50 for (uint64_t i = 0; i < n; i++) {
+
51 p[i] = i;
+
52 depth[i] = 0;
+
53 setSize[i] = 1;
+
54 }
+
55 }
@@ -334,14 +334,14 @@ Private Attributes
Returns
representative of the set to which i belongs to.

using path compression

-
73 {
-
74 /// using path compression
-
75 if (p[i] == i) {
-
76 return i;
-
77 }
-
78 return (p[i] = findSet(p[i]));
-
79 }
-
uint64_t findSet(uint64_t i)
Method to find the representative of the set to which i belongs to, T(n) = O(1)
Definition dsu_path_compression.cpp:73
+
74 {
+
75 /// using path compression
+
76 if (p[i] == i) {
+
77 return i;
+
78 }
+
79 return (p[i] = findSet(p[i]));
+
80 }
+
uint64_t findSet(uint64_t i)
Method to find the representative of the set to which i belongs to, T(n) = O(1)
Definition dsu_path_compression.cpp:74
Here is the call graph for this function:
@@ -382,13 +382,13 @@ Here is the call graph for this function:
Returns
representative of the set to which i belongs to

using union-rank

-
61 {
-
62 /// using union-rank
-
63 while (i != p[i]) {
-
64 i = p[i];
-
65 }
-
66 return i;
-
67 }
+
62 {
+
63 /// using union-rank
+
64 while (i != p[i]) {
+
65 i = p[i];
+
66 }
+
67 return i;
+
68 }
@@ -423,16 +423,16 @@ Here is the call graph for this function:
Returns
void
-
135 {
- -
137 ans.push_back(get_min(i));
-
138 ans.push_back(get_max(i));
-
139 ans.push_back(size(i));
-
140 return ans;
-
141 }
-
uint64_t size(uint64_t i)
A utility function that returns the size of the set to which i belongs to.
Definition dsu_path_compression.cpp:148
-
uint64_t get_max(uint64_t i)
A utility function that returns the max element of the set to which i belongs to.
Definition dsu_path_compression.cpp:155
-
uint64_t get_min(uint64_t i)
A utility function that returns the min element of the set to which i belongs to.
Definition dsu_path_compression.cpp:162
+
136 {
+ +
138 ans.push_back(get_min(i));
+
139 ans.push_back(get_max(i));
+
140 ans.push_back(size(i));
+
141 return ans;
+
142 }
+
uint64_t size(uint64_t i)
A utility function that returns the size of the set to which i belongs to.
Definition dsu_path_compression.cpp:149
+
uint64_t get_max(uint64_t i)
A utility function that returns the max element of the set to which i belongs to.
Definition dsu_path_compression.cpp:156
+
uint64_t get_min(uint64_t i)
A utility function that returns the min element of the set to which i belongs to.
Definition dsu_path_compression.cpp:163
Here is the call graph for this function:
@@ -473,7 +473,7 @@ Here is the call graph for this function:
Returns
maximum of the set to which i belongs to
-
155{ return maxElement[findSet(i)]; }
+
156{ return maxElement[findSet(i)]; }
Here is the call graph for this function:
@@ -513,7 +513,7 @@ Here is the call graph for this function:
Returns
minimum of the set to which i belongs to
-
162{ return minElement[findSet(i)]; }
+
163{ return minElement[findSet(i)]; }
Here is the call graph for this function:
@@ -553,15 +553,15 @@ Here is the call graph for this function:
Returns
void
-
119 {
- -
121 while (p[i] != i) {
-
122 ans.push_back(i);
-
123 i = p[i];
-
124 }
-
125 ans.push_back(i);
-
126 return ans;
-
127 }
+
120 {
+ +
122 while (p[i] != i) {
+
123 ans.push_back(i);
+
124 i = p[i];
+
125 }
+
126 ans.push_back(i);
+
127 return ans;
+
128 }
@@ -603,12 +603,12 @@ Here is the call graph for this function:
Returns
true if element i and j ARE in the same set
false if element i and j are NOT in same set
-
123 {
-
124 if (findSet(i) == findSet(j)) {
-
125 return true;
-
126 }
-
127 return false;
-
128 }
+
124 {
+
125 if (findSet(i) == findSet(j)) {
+
126 return true;
+
127 }
+
128 return false;
+
129 }
Here is the call graph for this function:
@@ -655,12 +655,12 @@ Here is the call graph for this function:
Returns
true if element i and j are in same set
false if element i and j are not in same set
-
107 {
-
108 if (findSet(i) == findSet(j)) {
-
109 return true;
-
110 }
-
111 return false;
-
112 }
+
108 {
+
109 if (findSet(i) == findSet(j)) {
+
110 return true;
+
111 }
+
112 return false;
+
113 }
Here is the call graph for this function:
@@ -700,7 +700,7 @@ Here is the call graph for this function:
Returns
size of the set to which i belongs to
-
148{ return setSize[findSet(i)]; }
+
149{ return setSize[findSet(i)]; }
Here is the call graph for this function:
@@ -751,35 +751,35 @@ Here is the call graph for this function:

if same depth, then increase one's depth

total size of the resultant set

changing the maximum elements

-
87 {
-
88 /// check if both belongs to the same set or not
-
89 if (isSame(i, j)) {
-
90 return;
-
91 }
-
92
-
93 // we find the representative of the i and j
-
94 uint64_t x = findSet(i);
-
95 uint64_t y = findSet(j);
-
96
-
97 /// always keeping the min as x
-
98 /// shallow tree
-
99 if (depth[x] > depth[y]) {
-
100 std::swap(x, y);
-
101 }
-
102 /// making the shallower root's parent the deeper root
-
103 p[x] = y;
-
104
-
105 /// if same depth, then increase one's depth
-
106 if (depth[x] == depth[y]) {
-
107 depth[y]++;
-
108 }
-
109 /// total size of the resultant set
-
110 setSize[y] += setSize[x];
-
111 /// changing the maximum elements
- - -
114 }
-
bool isSame(uint64_t i, uint64_t j)
A utility function which check whether i and j belongs to same set or not.
Definition dsu_path_compression.cpp:123
+
88 {
+
89 /// check if both belongs to the same set or not
+
90 if (isSame(i, j)) {
+
91 return;
+
92 }
+
93
+
94 // we find the representative of the i and j
+
95 uint64_t x = findSet(i);
+
96 uint64_t y = findSet(j);
+
97
+
98 /// always keeping the min as x
+
99 /// shallow tree
+
100 if (depth[x] > depth[y]) {
+
101 std::swap(x, y);
+
102 }
+
103 /// making the shallower root's parent the deeper root
+
104 p[x] = y;
+
105
+
106 /// if same depth, then increase one's depth
+
107 if (depth[x] == depth[y]) {
+
108 depth[y]++;
+
109 }
+
110 /// total size of the resultant set
+
111 setSize[y] += setSize[x];
+
112 /// changing the maximum elements
+ + +
115 }
+
bool isSame(uint64_t i, uint64_t j)
A utility function which check whether i and j belongs to same set or not.
Definition dsu_path_compression.cpp:124
T max(T... args)
T min(T... args)
T swap(T... args)
@@ -833,30 +833,30 @@ Here is the call graph for this function:

making the shallower tree, root parent of the deeper root

if same depth, then increase one's depth

total size of the resultant set

-
75 {
-
76 /// checks if both belongs to same set or not
-
77 if (isSame(i, j)) {
-
78 return;
-
79 }
-
80 /// we find representative of the i and j
-
81 uint64_t x = findSet(i);
-
82 uint64_t y = findSet(j);
-
83
-
84 /// always keeping the min as x
-
85 /// in order to create a shallow tree
-
86 if (depth[x] > depth[y]) {
-
87 std::swap(x, y);
-
88 }
-
89 /// making the shallower tree, root parent of the deeper root
-
90 p[x] = y;
-
91
-
92 /// if same depth, then increase one's depth
-
93 if (depth[x] == depth[y]) {
-
94 depth[y]++;
-
95 }
-
96 /// total size of the resultant set
-
97 setSize[y] += setSize[x];
-
98 }
+
76 {
+
77 /// checks if both belongs to same set or not
+
78 if (isSame(i, j)) {
+
79 return;
+
80 }
+
81 /// we find representative of the i and j
+
82 uint64_t x = findSet(i);
+
83 uint64_t y = findSet(j);
+
84
+
85 /// always keeping the min as x
+
86 /// in order to create a shallow tree
+
87 if (depth[x] > depth[y]) {
+
88 std::swap(x, y);
+
89 }
+
90 /// making the shallower tree, root parent of the deeper root
+
91 p[x] = y;
+
92
+
93 /// if same depth, then increase one's depth
+
94 if (depth[x] == depth[y]) {
+
95 depth[y]++;
+
96 }
+
97 /// total size of the resultant set
+
98 setSize[y] += setSize[x];
+
99 }
Here is the call graph for this function:
diff --git a/dd/d24/namespacedynamic__programming.html b/dd/d24/namespacedynamic__programming.html index 4ebe1e6c9..23be339fc 100644 --- a/dd/d24/namespacedynamic__programming.html +++ b/dd/d24/namespacedynamic__programming.html @@ -136,6 +136,7 @@ Functions

Dynamic Programming algorithms.

Dynamic programming algorithms.

Namespace for dynamic programming algorithms.

+

For std::vector.

for std::vector

Dynamic Programming algorithm.

for IO operations

@@ -153,7 +154,7 @@ Functions

for assert for IO operations for std::vector

for std::assert for IO operations for unordered map

Dynamic Programming algorithms

-

For std::min and std::max For assert For std::size_t For integral typedefs For std::vector

+

For std::min and std::max For assert For std::size_t

Function Documentation

◆ is_armstrong()

diff --git a/dd/d43/uint256__t_8hpp__incl.map b/dd/d43/uint256__t_8hpp__incl.map index cd24dbc16..a1a5a89b3 100644 --- a/dd/d43/uint256__t_8hpp__incl.map +++ b/dd/d43/uint256__t_8hpp__incl.map @@ -1,15 +1,17 @@ - + - + - - - - - + + + + + - - - + + + + + diff --git a/dd/d43/uint256__t_8hpp__incl.md5 b/dd/d43/uint256__t_8hpp__incl.md5 index 7094bd17a..8069f6dcc 100644 --- a/dd/d43/uint256__t_8hpp__incl.md5 +++ b/dd/d43/uint256__t_8hpp__incl.md5 @@ -1 +1 @@ -0e553dc905c385a72a251eac86c9364f \ No newline at end of file +9646c97da817c55a4f3ac596fefe477d \ No newline at end of file diff --git a/dd/d43/uint256__t_8hpp__incl.svg b/dd/d43/uint256__t_8hpp__incl.svg index 4b0d8c615..86fb50373 100644 --- a/dd/d43/uint256__t_8hpp__incl.svg +++ b/dd/d43/uint256__t_8hpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -ciphers/uint256_t.hpp + +ciphers/uint256_t.hpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -uint128_t.hpp + +uint128_t.hpp @@ -77,26 +77,26 @@ Node1->Node4 - - + + - + Node4->Node2 - - - + + + - + Node4->Node3 - - - + + + @@ -113,8 +113,8 @@ Node4->Node5 - - + + @@ -122,8 +122,8 @@ Node6 - -ostream + +cstdint @@ -131,8 +131,26 @@ Node4->Node6 - - + + + + + + + +Node7 + + +ostream + + + + + +Node4->Node7 + + + diff --git a/dd/d43/uint256__t_8hpp__incl_org.svg b/dd/d43/uint256__t_8hpp__incl_org.svg index e88b1abfd..0c047d647 100644 --- a/dd/d43/uint256__t_8hpp__incl_org.svg +++ b/dd/d43/uint256__t_8hpp__incl_org.svg @@ -4,16 +4,16 @@ - + ciphers/uint256_t.hpp Node1 - -ciphers/uint256_t.hpp + +ciphers/uint256_t.hpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -uint128_t.hpp + +uint128_t.hpp @@ -66,26 +66,26 @@ Node1->Node4 - - + + - + Node4->Node2 - - - + + + - + Node4->Node3 - - - + + + @@ -102,8 +102,8 @@ Node4->Node5 - - + + @@ -111,8 +111,8 @@ Node6 - -ostream + +cstdint @@ -120,8 +120,26 @@ Node4->Node6 - - + + + + + + + +Node7 + + +ostream + + + + + +Node4->Node7 + + + diff --git a/dd/d47/namespacemath.html b/dd/d47/namespacemath.html index 79d68133f..2a5313026 100644 --- a/dd/d47/namespacemath.html +++ b/dd/d47/namespacemath.html @@ -111,7 +111,7 @@ $(function(){initNavTree('dd/d47/namespacemath.html','../../'); initResizable(tr
-

for IO operations +

for assert More...

diff --git a/dc/dc4/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2numerical_methods_2rungekutta_8cpp-example.html b/dc/dc4/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2numerical_methods_2rungekutta_8cpp-example.html index 883d3ecfb..0cfc4b4cc 100644 --- a/dc/dc4/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2numerical_methods_2rungekutta_8cpp-example.html +++ b/dc/dc4/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2numerical_methods_2rungekutta_8cpp-example.html @@ -129,9 +129,9 @@ $(function(){initNavTree('dc/dc4/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plu
* There can be many such equations
*/
#include <cassert> /// asserting the test functions
+
#include <cstdint>
#include <iostream> /// for io operations
-
#include <vector> /// for using the vector container
-
+
#include <vector> /// for using the vector container
/**
* @brief The change() function is used
* to return the updated iterative value corresponding
@@ -247,7 +247,7 @@ $(function(){initNavTree('dc/dc4/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plu
int h(int key)
Definition hash_search.cpp:45
Functions for Runge Kutta fourth order method.
-
static double change(double x, double y)
for using the vector container
Definition rungekutta.cpp:33
+
static double change(double x, double y)
asserting the test functions
Definition rungekutta.cpp:33
double rungeKutta(double init_x, const double &init_y, const double &x, const double &h)
the Runge Kutta method finds the value of integration of a function in the given limits....
Definition rungekutta.cpp:57
diff --git a/dc/dc7/rungekutta_8cpp__incl.map b/dc/dc7/rungekutta_8cpp__incl.map index 840984bf2..c16e8d3c2 100644 --- a/dc/dc7/rungekutta_8cpp__incl.map +++ b/dc/dc7/rungekutta_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/dc/dc7/rungekutta_8cpp__incl.md5 b/dc/dc7/rungekutta_8cpp__incl.md5 index bf332b98e..5da3565c7 100644 --- a/dc/dc7/rungekutta_8cpp__incl.md5 +++ b/dc/dc7/rungekutta_8cpp__incl.md5 @@ -1 +1 @@ -ad0557430cc8dfe31e959988346fc945 \ No newline at end of file +371e9dc74e342eaac18f45eb87bf182b \ No newline at end of file diff --git a/dc/dc7/rungekutta_8cpp__incl.svg b/dc/dc7/rungekutta_8cpp__incl.svg index 6f1a8ecb9..497e69df6 100644 --- a/dc/dc7/rungekutta_8cpp__incl.svg +++ b/dc/dc7/rungekutta_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -numerical_methods/rungekutta.cpp + +numerical_methods/rungekutta.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -vector + +iostream @@ -77,8 +77,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/dc/dc7/rungekutta_8cpp__incl_org.svg b/dc/dc7/rungekutta_8cpp__incl_org.svg index 9067d614b..dda167440 100644 --- a/dc/dc7/rungekutta_8cpp__incl_org.svg +++ b/dc/dc7/rungekutta_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + numerical_methods/rungekutta.cpp Node1 - -numerical_methods/rungekutta.cpp + +numerical_methods/rungekutta.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -vector + +iostream @@ -66,8 +66,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/dc/dd9/strand__sort_8cpp.html b/dc/dd9/strand__sort_8cpp.html index c92c1347e..59d18f05a 100644 --- a/dc/dd9/strand__sort_8cpp.html +++ b/dc/dd9/strand__sort_8cpp.html @@ -236,7 +236,7 @@ template<typename T >
T empty(T... args)
T end(T... args)
T erase(T... args)
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T front(T... args)
T pop_front(T... args)
diff --git a/dc/dfb/atbash__cipher_8cpp.html b/dc/dfb/atbash__cipher_8cpp.html index 866b08af6..e6e48286e 100644 --- a/dc/dfb/atbash__cipher_8cpp.html +++ b/dc/dfb/atbash__cipher_8cpp.html @@ -189,7 +189,7 @@ Algorithm

52 return result;
53}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/dc/dfe/ternary__search_8cpp.html b/dc/dfe/ternary__search_8cpp.html index a90c40e42..2a14be556 100644 --- a/dc/dfe/ternary__search_8cpp.html +++ b/dc/dfe/ternary__search_8cpp.html @@ -300,7 +300,7 @@ Functions

@@ -281,20 +281,17 @@ Functions

 

Detailed Description

-

for IO operations

-

for std::cin and std::cout

+

for assert

std::cout

for IO implementations

-

for io operations

Evaluate recurrence relation using matrix exponentiation.

Math algorithms.

-

Mathematical functions.

-

for I/O operations

+

for mathematical functions

Mathematical algorithms.

-

for cout

+

for IO operations

for M_PI definition and pow()

for std::vector

-

for assert

+

for IO operations

Mathematical algorithms

for assert for std::rand for IO operations

Mathematical algorithms

@@ -302,30 +299,42 @@ Functions

Mathematical algorithms

for assert for int32_t type for atoi

Mathematical algorithms

+

for assert

+

Mathematical algorithms

+

for cout

+

Mathematical algorithms

For assert For timing the sieve For IO operations For string handling For std::vector

-

for IO operations for assert

+

for I/O operations

+

Mathematical algorithms

for assert

Math algorithms

-

for assert for std::cin and std::cout

+

for std::cin and std::cout for std::vector

Mathematical algorithms

for std::abs for std::array for assert

Maths algorithms

-

for assert for mathematical functions for passing in functions for IO operations

+

for assert for passing in functions for IO operations

+

Mathematical functions

for math functions for fixed size data types for time to initialize rng for function pointers for std::cout for random number generation for std::vector

for assert for integral types for std::invalid_argument for std::cout

-

for std::cin and std::cout for assert

+

for std::cin and std::cout

+

Mathematical algorithms

Given a recurrence relation; evaluate the value of nth term. For e.g., For fibonacci series, recurrence series is f(n) = f(n-1) + f(n-2) where f(0) = 0 and f(1) = 1. Note that the method used only demonstrates recurrence relation with one variable (n), unlike nCr problem, since it has two (n, r)

Algorithm

This problem can be solved using matrix exponentiation method.

See also
here for simple number exponentiation algorithm or explaination here.
Author
Ashish Daulatabad for assert for IO operations for std::vector STL

Mathematical algorithms

+

for io operations

+

Mathematical algorithms

for assert for std::int64_t

Maths algorithms.

+

for std::cout for std::vector

+

Mathematical algorithms

for assert for std::cout

Mathematical algorithms

for assert for M_PI definition and pow() for uint16_t datatype

Mathematical algorithms

+

for IO operations for assert

std::array assert std::sqrt, std::trunc, std::pow std::complex std::invalid_argument std::setprecision

Mathematical algorithms

for assert for IO operations

@@ -380,21 +389,21 @@ Algorithm -
35 {
-
36 if (num == 0 || num == 1) {
-
37 return 0; // The aliquot sum for 0 and 1 is 0
-
38 }
-
39
-
40 uint64_t sum = 0;
-
41
-
42 for (uint64_t i = 1; i <= num / 2; i++) {
-
43 if (num % i == 0) {
-
44 sum += i;
-
45 }
-
46 }
-
47
-
48 return sum;
-
49}
+
36 {
+
37 if (num == 0 || num == 1) {
+
38 return 0; // The aliquot sum for 0 and 1 is 0
+
39 }
+
40
+
41 uint64_t sum = 0;
+
42
+
43 for (uint64_t i = 1; i <= num / 2; i++) {
+
44 if (num % i == 0) {
+
45 sum += i;
+
46 }
+
47 }
+
48
+
49 return sum;
+
50}
T sum(const std::vector< std::valarray< T > > &A)
Definition vector_ops.hpp:232
@@ -503,10 +512,10 @@ Here is the call graph for this function:
Returns
Sum of binomial coefficients of number
-
26 {
-
27 // Calculating 2^n
-
28 return (1 << n);
-
29}
+
27 {
+
28 // Calculating 2^n
+
29 return (1 << n);
+
30}
@@ -976,16 +985,16 @@ template<typename T >
Returns
integral approximation of function from [lb, ub]
-
33 {
-
34 double result = 0;
-
35 uint64_t numDeltas = static_cast<uint64_t>((ub - lb) / delta);
-
36 for (int i = 0; i < numDeltas; i++) {
-
37 double begin = lb + i * delta;
-
38 double end = lb + (i + 1) * delta;
-
39 result += delta * (func(begin) + func(end)) / 2;
-
40 }
-
41 return result;
-
42}
+
44 {
+
45 double result = 0;
+
46 uint64_t numDeltas = static_cast<uint64_t>((ub - lb) / delta);
+
47 for (int i = 0; i < numDeltas; i++) {
+
48 double begin = lb + i * delta;
+
49 double end = lb + (i + 1) * delta;
+
50 result += delta * (func(begin) + func(end)) / 2;
+
51 }
+
52 return result;
+
53}
@@ -1016,28 +1025,28 @@ template<typename T > false if number is not a factorial

this loop is basically a reverse factorial calculation, where instead of multiplying we are dividing. We start at i = 2 since i = 1 has no impact division wise

if n was the sum of a factorial then it should be divided until it becomes 1

-
27 {
-
28 if (n <= 0) { // factorial numbers are only ever positive Integers
-
29 return false;
-
30 }
-
31
-
32 /*!
-
33 * this loop is basically a reverse factorial calculation, where instead
-
34 * of multiplying we are dividing. We start at i = 2 since i = 1 has
-
35 * no impact division wise
-
36 */
-
37 int i = 2;
-
38 while (n % i == 0) {
-
39 n = n / i;
-
40 i++;
-
41 }
-
42
-
43 /*!
-
44 * if n was the sum of a factorial then it should be divided until it
-
45 * becomes 1
-
46 */
-
47 return (n == 1);
-
48}
+
28 {
+
29 if (n <= 0) { // factorial numbers are only ever positive Integers
+
30 return false;
+
31 }
+
32
+
33 /*!
+
34 * this loop is basically a reverse factorial calculation, where instead
+
35 * of multiplying we are dividing. We start at i = 2 since i = 1 has
+
36 * no impact division wise
+
37 */
+
38 int i = 2;
+
39 while (n % i == 0) {
+
40 n = n / i;
+
41 i++;
+
42 }
+
43
+
44 /*!
+
45 * if n was the sum of a factorial then it should be divided until it
+
46 * becomes 1
+
47 */
+
48 return (n == 1);
+
49}
@@ -1168,18 +1177,17 @@ false if number is not a prime.
Returns
largest power
-
27 {
-
28 // Initialize result
-
29 int x = 0;
-
30
-
31 // Calculate result
-
32 while (n)
-
33 {
-
34 n /= p;
-
35 x += n;
-
36 }
-
37 return x;
-
38 }
+
29 {
+
30 // Initialize result
+
31 int x = 0;
+
32
+
33 // Calculate result
+
34 while (n) {
+
35 n /= p;
+
36 x += n;
+
37 }
+
38 return x;
+
39}
@@ -1204,35 +1212,35 @@ false if number is not a prime.
Returns
int Sum of LCMs, i.e. ∑LCM(i, num) from i = 1 to num
-
29 {
-
30 uint64_t i = 0, j = 0;
-
31 std::vector<uint64_t> eulerTotient(num + 1);
-
32 std::vector<uint64_t> sumOfEulerTotient(num + 1);
-
33
-
34 // storing initial values in eulerTotient vector
-
35 for (i = 1; i <= num; i++) {
-
36 eulerTotient[i] = i;
-
37 }
-
38
-
39 // applying totient sieve
-
40 for (i = 2; i <= num; i++) {
-
41 if (eulerTotient[i] == i) {
-
42 for (j = i; j <= num; j += i) {
-
43 eulerTotient[j] = eulerTotient[j] / i;
-
44 eulerTotient[j] = eulerTotient[j] * (i - 1);
-
45 }
-
46 }
-
47 }
-
48
-
49 // computing sum of euler totients
-
50 for (i = 1; i <= num; i++) {
-
51 for (j = i; j <= num; j += i) {
-
52 sumOfEulerTotient[j] += eulerTotient[i] * i;
-
53 }
-
54 }
-
55
-
56 return ((sumOfEulerTotient[num] + 1) * num) / 2;
-
57}
+
30 {
+
31 uint64_t i = 0, j = 0;
+
32 std::vector<uint64_t> eulerTotient(num + 1);
+
33 std::vector<uint64_t> sumOfEulerTotient(num + 1);
+
34
+
35 // storing initial values in eulerTotient vector
+
36 for (i = 1; i <= num; i++) {
+
37 eulerTotient[i] = i;
+
38 }
+
39
+
40 // applying totient sieve
+
41 for (i = 2; i <= num; i++) {
+
42 if (eulerTotient[i] == i) {
+
43 for (j = i; j <= num; j += i) {
+
44 eulerTotient[j] = eulerTotient[j] / i;
+
45 eulerTotient[j] = eulerTotient[j] * (i - 1);
+
46 }
+
47 }
+
48 }
+
49
+
50 // computing sum of euler totients
+
51 for (i = 1; i <= num; i++) {
+
52 for (j = i; j <= num; j += i) {
+
53 sumOfEulerTotient[j] += eulerTotient[i] * i;
+
54 }
+
55 }
+
56
+
57 return ((sumOfEulerTotient[num] + 1) * num) / 2;
+
58}
@@ -1258,19 +1266,19 @@ false if number is not a prime.
Returns
if number is a magic number, returns true, else false.
-
32 {
-
33 if (n <= 0) {
-
34 return false;
-
35 }
-
36 // result stores the modulus of @param n with 9
-
37 uint64_t result = n % 9;
-
38 // if result is 1 then the number is a magic number else not
-
39 if (result == 1) {
-
40 return true;
-
41 } else {
-
42 return false;
-
43 }
-
44}
+
33 {
+
34 if (n <= 0) {
+
35 return false;
+
36 }
+
37 // result stores the modulus of @param n with 9
+
38 uint64_t result = n % 9;
+
39 // if result is 1 then the number is a magic number else not
+
40 if (result == 1) {
+
41 return true;
+
42 } else {
+
43 return false;
+
44 }
+
45}
@@ -1465,18 +1473,20 @@ Here is the call graph for this function: -
39 {
-
40 uint64_t result = n;
-
41 for (uint64_t i = 2; i * i <= n; i++) {
-
42 if (n % i != 0) continue;
-
43 while (n % i == 0) n /= i;
-
44
-
45 result -= result / i;
-
46 }
-
47 if (n > 1) result -= result / n;
-
48
-
49 return result;
-
50}
+
41 {
+
42 uint64_t result = n;
+
43 for (uint64_t i = 2; i * i <= n; i++) {
+
44 if (n % i != 0)
+
45 continue;
+
46 while (n % i == 0) n /= i;
+
47
+
48 result -= result / i;
+
49 }
+
50 if (n > 1)
+
51 result -= result / n;
+
52
+
53 return result;
+
54}
@@ -2126,10 +2136,10 @@ template<typename T > -
51 {
-
52 assert(approx >= expected * (1 - threshold));
-
53 assert(approx <= expected * (1 + threshold));
-
54}
+
62 {
+
63 assert(approx >= expected * (1 - threshold));
+
64 assert(approx <= expected * (1 + threshold));
+
65}
diff --git a/dd/d4d/list__array_8cpp__incl.map b/dd/d4d/list__array_8cpp__incl.map index 702fcaec7..7162f9b15 100644 --- a/dd/d4d/list__array_8cpp__incl.map +++ b/dd/d4d/list__array_8cpp__incl.map @@ -1,9 +1,11 @@ - - - - - - - + + + + + + + + + diff --git a/dd/d4d/list__array_8cpp__incl.md5 b/dd/d4d/list__array_8cpp__incl.md5 index a23b1659f..7fd1f15f2 100644 --- a/dd/d4d/list__array_8cpp__incl.md5 +++ b/dd/d4d/list__array_8cpp__incl.md5 @@ -1 +1 @@ -e35d2e63f63d0a0c3eac60b27d63cec3 \ No newline at end of file +7f70add964575ccec8731c1186a59e30 \ No newline at end of file diff --git a/dd/d4d/list__array_8cpp__incl.svg b/dd/d4d/list__array_8cpp__incl.svg index d02273a4c..fdebb19bf 100644 --- a/dd/d4d/list__array_8cpp__incl.svg +++ b/dd/d4d/list__array_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -data_structures/list -_array.cpp + +data_structures/list +_array.cpp @@ -33,8 +33,8 @@ Node2 - -iostream + +array @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -array + +cassert @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -cassert + +cstdint @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + diff --git a/dd/d4d/list__array_8cpp__incl_org.svg b/dd/d4d/list__array_8cpp__incl_org.svg index e08d7f99e..ddc51bcb3 100644 --- a/dd/d4d/list__array_8cpp__incl_org.svg +++ b/dd/d4d/list__array_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + data_structures/list_array.cpp Node1 - -data_structures/list -_array.cpp + +data_structures/list +_array.cpp @@ -22,8 +22,8 @@ Node2 - -iostream + +array @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -array + +cassert @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -cassert + +cstdint @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + diff --git a/dd/d89/insertion__sort__recursive_8cpp.html b/dd/d89/insertion__sort__recursive_8cpp.html index b729f4b86..e377ceef7 100644 --- a/dd/d89/insertion__sort__recursive_8cpp.html +++ b/dd/d89/insertion__sort__recursive_8cpp.html @@ -218,7 +218,7 @@ template<typename T >
97 arr[N] = static_cast<T>(r);
98 }
99}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T rand(T... args)
Here is the call graph for this function:
diff --git a/dd/d9a/namespacegreedy__algorithms_1_1stable__matching.html b/dd/d9a/namespacegreedy__algorithms_1_1stable__matching.html index 70e7e6004..e666db071 100644 --- a/dd/d9a/namespacegreedy__algorithms_1_1stable__matching.html +++ b/dd/d9a/namespacegreedy__algorithms_1_1stable__matching.html @@ -151,57 +151,65 @@ Functions
Returns
matches the stable matching between the two sets
-
42 {
-
43 std::uint32_t num_elements = secondary_preferences.size();
-
44 std::vector<std::uint32_t> matches(num_elements, -1);
-
45 std::vector<bool> is_free_primary(num_elements, true);
-
46 std::vector<std::uint32_t> proposal_index(num_elements, 0); // Tracks the next secondary to propose for each primary
-
47
-
48 while (true) {
-
49 int free_primary_index = -1;
-
50
-
51 // Find the next free primary
-
52 for (std::uint32_t i = 0; i < num_elements; i++) {
-
53 if (is_free_primary[i]) {
-
54 free_primary_index = i;
-
55 break;
-
56 }
-
57 }
+
48 {
+
49 std::uint32_t num_elements = secondary_preferences.size();
+
50 std::vector<std::uint32_t> matches(num_elements, -1);
+
51 std::vector<bool> is_free_primary(num_elements, true);
+
52 std::vector<std::uint32_t> proposal_index(
+
53 num_elements,
+
54 0); // Tracks the next secondary to propose for each primary
+
55
+
56 while (true) {
+
57 int free_primary_index = -1;
58
-
59 // If no free primary is found, break the loop
-
60 if (free_primary_index == -1) break;
-
61
-
62 // Get the next secondary to propose
-
63 std::uint32_t secondary_to_propose = primary_preferences[free_primary_index][proposal_index[free_primary_index]];
-
64 proposal_index[free_primary_index]++;
-
65
-
66 // Get the current match of the secondary
-
67 std::uint32_t current_match = matches[secondary_to_propose];
-
68
-
69 // If the secondary is free, match them
-
70 if (current_match == -1) {
-
71 matches[secondary_to_propose] = free_primary_index;
-
72 is_free_primary[free_primary_index] = false;
-
73 } else {
-
74 // Determine if the current match should be replaced
-
75 auto new_proposer_rank = std::find(secondary_preferences[secondary_to_propose].begin(),
-
76 secondary_preferences[secondary_to_propose].end(),
-
77 free_primary_index);
-
78 auto current_match_rank = std::find(secondary_preferences[secondary_to_propose].begin(),
-
79 secondary_preferences[secondary_to_propose].end(),
-
80 current_match);
-
81
-
82 // If the new proposer is preferred over the current match
-
83 if (new_proposer_rank < current_match_rank) {
-
84 matches[secondary_to_propose] = free_primary_index;
-
85 is_free_primary[free_primary_index] = false;
-
86 is_free_primary[current_match] = true; // Current match is now free
-
87 }
-
88 }
-
89 }
-
90
-
91 return matches;
-
92}
+
59 // Find the next free primary
+
60 for (std::uint32_t i = 0; i < num_elements; i++) {
+
61 if (is_free_primary[i]) {
+
62 free_primary_index = i;
+
63 break;
+
64 }
+
65 }
+
66
+
67 // If no free primary is found, break the loop
+
68 if (free_primary_index == -1)
+
69 break;
+
70
+
71 // Get the next secondary to propose
+
72 std::uint32_t secondary_to_propose =
+
73 primary_preferences[free_primary_index]
+
74 [proposal_index[free_primary_index]];
+
75 proposal_index[free_primary_index]++;
+
76
+
77 // Get the current match of the secondary
+
78 std::uint32_t current_match = matches[secondary_to_propose];
+
79
+
80 // If the secondary is free, match them
+
81 if (current_match == -1) {
+
82 matches[secondary_to_propose] = free_primary_index;
+
83 is_free_primary[free_primary_index] = false;
+
84 } else {
+
85 // Determine if the current match should be replaced
+
86 auto new_proposer_rank =
+
87 std::find(secondary_preferences[secondary_to_propose].begin(),
+
88 secondary_preferences[secondary_to_propose].end(),
+
89 free_primary_index);
+
90 auto current_match_rank =
+
91 std::find(secondary_preferences[secondary_to_propose].begin(),
+
92 secondary_preferences[secondary_to_propose].end(),
+
93 current_match);
+
94
+
95 // If the new proposer is preferred over the current match
+
96 if (new_proposer_rank < current_match_rank) {
+
97 matches[secondary_to_propose] = free_primary_index;
+
98 is_free_primary[free_primary_index] = false;
+
99 is_free_primary[current_match] =
+
100 true; // Current match is now free
+
101 }
+
102 }
+
103 }
+
104
+
105 return matches;
+
106}
T begin(T... args)
T end(T... args)
T find(T... args)
diff --git a/dd/d9c/classmachine__learning_1_1aystar__search_1_1_eight_puzzle.html b/dd/d9c/classmachine__learning_1_1aystar__search_1_1_eight_puzzle.html index 59ee7e6dc..d0904369a 100644 --- a/dd/d9c/classmachine__learning_1_1aystar__search_1_1_eight_puzzle.html +++ b/dd/d9c/classmachine__learning_1_1aystar__search_1_1_eight_puzzle.html @@ -235,7 +235,7 @@ template<size_t N = 3>
125 }
126 }
127 }
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
diff --git a/dd/d9f/count__of__set__bits_8cpp__incl.map b/dd/d9f/count__of__set__bits_8cpp__incl.map index bf0b6de51..d10653dc7 100644 --- a/dd/d9f/count__of__set__bits_8cpp__incl.map +++ b/dd/d9f/count__of__set__bits_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/dd/d9f/count__of__set__bits_8cpp__incl.md5 b/dd/d9f/count__of__set__bits_8cpp__incl.md5 index b05f2e7dd..1f1d6459c 100644 --- a/dd/d9f/count__of__set__bits_8cpp__incl.md5 +++ b/dd/d9f/count__of__set__bits_8cpp__incl.md5 @@ -1 +1 @@ -c28f07291fcc27b1500e0f0f10d949bb \ No newline at end of file +c64b10b5236db928284eda6e54e44b72 \ No newline at end of file diff --git a/dd/d9f/count__of__set__bits_8cpp__incl.svg b/dd/d9f/count__of__set__bits_8cpp__incl.svg index a904bea15..806ada12c 100644 --- a/dd/d9f/count__of__set__bits_8cpp__incl.svg +++ b/dd/d9f/count__of__set__bits_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -bit_manipulation/count -_of_set_bits.cpp + +bit_manipulation/count +_of_set_bits.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/dd/d9f/count__of__set__bits_8cpp__incl_org.svg b/dd/d9f/count__of__set__bits_8cpp__incl_org.svg index 68cd3272d..50b32cf9e 100644 --- a/dd/d9f/count__of__set__bits_8cpp__incl_org.svg +++ b/dd/d9f/count__of__set__bits_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + bit_manipulation/count_of_set_bits.cpp Node1 - -bit_manipulation/count -_of_set_bits.cpp + +bit_manipulation/count +_of_set_bits.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/dd/dab/gale__shapley_8cpp__incl.map b/dd/dab/gale__shapley_8cpp__incl.map index c1ed2a86b..34ef01ddd 100644 --- a/dd/dab/gale__shapley_8cpp__incl.map +++ b/dd/dab/gale__shapley_8cpp__incl.map @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + diff --git a/dd/dab/gale__shapley_8cpp__incl.md5 b/dd/dab/gale__shapley_8cpp__incl.md5 index cf6c49b4e..a4a34fac9 100644 --- a/dd/dab/gale__shapley_8cpp__incl.md5 +++ b/dd/dab/gale__shapley_8cpp__incl.md5 @@ -1 +1 @@ -4b4ec511a50c6aac961709ae72aea6f2 \ No newline at end of file +67b476565ec2fa0dc95063769cd5b42a \ No newline at end of file diff --git a/dd/dab/gale__shapley_8cpp__incl.svg b/dd/dab/gale__shapley_8cpp__incl.svg index 6306b276b..3848c3e98 100644 --- a/dd/dab/gale__shapley_8cpp__incl.svg +++ b/dd/dab/gale__shapley_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -greedy_algorithms/gale -_shapley.cpp + +greedy_algorithms/gale +_shapley.cpp @@ -33,8 +33,8 @@ Node2 - -iostream + +algorithm @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -vector + +cassert @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -algorithm + +cstdint @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -cassert + +vector @@ -96,8 +96,8 @@ Node1->Node5 - - + + diff --git a/dd/dab/gale__shapley_8cpp__incl_org.svg b/dd/dab/gale__shapley_8cpp__incl_org.svg index 1861e0c2b..cb6fd0719 100644 --- a/dd/dab/gale__shapley_8cpp__incl_org.svg +++ b/dd/dab/gale__shapley_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + greedy_algorithms/gale_shapley.cpp Node1 - -greedy_algorithms/gale -_shapley.cpp + +greedy_algorithms/gale +_shapley.cpp @@ -22,8 +22,8 @@ Node2 - -iostream + +algorithm @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -vector + +cassert @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -algorithm + +cstdint @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -cassert + +vector @@ -85,8 +85,8 @@ Node1->Node5 - - + + diff --git a/dd/db0/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2sorting_2wiggle_sort_8cpp-example.html b/dd/db0/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2sorting_2wiggle_sort_8cpp-example.html index 0c734645c..fa79d69af 100644 --- a/dd/db0/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2sorting_2wiggle_sort_8cpp-example.html +++ b/dd/db0/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2sorting_2wiggle_sort_8cpp-example.html @@ -129,6 +129,7 @@ $(function(){initNavTree('dd/db0/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plu
#include <algorithm>
#include <cassert>
+
#include <cstdint>
#include <ctime>
#include <iostream> /// for io operations
#include <vector>
@@ -160,7 +161,7 @@ $(function(){initNavTree('dd/db0/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plu
*/
template <typename T> // this allows to have vectors of ints, double, float,
// etc
-
std::vector<T> wiggleSort(const std::vector<T> &arr) {
+
std::vector<T> wiggleSort(const std::vector<T> &arr) {
uint32_t size = arr.size();
@@ -244,7 +245,7 @@ $(function(){initNavTree('dd/db0/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plu
T endl(T... args)
static void test()
Self-test implementations.
Definition generate_parentheses.cpp:82
int main()
Main function.
Definition generate_parentheses.cpp:110
-
static void displayElements(const std::vector< T > &arr)
Utility function used for printing the elements. Prints elements of the array after they're sorted us...
Definition wiggle_sort.cpp:85
+
static void displayElements(const std::vector< T > &arr)
Utility function used for printing the elements. Prints elements of the array after they're sorted us...
Definition wiggle_sort.cpp:86
for working with vectors
Functions for Wiggle Sort algorithm.
T rand(T... args)
diff --git a/dd/dca/class_f_c_f_s.html b/dd/dca/class_f_c_f_s.html index 25ff39e2f..2569195dc 100644 --- a/dd/dca/class_f_c_f_s.html +++ b/dd/dca/class_f_c_f_s.html @@ -199,16 +199,16 @@ template<typename S , typename T , typename E >
Returns
void
-
129 {
-
130 // Add if a process with process ID as id is not found in idList.
-
131 if (idList.find(id) == idList.end()) {
- -
133 make_tuple(id, arrival, burst, 0, 0, 0);
-
134 schedule.push(t);
-
135 idList.insert(id);
-
136 }
-
137 }
-
priority_queue< tuple< S, T, E, double, double, double >, vector< tuple< S, T, E, double, double, double > >, Compare< S, T, E > > schedule
Definition fcfs_scheduling.cpp:111
+
130 {
+
131 // Add if a process with process ID as id is not found in idList.
+
132 if (idList.find(id) == idList.end()) {
+ +
134 make_tuple(id, arrival, burst, 0, 0, 0);
+
135 schedule.push(t);
+
136 idList.insert(id);
+
137 }
+
138 }
+
priority_queue< tuple< S, T, E, double, double, double >, vector< tuple< S, T, E, double, double, double > >, Compare< S, T, E > > schedule
Definition fcfs_scheduling.cpp:112
Here is the call graph for this function:
@@ -245,26 +245,26 @@ template<typename S , typename T , typename E >

Utility function for printing the status of each process after execution.

Returns
void
-
191 {
-
192 cout << "Status of all the proceses post completion is as follows:"
-
193 << endl;
-
194
-
195 cout << std::setw(17) << left << "Process ID" << std::setw(17) << left
-
196 << "Arrival Time" << std::setw(17) << left << "Burst Time"
-
197 << std::setw(17) << left << "Completion Time" << std::setw(17)
-
198 << left << "Turnaround Time" << std::setw(17) << left
-
199 << "Waiting Time" << endl;
-
200
-
201 for (size_t i{}; i < result.size(); i++) {
-
202 cout << std::setprecision(2) << std::fixed << std::setw(17) << left
-
203 << get<0>(result[i]) << std::setw(17) << left
-
204 << get<1>(result[i]) << std::setw(17) << left
-
205 << get<2>(result[i]) << std::setw(17) << left
-
206 << get<3>(result[i]) << std::setw(17) << left
-
207 << get<4>(result[i]) << std::setw(17) << left
-
208 << get<5>(result[i]) << endl;
-
209 }
-
210 }
+
192 {
+
193 cout << "Status of all the proceses post completion is as follows:"
+
194 << endl;
+
195
+
196 cout << std::setw(17) << left << "Process ID" << std::setw(17) << left
+
197 << "Arrival Time" << std::setw(17) << left << "Burst Time"
+
198 << std::setw(17) << left << "Completion Time" << std::setw(17)
+
199 << left << "Turnaround Time" << std::setw(17) << left
+
200 << "Waiting Time" << endl;
+
201
+
202 for (size_t i{}; i < result.size(); i++) {
+
203 cout << std::setprecision(2) << std::fixed << std::setw(17) << left
+
204 << get<0>(result[i]) << std::setw(17) << left
+
205 << get<1>(result[i]) << std::setw(17) << left
+
206 << get<2>(result[i]) << std::setw(17) << left
+
207 << get<3>(result[i]) << std::setw(17) << left
+
208 << get<4>(result[i]) << std::setw(17) << left
+
209 << get<5>(result[i]) << endl;
+
210 }
+
211 }
T fixed(T... args)
#define endl
Definition matrix_exponentiation.cpp:36
@@ -307,37 +307,37 @@ template<typename S , typename T , typename E >

FCFS is a non-preemptive algorithm in which the process which arrives first gets executed first. If two or more processes arrive together then the process with smaller process ID runs first (each process has a unique proces ID).

I used a min priority queue of tuples to accomplish this task. The processes are ordered by their arrival times. If arrival times of some processes are equal, then they are ordered by their process ID.

Returns
void
-
154 {
-
155 // Variable to keep track of time elapsed so far
-
156 double timeElapsed = 0;
-
157
-
158 while (!schedule.empty()) {
- -
160
-
161 // If the current process arrived at time t2, the last process
-
162 // completed its execution at time t1, and t2 > t1.
-
163 if (get<1>(cur) > timeElapsed) {
-
164 timeElapsed += get<1>(cur) - timeElapsed;
-
165 }
-
166
-
167 // Add Burst time to time elapsed
-
168 timeElapsed += get<2>(cur);
-
169
-
170 // Completion time of the current process will be same as time
-
171 // elapsed so far
-
172 get<3>(cur) = timeElapsed;
-
173
-
174 // Turnaround time = Completion time - Arrival time
-
175 get<4>(cur) = get<3>(cur) - get<1>(cur);
-
176
-
177 // Waiting time = Turnaround time - Burst time
-
178 get<5>(cur) = get<4>(cur) - get<2>(cur);
-
179
-
180 result.push_back(cur);
-
181 schedule.pop();
-
182 }
-
183 return result;
-
184 }
+
155 {
+
156 // Variable to keep track of time elapsed so far
+
157 double timeElapsed = 0;
+
158
+
159 while (!schedule.empty()) {
+ +
161
+
162 // If the current process arrived at time t2, the last process
+
163 // completed its execution at time t1, and t2 > t1.
+
164 if (get<1>(cur) > timeElapsed) {
+
165 timeElapsed += get<1>(cur) - timeElapsed;
+
166 }
+
167
+
168 // Add Burst time to time elapsed
+
169 timeElapsed += get<2>(cur);
+
170
+
171 // Completion time of the current process will be same as time
+
172 // elapsed so far
+
173 get<3>(cur) = timeElapsed;
+
174
+
175 // Turnaround time = Completion time - Arrival time
+
176 get<4>(cur) = get<3>(cur) - get<1>(cur);
+
177
+
178 // Waiting time = Turnaround time - Burst time
+
179 get<5>(cur) = get<4>(cur) - get<2>(cur);
+
180
+
181 result.push_back(cur);
+
182 schedule.pop();
+
183 }
+
184 return result;
+
185 }
diff --git a/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.map b/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.map index 9a2ec56da..811ac1583 100644 --- a/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.map +++ b/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.map @@ -1,9 +1,11 @@ - - - - - - - + + + + + + + + + diff --git a/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.md5 b/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.md5 index f59cc0ab2..d805ab8cf 100644 --- a/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.md5 +++ b/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.md5 @@ -1 +1 @@ -8fab4781bab1709356bf5d22468cddcc \ No newline at end of file +d0ceb5f1582a705bb5ccec6c8a31443a \ No newline at end of file diff --git a/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.svg b/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.svg index eb5e57f82..92dd30118 100644 --- a/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.svg +++ b/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -math/fibonacci_matrix -_exponentiation.cpp + +math/fibonacci_matrix +_exponentiation.cpp @@ -33,8 +33,8 @@ Node2 - -iostream + +cassert @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -vector + +cstdint @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -cassert + +iostream @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl_org.svg b/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl_org.svg index aee18e192..0b4732cb4 100644 --- a/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl_org.svg +++ b/dd/ded/fibonacci__matrix__exponentiation_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + math/fibonacci_matrix_exponentiation.cpp Node1 - -math/fibonacci_matrix -_exponentiation.cpp + +math/fibonacci_matrix +_exponentiation.cpp @@ -22,8 +22,8 @@ Node2 - -iostream + +cassert @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -vector + +cstdint @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -cassert + +iostream @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/de/d07/cycle__sort_8cpp.html b/de/d07/cycle__sort_8cpp.html index ef09a932a..30e52883f 100644 --- a/de/d07/cycle__sort_8cpp.html +++ b/de/d07/cycle__sort_8cpp.html @@ -115,12 +115,13 @@ $(function(){initNavTree('de/d07/cycle__sort_8cpp.html','../../'); initResizable More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for cycle_sort.cpp:
-
+

@@ -180,53 +181,53 @@ template<typename T >
Returns
void
-
37 {
-
38 std::vector<T> arr(in_arr);
-
39 for (int cycle_start = 0; cycle_start <= arr.size() - 1; cycle_start++) {
-
40 // initialize item
-
41 T item = arr[cycle_start];
-
42
-
43 // Count the number of elements smaller than item, this number is the
-
44 // correct index of item.
-
45 int pos = cycle_start;
-
46 for (int i = cycle_start + 1; i < arr.size(); i++) {
-
47 if (arr[i] < item) {
-
48 pos++;
-
49 }
-
50 }
-
51
-
52 // item is already in correct position
-
53 if (pos == cycle_start) {
-
54 continue;
-
55 }
-
56
-
57 // duplicate elements
-
58 while (item == arr[pos]) pos += 1;
-
59 if (pos == cycle_start) {
-
60 continue;
-
61 } else {
-
62 std::swap(item, arr[pos]);
-
63 }
-
64 // Rest of the elements
-
65 while (pos != cycle_start) {
-
66 pos = cycle_start;
-
67 // Find position where we put the element
-
68 for (size_t i = cycle_start + 1; i < arr.size(); i++) {
-
69 if (arr[i] < item) {
-
70 pos += 1;
-
71 }
-
72 }
-
73 // duplicate elements
-
74 while (item == arr[pos]) pos += 1;
-
75 if (item == arr[pos]) {
-
76 continue;
-
77 } else {
-
78 std::swap(item, arr[pos]);
-
79 }
-
80 }
-
81 }
-
82 return arr;
-
83}
+
38 {
+
39 std::vector<T> arr(in_arr);
+
40 for (int cycle_start = 0; cycle_start <= arr.size() - 1; cycle_start++) {
+
41 // initialize item
+
42 T item = arr[cycle_start];
+
43
+
44 // Count the number of elements smaller than item, this number is the
+
45 // correct index of item.
+
46 int pos = cycle_start;
+
47 for (int i = cycle_start + 1; i < arr.size(); i++) {
+
48 if (arr[i] < item) {
+
49 pos++;
+
50 }
+
51 }
+
52
+
53 // item is already in correct position
+
54 if (pos == cycle_start) {
+
55 continue;
+
56 }
+
57
+
58 // duplicate elements
+
59 while (item == arr[pos]) pos += 1;
+
60 if (pos == cycle_start) {
+
61 continue;
+
62 } else {
+
63 std::swap(item, arr[pos]);
+
64 }
+
65 // Rest of the elements
+
66 while (pos != cycle_start) {
+
67 pos = cycle_start;
+
68 // Find position where we put the element
+
69 for (size_t i = cycle_start + 1; i < arr.size(); i++) {
+
70 if (arr[i] < item) {
+
71 pos += 1;
+
72 }
+
73 }
+
74 // duplicate elements
+
75 while (item == arr[pos]) pos += 1;
+
76 if (item == arr[pos]) {
+
77 continue;
+
78 } else {
+
79 std::swap(item, arr[pos]);
+
80 }
+
81 }
+
82 }
+
83 return arr;
+
84}
T swap(T... args)
@@ -254,11 +255,11 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
127 {
-
128 test(); // execute the test
-
129 return 0;
-
130}
-
static void test()
Test implementations.
Definition cycle_sort.cpp:91
+
128 {
+
129 test(); // execute the test
+
130 return 0;
+
131}
+
static void test()
Test implementations.
Definition cycle_sort.cpp:92
Here is the call graph for this function:
@@ -292,40 +293,40 @@ Here is the call graph for this function:

Test implementations.

Returns
void
-
91 {
-
92 // Test 1
-
93 // [4, 3, 2, 1] return [1, 2, 3, 4]
-
94 std::vector<uint32_t> array1 = {4, 3, 2, 1};
-
95 std::cout << "Test 1... ";
- -
97 assert(std::is_sorted(std::begin(arr1), std::end(arr1)));
-
98 std::cout << "passed" << std::endl;
-
99
-
100 // [4.3, -6.5, -7.4, 0, 2.7, 1.8] return [-7.4, -6.5, 0, 1.8, 2.7, 4.3]
-
101 std::vector<double> array2 = {4.3, -6.5, -7.4, 0, 2.7, 1.8};
-
102 std::cout << "Test 2... ";
- -
104 assert(std::is_sorted(std::begin(arr2), std::end(arr2)));
-
105 std::cout << "passed" << std::endl;
-
106
-
107 // Test 3
-
108 // [3, 3, 3, 3] return [3, 3, 3, 3]
-
109 std::vector<uint32_t> array3 = {3, 3, 3, 3};
-
110 std::cout << "Test 3... ";
- -
112 assert(std::is_sorted(std::begin(arr3), std::end(arr3)));
-
113 std::cout << "passed" << std::endl;
-
114
-
115 // [9, 4, 6, 8, 14, 3] return [9, 4, 6, 8, 14, 3]
-
116 std::vector<uint32_t> array4 = {3, 4, 6, 8, 9, 14};
-
117 std::cout << "Test 4... ";
- -
119 assert(std::is_sorted(std::begin(arr4), std::end(arr4)));
-
120 std::cout << "passed" << std::endl;
-
121}
+
92 {
+
93 // Test 1
+
94 // [4, 3, 2, 1] return [1, 2, 3, 4]
+
95 std::vector<uint32_t> array1 = {4, 3, 2, 1};
+
96 std::cout << "Test 1... ";
+ +
98 assert(std::is_sorted(std::begin(arr1), std::end(arr1)));
+
99 std::cout << "passed" << std::endl;
+
100
+
101 // [4.3, -6.5, -7.4, 0, 2.7, 1.8] return [-7.4, -6.5, 0, 1.8, 2.7, 4.3]
+
102 std::vector<double> array2 = {4.3, -6.5, -7.4, 0, 2.7, 1.8};
+
103 std::cout << "Test 2... ";
+ +
105 assert(std::is_sorted(std::begin(arr2), std::end(arr2)));
+
106 std::cout << "passed" << std::endl;
+
107
+
108 // Test 3
+
109 // [3, 3, 3, 3] return [3, 3, 3, 3]
+
110 std::vector<uint32_t> array3 = {3, 3, 3, 3};
+
111 std::cout << "Test 3... ";
+ +
113 assert(std::is_sorted(std::begin(arr3), std::end(arr3)));
+
114 std::cout << "passed" << std::endl;
+
115
+
116 // [9, 4, 6, 8, 14, 3] return [9, 4, 6, 8, 14, 3]
+
117 std::vector<uint32_t> array4 = {3, 4, 6, 8, 9, 14};
+
118 std::cout << "Test 4... ";
+ +
120 assert(std::is_sorted(std::begin(arr4), std::end(arr4)));
+
121 std::cout << "passed" << std::endl;
+
122}
T begin(T... args)
-
std::vector< T > cycleSort(const std::vector< T > &in_arr)
The main function implements cycleSort.
Definition cycle_sort.cpp:37
+
std::vector< T > cycleSort(const std::vector< T > &in_arr)
The main function implements cycleSort.
Definition cycle_sort.cpp:38
T end(T... args)
T endl(T... args)
T is_sorted(T... args)
diff --git a/de/d24/power__of__2_8cpp__incl.map b/de/d24/power__of__2_8cpp__incl.map index 304850ce0..a7b5ef33c 100644 --- a/de/d24/power__of__2_8cpp__incl.map +++ b/de/d24/power__of__2_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/de/d24/power__of__2_8cpp__incl.md5 b/de/d24/power__of__2_8cpp__incl.md5 index b514c89b8..77d161e20 100644 --- a/de/d24/power__of__2_8cpp__incl.md5 +++ b/de/d24/power__of__2_8cpp__incl.md5 @@ -1 +1 @@ -8c9e1e656f9290382693f1e30ce9c606 \ No newline at end of file +9199878ba65744f7136991818cd8655f \ No newline at end of file diff --git a/de/d24/power__of__2_8cpp__incl.svg b/de/d24/power__of__2_8cpp__incl.svg index 6b1655a29..c8532c16a 100644 --- a/de/d24/power__of__2_8cpp__incl.svg +++ b/de/d24/power__of__2_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -bit_manipulation/power -_of_2.cpp + +bit_manipulation/power +_of_2.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/de/d24/power__of__2_8cpp__incl_org.svg b/de/d24/power__of__2_8cpp__incl_org.svg index 5bc581d2b..878177bea 100644 --- a/de/d24/power__of__2_8cpp__incl_org.svg +++ b/de/d24/power__of__2_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + bit_manipulation/power_of_2.cpp Node1 - -bit_manipulation/power -_of_2.cpp + +bit_manipulation/power +_of_2.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/de/d47/string__fibonacci_8cpp.html b/de/d47/string__fibonacci_8cpp.html index f53fba06e..1b81f2b34 100644 --- a/de/d47/string__fibonacci_8cpp.html +++ b/de/d47/string__fibonacci_8cpp.html @@ -112,12 +112,13 @@ $(function(){initNavTree('de/d47/string__fibonacci_8cpp.html','../../'); initRes

This Programme returns the Nth fibonacci as a string. More...

-
#include <iostream>
+
#include <cstdint>
+#include <iostream>
#include <cstring>
Include dependency graph for string_fibonacci.cpp:
-
+
Returns
sum as a std::string
-
24 {
-
25 std::string temp = "";
-
26
-
27 // carry flag
-
28 int carry = 0;
-
29
-
30 // fills up with zeros
-
31 while (a.length() < b.length()) {
-
32 a = "0" + a;
-
33 }
-
34
-
35 // fills up with zeros
-
36 while (b.length() < a.length()) {
-
37 b = "0" + b;
-
38 }
-
39
-
40 // adds the numbers a and b
-
41 for (int i = a.length() - 1; i >= 0; i--) {
-
42 char val = static_cast<char>(((a[i] - 48) + (b[i] - 48)) + 48 + carry);
-
43 if (val > 57) {
-
44 carry = 1;
-
45 val -= 10;
-
46 } else {
-
47 carry = 0;
-
48 }
-
49 temp = val + temp;
-
50 }
-
51
-
52 // processes the carry flag
-
53 if (carry == 1) {
-
54 temp = "1" + temp;
-
55 }
-
56
-
57 // removes leading zeros.
-
58 while (temp[0] == '0' && temp.length() > 1) {
-
59 temp = temp.substr(1);
-
60 }
-
61
-
62 return temp;
-
63}
+
25 {
+
26 std::string temp = "";
+
27
+
28 // carry flag
+
29 int carry = 0;
+
30
+
31 // fills up with zeros
+
32 while (a.length() < b.length()) {
+
33 a = "0" + a;
+
34 }
+
35
+
36 // fills up with zeros
+
37 while (b.length() < a.length()) {
+
38 b = "0" + b;
+
39 }
+
40
+
41 // adds the numbers a and b
+
42 for (int i = a.length() - 1; i >= 0; i--) {
+
43 char val = static_cast<char>(((a[i] - 48) + (b[i] - 48)) + 48 + carry);
+
44 if (val > 57) {
+
45 carry = 1;
+
46 val -= 10;
+
47 } else {
+
48 carry = 0;
+
49 }
+
50 temp = val + temp;
+
51 }
+
52
+
53 // processes the carry flag
+
54 if (carry == 1) {
+
55 temp = "1" + temp;
+
56 }
+
57
+
58 // removes leading zeros.
+
59 while (temp[0] == '0' && temp.length() > 1) {
+
60 temp = temp.substr(1);
+
61 }
+
62
+
63 return temp;
+
64}
T length(T... args)
T substr(T... args)
@@ -231,19 +232,19 @@ Here is the call graph for this function:

@@ -160,46 +161,46 @@ Functions

-
68 {
-
69 std::string tmp = "";
-
70 std::string fibMinus1 = "1";
-
71 std::string fibMinus2 = "0";
-
72 for (uint64_t i = 0; i < n; i++) {
-
73 tmp = add(fibMinus1, fibMinus2);
-
74 fibMinus2 = fibMinus1;
-
75 fibMinus1 = tmp;
-
76 }
-
77 std::cout << fibMinus2;
-
78}
+
69 {
+
70 std::string tmp = "";
+
71 std::string fibMinus1 = "1";
+
72 std::string fibMinus2 = "0";
+
73 for (uint64_t i = 0; i < n; i++) {
+
74 tmp = add(fibMinus1, fibMinus2);
+
75 fibMinus2 = fibMinus1;
+
76 fibMinus1 = tmp;
+
77 }
+
78 std::cout << fibMinus2;
+
79}
-
std::string add(std::string a, std::string b)
Definition string_fibonacci.cpp:24
+
std::string add(std::string a, std::string b)
Definition string_fibonacci.cpp:25
Here is the call graph for this function:
@@ -267,17 +268,17 @@ Here is the call graph for this function:

main function

-
81 {
-
82 int n;
-
83 std::cout << "Enter whatever number N you want to find the fibonacci of\n";
-
84 std::cin >> n;
-
85 std::cout << n << " th Fibonacci is \n";
-
86 fib_Accurate(n);
-
87
-
88 return 0;
-
89}
+
82 {
+
83 int n;
+
84 std::cout << "Enter whatever number N you want to find the fibonacci of\n";
+
85 std::cin >> n;
+
86 std::cout << n << " th Fibonacci is \n";
+
87 fib_Accurate(n);
+
88
+
89 return 0;
+
90}
-
void fib_Accurate(uint64_t n)
Definition string_fibonacci.cpp:68
+
void fib_Accurate(uint64_t n)
Definition string_fibonacci.cpp:69
Here is the call graph for this function:
diff --git a/de/d4a/class_compare.html b/de/d4a/class_compare.html index 7252fa94f..15fbf78c5 100644 --- a/de/d4a/class_compare.html +++ b/de/d4a/class_compare.html @@ -172,17 +172,17 @@ template<typename S , typename T , typename E >
Returns
true if the tuples SHOULD be swapped
false if the tuples SHOULDN'T be swapped
-
76 {
-
77 // Compare arrival times
-
78 if (get<1>(t2) < get<1>(t1)) {
-
79 return true;
-
80 }
-
81 // If arrival times are same, then compare Process IDs
-
82 else if (get<1>(t2) == get<1>(t1)) {
-
83 return get<0>(t2) < get<0>(t1);
-
84 }
-
85 return false;
-
86 }
+
77 {
+
78 // Compare arrival times
+
79 if (get<1>(t2) < get<1>(t1)) {
+
80 return true;
+
81 }
+
82 // If arrival times are same, then compare Process IDs
+
83 else if (get<1>(t2) == get<1>(t1)) {
+
84 return get<0>(t2) < get<0>(t1);
+
85 }
+
86 return false;
+
87 }
diff --git a/de/d4c/saddleback__search_8cpp__incl.map b/de/d4c/saddleback__search_8cpp__incl.map index 9fd75414e..62d2cb75e 100644 --- a/de/d4c/saddleback__search_8cpp__incl.map +++ b/de/d4c/saddleback__search_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/de/d4c/saddleback__search_8cpp__incl.md5 b/de/d4c/saddleback__search_8cpp__incl.md5 index 8b2d4328b..f849458c6 100644 --- a/de/d4c/saddleback__search_8cpp__incl.md5 +++ b/de/d4c/saddleback__search_8cpp__incl.md5 @@ -1 +1 @@ -069f213c8de44d7fba1c47336162e9e1 \ No newline at end of file +33f64db57388ee82c28b39d7b035cc24 \ No newline at end of file diff --git a/de/d4c/saddleback__search_8cpp__incl.svg b/de/d4c/saddleback__search_8cpp__incl.svg index 1daeafddd..eed5ea7bb 100644 --- a/de/d4c/saddleback__search_8cpp__incl.svg +++ b/de/d4c/saddleback__search_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -search/saddleback_search.cpp + +search/saddleback_search.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cstdint @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -vector + +iostream @@ -77,8 +77,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/de/d4c/saddleback__search_8cpp__incl_org.svg b/de/d4c/saddleback__search_8cpp__incl_org.svg index 745dbc69e..61c8699b2 100644 --- a/de/d4c/saddleback__search_8cpp__incl_org.svg +++ b/de/d4c/saddleback__search_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + search/saddleback_search.cpp Node1 - -search/saddleback_search.cpp + +search/saddleback_search.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cstdint @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -vector + +iostream @@ -66,8 +66,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/de/d59/sum__of__binomial__coefficient_8cpp__incl.map b/de/d59/sum__of__binomial__coefficient_8cpp__incl.map index 7c1332b29..5fc735e0d 100644 --- a/de/d59/sum__of__binomial__coefficient_8cpp__incl.map +++ b/de/d59/sum__of__binomial__coefficient_8cpp__incl.map @@ -1,7 +1,9 @@ - + - - - + + + + + diff --git a/de/d59/sum__of__binomial__coefficient_8cpp__incl.md5 b/de/d59/sum__of__binomial__coefficient_8cpp__incl.md5 index 6ea46204b..e815ed1f0 100644 --- a/de/d59/sum__of__binomial__coefficient_8cpp__incl.md5 +++ b/de/d59/sum__of__binomial__coefficient_8cpp__incl.md5 @@ -1 +1 @@ -d338ca9833cd74bfec2cc14338ae689f \ No newline at end of file +912127e1b4db74883ea21a1a39daba44 \ No newline at end of file diff --git a/de/d59/sum__of__binomial__coefficient_8cpp__incl.svg b/de/d59/sum__of__binomial__coefficient_8cpp__incl.svg index c3ad80676..f38812f91 100644 --- a/de/d59/sum__of__binomial__coefficient_8cpp__incl.svg +++ b/de/d59/sum__of__binomial__coefficient_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -math/sum_of_binomial -_coefficient.cpp + +math/sum_of_binomial +_coefficient.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/de/d59/sum__of__binomial__coefficient_8cpp__incl_org.svg b/de/d59/sum__of__binomial__coefficient_8cpp__incl_org.svg index f19e24ac8..720d820a9 100644 --- a/de/d59/sum__of__binomial__coefficient_8cpp__incl_org.svg +++ b/de/d59/sum__of__binomial__coefficient_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + math/sum_of_binomial_coefficient.cpp Node1 - -math/sum_of_binomial -_coefficient.cpp + +math/sum_of_binomial +_coefficient.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/de/d5b/eulers__totient__function_8cpp__incl.map b/de/d5b/eulers__totient__function_8cpp__incl.map index c52a5a7ba..d7daf1420 100644 --- a/de/d5b/eulers__totient__function_8cpp__incl.map +++ b/de/d5b/eulers__totient__function_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/de/d5b/eulers__totient__function_8cpp__incl.md5 b/de/d5b/eulers__totient__function_8cpp__incl.md5 index cd8c2dfda..7d2f200be 100644 --- a/de/d5b/eulers__totient__function_8cpp__incl.md5 +++ b/de/d5b/eulers__totient__function_8cpp__incl.md5 @@ -1 +1 @@ -9a19dc852bddd0eecca441f9b499fab0 \ No newline at end of file +2e2b79e6df00acf51f1e3099d6922b25 \ No newline at end of file diff --git a/de/d5b/eulers__totient__function_8cpp__incl.svg b/de/d5b/eulers__totient__function_8cpp__incl.svg index 0205188b3..143e77963 100644 --- a/de/d5b/eulers__totient__function_8cpp__incl.svg +++ b/de/d5b/eulers__totient__function_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -math/eulers_totient -_function.cpp + +math/eulers_totient +_function.cpp @@ -33,8 +33,8 @@ Node2 - -iostream + +cassert @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -cassert + +cstdint @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/de/d5b/eulers__totient__function_8cpp__incl_org.svg b/de/d5b/eulers__totient__function_8cpp__incl_org.svg index 6319fe2da..1c8637985 100644 --- a/de/d5b/eulers__totient__function_8cpp__incl_org.svg +++ b/de/d5b/eulers__totient__function_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + math/eulers_totient_function.cpp Node1 - -math/eulers_totient -_function.cpp + +math/eulers_totient +_function.cpp @@ -22,8 +22,8 @@ Node2 - -iostream + +cassert @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -cassert + +cstdint @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/de/d75/qr__eigen__values_8cpp.html b/de/d75/qr__eigen__values_8cpp.html index 45b90a250..ac4aad91d 100644 --- a/de/d75/qr__eigen__values_8cpp.html +++ b/de/d75/qr__eigen__values_8cpp.html @@ -209,7 +209,7 @@ Functions
41 }
42 }
43}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
#define LIMS
Definition qr_eigen_values.cpp:20
T rand(T... args)
@@ -404,7 +404,7 @@ Here is the call graph for this function:
196 std::cout << "Test 1 Passed\n\n";
197}
T endl(T... args)
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
diff --git a/de/d88/travelling__salesman__problem_8cpp.html b/de/d88/travelling__salesman__problem_8cpp.html index 55cb24319..bfcb72d2e 100644 --- a/de/d88/travelling__salesman__problem_8cpp.html +++ b/de/d88/travelling__salesman__problem_8cpp.html @@ -115,13 +115,14 @@ $(function(){initNavTree('de/d88/travelling__salesman__problem_8cpp.html','../.. More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <iostream>
#include <limits>
#include <vector>
Include dependency graph for travelling_salesman_problem.cpp:
-
+

Main function.

Returns
0 on exit
-
104 {
-
105 tests(); // run self-test implementations
- -
107 {0, 5, 10, 15}, {5, 0, 20, 30}, {10, 20, 0, 35}, {15, 30, 35, 0}};
-
108 uint32_t V = cities.size();
- -
110 return 0;
-
111}
+
105 {
+
106 tests(); // run self-test implementations
+ +
108 {0, 5, 10, 15}, {5, 0, 20, 30}, {10, 20, 0, 35}, {15, 30, 35, 0}};
+
109 uint32_t V = cities.size();
+ +
111 return 0;
+
112}
T endl(T... args)
-
int TravellingSalesmanProblem(std::vector< std::vector< uint32_t > > *cities, int32_t src, uint32_t V)
Function calculates the minimum path distance that will cover all the cities starting from the source...
Definition travelling_salesman_problem.cpp:40
+
int TravellingSalesmanProblem(std::vector< std::vector< uint32_t > > *cities, int32_t src, uint32_t V)
Function calculates the minimum path distance that will cover all the cities starting from the source...
Definition travelling_salesman_problem.cpp:41
T size(T... args)
-
static void tests()
Self-test implementations.
Definition travelling_salesman_problem.cpp:77
+
static void tests()
Self-test implementations.
Definition travelling_salesman_problem.cpp:78
Here is the call graph for this function:
@@ -211,28 +212,28 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
77 {
-
78 std::cout << "Initiatinig Predefined Tests..." << std::endl;
-
79 std::cout << "Initiating Test 1..." << std::endl;
- -
81 {0, 20, 42, 35}, {20, 0, 30, 34}, {42, 30, 0, 12}, {35, 34, 12, 0}};
-
82 uint32_t V = cities.size();
-
83 assert(graph::TravellingSalesmanProblem(&cities, 0, V) == 97);
-
84 std::cout << "1st test passed..." << std::endl;
-
85
-
86 std::cout << "Initiating Test 2..." << std::endl;
-
87 cities = {{0, 5, 10, 15}, {5, 0, 20, 30}, {10, 20, 0, 35}, {15, 30, 35, 0}};
-
88 V = cities.size();
-
89 assert(graph::TravellingSalesmanProblem(&cities, 0, V) == 75);
-
90 std::cout << "2nd test passed..." << std::endl;
-
91
-
92 std::cout << "Initiating Test 3..." << std::endl;
-
93 cities = {
-
94 {0, 10, 15, 20}, {10, 0, 35, 25}, {15, 35, 0, 30}, {20, 25, 30, 0}};
-
95 V = cities.size();
-
96 assert(graph::TravellingSalesmanProblem(&cities, 0, V) == 80);
-
97 std::cout << "3rd test passed..." << std::endl;
-
98}
+
78 {
+
79 std::cout << "Initiatinig Predefined Tests..." << std::endl;
+
80 std::cout << "Initiating Test 1..." << std::endl;
+ +
82 {0, 20, 42, 35}, {20, 0, 30, 34}, {42, 30, 0, 12}, {35, 34, 12, 0}};
+
83 uint32_t V = cities.size();
+
84 assert(graph::TravellingSalesmanProblem(&cities, 0, V) == 97);
+
85 std::cout << "1st test passed..." << std::endl;
+
86
+
87 std::cout << "Initiating Test 2..." << std::endl;
+
88 cities = {{0, 5, 10, 15}, {5, 0, 20, 30}, {10, 20, 0, 35}, {15, 30, 35, 0}};
+
89 V = cities.size();
+
90 assert(graph::TravellingSalesmanProblem(&cities, 0, V) == 75);
+
91 std::cout << "2nd test passed..." << std::endl;
+
92
+
93 std::cout << "Initiating Test 3..." << std::endl;
+
94 cities = {
+
95 {0, 10, 15, 20}, {10, 0, 35, 25}, {15, 35, 0, 30}, {20, 25, 30, 0}};
+
96 V = cities.size();
+
97 assert(graph::TravellingSalesmanProblem(&cities, 0, V) == 80);
+
98 std::cout << "3rd test passed..." << std::endl;
+
99}
Here is the call graph for this function:
diff --git a/de/d89/graham__scan__functions_8hpp_source.html b/de/d89/graham__scan__functions_8hpp_source.html index c42a3009d..5a7481f46 100644 --- a/de/d89/graham__scan__functions_8hpp_source.html +++ b/de/d89/graham__scan__functions_8hpp_source.html @@ -148,182 +148,183 @@ $(function(){initNavTree('de/d89/graham__scan__functions_8hpp_source.html','../.
39 *
40 *******************************************************************************/
41#include <algorithm> /// for std::swap
-
42#include <cstdlib> /// for mathematics and datatype conversion
-
43#include <iostream> /// for IO operations
-
44#include <stack> /// for std::stack
-
45#include <vector> /// for std::vector
-
46
-
47/******************************************************************************
-
48 * @namespace geometry
-
49 * @brief geometric algorithms
-
50 *******************************************************************************/
-
-
51namespace geometry {
-
52
-
53/******************************************************************************
-
54 * @namespace graham scan
-
55 * @brief convex hull algorithm
-
56 *******************************************************************************/
-
57namespace grahamscan {
-
58
-
59/******************************************************************************
-
60 * @struct Point
-
61 * @brief for X and Y co-ordinates of the co-ordinate.
-
62 *******************************************************************************/
-
-
63struct Point {
-
64 int x, y;
-
65};
+
42#include <cstdint>
+
43#include <cstdlib> /// for mathematics and datatype conversion
+
44#include <iostream> /// for IO operations
+
45#include <stack> /// for std::stack
+
46#include <vector> /// for std::vector
+
47
+
48/******************************************************************************
+
49 * @namespace geometry
+
50 * @brief geometric algorithms
+
51 *******************************************************************************/
+
+
52namespace geometry {
+
53
+
54/******************************************************************************
+
55 * @namespace graham scan
+
56 * @brief convex hull algorithm
+
57 *******************************************************************************/
+
58namespace grahamscan {
+
59
+
60/******************************************************************************
+
61 * @struct Point
+
62 * @brief for X and Y co-ordinates of the co-ordinate.
+
63 *******************************************************************************/
+
+
64struct Point {
+
65 int x, y;
+
66};
-
66
-
67// A global point needed for sorting points with reference
-
68// to the first point Used in compare function of qsort()
-
69
-
70Point p0;
-
71
-
72/******************************************************************************
-
73 * @brief A utility function to find next to top in a stack.
-
74 * @param S Stack to be used for the process.
-
75 * @returns @param Point Co-ordinates of the Point <int, int>
-
76 *******************************************************************************/
-
77Point nextToTop(std::stack<Point> *S) {
-
78 Point p = S->top();
-
79 S->pop();
-
80 Point res = S->top();
-
81 S->push(p);
-
82 return res;
-
83}
-
84
-
85/******************************************************************************
-
86 * @brief A utility function to return square of distance between p1 and p2.
-
87 * @param p1 Co-ordinates of Point 1 <int, int>.
-
88 * @param p2 Co-ordinates of Point 2 <int, int>.
-
89 * @returns @param int distance between p1 and p2.
-
90 *******************************************************************************/
-
91int distSq(Point p1, Point p2) {
-
92 return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
-
93}
-
94
-
95/******************************************************************************
-
96 * @brief To find orientation of ordered triplet (p, q, r).
-
97 * @param p Co-ordinates of Point p <int, int>.
-
98 * @param q Co-ordinates of Point q <int, int>.
-
99 * @param r Co-ordinates of Point r <int, int>.
-
100 * @returns @param int 0 --> p, q and r are collinear, 1 --> Clockwise,
-
101 * 2 --> Counterclockwise
-
102 *******************************************************************************/
-
103int orientation(Point p, Point q, Point r) {
-
104 int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
-
105
-
106 if (val == 0) {
-
107 return 0; // collinear
-
108 }
-
109 return (val > 0) ? 1 : 2; // clock or counter-clock wise
-
110}
-
111
-
112/******************************************************************************
-
113 * @brief A function used by library function qsort() to sort an array of
-
114 * points with respect to the first point
-
115 * @param vp1 Co-ordinates of Point 1 <int, int>.
-
116 * @param vp2 Co-ordinates of Point 2 <int, int>.
-
117 * @returns @param int distance between p1 and p2.
-
118 *******************************************************************************/
-
119int compare(const void *vp1, const void *vp2) {
-
120 auto *p1 = static_cast<const Point *>(vp1);
-
121 auto *p2 = static_cast<const Point *>(vp2);
-
122
-
123 // Find orientation
-
124 int o = orientation(p0, *p1, *p2);
-
125 if (o == 0) {
-
126 return (distSq(p0, *p2) >= distSq(p0, *p1)) ? -1 : 1;
-
127 }
-
128
-
129 return (o == 2) ? -1 : 1;
-
130}
-
131
-
132/******************************************************************************
-
133 * @brief Prints convex hull of a set of n points.
-
134 * @param points vector of Point<int, int> with co-ordinates.
-
135 * @param size Size of the vector.
-
136 * @returns @param vector vector of Conver Hull.
-
137 *******************************************************************************/
-
138std::vector<Point> convexHull(std::vector<Point> points, uint64_t size) {
-
139 // Find the bottom-most point
-
140 int ymin = points[0].y, min = 0;
-
141 for (int i = 1; i < size; i++) {
-
142 int y = points[i].y;
-
143
-
144 // Pick the bottom-most or chose the left-most point in case of tie
-
145 if ((y < ymin) || (ymin == y && points[i].x < points[min].x)) {
-
146 ymin = points[i].y, min = i;
-
147 }
-
148 }
-
149
-
150 // Place the bottom-most point at first position
-
151 std::swap(points[0], points[min]);
-
152
-
153 // Sort n-1 points with respect to the first point. A point p1 comes
-
154 // before p2 in sorted output if p2 has larger polar angle
-
155 // (in counterclockwise direction) than p1.
-
156 p0 = points[0];
-
157 qsort(&points[1], size - 1, sizeof(Point), compare);
-
158
-
159 // If two or more points make same angle with p0, Remove all but the one
-
160 // that is farthest from p0 Remember that, in above sorting, our criteria
-
161 // was to keep the farthest point at the end when more than one points have
-
162 // same angle.
-
163 int m = 1; // Initialize size of modified array
-
164 for (int i = 1; i < size; i++) {
-
165 // Keep removing i while angle of i and i+1 is same with respect to p0
-
166 while (i < size - 1 && orientation(p0, points[i], points[i + 1]) == 0) {
-
167 i++;
-
168 }
-
169
-
170 points[m] = points[i];
-
171 m++; // Update size of modified array
-
172 }
-
173
-
174 // If modified array of points has less than 3 points, convex hull is not
-
175 // possible
-
176 if (m < 3) {
-
177 return {};
-
178 };
-
179
-
180 // Create an empty stack and push first three points to it.
- -
182 St.push(points[0]);
-
183 St.push(points[1]);
-
184 St.push(points[2]);
-
185
-
186 // Process remaining n-3 points
-
187 for (int i = 3; i < m; i++) {
-
188 // Keep removing top while the angle formed by
-
189 // points next-to-top, top, and points[i] makes
-
190 // a non-left turn
-
191 while (St.size() > 1 &&
-
192 orientation(nextToTop(&St), St.top(), points[i]) != 2) {
-
193 St.pop();
-
194 }
-
195 St.push(points[i]);
-
196 }
-
197
- -
199 // Now stack has the output points, push them into the resultant vector
-
200 while (!St.empty()) {
-
201 Point p = St.top();
-
202 result.push_back(p);
-
203 St.pop();
-
204 }
-
205
-
206 return result; // return resultant vector with Convex Hull co-ordinates.
-
207}
-
208} // namespace grahamscan
-
209} // namespace geometry
+
67
+
68// A global point needed for sorting points with reference
+
69// to the first point Used in compare function of qsort()
+
70
+
71Point p0;
+
72
+
73/******************************************************************************
+
74 * @brief A utility function to find next to top in a stack.
+
75 * @param S Stack to be used for the process.
+
76 * @returns @param Point Co-ordinates of the Point <int, int>
+
77 *******************************************************************************/
+
78Point nextToTop(std::stack<Point> *S) {
+
79 Point p = S->top();
+
80 S->pop();
+
81 Point res = S->top();
+
82 S->push(p);
+
83 return res;
+
84}
+
85
+
86/******************************************************************************
+
87 * @brief A utility function to return square of distance between p1 and p2.
+
88 * @param p1 Co-ordinates of Point 1 <int, int>.
+
89 * @param p2 Co-ordinates of Point 2 <int, int>.
+
90 * @returns @param int distance between p1 and p2.
+
91 *******************************************************************************/
+
92int distSq(Point p1, Point p2) {
+
93 return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
+
94}
+
95
+
96/******************************************************************************
+
97 * @brief To find orientation of ordered triplet (p, q, r).
+
98 * @param p Co-ordinates of Point p <int, int>.
+
99 * @param q Co-ordinates of Point q <int, int>.
+
100 * @param r Co-ordinates of Point r <int, int>.
+
101 * @returns @param int 0 --> p, q and r are collinear, 1 --> Clockwise,
+
102 * 2 --> Counterclockwise
+
103 *******************************************************************************/
+
104int orientation(Point p, Point q, Point r) {
+
105 int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
+
106
+
107 if (val == 0) {
+
108 return 0; // collinear
+
109 }
+
110 return (val > 0) ? 1 : 2; // clock or counter-clock wise
+
111}
+
112
+
113/******************************************************************************
+
114 * @brief A function used by library function qsort() to sort an array of
+
115 * points with respect to the first point
+
116 * @param vp1 Co-ordinates of Point 1 <int, int>.
+
117 * @param vp2 Co-ordinates of Point 2 <int, int>.
+
118 * @returns @param int distance between p1 and p2.
+
119 *******************************************************************************/
+
120int compare(const void *vp1, const void *vp2) {
+
121 auto *p1 = static_cast<const Point *>(vp1);
+
122 auto *p2 = static_cast<const Point *>(vp2);
+
123
+
124 // Find orientation
+
125 int o = orientation(p0, *p1, *p2);
+
126 if (o == 0) {
+
127 return (distSq(p0, *p2) >= distSq(p0, *p1)) ? -1 : 1;
+
128 }
+
129
+
130 return (o == 2) ? -1 : 1;
+
131}
+
132
+
133/******************************************************************************
+
134 * @brief Prints convex hull of a set of n points.
+
135 * @param points vector of Point<int, int> with co-ordinates.
+
136 * @param size Size of the vector.
+
137 * @returns @param vector vector of Conver Hull.
+
138 *******************************************************************************/
+
139std::vector<Point> convexHull(std::vector<Point> points, uint64_t size) {
+
140 // Find the bottom-most point
+
141 int ymin = points[0].y, min = 0;
+
142 for (int i = 1; i < size; i++) {
+
143 int y = points[i].y;
+
144
+
145 // Pick the bottom-most or chose the left-most point in case of tie
+
146 if ((y < ymin) || (ymin == y && points[i].x < points[min].x)) {
+
147 ymin = points[i].y, min = i;
+
148 }
+
149 }
+
150
+
151 // Place the bottom-most point at first position
+
152 std::swap(points[0], points[min]);
+
153
+
154 // Sort n-1 points with respect to the first point. A point p1 comes
+
155 // before p2 in sorted output if p2 has larger polar angle
+
156 // (in counterclockwise direction) than p1.
+
157 p0 = points[0];
+
158 qsort(&points[1], size - 1, sizeof(Point), compare);
+
159
+
160 // If two or more points make same angle with p0, Remove all but the one
+
161 // that is farthest from p0 Remember that, in above sorting, our criteria
+
162 // was to keep the farthest point at the end when more than one points have
+
163 // same angle.
+
164 int m = 1; // Initialize size of modified array
+
165 for (int i = 1; i < size; i++) {
+
166 // Keep removing i while angle of i and i+1 is same with respect to p0
+
167 while (i < size - 1 && orientation(p0, points[i], points[i + 1]) == 0) {
+
168 i++;
+
169 }
+
170
+
171 points[m] = points[i];
+
172 m++; // Update size of modified array
+
173 }
+
174
+
175 // If modified array of points has less than 3 points, convex hull is not
+
176 // possible
+
177 if (m < 3) {
+
178 return {};
+
179 };
+
180
+
181 // Create an empty stack and push first three points to it.
+ +
183 St.push(points[0]);
+
184 St.push(points[1]);
+
185 St.push(points[2]);
+
186
+
187 // Process remaining n-3 points
+
188 for (int i = 3; i < m; i++) {
+
189 // Keep removing top while the angle formed by
+
190 // points next-to-top, top, and points[i] makes
+
191 // a non-left turn
+
192 while (St.size() > 1 &&
+
193 orientation(nextToTop(&St), St.top(), points[i]) != 2) {
+
194 St.pop();
+
195 }
+
196 St.push(points[i]);
+
197 }
+
198
+ +
200 // Now stack has the output points, push them into the resultant vector
+
201 while (!St.empty()) {
+
202 Point p = St.top();
+
203 result.push_back(p);
+
204 St.pop();
+
205 }
+
206
+
207 return result; // return resultant vector with Convex Hull co-ordinates.
+
208}
+
209} // namespace grahamscan
+
210} // namespace geometry
T empty(T... args)
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T min(T... args)
-
for std::vector
Definition graham_scan_functions.hpp:51
+
for std::swap
Definition graham_scan_functions.hpp:52
T pop(T... args)
T push(T... args)
T qsort(T... args)
@@ -332,7 +333,7 @@ $(function(){initNavTree('de/d89/graham__scan__functions_8hpp_source.html','../.
Definition line_segment_intersection.cpp:12
int y
Point respect to x coordinate.
Definition line_segment_intersection.cpp:14
Definition huffman.cpp:36
-
Definition graham_scan_functions.hpp:63
+
Definition graham_scan_functions.hpp:64
T swap(T... args)
T top(T... args)
diff --git a/de/d99/aliquot__sum_8cpp.html b/de/d99/aliquot__sum_8cpp.html index 9a212809e..6095e5e32 100644 --- a/de/d99/aliquot__sum_8cpp.html +++ b/de/d99/aliquot__sum_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('de/d99/aliquot__sum_8cpp.html','../../'); initResizabl

Program to return the Aliquot Sum of a number. More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for aliquot_sum.cpp:
-
+

@@ -164,19 +165,19 @@ Functions

- +

Namespaces

namespace  math
 for IO operations
 for assert
 

Main function.

Returns
0 on exit
-
73 {
-
74 test(); // run the self-test implementations
-
75 return 0;
-
76}
-
static void test()
Self-test implementations.
Definition aliquot_sum.cpp:56
+
74 {
+
75 test(); // run the self-test implementations
+
76 return 0;
+
77}
+
static void test()
Self-test implementations.
Definition aliquot_sum.cpp:57
Here is the call graph for this function:
@@ -206,20 +207,20 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
56 {
-
57 // Aliquot sum of 10 is 1 + 2 + 5 = 8
-
58 assert(math::aliquot_sum(10) == 8);
-
59 // Aliquot sum of 15 is 1 + 3 + 5 = 9
-
60 assert(math::aliquot_sum(15) == 9);
-
61 // Aliquot sum of 1 is 0
-
62 assert(math::aliquot_sum(1) == 0);
-
63 // Aliquot sum of 97 is 1 (the aliquot sum of a prime number is 1)
-
64 assert(math::aliquot_sum(97) == 1);
-
65
-
66 std::cout << "All the tests have successfully passed!\n";
-
67}
+
57 {
+
58 // Aliquot sum of 10 is 1 + 2 + 5 = 8
+
59 assert(math::aliquot_sum(10) == 8);
+
60 // Aliquot sum of 15 is 1 + 3 + 5 = 9
+
61 assert(math::aliquot_sum(15) == 9);
+
62 // Aliquot sum of 1 is 0
+
63 assert(math::aliquot_sum(1) == 0);
+
64 // Aliquot sum of 97 is 1 (the aliquot sum of a prime number is 1)
+
65 assert(math::aliquot_sum(97) == 1);
+
66
+
67 std::cout << "All the tests have successfully passed!\n";
+
68}
-
uint64_t aliquot_sum(const uint64_t num)
to return the aliquot sum of a number
Definition aliquot_sum.cpp:35
+
uint64_t aliquot_sum(const uint64_t num)
to return the aliquot sum of a number
Definition aliquot_sum.cpp:36
Here is the call graph for this function:
diff --git a/de/dab/ncr__modulo__p_8cpp.html b/de/dab/ncr__modulo__p_8cpp.html index a4096c83d..cc79780d2 100644 --- a/de/dab/ncr__modulo__p_8cpp.html +++ b/de/dab/ncr__modulo__p_8cpp.html @@ -132,7 +132,7 @@ Classes
- + diff --git a/de/db2/quick__sort_8cpp__incl.map b/de/db2/quick__sort_8cpp__incl.map index eb0b16d4d..1cac4779e 100644 --- a/de/db2/quick__sort_8cpp__incl.map +++ b/de/db2/quick__sort_8cpp__incl.map @@ -1,13 +1,15 @@ - + - + - - - - - - - + + + + + + + + + diff --git a/de/db2/quick__sort_8cpp__incl.md5 b/de/db2/quick__sort_8cpp__incl.md5 index e094e6700..c7520161f 100644 --- a/de/db2/quick__sort_8cpp__incl.md5 +++ b/de/db2/quick__sort_8cpp__incl.md5 @@ -1 +1 @@ -d472889d48e6403103b55c42580551d7 \ No newline at end of file +2061feed560a85078512c22b53a0adf4 \ No newline at end of file diff --git a/de/db2/quick__sort_8cpp__incl.svg b/de/db2/quick__sort_8cpp__incl.svg index 1aa3b4473..2923a01ee 100644 --- a/de/db2/quick__sort_8cpp__incl.svg +++ b/de/db2/quick__sort_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -sorting/quick_sort.cpp + +sorting/quick_sort.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -ctime + +cstdint @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -iostream + +ctime @@ -95,8 +95,8 @@ Node1->Node5 - - + + @@ -104,8 +104,8 @@ Node6 - -vector + +iostream @@ -113,8 +113,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/de/db2/quick__sort_8cpp__incl_org.svg b/de/db2/quick__sort_8cpp__incl_org.svg index 43ab7e6cc..b018eb500 100644 --- a/de/db2/quick__sort_8cpp__incl_org.svg +++ b/de/db2/quick__sort_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + sorting/quick_sort.cpp Node1 - -sorting/quick_sort.cpp + +sorting/quick_sort.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -ctime + +cstdint @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -iostream + +ctime @@ -84,8 +84,8 @@ Node1->Node5 - - + + @@ -93,8 +93,8 @@ Node6 - -vector + +iostream @@ -102,8 +102,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/de/db6/a1z26__cipher_8cpp.html b/de/db6/a1z26__cipher_8cpp.html index 9cda4d266..6ed2bb1fc 100644 --- a/de/db6/a1z26__cipher_8cpp.html +++ b/de/db6/a1z26__cipher_8cpp.html @@ -228,7 +228,7 @@ Variables
111}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T push_back(T... args)
T replace(T... args)
T stoi(T... args)
diff --git a/de/dc3/fibonacci__sum_8cpp.html b/de/dc3/fibonacci__sum_8cpp.html index 4b0a3d5be..8350b4b52 100644 --- a/de/dc3/fibonacci__sum_8cpp.html +++ b/de/dc3/fibonacci__sum_8cpp.html @@ -116,18 +116,19 @@ $(function(){initNavTree('de/dc3/fibonacci__sum_8cpp.html','../../'); initResiza \mathrm{F}(n+1) + .. + \mathrm{F}(m)\). More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for fibonacci_sum.cpp:
-
+

@@ -168,11 +169,11 @@ Functions

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  ncr_modulo_p
 Functions for nCr modulo p implementation.
- +
Returns
uint64_t the sum of sequence
-
90 {
-
91 return (result(m + 2) - result(n + 1));
-
92}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
91 {
+
92 return (result(m + 2) - result(n + 1));
+
93}
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
Here is the call graph for this function:
@@ -216,11 +217,11 @@ Here is the call graph for this function:

Main function.

Returns
0 on exit
-
136 {
-
137 test(); // execute the tests
-
138 return 0;
-
139}
-
static void test()
Definition fibonacci_sum.cpp:101
+
137 {
+
138 test(); // execute the tests
+
139 return 0;
+
140}
+
static void test()
Definition fibonacci_sum.cpp:102
Here is the call graph for this function:
@@ -255,17 +256,17 @@ Here is the call graph for this function:
Returns
resultant matrix
-
39 {
- -
41
-
42 // multiplying matrices
-
43 result[0][0] = T[0][0] * A[0][0] + T[0][1] * A[1][0];
-
44 result[0][1] = T[0][0] * A[0][1] + T[0][1] * A[1][1];
-
45 result[1][0] = T[1][0] * A[0][0] + T[1][1] * A[1][0];
-
46 result[1][1] = T[1][0] * A[0][1] + T[1][1] * A[1][1];
-
47
-
48 return result;
-
49}
+
40 {
+ +
42
+
43 // multiplying matrices
+
44 result[0][0] = T[0][0] * A[0][0] + T[0][1] * A[1][0];
+
45 result[0][1] = T[0][0] * A[0][1] + T[0][1] * A[1][1];
+
46 result[1][0] = T[1][0] * A[0][0] + T[1][1] * A[1][0];
+
47 result[1][1] = T[1][0] * A[0][1] + T[1][1] * A[1][1];
+
48
+
49 return result;
+
50}
Here is the call graph for this function:
@@ -301,19 +302,19 @@ Here is the call graph for this function:
Returns
resultant matrix
-
57 {
-
58 math::fibonacci_sum::matrix A{{1, 1}, {1, 0}};
-
59 if (ex == 0 || ex == 1) {
-
60 return T;
-
61 }
-
62
-
63 T = power(T, ex / 2);
-
64 T = multiply(T, T);
-
65 if (ex & 1) {
-
66 T = multiply(T, A);
-
67 }
-
68 return T;
-
69}
+
58 {
+
59 math::fibonacci_sum::matrix A{{1, 1}, {1, 0}};
+
60 if (ex == 0 || ex == 1) {
+
61 return T;
+
62 }
+
63
+
64 T = power(T, ex / 2);
+
65 T = multiply(T, T);
+
66 if (ex & 1) {
+
67 T = multiply(T, A);
+
68 }
+
69 return T;
+
70}
int multiply(int x, int res[], int res_size)
Definition power_for_huge_numbers.cpp:25
void power(int x, int n)
Definition power_for_huge_numbers.cpp:56
@@ -345,13 +346,13 @@ Here is the call graph for this function:
Returns
uint64_t ans, the sum of sequence
-
76 {
-
77 math::fibonacci_sum::matrix T{{1, 1}, {1, 0}};
-
78 T = power(T, n);
-
79 uint64_t ans = T[0][1];
-
80 ans = (ans - 1);
-
81 return ans;
-
82}
+
77 {
+
78 math::fibonacci_sum::matrix T{{1, 1}, {1, 0}};
+
79 T = power(T, n);
+
80 uint64_t ans = T[0][1];
+
81 ans = (ans - 1);
+
82 return ans;
+
83}
Here is the call graph for this function:
@@ -383,39 +384,39 @@ Here is the call graph for this function:

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  fibonacci_sum
 Functions for the sum of the Fibonacci Sequence: \(\mathrm{F}(n) + @@ -187,10 +188,10 @@ Functions

Function for testing fiboSum function. test cases and assert statement.

Returns
void
-
101 {
-
102 uint64_t n = 0, m = 3;
-
103 uint64_t test_1 = math::fibonacci_sum::fiboSum(n, m);
-
104 assert(test_1 == 4);
-
105 std::cout << "Passed Test 1!" << std::endl;
-
106
-
107 n = 3;
-
108 m = 5;
-
109 uint64_t test_2 = math::fibonacci_sum::fiboSum(n, m);
-
110 assert(test_2 == 10);
-
111 std::cout << "Passed Test 2!" << std::endl;
-
112
-
113 n = 5;
-
114 m = 7;
-
115 uint64_t test_3 = math::fibonacci_sum::fiboSum(n, m);
-
116 assert(test_3 == 26);
-
117 std::cout << "Passed Test 3!" << std::endl;
-
118
-
119 n = 7;
-
120 m = 10;
-
121 uint64_t test_4 = math::fibonacci_sum::fiboSum(n, m);
-
122 assert(test_4 == 123);
-
123 std::cout << "Passed Test 4!" << std::endl;
-
124
-
125 n = 9;
-
126 m = 12;
-
127 uint64_t test_5 = math::fibonacci_sum::fiboSum(n, m);
-
128 assert(test_5 == 322);
-
129 std::cout << "Passed Test 5!" << std::endl;
-
130}
+
102 {
+
103 uint64_t n = 0, m = 3;
+
104 uint64_t test_1 = math::fibonacci_sum::fiboSum(n, m);
+
105 assert(test_1 == 4);
+
106 std::cout << "Passed Test 1!" << std::endl;
+
107
+
108 n = 3;
+
109 m = 5;
+
110 uint64_t test_2 = math::fibonacci_sum::fiboSum(n, m);
+
111 assert(test_2 == 10);
+
112 std::cout << "Passed Test 2!" << std::endl;
+
113
+
114 n = 5;
+
115 m = 7;
+
116 uint64_t test_3 = math::fibonacci_sum::fiboSum(n, m);
+
117 assert(test_3 == 26);
+
118 std::cout << "Passed Test 3!" << std::endl;
+
119
+
120 n = 7;
+
121 m = 10;
+
122 uint64_t test_4 = math::fibonacci_sum::fiboSum(n, m);
+
123 assert(test_4 == 123);
+
124 std::cout << "Passed Test 4!" << std::endl;
+
125
+
126 n = 9;
+
127 m = 12;
+
128 uint64_t test_5 = math::fibonacci_sum::fiboSum(n, m);
+
129 assert(test_5 == 322);
+
130 std::cout << "Passed Test 5!" << std::endl;
+
131}
T endl(T... args)
-
uint64_t fiboSum(uint64_t n, uint64_t m)
Definition fibonacci_sum.cpp:90
+
uint64_t fiboSum(uint64_t n, uint64_t m)
Definition fibonacci_sum.cpp:91
static void test_1()
Definition heavy_light_decomposition.cpp:505
static void test_2()
Definition heavy_light_decomposition.cpp:549
static void test_3()
Definition heavy_light_decomposition.cpp:592
diff --git a/de/dcd/kadanes3_8cpp.html b/de/dcd/kadanes3_8cpp.html index afbc66b58..67889d96d 100644 --- a/de/dcd/kadanes3_8cpp.html +++ b/de/dcd/kadanes3_8cpp.html @@ -115,11 +115,12 @@ $(function(){initNavTree('de/dcd/kadanes3_8cpp.html','../../'); initResizable(tr
#include <array>
#include <cassert>
#include <climits>
+#include <cstdint>
#include <iostream>
Include dependency graph for kadanes3.cpp:
-
+
T clock(T... args)
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T endl(T... args)
large_number fib(uint64_t n)
Definition fibonacci_large.cpp:24
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T scientific(T... args)
T strtoull(T... args)
diff --git a/de/df6/classgreedy__algorithms_1_1_binary_addition.html b/de/df6/classgreedy__algorithms_1_1_binary_addition.html index d6b40adce..fb9424292 100644 --- a/de/df6/classgreedy__algorithms_1_1_binary_addition.html +++ b/de/df6/classgreedy__algorithms_1_1_binary_addition.html @@ -196,7 +196,7 @@ Private Member Functions
67 }
bool isValidBinaryString(const std::string &str) const
Validates whether a string contains only binary characters (0 or 1).
Definition binary_addition.cpp:75
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T max(T... args)
T sum(const std::vector< std::valarray< T > > &A)
Definition vector_ops.hpp:232
T reverse(T... args)
diff --git a/df/d0f/fibonacci_8cpp__incl.map b/df/d0f/fibonacci_8cpp__incl.map index e16cc4731..1451db75a 100644 --- a/df/d0f/fibonacci_8cpp__incl.map +++ b/df/d0f/fibonacci_8cpp__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/df/d0f/fibonacci_8cpp__incl.md5 b/df/d0f/fibonacci_8cpp__incl.md5 index d50796381..66352ee6a 100644 --- a/df/d0f/fibonacci_8cpp__incl.md5 +++ b/df/d0f/fibonacci_8cpp__incl.md5 @@ -1 +1 @@ -49f66312ca146ee843623ef817e14b8f \ No newline at end of file +d3a10169b6b4b9690a711d2055b7a434 \ No newline at end of file diff --git a/df/d0f/fibonacci_8cpp__incl.svg b/df/d0f/fibonacci_8cpp__incl.svg index b144f3d6b..177a0ebbd 100644 --- a/df/d0f/fibonacci_8cpp__incl.svg +++ b/df/d0f/fibonacci_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -math/fibonacci.cpp + +math/fibonacci.cpp @@ -32,8 +32,8 @@ Node2 - -cassert + +cstdint @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -50,8 +50,8 @@ Node3 - -iostream + +cassert @@ -59,8 +59,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/df/d0f/fibonacci_8cpp__incl_org.svg b/df/d0f/fibonacci_8cpp__incl_org.svg index 7d75cea02..b06595c92 100644 --- a/df/d0f/fibonacci_8cpp__incl_org.svg +++ b/df/d0f/fibonacci_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + math/fibonacci.cpp Node1 - -math/fibonacci.cpp + +math/fibonacci.cpp @@ -21,8 +21,8 @@ Node2 - -cassert + +cstdint @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -39,8 +39,8 @@ Node3 - -iostream + +cassert @@ -48,8 +48,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + diff --git a/df/d11/midpoint__integral__method_8cpp.html b/df/d11/midpoint__integral__method_8cpp.html index 1f5edec6a..5c7bcbdc6 100644 --- a/df/d11/midpoint__integral__method_8cpp.html +++ b/df/d11/midpoint__integral__method_8cpp.html @@ -372,7 +372,7 @@ Here is the call graph for this function:
T atof(T... args)
T atoi(T... args)
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
T endl(T... args)
static void test()
Self-test implementations.
Definition generate_parentheses.cpp:82
int h(int key)
Definition hash_search.cpp:45
diff --git a/df/d14/dnf__sort_8cpp__incl.map b/df/d14/dnf__sort_8cpp__incl.map index f244fb28d..a3da6d9c4 100644 --- a/df/d14/dnf__sort_8cpp__incl.map +++ b/df/d14/dnf__sort_8cpp__incl.map @@ -1,11 +1,13 @@ - + - + - - - - - + + + + + + + diff --git a/df/d14/dnf__sort_8cpp__incl.md5 b/df/d14/dnf__sort_8cpp__incl.md5 index 9610324f1..2f9fa2fce 100644 --- a/df/d14/dnf__sort_8cpp__incl.md5 +++ b/df/d14/dnf__sort_8cpp__incl.md5 @@ -1 +1 @@ -02b6272d7e0497aeb2fb1ce3309cc25d \ No newline at end of file +dd905360671719642a1b392d60b27e78 \ No newline at end of file diff --git a/df/d14/dnf__sort_8cpp__incl.svg b/df/d14/dnf__sort_8cpp__incl.svg index 6456e3cca..3dcd3eb87 100644 --- a/df/d14/dnf__sort_8cpp__incl.svg +++ b/df/d14/dnf__sort_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,8 +23,8 @@ Node1 - -sorting/dnf_sort.cpp + +sorting/dnf_sort.cpp @@ -41,8 +41,8 @@ Node1->Node2 - - + + @@ -59,8 +59,8 @@ Node1->Node3 - - + + @@ -68,8 +68,8 @@ Node4 - -iostream + +cstdint @@ -77,8 +77,8 @@ Node1->Node4 - - + + @@ -86,8 +86,8 @@ Node5 - -vector + +iostream @@ -95,8 +95,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/df/d14/dnf__sort_8cpp__incl_org.svg b/df/d14/dnf__sort_8cpp__incl_org.svg index 91247be9e..30826597f 100644 --- a/df/d14/dnf__sort_8cpp__incl_org.svg +++ b/df/d14/dnf__sort_8cpp__incl_org.svg @@ -4,16 +4,16 @@ - + sorting/dnf_sort.cpp Node1 - -sorting/dnf_sort.cpp + +sorting/dnf_sort.cpp @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -48,8 +48,8 @@ Node1->Node3 - - + + @@ -57,8 +57,8 @@ Node4 - -iostream + +cstdint @@ -66,8 +66,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node5 - -vector + +iostream @@ -84,8 +84,26 @@ Node1->Node5 - - + + + + + + + +Node6 + + +vector + + + + + +Node1->Node6 + + + diff --git a/df/d28/dsu__union__rank_8cpp.html b/df/d28/dsu__union__rank_8cpp.html index 2959c5522..6e598a3cf 100644 --- a/df/d28/dsu__union__rank_8cpp.html +++ b/df/d28/dsu__union__rank_8cpp.html @@ -114,12 +114,13 @@ $(function(){initNavTree('df/d28/dsu__union__rank_8cpp.html','../../'); initResi

DSU (Disjoint sets) More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <vector>
Include dependency graph for dsu_union_rank.cpp:
-
+

diff --git a/de/dd3/newton__raphson__method_8cpp.html b/de/dd3/newton__raphson__method_8cpp.html index 54cfde018..b56bf5d25 100644 --- a/de/dd3/newton__raphson__method_8cpp.html +++ b/de/dd3/newton__raphson__method_8cpp.html @@ -114,13 +114,14 @@ $(function(){initNavTree('de/dd3/newton__raphson__method_8cpp.html','../../'); i

Solve the equation \(f(x)=0\) using Newton-Raphson method for both real and complex solutions. More...

#include <cmath>
+#include <cstdint>
#include <ctime>
#include <iostream>
#include <limits>
Include dependency graph for newton_raphson_method.cpp:
-
+

@@ -180,9 +181,9 @@ x_{i+1} = x_i - \frac{f(x_i)}{f'(x_i)} f(x) = x^3 - 4x - 9 \]

-
29 {
-
30 return (std::pow(i, 3) - (4 * i) - 9); // original equation
-
31}
+
30 {
+
31 return (std::pow(i, 3) - (4 * i) - 9); // original equation
+
32}
T pow(T... args)
Here is the call graph for this function:
@@ -219,9 +220,9 @@ Here is the call graph for this function:
f'(x) = 3x^2 - 4 \]

-
39 {
-
40 return ((3 * std::pow(i, 2)) - 4); // derivative of equation
-
41}
+
40 {
+
41 return ((3 * std::pow(i, 2)) - 4); // derivative of equation
+
42}
Here is the call graph for this function:
@@ -245,36 +246,36 @@ Here is the call graph for this function:

Main function

-
44 {
-
45 std::srand(std::time(nullptr)); // initialize randomizer
-
46
-
47 double z = NAN, c = std::rand() % 100, m = NAN, n = NAN;
-
48 int i = 0;
-
49
-
50 std::cout << "\nInitial approximation: " << c;
-
51
-
52 // start iterations
-
53 for (i = 0; i < MAX_ITERATIONS; i++) {
-
54 m = eq(c);
-
55 n = eq_der(c);
-
56
-
57 z = c - (m / n);
-
58 c = z;
-
59
-
60 if (std::abs(m) < EPSILON) { // stoping criteria
-
61 break;
-
62 }
-
63 }
-
64
-
65 std::cout << "\n\nRoot: " << z << "\t\tSteps: " << i << std::endl;
-
66 return 0;
-
67}
+
45 {
+
46 std::srand(std::time(nullptr)); // initialize randomizer
+
47
+
48 double z = NAN, c = std::rand() % 100, m = NAN, n = NAN;
+
49 int i = 0;
+
50
+
51 std::cout << "\nInitial approximation: " << c;
+
52
+
53 // start iterations
+
54 for (i = 0; i < MAX_ITERATIONS; i++) {
+
55 m = eq(c);
+
56 n = eq_der(c);
+
57
+
58 z = c - (m / n);
+
59 c = z;
+
60
+
61 if (std::abs(m) < EPSILON) { // stoping criteria
+
62 break;
+
63 }
+
64 }
+
65
+
66 std::cout << "\n\nRoot: " << z << "\t\tSteps: " << i << std::endl;
+
67 return 0;
+
68}
T endl(T... args)
-
static double eq(double i)
Definition newton_raphson_method.cpp:29
-
static double eq_der(double i)
Definition newton_raphson_method.cpp:39
-
constexpr int16_t MAX_ITERATIONS
Maximum number of iterations.
Definition newton_raphson_method.cpp:21
-
constexpr double EPSILON
system accuracy limit
Definition newton_raphson_method.cpp:20
+
static double eq(double i)
Definition newton_raphson_method.cpp:30
+
static double eq_der(double i)
Definition newton_raphson_method.cpp:40
+
constexpr int16_t MAX_ITERATIONS
Maximum number of iterations.
Definition newton_raphson_method.cpp:22
+
constexpr double EPSILON
system accuracy limit
Definition newton_raphson_method.cpp:21
T rand(T... args)
T srand(T... args)
T time(T... args)
diff --git a/de/de4/fibonacci__large_8cpp.html b/de/de4/fibonacci__large_8cpp.html index 2901f343e..187d0b651 100644 --- a/de/de4/fibonacci__large_8cpp.html +++ b/de/de4/fibonacci__large_8cpp.html @@ -239,10 +239,10 @@ Functions

@@ -163,14 +164,14 @@ element). Disjoint sets uses cases : for finding connected components in a graph

Main function.

Returns
0 on exit
-
182 {
-
183 test1(); // run 1st test case
-
184 test2(); // run 2nd test case
-
185
-
186 return 0;
-
187}
-
static void test2()
Self-implementations, 2nd test.
Definition dsu_union_rank.cpp:157
-
static void test1()
Self-implementations, 1st test.
Definition dsu_union_rank.cpp:133
+
183 {
+
184 test1(); // run 1st test case
+
185 test2(); // run 2nd test case
+
186
+
187 return 0;
+
188}
+
static void test2()
Self-implementations, 2nd test.
Definition dsu_union_rank.cpp:158
+
static void test1()
Self-implementations, 1st test.
Definition dsu_union_rank.cpp:134
Here is the call graph for this function:
@@ -207,28 +208,28 @@ Here is the call graph for this function:

< number of elements

< object of class disjoint sets

< performs union operation on 1 and 2

-
133 {
-
134 /* checks the parents in the resultant structures */
-
135 uint64_t n = 10; ///< number of elements
-
136 dsu d(n + 1); ///< object of class disjoint sets
-
137 d.unionSet(2, 1); ///< performs union operation on 1 and 2
-
138 d.unionSet(1, 4);
-
139 d.unionSet(8, 1);
-
140 d.unionSet(3, 5);
-
141 d.unionSet(5, 6);
-
142 d.unionSet(5, 7);
-
143 d.unionSet(9, 10);
-
144 d.unionSet(2, 10);
-
145 // keeping track of the changes using parent pointers
-
146 vector<uint64_t> ans = {7, 5};
-
147 for (uint64_t i = 0; i < ans.size(); i++) {
-
148 assert(d.getParents(7).at(i) ==
-
149 ans[i]); // makes sure algorithm works fine
-
150 }
-
151 cout << "1st test passed!" << endl;
-
152}
+
134 {
+
135 /* checks the parents in the resultant structures */
+
136 uint64_t n = 10; ///< number of elements
+
137 dsu d(n + 1); ///< object of class disjoint sets
+
138 d.unionSet(2, 1); ///< performs union operation on 1 and 2
+
139 d.unionSet(1, 4);
+
140 d.unionSet(8, 1);
+
141 d.unionSet(3, 5);
+
142 d.unionSet(5, 6);
+
143 d.unionSet(5, 7);
+
144 d.unionSet(9, 10);
+
145 d.unionSet(2, 10);
+
146 // keeping track of the changes using parent pointers
+
147 vector<uint64_t> ans = {7, 5};
+
148 for (uint64_t i = 0; i < ans.size(); i++) {
+
149 assert(d.getParents(7).at(i) ==
+
150 ans[i]); // makes sure algorithm works fine
+
151 }
+
152 cout << "1st test passed!" << endl;
+
153}
-
Disjoint sets union data structure, class based representation.
Definition dsu_path_compression.cpp:33
+
Disjoint sets union data structure, class based representation.
Definition dsu_path_compression.cpp:34
#define endl
Definition matrix_exponentiation.cpp:36
@@ -269,27 +270,27 @@ Here is the call graph for this function:

performs union operation on 1 and 2

keeping track of the changes using parent pointers

makes sure algorithm works fine

-
157 {
-
158 // checks the parents in the resultant structures
-
159 uint64_t n = 10; ///< number of elements
-
160 dsu d(n + 1); ///< object of class disjoint sets
-
161 d.unionSet(2, 1); /// performs union operation on 1 and 2
-
162 d.unionSet(1, 4);
-
163 d.unionSet(8, 1);
-
164 d.unionSet(3, 5);
-
165 d.unionSet(5, 6);
-
166 d.unionSet(5, 7);
-
167 d.unionSet(9, 10);
-
168 d.unionSet(2, 10);
-
169
-
170 /// keeping track of the changes using parent pointers
-
171 vector<uint64_t> ans = {2, 1, 10};
-
172 for (uint64_t i = 0; i < ans.size(); i++) {
-
173 assert(d.getParents(2).at(i) ==
-
174 ans[i]); /// makes sure algorithm works fine
-
175 }
-
176 cout << "2nd test passed!" << endl;
-
177}
+
158 {
+
159 // checks the parents in the resultant structures
+
160 uint64_t n = 10; ///< number of elements
+
161 dsu d(n + 1); ///< object of class disjoint sets
+
162 d.unionSet(2, 1); /// performs union operation on 1 and 2
+
163 d.unionSet(1, 4);
+
164 d.unionSet(8, 1);
+
165 d.unionSet(3, 5);
+
166 d.unionSet(5, 6);
+
167 d.unionSet(5, 7);
+
168 d.unionSet(9, 10);
+
169 d.unionSet(2, 10);
+
170
+
171 /// keeping track of the changes using parent pointers
+
172 vector<uint64_t> ans = {2, 1, 10};
+
173 for (uint64_t i = 0; i < ans.size(); i++) {
+
174 assert(d.getParents(2).at(i) ==
+
175 ans[i]); /// makes sure algorithm works fine
+
176 }
+
177 cout << "2nd test passed!" << endl;
+
178}
Here is the call graph for this function:
diff --git a/df/d2c/elliptic__curve__key__exchange_8cpp.html b/df/d2c/elliptic__curve__key__exchange_8cpp.html index f92688d10..0686e7a40 100644 --- a/df/d2c/elliptic__curve__key__exchange_8cpp.html +++ b/df/d2c/elliptic__curve__key__exchange_8cpp.html @@ -121,7 +121,7 @@ $(function(){initNavTree('df/d2c/elliptic__curve__key__exchange_8cpp.html','../.
Include dependency graph for elliptic_curve_key_exchange.cpp:
-
+
- + diff --git a/df/d6b/namespaceciphers_1_1elliptic__curve__key__exchange.html b/df/d6b/namespaceciphers_1_1elliptic__curve__key__exchange.html index e2301a3fa..737623991 100644 --- a/df/d6b/namespaceciphers_1_1elliptic__curve__key__exchange.html +++ b/df/d6b/namespaceciphers_1_1elliptic__curve__key__exchange.html @@ -382,7 +382,7 @@ Here is the call graph for this function:
186 }
187 return Q;
188}
-
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:47
+
constexpr uint32_t N
A struct to represent sparse table for min() as their invariant function, for the given array A....
Definition sparse_table.cpp:48
Point addition(Point a, Point b, const uint256_t &curve_a_coeff, uint256_t mod)
Addition of points.
Definition elliptic_curve_key_exchange.cpp:110
Definition of struct Point.
Definition elliptic_curve_key_exchange.cpp:46
diff --git a/df/d72/modular__division_8cpp.html b/df/d72/modular__division_8cpp.html index 6f9d91cd3..3477b2c16 100644 --- a/df/d72/modular__division_8cpp.html +++ b/df/d72/modular__division_8cpp.html @@ -114,17 +114,18 @@ $(function(){initNavTree('df/d72/modular__division_8cpp.html','../../'); initRes

An algorithm to divide two numbers under modulo p Modular Division More...

#include <cassert>
+#include <cstdint>
#include <iostream>
Include dependency graph for modular_division.cpp:
-
+

@@ -345,7 +345,7 @@ Here is the call graph for this function:
221 assert((a ^ b) == uint128_t("12321421424217440294"));
222 assert((a << 64) == uint128_t("227290107637132170748078080907806769152"));
223}
-
class for 128-bit unsigned integer
Definition uint128_t.hpp:59
+
class for 128-bit unsigned integer
Definition uint128_t.hpp:60
diff --git a/df/d3c/exponential__search_8cpp__incl.map b/df/d3c/exponential__search_8cpp__incl.map index 935d6d2e3..687a75670 100644 --- a/df/d3c/exponential__search_8cpp__incl.map +++ b/df/d3c/exponential__search_8cpp__incl.map @@ -1,11 +1,11 @@ - + - + - - - - - + + + + + diff --git a/df/d3c/exponential__search_8cpp__incl.md5 b/df/d3c/exponential__search_8cpp__incl.md5 index 818ef175e..6c13a3eaf 100644 --- a/df/d3c/exponential__search_8cpp__incl.md5 +++ b/df/d3c/exponential__search_8cpp__incl.md5 @@ -1 +1 @@ -5164a3da2fcbda485abfd47e9570ca44 \ No newline at end of file +7299af949721aa4acb03e7e972926ea1 \ No newline at end of file diff --git a/df/d3c/exponential__search_8cpp__incl.svg b/df/d3c/exponential__search_8cpp__incl.svg index d123a45b1..f0db2b17d 100644 --- a/df/d3c/exponential__search_8cpp__incl.svg +++ b/df/d3c/exponential__search_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -search/exponential -_search.cpp + +search/exponential +_search.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -iostream + +cstdint @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -cstring + +cstring @@ -96,8 +96,8 @@ Node1->Node5 - - + + diff --git a/df/d3c/exponential__search_8cpp__incl_org.svg b/df/d3c/exponential__search_8cpp__incl_org.svg index a1427abcb..719e5d742 100644 --- a/df/d3c/exponential__search_8cpp__incl_org.svg +++ b/df/d3c/exponential__search_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + search/exponential_search.cpp Node1 - -search/exponential -_search.cpp + +search/exponential +_search.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -iostream + +cstdint @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -cstring + +cstring @@ -85,8 +85,8 @@ Node1->Node5 - - + + diff --git a/df/d47/fcfs__scheduling_8cpp.html b/df/d47/fcfs__scheduling_8cpp.html index 31acc1810..c178a51d0 100644 --- a/df/d47/fcfs__scheduling_8cpp.html +++ b/df/d47/fcfs__scheduling_8cpp.html @@ -115,6 +115,7 @@ $(function(){initNavTree('df/d47/fcfs__scheduling_8cpp.html','../../'); initResi More...

#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <cstdlib>
#include <ctime>
#include <iomanip>
@@ -183,35 +184,35 @@ template<typename S , typename T , typename E >

Sorts the input vector according to arrival time. Processes whose arrival times are same get sorted according to process ID For each process, completion time, turnaround time and completion time are calculated, inserted in a tuple, which is added to the vector result.

Returns
A vector of tuples consisting of process ID, arrival time, burst time, completion time, turnaround time and waiting time for each process.
-
226 {
-
227 sort(input.begin(), input.end(), sortcol<S, T, E>);
- -
229 double timeElapsed = 0;
-
230 for (size_t i{}; i < input.size(); i++) {
-
231 T arrival = get<1>(input[i]);
-
232 E burst = get<2>(input[i]);
-
233
-
234 if (arrival > timeElapsed) {
-
235 timeElapsed += arrival - timeElapsed;
-
236 }
-
237 timeElapsed += burst;
-
238 double completion = timeElapsed;
-
239 double turnaround = completion - arrival;
-
240 double waiting = turnaround - burst;
-
241
-
242 get<0>(result[i]) = get<0>(input[i]);
-
243 get<1>(result[i]) = arrival;
-
244 get<2>(result[i]) = burst;
-
245 get<3>(result[i]) = completion;
-
246 get<4>(result[i]) = turnaround;
-
247 get<5>(result[i]) = waiting;
-
248 }
-
249 return result;
-
250}
+
227 {
+
228 sort(input.begin(), input.end(), sortcol<S, T, E>);
+ +
230 double timeElapsed = 0;
+
231 for (size_t i{}; i < input.size(); i++) {
+
232 T arrival = get<1>(input[i]);
+
233 E burst = get<2>(input[i]);
+
234
+
235 if (arrival > timeElapsed) {
+
236 timeElapsed += arrival - timeElapsed;
+
237 }
+
238 timeElapsed += burst;
+
239 double completion = timeElapsed;
+
240 double turnaround = completion - arrival;
+
241 double waiting = turnaround - burst;
+
242
+
243 get<0>(result[i]) = get<0>(input[i]);
+
244 get<1>(result[i]) = arrival;
+
245 get<2>(result[i]) = burst;
+
246 get<3>(result[i]) = completion;
+
247 get<4>(result[i]) = turnaround;
+
248 get<5>(result[i]) = waiting;
+
249 }
+
250 return result;
+
251}
T begin(T... args)
T end(T... args)
-
bool sortcol(tuple< S, T, E > &t1, tuple< S, T, E > &t2)
Comparator function for sorting a vector.
Definition fcfs_scheduling.cpp:45
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
bool sortcol(tuple< S, T, E > &t1, tuple< S, T, E > &t2)
Comparator function for sorting a vector.
Definition fcfs_scheduling.cpp:46
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
T size(T... args)
T sort(T... args)
@@ -240,11 +241,11 @@ Here is the call graph for this function:

Entry point of the program.

Returns
0 on exit
-
287 {
-
288 test(); // run self-test implementations
-
289 return 0;
-
290}
-
static void test()
Self-test implementations.
Definition fcfs_scheduling.cpp:256
+
288 {
+
289 test(); // run self-test implementations
+
290 return 0;
+
291}
+
static void test()
Self-test implementations.
Definition fcfs_scheduling.cpp:257
Here is the call graph for this function:
@@ -293,14 +294,14 @@ template<typename S , typename T , typename E >
Returns
true if t1 and t2 are in the CORRECT order
false if t1 and t2 are in the INCORRECT order
-
45 {
-
46 if (get<1>(t1) < get<1>(t2)) {
-
47 return true;
-
48 } else if (get<1>(t1) == get<1>(t2) && get<0>(t1) < get<0>(t2)) {
-
49 return true;
-
50 }
-
51 return false;
-
52}
+
46 {
+
47 if (get<1>(t1) < get<1>(t2)) {
+
48 return true;
+
49 } else if (get<1>(t1) == get<1>(t2) && get<0>(t1) < get<0>(t2)) {
+
50 return true;
+
51 }
+
52 return false;
+
53}
@@ -329,37 +330,37 @@ false if t1 and t2 are in the INCORRECT order

Self-test implementations.

Returns
void
-
256 {
-
257 for (int i{}; i < 1000; i++) {
-
258 srand(time(nullptr));
-
259 uint32_t n = 1 + rand() % 1000;
- - -
262
-
263 for (uint32_t i{}; i < n; i++) {
-
264 get<0>(input[i]) = i;
-
265 srand(time(nullptr));
-
266 get<1>(input[i]) = 1 + rand() % 10000;
-
267 srand(time(nullptr));
-
268 get<2>(input[i]) = 1 + rand() % 10000;
-
269 }
-
270
-
271 for (uint32_t i{}; i < n; i++) {
-
272 readyQueue.addProcess(get<0>(input[i]), get<1>(input[i]),
-
273 get<2>(input[i]));
-
274 }
- - -
277 assert(res == readyQueue.scheduleForFcfs());
-
278 // readyQueue.printResult();
-
279 }
-
280 cout << "All the tests have successfully passed!" << endl;
-
281}
+
257 {
+
258 for (int i{}; i < 1000; i++) {
+
259 srand(time(nullptr));
+
260 uint32_t n = 1 + rand() % 1000;
+ + +
263
+
264 for (uint32_t i{}; i < n; i++) {
+
265 get<0>(input[i]) = i;
+
266 srand(time(nullptr));
+
267 get<1>(input[i]) = 1 + rand() % 10000;
+
268 srand(time(nullptr));
+
269 get<2>(input[i]) = 1 + rand() % 10000;
+
270 }
+
271
+
272 for (uint32_t i{}; i < n; i++) {
+
273 readyQueue.addProcess(get<0>(input[i]), get<1>(input[i]),
+
274 get<2>(input[i]));
+
275 }
+ + +
278 assert(res == readyQueue.scheduleForFcfs());
+
279 // readyQueue.printResult();
+
280 }
+
281 cout << "All the tests have successfully passed!" << endl;
+
282}
-
Class which implements the FCFS scheduling algorithm.
Definition fcfs_scheduling.cpp:97
-
void addProcess(S id, T arrival, E burst)
Adds the process to the ready queue if it isn't already there.
Definition fcfs_scheduling.cpp:129
-
vector< tuple< S, T, E, double, double, double > > scheduleForFcfs()
Algorithm for scheduling CPU processes according to the First Come First Serve(FCFS) scheduling algor...
Definition fcfs_scheduling.cpp:154
-
vector< tuple< S, T, E, double, double, double > > get_final_status(vector< tuple< uint32_t, uint32_t, uint32_t > > input)
Function to be used for testing purposes. This function guarantees the correct solution for FCFS sche...
Definition fcfs_scheduling.cpp:225
+
Class which implements the FCFS scheduling algorithm.
Definition fcfs_scheduling.cpp:98
+
void addProcess(S id, T arrival, E burst)
Adds the process to the ready queue if it isn't already there.
Definition fcfs_scheduling.cpp:130
+
vector< tuple< S, T, E, double, double, double > > scheduleForFcfs()
Algorithm for scheduling CPU processes according to the First Come First Serve(FCFS) scheduling algor...
Definition fcfs_scheduling.cpp:155
+
vector< tuple< S, T, E, double, double, double > > get_final_status(vector< tuple< uint32_t, uint32_t, uint32_t > > input)
Function to be used for testing purposes. This function guarantees the correct solution for FCFS sche...
Definition fcfs_scheduling.cpp:226
#define endl
Definition matrix_exponentiation.cpp:36
T time(T... args)
diff --git a/df/d66/vector__cross__product_8cpp.html b/df/d66/vector__cross__product_8cpp.html index 9dfadd847..53ecd23fe 100644 --- a/df/d66/vector__cross__product_8cpp.html +++ b/df/d66/vector__cross__product_8cpp.html @@ -126,7 +126,7 @@ Include dependency graph for vector_cross_product.cpp:

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  vector_cross
 Functions for Vector Cross Product algorithms.
- + @@ -177,11 +178,11 @@ Functions
Returns
0 on exit
-
112 {
-
113 test(); // execute the tests
-
114 return 0;
-
115}
-
static void test()
Definition modular_division.cpp:88
+
113 {
+
114 test(); // execute the tests
+
115 return 0;
+
116}
+
static void test()
Definition modular_division.cpp:89
Here is the call graph for this function:
@@ -226,13 +227,13 @@ Here is the call graph for this function:
Returns
a/b modulo c

Calculate the inverse of b

Calculate the final result

-
74 {
-
75 uint64_t inverse = power(b, p - 2, p) % p; /// Calculate the inverse of b
-
76 uint64_t result =
-
77 ((a % p) * (inverse % p)) % p; /// Calculate the final result
-
78 return result;
-
79}
-
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:76
+
75 {
+
76 uint64_t inverse = power(b, p - 2, p) % p; /// Calculate the inverse of b
+
77 uint64_t result =
+
78 ((a % p) * (inverse % p)) % p; /// Calculate the final result
+
79 return result;
+
80}
+
uint64_t result(uint64_t n)
Definition fibonacci_sum.cpp:77
void power(int x, int n)
Definition power_for_huge_numbers.cpp:56
Here is the call graph for this function:
@@ -282,23 +283,23 @@ Here is the call graph for this function:

If b is odd, multiply a with answer

b must be even now

b = b/2

-
49 {
-
50 uint64_t ans = 1; /// Initialize the answer to be returned
-
51 a = a % c; /// Update a if it is more than or equal to c
-
52 if (a == 0) {
-
53 return 0; /// In case a is divisible by c;
-
54 }
-
55 while (b > 0) {
-
56 /// If b is odd, multiply a with answer
-
57 if (b & 1) {
-
58 ans = ((ans % c) * (a % c)) % c;
-
59 }
-
60 /// b must be even now
-
61 b = b >> 1; /// b = b/2
-
62 a = ((a % c) * (a % c)) % c;
-
63 }
-
64 return ans;
-
65}
+
50 {
+
51 uint64_t ans = 1; /// Initialize the answer to be returned
+
52 a = a % c; /// Update a if it is more than or equal to c
+
53 if (a == 0) {
+
54 return 0; /// In case a is divisible by c;
+
55 }
+
56 while (b > 0) {
+
57 /// If b is odd, multiply a with answer
+
58 if (b & 1) {
+
59 ans = ((ans % c) * (a % c)) % c;
+
60 }
+
61 /// b must be even now
+
62 b = b >> 1; /// b = b/2
+
63 a = ((a % c) * (a % c)) % c;
+
64 }
+
65 return ans;
+
66}
@@ -325,26 +326,26 @@ Here is the call graph for this function:

Namespaces

namespace  math
 for IO operations
 for assert
 
namespace  modular_division
 Functions for Modular Division implementation.

Function for testing power function. test cases and assert statement.

Returns
void
-
88 {
-
89 uint64_t test_case_1 = math::modular_division::mod_division(8, 2, 2);
-
90 assert(test_case_1 == 0);
-
91 std::cout << "Test 1 Passed!" << std::endl;
-
92 uint64_t test_case_2 = math::modular_division::mod_division(15, 3, 7);
-
93 assert(test_case_2 == 5);
-
94 std::cout << "Test 2 Passed!" << std::endl;
-
95 uint64_t test_case_3 = math::modular_division::mod_division(10, 5, 2);
-
96 assert(test_case_3 == 0);
-
97 std::cout << "Test 3 Passed!" << std::endl;
-
98 uint64_t test_case_4 = math::modular_division::mod_division(81, 3, 5);
-
99 assert(test_case_4 == 2);
-
100 std::cout << "Test 4 Passed!" << std::endl;
-
101 uint64_t test_case_5 = math::modular_division::mod_division(12848, 73, 29);
-
102 assert(test_case_5 == 2);
-
103 std::cout << "Test 5 Passed!" << std::endl;
-
104}
+
89 {
+
90 uint64_t test_case_1 = math::modular_division::mod_division(8, 2, 2);
+
91 assert(test_case_1 == 0);
+
92 std::cout << "Test 1 Passed!" << std::endl;
+
93 uint64_t test_case_2 = math::modular_division::mod_division(15, 3, 7);
+
94 assert(test_case_2 == 5);
+
95 std::cout << "Test 2 Passed!" << std::endl;
+
96 uint64_t test_case_3 = math::modular_division::mod_division(10, 5, 2);
+
97 assert(test_case_3 == 0);
+
98 std::cout << "Test 3 Passed!" << std::endl;
+
99 uint64_t test_case_4 = math::modular_division::mod_division(81, 3, 5);
+
100 assert(test_case_4 == 2);
+
101 std::cout << "Test 4 Passed!" << std::endl;
+
102 uint64_t test_case_5 = math::modular_division::mod_division(12848, 73, 29);
+
103 assert(test_case_5 == 2);
+
104 std::cout << "Test 5 Passed!" << std::endl;
+
105}
T endl(T... args)
-
uint64_t mod_division(uint64_t a, uint64_t b, uint64_t p)
This function calculates modular division.
Definition modular_division.cpp:74
+
uint64_t mod_division(uint64_t a, uint64_t b, uint64_t p)
This function calculates modular division.
Definition modular_division.cpp:75
Here is the call graph for this function:
diff --git a/df/d88/data__structures_2sparse__table_8cpp__incl.map b/df/d88/data__structures_2sparse__table_8cpp__incl.map index 4a008e902..7422a8d37 100644 --- a/df/d88/data__structures_2sparse__table_8cpp__incl.map +++ b/df/d88/data__structures_2sparse__table_8cpp__incl.map @@ -1,9 +1,11 @@ - + - + - - - + + + + + diff --git a/df/d88/data__structures_2sparse__table_8cpp__incl.md5 b/df/d88/data__structures_2sparse__table_8cpp__incl.md5 index c4d02e9a6..e7fdabd20 100644 --- a/df/d88/data__structures_2sparse__table_8cpp__incl.md5 +++ b/df/d88/data__structures_2sparse__table_8cpp__incl.md5 @@ -1 +1 @@ -00d383768b1d9cf81c88ba4c61810ef5 \ No newline at end of file +5562a19c49f950b27a8fb95aed41a164 \ No newline at end of file diff --git a/df/d88/data__structures_2sparse__table_8cpp__incl.svg b/df/d88/data__structures_2sparse__table_8cpp__incl.svg index 3ed112b12..1430401d0 100644 --- a/df/d88/data__structures_2sparse__table_8cpp__incl.svg +++ b/df/d88/data__structures_2sparse__table_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -data_structures/sparse -_table.cpp + +data_structures/sparse +_table.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -iostream + +cstdint @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + diff --git a/df/d88/data__structures_2sparse__table_8cpp__incl_org.svg b/df/d88/data__structures_2sparse__table_8cpp__incl_org.svg index 1b67224b9..7ca074b2e 100644 --- a/df/d88/data__structures_2sparse__table_8cpp__incl_org.svg +++ b/df/d88/data__structures_2sparse__table_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + data_structures/sparse_table.cpp Node1 - -data_structures/sparse -_table.cpp + +data_structures/sparse +_table.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -iostream + +cstdint @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +iostream + + + + + +Node1->Node5 + + + diff --git a/df/d92/wildcard__matching_8cpp__incl.map b/df/d92/wildcard__matching_8cpp__incl.map index 8cdde6e79..a2108e42d 100644 --- a/df/d92/wildcard__matching_8cpp__incl.map +++ b/df/d92/wildcard__matching_8cpp__incl.map @@ -1,9 +1,11 @@ - + - - - - - + + + + + + + diff --git a/df/d92/wildcard__matching_8cpp__incl.md5 b/df/d92/wildcard__matching_8cpp__incl.md5 index c2193e59d..8324aee2a 100644 --- a/df/d92/wildcard__matching_8cpp__incl.md5 +++ b/df/d92/wildcard__matching_8cpp__incl.md5 @@ -1 +1 @@ -6c24a000481f42557122fedd78d366b0 \ No newline at end of file +b6ade645e1a2cfe92a96eed9e656da54 \ No newline at end of file diff --git a/df/d92/wildcard__matching_8cpp__incl.svg b/df/d92/wildcard__matching_8cpp__incl.svg index 47c5e813a..7c5adab51 100644 --- a/df/d92/wildcard__matching_8cpp__incl.svg +++ b/df/d92/wildcard__matching_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -backtracking/wildcard -_matching.cpp + +backtracking/wildcard +_matching.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -51,8 +51,8 @@ Node3 - -iostream + +cstdint @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -vector + +iostream @@ -78,8 +78,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/df/d92/wildcard__matching_8cpp__incl_org.svg b/df/d92/wildcard__matching_8cpp__incl_org.svg index b957ab9bb..6b34cf307 100644 --- a/df/d92/wildcard__matching_8cpp__incl_org.svg +++ b/df/d92/wildcard__matching_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + backtracking/wildcard_matching.cpp Node1 - -backtracking/wildcard -_matching.cpp + +backtracking/wildcard +_matching.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -40,8 +40,8 @@ Node3 - -iostream + +cstdint @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -vector + +iostream @@ -67,8 +67,26 @@ Node1->Node4 - - + + + + + + + +Node5 + + +vector + + + + + +Node1->Node5 + + + diff --git a/df/d94/subarray__sum_8cpp.html b/df/d94/subarray__sum_8cpp.html index 6bbfe0385..51dfd7127 100644 --- a/df/d94/subarray__sum_8cpp.html +++ b/df/d94/subarray__sum_8cpp.html @@ -114,13 +114,14 @@ $(function(){initNavTree('df/d94/subarray__sum_8cpp.html','../../'); initResizab

Subset-sum (only continuous subsets) problem More...

#include <cassert>
+#include <cstdint>
#include <iostream>
#include <unordered_map>
#include <vector>
Include dependency graph for subarray_sum.cpp:
-
+

Main function.

Returns
0 on exit
-
114 {
-
115 test(); // run self-test implementations
-
116 return 0;
-
117}
-
static void test()
Self-test implementations.
Definition subarray_sum.cpp:67
+
115 {
+
116 test(); // run self-test implementations
+
117 return 0;
+
118}
+
static void test()
Self-test implementations.
Definition subarray_sum.cpp:68
Here is the call graph for this function:
@@ -207,28 +208,28 @@ Here is the call graph for this function:
Returns
count of the number of subsets with required sum
-
38 {
-
39 int64_t nelement = in_arr.size();
-
40 int64_t count_of_subset = 0;
-
41 int64_t current_sum = 0;
- -
43 sumarray; // to store the subarrays count
-
44 // frequency having some sum value
-
45
-
46 for (int64_t i = 0; i < nelement; i++) {
-
47 current_sum += in_arr[i];
-
48
-
49 if (current_sum == sum) {
-
50 count_of_subset++;
-
51 }
-
52 // If in case current_sum is greater than the required sum
-
53 if (sumarray.find(current_sum - sum) != sumarray.end()) {
-
54 count_of_subset += (sumarray[current_sum - sum]);
-
55 }
-
56 sumarray[current_sum]++;
-
57 }
-
58 return count_of_subset;
-
59}
+
39 {
+
40 int64_t nelement = in_arr.size();
+
41 int64_t count_of_subset = 0;
+
42 int64_t current_sum = 0;
+ +
44 sumarray; // to store the subarrays count
+
45 // frequency having some sum value
+
46
+
47 for (int64_t i = 0; i < nelement; i++) {
+
48 current_sum += in_arr[i];
+
49
+
50 if (current_sum == sum) {
+
51 count_of_subset++;
+
52 }
+
53 // If in case current_sum is greater than the required sum
+
54 if (sumarray.find(current_sum - sum) != sumarray.end()) {
+
55 count_of_subset += (sumarray[current_sum - sum]);
+
56 }
+
57 sumarray[current_sum]++;
+
58 }
+
59 return count_of_subset;
+
60}
T end(T... args)
T find(T... args)
T sum(const std::vector< std::valarray< T > > &A)
Definition vector_ops.hpp:232
@@ -267,48 +268,48 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
67 {
-
68 // 1st test
-
69 std::cout << "1st test ";
-
70 std::vector<int64_t> array1 = {-7, -3, -2, 5, 8}; // input array
-
71 assert(
-
72 backtracking::subarray_sum::subarray_sum(0, array1) ==
-
73 1); // first argument in subarray_sum function is the required sum and
-
74 // second is the input array, answer is the subarray {(-3,-2,5)}
-
75 std::cout << "passed" << std::endl;
-
76
-
77 // 2nd test
-
78 std::cout << "2nd test ";
-
79 std::vector<int64_t> array2 = {1, 2, 3, 3};
-
80 assert(backtracking::subarray_sum::subarray_sum(6, array2) ==
-
81 2); // here we are expecting 2 subsets which sum up to 6 i.e.
-
82 // {(1,2,3),(3,3)}
-
83 std::cout << "passed" << std::endl;
-
84
-
85 // 3rd test
-
86 std::cout << "3rd test ";
-
87 std::vector<int64_t> array3 = {1, 1, 1, 1};
-
88 assert(backtracking::subarray_sum::subarray_sum(1, array3) ==
-
89 4); // here we are expecting 4 subsets which sum up to 1 i.e.
-
90 // {(1),(1),(1),(1)}
-
91 std::cout << "passed" << std::endl;
-
92
-
93 // 4rd test
-
94 std::cout << "4th test ";
-
95 std::vector<int64_t> array4 = {3, 3, 3, 3};
-
96 assert(backtracking::subarray_sum::subarray_sum(6, array4) ==
-
97 3); // here we are expecting 3 subsets which sum up to 6 i.e.
-
98 // {(3,3),(3,3),(3,3)}
-
99 std::cout << "passed" << std::endl;
-
100
-
101 // 5th test
-
102 std::cout << "5th test ";
-
103 std::vector<int64_t> array5 = {};
-
104 assert(backtracking::subarray_sum::subarray_sum(6, array5) ==
-
105 0); // here we are expecting 0 subsets which sum up to 6 i.e. we
-
106 // cannot select anything from an empty array
-
107 std::cout << "passed" << std::endl;
-
108}
+
68 {
+
69 // 1st test
+
70 std::cout << "1st test ";
+
71 std::vector<int64_t> array1 = {-7, -3, -2, 5, 8}; // input array
+
72 assert(
+
73 backtracking::subarray_sum::subarray_sum(0, array1) ==
+
74 1); // first argument in subarray_sum function is the required sum and
+
75 // second is the input array, answer is the subarray {(-3,-2,5)}
+
76 std::cout << "passed" << std::endl;
+
77
+
78 // 2nd test
+
79 std::cout << "2nd test ";
+
80 std::vector<int64_t> array2 = {1, 2, 3, 3};
+
81 assert(backtracking::subarray_sum::subarray_sum(6, array2) ==
+
82 2); // here we are expecting 2 subsets which sum up to 6 i.e.
+
83 // {(1,2,3),(3,3)}
+
84 std::cout << "passed" << std::endl;
+
85
+
86 // 3rd test
+
87 std::cout << "3rd test ";
+
88 std::vector<int64_t> array3 = {1, 1, 1, 1};
+
89 assert(backtracking::subarray_sum::subarray_sum(1, array3) ==
+
90 4); // here we are expecting 4 subsets which sum up to 1 i.e.
+
91 // {(1),(1),(1),(1)}
+
92 std::cout << "passed" << std::endl;
+
93
+
94 // 4rd test
+
95 std::cout << "4th test ";
+
96 std::vector<int64_t> array4 = {3, 3, 3, 3};
+
97 assert(backtracking::subarray_sum::subarray_sum(6, array4) ==
+
98 3); // here we are expecting 3 subsets which sum up to 6 i.e.
+
99 // {(3,3),(3,3),(3,3)}
+
100 std::cout << "passed" << std::endl;
+
101
+
102 // 5th test
+
103 std::cout << "5th test ";
+
104 std::vector<int64_t> array5 = {};
+
105 assert(backtracking::subarray_sum::subarray_sum(6, array5) ==
+
106 0); // here we are expecting 0 subsets which sum up to 6 i.e. we
+
107 // cannot select anything from an empty array
+
108 std::cout << "passed" << std::endl;
+
109}
T endl(T... args)
diff --git a/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.map b/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.map index 10d113832..59aae0619 100644 --- a/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.map +++ b/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.map @@ -1,13 +1,15 @@ - + - + - - - - - - - + + + + + + + + + diff --git a/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.md5 b/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.md5 index 885f71147..b1318b438 100644 --- a/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.md5 +++ b/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.md5 @@ -1 +1 @@ -8028e3347ea4753fa7b762d749e3ee0c \ No newline at end of file +01b6ac7b920517c5bf3f4d5a3e1f6751 \ No newline at end of file diff --git a/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.svg b/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.svg index d1c355c95..6ef89c185 100644 --- a/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.svg +++ b/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -bit_manipulation/travelling -_salesman_using_bit_manipulation.cpp + +bit_manipulation/travelling +_salesman_using_bit_manipulation.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,8 @@ Node1->Node3 - - + + @@ -69,8 +69,8 @@ Node4 - -iostream + +cstdint @@ -78,8 +78,8 @@ Node1->Node4 - - + + @@ -87,8 +87,8 @@ Node5 - -limits + +iostream @@ -96,8 +96,8 @@ Node1->Node5 - - + + @@ -105,8 +105,8 @@ Node6 - -vector + +limits @@ -114,8 +114,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl_org.svg b/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl_org.svg index 13ea50400..b6929e82c 100644 --- a/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl_org.svg +++ b/df/dc5/travelling__salesman__using__bit__manipulation_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + bit_manipulation/travelling_salesman_using_bit_manipulation.cpp Node1 - -bit_manipulation/travelling -_salesman_using_bit_manipulation.cpp + +bit_manipulation/travelling +_salesman_using_bit_manipulation.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,8 @@ Node1->Node3 - - + + @@ -58,8 +58,8 @@ Node4 - -iostream + +cstdint @@ -67,8 +67,8 @@ Node1->Node4 - - + + @@ -76,8 +76,8 @@ Node5 - -limits + +iostream @@ -85,8 +85,8 @@ Node1->Node5 - - + + @@ -94,8 +94,8 @@ Node6 - -vector + +limits @@ -103,8 +103,26 @@ Node1->Node6 - - + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + diff --git a/df/dcb/namespacestrings.html b/df/dcb/namespacestrings.html index faa6278a1..20983ae8c 100644 --- a/df/dcb/namespacestrings.html +++ b/df/dcb/namespacestrings.html @@ -121,9 +121,9 @@ Namespaces

@@ -166,11 +167,11 @@ Functions

Detailed Description

String algorithms.

-

for std::vector STL

+

for assert

Algorithms with strings.

-

for assert for IO operations for string

+

for IO operations for std::vector STL for string

Algorithms with strings

diff --git a/df/dcd/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2math_2quadratic_equations_complex_numbers_8cpp-example.html b/df/dcd/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2math_2quadratic_equations_complex_numbers_8cpp-example.html index 0aab75773..40ff59211 100644 --- a/df/dcd/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2math_2quadratic_equations_complex_numbers_8cpp-example.html +++ b/df/dcd/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2math_2quadratic_equations_complex_numbers_8cpp-example.html @@ -306,7 +306,7 @@ $(function(){initNavTree('df/dcd/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plu
static void test()
Self-test implementations.
Definition generate_parentheses.cpp:82
int main()
Main function.
Definition generate_parentheses.cpp:110
-
for IO operations
+
for assert
std::array< std::complex< long double >, 2 > quadraticEquation(long double a, long double b, long double c)
Quadratic equation calculator.
Definition quadratic_equations_complex_numbers.cpp:53
T pow(T... args)
void assertArray(std::array< std::complex< long double >, 2 > input, std::array< std::complex< long double >, 2 > expected, size_t precision=10)
Asserts an array of complex numbers.
Definition quadratic_equations_complex_numbers.cpp:100
diff --git a/df/dce/namespacegraph.html b/df/dce/namespacegraph.html index 9d3e08f45..e8db086ce 100644 --- a/df/dce/namespacegraph.html +++ b/df/dce/namespacegraph.html @@ -164,6 +164,7 @@ Functions

Detailed Description

Graph Algorithms.

+

for assert

Check whether a given graph is bipartite or not.

for std::vector

Graph algorithms.

@@ -172,7 +173,8 @@ Functions

A bipartite graph is the one whose nodes can be divided into two disjoint sets in such a way that the nodes in a set are not connected to each other at all, i.e. no intra-set connections. The only connections that exist are that of inter-set, i.e. the nodes from one set are connected to a subset of nodes in the other set. In this implementation, using a graph in the form of adjacency list, check whether the given graph is a bipartite or not.

References used: GeeksForGeeks

Author
tushar2407 for assert for IO operations for queue data structure for vector data structure

Graphical algorithms

-

for std::min for assert for IO operations for limits of integral types for std::vector

+

for std::min for IO operations for limits of integral types for std::vector

+

Graph Algorithms

Function Documentation

◆ addEdge() [1/3]

@@ -354,38 +356,38 @@ Here is the call graph for this function:

insert the neighbouring node into the queue

if both the current node and its neighbour has the same state then it is not a bipartite graph

return true when all the connected nodes of the current nodes are travelled and satisify all the above conditions

-
37 {
-
38 std::queue<int64_t> q; ///< stores the neighbouring node indexes in squence
-
39 /// of being reached
-
40 q.push(index); /// insert the current node into the queue
-
41 (*visited)[index] = 1; /// mark the current node as travelled
-
42 while (q.size()) {
-
43 int64_t u = q.front();
-
44 q.pop();
-
45 for (uint64_t i = 0; i < graph[u].size(); i++) {
-
46 int64_t v =
-
47 graph[u][i]; ///< stores the neighbour of the current node
-
48 if (!(*visited)[v]) /// check whether the neighbour node is
-
49 /// travelled already or not
-
50 {
-
51 (*visited)[v] =
-
52 ((*visited)[u] == 1)
-
53 ? -1
-
54 : 1; /// colour the neighbouring node with
-
55 /// different colour than the current node
-
56 q.push(v); /// insert the neighbouring node into the queue
-
57 } else if ((*visited)[v] ==
-
58 (*visited)[u]) /// if both the current node and its
-
59 /// neighbour has the same state then it
-
60 /// is not a bipartite graph
-
61 {
-
62 return false;
-
63 }
-
64 }
-
65 }
-
66 return true; /// return true when all the connected nodes of the current
-
67 /// nodes are travelled and satisify all the above conditions
-
68}
+
38 {
+
39 std::queue<int64_t> q; ///< stores the neighbouring node indexes in squence
+
40 /// of being reached
+
41 q.push(index); /// insert the current node into the queue
+
42 (*visited)[index] = 1; /// mark the current node as travelled
+
43 while (q.size()) {
+
44 int64_t u = q.front();
+
45 q.pop();
+
46 for (uint64_t i = 0; i < graph[u].size(); i++) {
+
47 int64_t v =
+
48 graph[u][i]; ///< stores the neighbour of the current node
+
49 if (!(*visited)[v]) /// check whether the neighbour node is
+
50 /// travelled already or not
+
51 {
+
52 (*visited)[v] =
+
53 ((*visited)[u] == 1)
+
54 ? -1
+
55 : 1; /// colour the neighbouring node with
+
56 /// different colour than the current node
+
57 q.push(v); /// insert the neighbouring node into the queue
+
58 } else if ((*visited)[v] ==
+
59 (*visited)[u]) /// if both the current node and its
+
60 /// neighbour has the same state then it
+
61 /// is not a bipartite graph
+
62 {
+
63 return false;
+
64 }
+
65 }
+
66 }
+
67 return true; /// return true when all the connected nodes of the current
+
68 /// nodes are travelled and satisify all the above conditions
+
69}
Graph Algorithms.
@@ -706,25 +708,25 @@ Here is the call graph for this function:
Returns
booleans

< stores boolean values which signify whether that node had been visited or not

if the current node is not visited then check whether the sub-graph of that node is a bipartite or not

-
75 {
- -
77 graph.size()); ///< stores boolean values
-
78 /// which signify whether that node had been visited or
-
79 /// not
-
80
-
81 for (uint64_t i = 0; i < graph.size(); i++) {
-
82 if (!visited[i]) /// if the current node is not visited then check
-
83 /// whether the sub-graph of that node is a bipartite
-
84 /// or not
-
85 {
-
86 if (!checkBipartite(graph, i, &visited)) {
-
87 return false;
-
88 }
-
89 }
-
90 }
-
91 return true;
-
92}
-
bool checkBipartite(const std::vector< std::vector< int64_t > > &graph, int64_t index, std::vector< int64_t > *visited)
function to check whether the passed graph is bipartite or not
Definition is_graph_bipartite2.cpp:36
+
76 {
+ +
78 graph.size()); ///< stores boolean values
+
79 /// which signify whether that node had been visited or
+
80 /// not
+
81
+
82 for (uint64_t i = 0; i < graph.size(); i++) {
+
83 if (!visited[i]) /// if the current node is not visited then check
+
84 /// whether the sub-graph of that node is a bipartite
+
85 /// or not
+
86 {
+
87 if (!checkBipartite(graph, i, &visited)) {
+
88 return false;
+
89 }
+
90 }
+
91 }
+
92 return true;
+
93}
+
bool checkBipartite(const std::vector< std::vector< int64_t > > &graph, int64_t index, std::vector< int64_t > *visited)
function to check whether the passed graph is bipartite or not
Definition is_graph_bipartite2.cpp:37
Here is the call graph for this function:
@@ -766,36 +768,36 @@ Here is the call graph for this function:
-
41 {
-
42 //// vtx stores the vertexs of the graph
- -
44 for (uint32_t i = 0; i < V; i++) {
-
45 if (i != src) {
-
46 vtx.push_back(i);
-
47 }
-
48 }
-
49
-
50 //// store minimum weight Hamiltonian Cycle.
-
51 int32_t min_path = 2147483647;
-
52 do {
-
53 //// store current Path weight(cost)
-
54 int32_t curr_weight = 0;
-
55
-
56 //// compute current path weight
-
57 int k = src;
-
58 for (int i : vtx) {
-
59 curr_weight += (*cities)[k][i];
-
60 k = i;
-
61 }
-
62 curr_weight += (*cities)[k][src];
-
63
-
64 //// update minimum
-
65 min_path = std::min(min_path, curr_weight);
-
66
-
67 } while (next_permutation(vtx.begin(), vtx.end()));
-
68
-
69 return min_path;
-
70}
+
42 {
+
43 //// vtx stores the vertexs of the graph
+ +
45 for (uint32_t i = 0; i < V; i++) {
+
46 if (i != src) {
+
47 vtx.push_back(i);
+
48 }
+
49 }
+
50
+
51 //// store minimum weight Hamiltonian Cycle.
+
52 int32_t min_path = 2147483647;
+
53 do {
+
54 //// store current Path weight(cost)
+
55 int32_t curr_weight = 0;
+
56
+
57 //// compute current path weight
+
58 int k = src;
+
59 for (int i : vtx) {
+
60 curr_weight += (*cities)[k][i];
+
61 k = i;
+
62 }
+
63 curr_weight += (*cities)[k][src];
+
64
+
65 //// update minimum
+
66 min_path = std::min(min_path, curr_weight);
+
67
+
68 } while (next_permutation(vtx.begin(), vtx.end()));
+
69
+
70 return min_path;
+
71}
T begin(T... args)
double k(double x)
Another test function.
Definition composite_simpson_rule.cpp:117
T end(T... args)
diff --git a/doxygen_crawl.html b/doxygen_crawl.html index dd177cddf..61d16f18b 100644 --- a/doxygen_crawl.html +++ b/doxygen_crawl.html @@ -3104,8 +3104,8 @@ + - diff --git a/globals_func_t.html b/globals_func_t.html index b3da32630..6ef0b6a79 100644 --- a/globals_func_t.html +++ b/globals_func_t.html @@ -108,7 +108,7 @@ $(function(){initNavTree('globals_func_t.html',''); initResizable(true); });

- t -

  • ternary_search() : ternary_search.cpp
  • -
  • test() : generate_parentheses.cpp, rat_maze.cpp, subarray_sum.cpp, subset_sum.cpp, wildcard_matching.cpp, count_bits_flip.cpp, count_of_trailing_ciphers_in_factorial_n.cpp, find_non_repeating_number.cpp, hamming_distance.cpp, next_higher_number_with_same_number_of_set_bits.cpp, power_of_2.cpp, set_kth_bit.cpp, travelling_salesman_using_bit_manipulation.cpp, a1z26_cipher.cpp, atbash_cipher.cpp, caesar_cipher.cpp, elliptic_curve_key_exchange.cpp, morse_code.cpp, vigenere_cipher.cpp, xor_cipher.cpp, fcfs_scheduling.cpp, list_array.cpp, reverse_a_linked_list.cpp, segment_tree.cpp, sparse_table.cpp, treap.cpp, trie_tree.cpp, trie_using_hashmap.cpp, karatsuba_algorithm_for_fast_multiplication.cpp, 0_1_knapsack.cpp, abbreviation.cpp, coin_change_topdown.cpp, cut_rod.cpp, house_robber.cpp, longest_increasing_subsequence.cpp, longest_palindromic_subsequence.cpp, maximum_circular_subarray.cpp, minimum_edit_distance.cpp, palindrome_partitioning.cpp, shortest_common_supersequence.cpp, subset_sum.cpp, trapped_rainwater.cpp, word_break.cpp, jarvis_algorithm.cpp, connected_components_with_dsu.cpp, is_graph_bipartite.cpp, topological_sort.cpp, jump_game.cpp, kruskals_minimum_spanning_tree.cpp, md5.cpp, sha1.cpp, k_nearest_neighbors.cpp, neural_network.cpp, aliquot_sum.cpp, area.cpp, double_factorial.cpp, eratosthenes.cpp, eulers_totient_function.cpp, fibonacci.cpp, fibonacci_matrix_exponentiation.cpp, fibonacci_sum.cpp, gcd_of_n_numbers.cpp, integral_approximation2.cpp, inv_sqrt.cpp, iterative_factorial.cpp, largest_power.cpp, lcm_sum.cpp, modular_division.cpp, modular_exponentiation.cpp, modular_inverse_fermat_little_theorem.cpp, modular_inverse_simple.cpp, n_bonacci.cpp, n_choose_r.cpp, perimeter.cpp, power_of_two.cpp, quadratic_equations_complex_numbers.cpp, sum_of_binomial_coefficient.cpp, sum_of_digits.cpp, vector_cross_product.cpp, volume.cpp, babylonian_method.cpp, composite_simpson_rule.cpp, fast_fourier_transform.cpp, gram_schmidt.cpp, inverse_fast_fourier_transform.cpp, midpoint_integral_method.cpp, rungekutta.cpp, array_left_rotation.cpp, array_right_rotation.cpp, circular_linked_list.cpp, inorder_successor_of_bst.cpp, intersection_of_two_arrays.cpp, reverse_binary_tree.cpp, trie_multiple_search.cpp, union_of_two_arrays.cpp, kadanes3.cpp, lfu_cache.cpp, lru_cache2.cpp, smallest_circle.cpp, ground_to_ground_projectile_motion.cpp, exponential_dist.cpp, geometric_dist.cpp, windowed_median.cpp, persistent_seg_tree_lazy_prop.cpp, prefix_sum_array.cpp, segtree.cpp, floyd_cycle_detection_algo.cpp, median_search.cpp, median_search2.cpp, saddleback_search.cpp, sublist_search.cpp, text_search.cpp, binary_insertion_sort.cpp, bogo_sort.cpp, bubble_sort.cpp, count_inversions.cpp, cycle_sort.cpp, dnf_sort.cpp, gnome_sort.cpp, heap_sort.cpp, merge_insertion_sort.cpp, pancake_sort.cpp, random_pivot_quick_sort.cpp, recursive_bubble_sort.cpp, selection_sort_recursive.cpp, strand_sort.cpp, wave_sort.cpp, wiggle_sort.cpp, duval.cpp, horspool.cpp, manacher_algorithm.cpp, z_function.cpp
  • +
  • test() : generate_parentheses.cpp, rat_maze.cpp, subarray_sum.cpp, subset_sum.cpp, wildcard_matching.cpp, count_bits_flip.cpp, count_of_trailing_ciphers_in_factorial_n.cpp, find_non_repeating_number.cpp, hamming_distance.cpp, next_higher_number_with_same_number_of_set_bits.cpp, power_of_2.cpp, set_kth_bit.cpp, travelling_salesman_using_bit_manipulation.cpp, a1z26_cipher.cpp, atbash_cipher.cpp, caesar_cipher.cpp, elliptic_curve_key_exchange.cpp, morse_code.cpp, vigenere_cipher.cpp, xor_cipher.cpp, fcfs_scheduling.cpp, list_array.cpp, reverse_a_linked_list.cpp, segment_tree.cpp, sparse_table.cpp, treap.cpp, trie_tree.cpp, trie_using_hashmap.cpp, karatsuba_algorithm_for_fast_multiplication.cpp, 0_1_knapsack.cpp, abbreviation.cpp, coin_change_topdown.cpp, cut_rod.cpp, house_robber.cpp, longest_increasing_subsequence.cpp, longest_palindromic_subsequence.cpp, maximum_circular_subarray.cpp, minimum_edit_distance.cpp, palindrome_partitioning.cpp, shortest_common_supersequence.cpp, subset_sum.cpp, trapped_rainwater.cpp, word_break.cpp, jarvis_algorithm.cpp, connected_components_with_dsu.cpp, is_graph_bipartite.cpp, topological_sort.cpp, jump_game.cpp, kruskals_minimum_spanning_tree.cpp, md5.cpp, sha1.cpp, k_nearest_neighbors.cpp, neural_network.cpp, aliquot_sum.cpp, area.cpp, double_factorial.cpp, eratosthenes.cpp, eulers_totient_function.cpp, fibonacci.cpp, fibonacci_matrix_exponentiation.cpp, fibonacci_sum.cpp, gcd_of_n_numbers.cpp, integral_approximation2.cpp, inv_sqrt.cpp, iterative_factorial.cpp, largest_power.cpp, lcm_sum.cpp, modular_division.cpp, modular_exponentiation.cpp, modular_inverse_fermat_little_theorem.cpp, modular_inverse_simple.cpp, n_bonacci.cpp, n_choose_r.cpp, perimeter.cpp, power_of_two.cpp, quadratic_equations_complex_numbers.cpp, sum_of_binomial_coefficient.cpp, sum_of_digits.cpp, vector_cross_product.cpp, volume.cpp, babylonian_method.cpp, composite_simpson_rule.cpp, fast_fourier_transform.cpp, gram_schmidt.cpp, inverse_fast_fourier_transform.cpp, midpoint_integral_method.cpp, rungekutta.cpp, array_left_rotation.cpp, array_right_rotation.cpp, circular_linked_list.cpp, inorder_successor_of_bst.cpp, intersection_of_two_arrays.cpp, reverse_binary_tree.cpp, trie_multiple_search.cpp, union_of_two_arrays.cpp, kadanes3.cpp, lfu_cache.cpp, lru_cache2.cpp, smallest_circle.cpp, ground_to_ground_projectile_motion.cpp, exponential_dist.cpp, geometric_dist.cpp, windowed_median.cpp, persistent_seg_tree_lazy_prop.cpp, prefix_sum_array.cpp, segtree.cpp, floyd_cycle_detection_algo.cpp, median_search.cpp, median_search2.cpp, saddleback_search.cpp, sublist_search.cpp, text_search.cpp, binary_insertion_sort.cpp, bogo_sort.cpp, bubble_sort.cpp, count_inversions.cpp, cycle_sort.cpp, dnf_sort.cpp, gnome_sort.cpp, heap_sort.cpp, merge_insertion_sort.cpp, pancake_sort.cpp, random_pivot_quick_sort.cpp, recursive_bubble_sort.cpp, selection_sort_recursive.cpp, strand_sort.cpp, wave_sort.cpp, wiggle_sort.cpp, duval.cpp, horspool.cpp, manacher_algorithm.cpp, z_function.cpp
  • test1() : hill_cipher.cpp, dsu_path_compression.cpp, dsu_union_rank.cpp, tree_234.cpp, hamiltons_cycle.cpp, adaline_learning.cpp, kohonen_som_topology.cpp, kohonen_som_trace.cpp, large_factorial.cpp, sum_of_digits.cpp, brent_method_extrema.cpp, durand_kerner_roots.cpp, golden_search_extrema.cpp, lu_decompose.cpp, qr_eigen_values.cpp, iterative_tree_traversals.cpp, recursive_tree_traversal.cpp, stooge_sort.cpp
  • test2() : hill_cipher.cpp, dsu_path_compression.cpp, dsu_union_rank.cpp, tree_234.cpp, hamiltons_cycle.cpp, adaline_learning.cpp, kohonen_som_topology.cpp, kohonen_som_trace.cpp, large_factorial.cpp, sum_of_digits.cpp, brent_method_extrema.cpp, durand_kerner_roots.cpp, golden_search_extrema.cpp, lu_decompose.cpp, qr_eigen_values.cpp, iterative_tree_traversals.cpp, recursive_tree_traversal.cpp, smallest_circle.cpp, stooge_sort.cpp
  • test3() : hamiltons_cycle.cpp, adaline_learning.cpp, kohonen_som_topology.cpp, kohonen_som_trace.cpp, brent_method_extrema.cpp, golden_search_extrema.cpp, iterative_tree_traversals.cpp, recursive_tree_traversal.cpp, smallest_circle.cpp, stooge_sort.cpp
  • diff --git a/globals_t.html b/globals_t.html index e2df96a28..711ea38ef 100644 --- a/globals_t.html +++ b/globals_t.html @@ -108,7 +108,7 @@ $(function(){initNavTree('globals_t.html',''); initResizable(true); });

    - t -

    • ternary_search() : ternary_search.cpp
    • -
    • test() : generate_parentheses.cpp, rat_maze.cpp, subarray_sum.cpp, subset_sum.cpp, wildcard_matching.cpp, count_bits_flip.cpp, count_of_trailing_ciphers_in_factorial_n.cpp, find_non_repeating_number.cpp, hamming_distance.cpp, next_higher_number_with_same_number_of_set_bits.cpp, power_of_2.cpp, set_kth_bit.cpp, travelling_salesman_using_bit_manipulation.cpp, a1z26_cipher.cpp, atbash_cipher.cpp, caesar_cipher.cpp, elliptic_curve_key_exchange.cpp, morse_code.cpp, vigenere_cipher.cpp, xor_cipher.cpp, fcfs_scheduling.cpp, list_array.cpp, reverse_a_linked_list.cpp, segment_tree.cpp, sparse_table.cpp, treap.cpp, trie_tree.cpp, trie_using_hashmap.cpp, karatsuba_algorithm_for_fast_multiplication.cpp, 0_1_knapsack.cpp, abbreviation.cpp, coin_change_topdown.cpp, cut_rod.cpp, house_robber.cpp, longest_increasing_subsequence.cpp, longest_palindromic_subsequence.cpp, maximum_circular_subarray.cpp, minimum_edit_distance.cpp, palindrome_partitioning.cpp, shortest_common_supersequence.cpp, subset_sum.cpp, trapped_rainwater.cpp, word_break.cpp, jarvis_algorithm.cpp, connected_components_with_dsu.cpp, is_graph_bipartite.cpp, topological_sort.cpp, jump_game.cpp, kruskals_minimum_spanning_tree.cpp, md5.cpp, sha1.cpp, k_nearest_neighbors.cpp, neural_network.cpp, aliquot_sum.cpp, area.cpp, double_factorial.cpp, eratosthenes.cpp, eulers_totient_function.cpp, fibonacci.cpp, fibonacci_matrix_exponentiation.cpp, fibonacci_sum.cpp, gcd_of_n_numbers.cpp, integral_approximation2.cpp, inv_sqrt.cpp, iterative_factorial.cpp, largest_power.cpp, lcm_sum.cpp, modular_division.cpp, modular_exponentiation.cpp, modular_inverse_fermat_little_theorem.cpp, modular_inverse_simple.cpp, n_bonacci.cpp, n_choose_r.cpp, perimeter.cpp, power_of_two.cpp, quadratic_equations_complex_numbers.cpp, sum_of_binomial_coefficient.cpp, sum_of_digits.cpp, vector_cross_product.cpp, volume.cpp, babylonian_method.cpp, composite_simpson_rule.cpp, fast_fourier_transform.cpp, gram_schmidt.cpp, inverse_fast_fourier_transform.cpp, midpoint_integral_method.cpp, rungekutta.cpp, array_left_rotation.cpp, array_right_rotation.cpp, circular_linked_list.cpp, inorder_successor_of_bst.cpp, intersection_of_two_arrays.cpp, reverse_binary_tree.cpp, trie_multiple_search.cpp, union_of_two_arrays.cpp, kadanes3.cpp, lfu_cache.cpp, lru_cache2.cpp, smallest_circle.cpp, ground_to_ground_projectile_motion.cpp, exponential_dist.cpp, geometric_dist.cpp, windowed_median.cpp, persistent_seg_tree_lazy_prop.cpp, prefix_sum_array.cpp, segtree.cpp, floyd_cycle_detection_algo.cpp, median_search.cpp, median_search2.cpp, saddleback_search.cpp, sublist_search.cpp, text_search.cpp, binary_insertion_sort.cpp, bogo_sort.cpp, bubble_sort.cpp, count_inversions.cpp, cycle_sort.cpp, dnf_sort.cpp, gnome_sort.cpp, heap_sort.cpp, merge_insertion_sort.cpp, pancake_sort.cpp, random_pivot_quick_sort.cpp, recursive_bubble_sort.cpp, selection_sort_recursive.cpp, strand_sort.cpp, wave_sort.cpp, wiggle_sort.cpp, duval.cpp, horspool.cpp, manacher_algorithm.cpp, z_function.cpp
    • +
    • test() : generate_parentheses.cpp, rat_maze.cpp, subarray_sum.cpp, subset_sum.cpp, wildcard_matching.cpp, count_bits_flip.cpp, count_of_trailing_ciphers_in_factorial_n.cpp, find_non_repeating_number.cpp, hamming_distance.cpp, next_higher_number_with_same_number_of_set_bits.cpp, power_of_2.cpp, set_kth_bit.cpp, travelling_salesman_using_bit_manipulation.cpp, a1z26_cipher.cpp, atbash_cipher.cpp, caesar_cipher.cpp, elliptic_curve_key_exchange.cpp, morse_code.cpp, vigenere_cipher.cpp, xor_cipher.cpp, fcfs_scheduling.cpp, list_array.cpp, reverse_a_linked_list.cpp, segment_tree.cpp, sparse_table.cpp, treap.cpp, trie_tree.cpp, trie_using_hashmap.cpp, karatsuba_algorithm_for_fast_multiplication.cpp, 0_1_knapsack.cpp, abbreviation.cpp, coin_change_topdown.cpp, cut_rod.cpp, house_robber.cpp, longest_increasing_subsequence.cpp, longest_palindromic_subsequence.cpp, maximum_circular_subarray.cpp, minimum_edit_distance.cpp, palindrome_partitioning.cpp, shortest_common_supersequence.cpp, subset_sum.cpp, trapped_rainwater.cpp, word_break.cpp, jarvis_algorithm.cpp, connected_components_with_dsu.cpp, is_graph_bipartite.cpp, topological_sort.cpp, jump_game.cpp, kruskals_minimum_spanning_tree.cpp, md5.cpp, sha1.cpp, k_nearest_neighbors.cpp, neural_network.cpp, aliquot_sum.cpp, area.cpp, double_factorial.cpp, eratosthenes.cpp, eulers_totient_function.cpp, fibonacci.cpp, fibonacci_matrix_exponentiation.cpp, fibonacci_sum.cpp, gcd_of_n_numbers.cpp, integral_approximation2.cpp, inv_sqrt.cpp, iterative_factorial.cpp, largest_power.cpp, lcm_sum.cpp, modular_division.cpp, modular_exponentiation.cpp, modular_inverse_fermat_little_theorem.cpp, modular_inverse_simple.cpp, n_bonacci.cpp, n_choose_r.cpp, perimeter.cpp, power_of_two.cpp, quadratic_equations_complex_numbers.cpp, sum_of_binomial_coefficient.cpp, sum_of_digits.cpp, vector_cross_product.cpp, volume.cpp, babylonian_method.cpp, composite_simpson_rule.cpp, fast_fourier_transform.cpp, gram_schmidt.cpp, inverse_fast_fourier_transform.cpp, midpoint_integral_method.cpp, rungekutta.cpp, array_left_rotation.cpp, array_right_rotation.cpp, circular_linked_list.cpp, inorder_successor_of_bst.cpp, intersection_of_two_arrays.cpp, reverse_binary_tree.cpp, trie_multiple_search.cpp, union_of_two_arrays.cpp, kadanes3.cpp, lfu_cache.cpp, lru_cache2.cpp, smallest_circle.cpp, ground_to_ground_projectile_motion.cpp, exponential_dist.cpp, geometric_dist.cpp, windowed_median.cpp, persistent_seg_tree_lazy_prop.cpp, prefix_sum_array.cpp, segtree.cpp, floyd_cycle_detection_algo.cpp, median_search.cpp, median_search2.cpp, saddleback_search.cpp, sublist_search.cpp, text_search.cpp, binary_insertion_sort.cpp, bogo_sort.cpp, bubble_sort.cpp, count_inversions.cpp, cycle_sort.cpp, dnf_sort.cpp, gnome_sort.cpp, heap_sort.cpp, merge_insertion_sort.cpp, pancake_sort.cpp, random_pivot_quick_sort.cpp, recursive_bubble_sort.cpp, selection_sort_recursive.cpp, strand_sort.cpp, wave_sort.cpp, wiggle_sort.cpp, duval.cpp, horspool.cpp, manacher_algorithm.cpp, z_function.cpp
    • test1() : hill_cipher.cpp, dsu_path_compression.cpp, dsu_union_rank.cpp, tree_234.cpp, hamiltons_cycle.cpp, adaline_learning.cpp, kohonen_som_topology.cpp, kohonen_som_trace.cpp, large_factorial.cpp, sum_of_digits.cpp, brent_method_extrema.cpp, durand_kerner_roots.cpp, golden_search_extrema.cpp, lu_decompose.cpp, qr_eigen_values.cpp, iterative_tree_traversals.cpp, recursive_tree_traversal.cpp, stooge_sort.cpp
    • test2() : hill_cipher.cpp, dsu_path_compression.cpp, dsu_union_rank.cpp, tree_234.cpp, hamiltons_cycle.cpp, adaline_learning.cpp, kohonen_som_topology.cpp, kohonen_som_trace.cpp, large_factorial.cpp, sum_of_digits.cpp, brent_method_extrema.cpp, durand_kerner_roots.cpp, golden_search_extrema.cpp, lu_decompose.cpp, qr_eigen_values.cpp, iterative_tree_traversals.cpp, recursive_tree_traversal.cpp, smallest_circle.cpp, stooge_sort.cpp
    • test3() : hamiltons_cycle.cpp, adaline_learning.cpp, kohonen_som_topology.cpp, kohonen_som_trace.cpp, brent_method_extrema.cpp, golden_search_extrema.cpp, iterative_tree_traversals.cpp, recursive_tree_traversal.cpp, smallest_circle.cpp, stooge_sort.cpp
    • diff --git a/hierarchy.html b/hierarchy.html index 69496bfb0..d9a6bd8fe 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -137,7 +137,7 @@ This inheritance list is sorted roughly, but not completely, alphabetically: Cgreedy_algorithms::DigitSeparationA class that provides methods to separate the digits of a large positive number  Cdouble_linked_list  CdsuDisjoint sets union data structure, class based representation - CEasterYearMonthDayFor IO operations + CEasterYearMonthDayFor assert  CEdge  Cmachine_learning::aystar_search::EightPuzzle< N >A class defining EightPuzzle/15-Puzzle game  Cdouble_hashing::Entry diff --git a/inherit_graph_35.map b/inherit_graph_35.map index b43c68e5d..187c4f47b 100644 --- a/inherit_graph_35.map +++ b/inherit_graph_35.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_35.md5 b/inherit_graph_35.md5 index 1c17e8b95..15772091b 100644 --- a/inherit_graph_35.md5 +++ b/inherit_graph_35.md5 @@ -1 +1 @@ -0d3b1a5551be97264d715f0108007db1 \ No newline at end of file +c2ff2c33b8acd63dccc537e25d82de04 \ No newline at end of file diff --git a/inherit_graph_35.svg b/inherit_graph_35.svg index 0477b0838..dc4738d7a 100644 --- a/inherit_graph_35.svg +++ b/inherit_graph_35.svg @@ -11,7 +11,7 @@ Node0 - + EasterYearMonthDay diff --git a/namespaces.html b/namespaces.html index e60c11b00..ac8aff924 100644 --- a/namespaces.html +++ b/namespaces.html @@ -118,7 +118,7 @@ $(function(){initNavTree('namespaces.html',''); initResizable(true); });  Nbase64_encodingFunctions for Base64 Encoding and Decoding implementation  Nbidirectional_dijkstraFunctions for [Bidirectional Dijkstra Shortest Path] (https://www.coursera.org/learn/algorithms-on-graphs/lecture/7ml18/bidirectional-dijkstra) algorithm  NbinomialFunctions for Binomial coefficients implementation - Nbit_manipulationFor IO operations + Nbit_manipulationFor assert  Nboruvkas_minimum_spanning_treeFunctions for the [Borůvkas Algorithm](https://en.wikipedia.org/wiki/Borůvka's_algorithm) implementation  Nbubble_sortBubble sort algorithm  NcaesarFunctions for Caesar cipher algorithm @@ -150,7 +150,7 @@ $(function(){initNavTree('namespaces.html',''); initResizable(true); });  Nmemory_gameFunctions for the Memory Game implementation  Ngcd_of_n_numbersCompute GCD of numbers in an array  Ngeometric_distFunctions for the Geometric Distribution algorithm implementation - NgeometryFor std::vector + NgeometryFor std::swap  Ngram_schmidtFunctions for Gram Schmidt Orthogonalisation Process  NgraphGraph Algorithms  Ngraph_coloringFunctions for the Graph Coloring algorithm, @@ -160,7 +160,7 @@ $(function(){initNavTree('namespaces.html',''); initResizable(true); });  Nstable_matchingFunctions for the Gale-Shapley Algorithm  Nground_to_ground_projectile_motionFunctions for the Ground to ground projectile motion equation  Nhamming_distanceFunctions for Hamming distance implementation - NhashingHashing algorithms + NhashingUsed for assert  Nheavy_light_decompositionHeavy light decomposition algorithm  NhorspoolFunctions for Horspool's algorithm  Nhouse_robberFunctions for the House Robber algorithm @@ -184,7 +184,7 @@ $(function(){initNavTree('namespaces.html',''); initResizable(true); });  Nmachine_learningA* search algorithm  Nmagic_sequenceFunctions for the Magic sequence implementation  NmanacherFunctions for Manacher's Algorithm implementation - NmathFor IO operations + NmathFor assert  NMD5Functions for the MD5 algorithm implementation  Nmedian_searchFunctions for Median search algorithm  Nmerge_insertionCombined Intersion-Merge sorting algorithm @@ -223,7 +223,7 @@ solve-a-rat-in-a-maze-c-java-pytho/" target="_blank">Rat in a Maze algorithm  Nreverse_binary_treeFunctions for the Reverse a Binary Tree implementation  Nrunge_kuttaFunctions for Runge Kutta fourth order method  NsaddlebackFunction for implementing Saddleback Algorithm - NsearchFor std::vector + NsearchFor std::assert  Nselection_sort_recursiveFunctions for the Selection sort implementation using recursion  NsetKthBitFunctions for the [From the right, set the Kth bit in the binary representation of N] (https://practice.geeksforgeeks.org/problems/set-kth-bit3724/1/) implementation  NSHAFunctions for the SHA-1 algorithm implementation diff --git a/navtreeindex10.js b/navtreeindex10.js index decd85a67..c5958f17b 100644 --- a/navtreeindex10.js +++ b/navtreeindex10.js @@ -217,8 +217,8 @@ var NAVTREEINDEX10 = "da/dc3/linked__list_8cpp.html#ab1a372fe1e605bc0e0987dcdd7361180":[11,0,4,9,2], "da/dc3/linked__list_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4":[11,0,4,9,3], "da/dc9/fibonacci__matrix__exponentiation_8cpp.html":[11,0,14,18], +"da/dc9/fibonacci__matrix__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d":[11,0,14,18,2], "da/dc9/fibonacci__matrix__exponentiation_8cpp.html#abc3bc08249058d57cfc8f54a29d9cf9f":[11,0,14,18,0], -"da/dc9/fibonacci__matrix__exponentiation_8cpp.html#ae1a3968e7947464bee7714f6d43b7002":[11,0,14,18,2], "da/dc9/fibonacci__matrix__exponentiation_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4":[11,0,14,18,1], "da/dd1/structquadratic__probing_1_1_entry.html":[9,0,96,0], "da/dd1/structquadratic__probing_1_1_entry.html":[10,0,15,0], diff --git a/search/all_19.js b/search/all_19.js index 862046352..f75fc167f 100644 --- a/search/all_19.js +++ b/search/all_19.js @@ -23,7 +23,7 @@ var searchData= ['ternary_5fsearch_20',['ternary_search',['../dc/dfe/ternary__search_8cpp.html#aef655a27eb82efa299bf9d0becf6e9c8',1,'ternary_search.cpp']]], ['ternary_5fsearch_2ecpp_21',['ternary_search.cpp',['../dc/dfe/ternary__search_8cpp.html',1,'']]], ['test_22',['Test',['../d6/dcd/md__c_o_n_t_r_i_b_u_t_i_n_g.html#autotoc_md29',1,'']]], - ['test_23',['test',['http://en.cppreference.com/w/cpp/utility/bitset/test.html',0,'std::bitset::test()'],['../db/d82/classlarge__number.html#a959c5c1a982949bbf98e1ea0f9afe6a9',1,'large_number::test()'],['../dd/d1e/generate__parentheses_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): generate_parentheses.cpp'],['../dc/d5a/rat__maze_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): rat_maze.cpp'],['../df/d94/subarray__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subarray_sum.cpp'],['../d0/dfe/backtracking_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subset_sum.cpp'],['../dc/d14/wildcard__matching_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): wildcard_matching.cpp'],['../d7/d56/count__bits__flip_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_bits_flip.cpp'],['../da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_of_trailing_ciphers_in_factorial_n.cpp'],['../d6/d38/find__non__repeating__number_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): find_non_repeating_number.cpp'],['../d4/d48/hamming__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): hamming_distance.cpp'],['../d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): next_higher_number_with_same_number_of_set_bits.cpp'],['../dc/d6d/power__of__2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): power_of_2.cpp'],['../d5/db5/set__kth__bit_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): set_kth_bit.cpp'],['../d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): travelling_salesman_using_bit_manipulation.cpp'],['../de/db6/a1z26__cipher_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): a1z26_cipher.cpp'],['../dc/dfb/atbash__cipher_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): atbash_cipher.cpp'],['../d6/d2c/caesar__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): caesar_cipher.cpp'],['../df/d2c/elliptic__curve__key__exchange_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): elliptic_curve_key_exchange.cpp'],['../d8/d76/morse__code_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): morse_code.cpp'],['../dd/d12/vigenere__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): vigenere_cipher.cpp'],['../d3/d4c/xor__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): xor_cipher.cpp'],['../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fcfs_scheduling.cpp'],['../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): list_array.cpp'],['../d6/d05/reverse__a__linked__list_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): reverse_a_linked_list.cpp'],['../de/dd1/segment__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): segment_tree.cpp'],['../d6/d42/data__structures_2sparse__table_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sparse_table.cpp'],['../d0/dd2/treap_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): treap.cpp'],['../d7/d83/trie__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_tree.cpp'],['../d5/d8a/trie__using__hashmap_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_using_hashmap.cpp'],['../da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): karatsuba_algorithm_for_fast_multiplication.cpp'],['../db/d16/0__1__knapsack_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): 0_1_knapsack.cpp'],['../d7/d73/abbreviation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): abbreviation.cpp'],['../d9/d31/coin__change__topdown_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): coin_change_topdown.cpp'],['../d6/d10/cut__rod_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): cut_rod.cpp'],['../d6/d26/house__robber_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): house_robber.cpp'],['../d7/d57/longest__increasing__subsequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): longest_increasing_subsequence.cpp'],['../d0/d77/longest__palindromic__subsequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): longest_palindromic_subsequence.cpp'],['../db/dfb/maximum__circular__subarray_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): maximum_circular_subarray.cpp'],['../da/d52/minimum__edit__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): minimum_edit_distance.cpp'],['../d5/d90/palindrome__partitioning_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): palindrome_partitioning.cpp'],['../d7/d65/shortest__common__supersequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): shortest_common_supersequence.cpp'],['../d6/d80/dynamic__programming_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subset_sum.cpp'],['../d9/d80/trapped__rainwater_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trapped_rainwater.cpp'],['../d3/d84/word__break_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): word_break.cpp'],['../d4/d8d/jarvis__algorithm_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): jarvis_algorithm.cpp'],['../d8/d99/connected__components__with__dsu_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): connected_components_with_dsu.cpp'],['../d6/dd8/is__graph__bipartite_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): is_graph_bipartite.cpp'],['../d8/db9/topological__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): topological_sort.cpp'],['../da/dd3/namespacespirograph.html#a8e83a64e8443fff1e5ffdc1c299c1e99',1,'spirograph::test()'],['../d6/dba/jump__game_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): jump_game.cpp'],['../d8/d7d/kruskals__minimum__spanning__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): kruskals_minimum_spanning_tree.cpp'],['../d5/d96/md5_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): md5.cpp'],['../d8/d7a/sha1_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sha1.cpp'],['../d4/d3e/k__nearest__neighbors_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): k_nearest_neighbors.cpp'],['../d2/d58/neural__network_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): neural_network.cpp'],['../de/d99/aliquot__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): aliquot_sum.cpp'],['../dc/d82/area_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): area.cpp'],['../d7/d89/double__factorial_8cpp.html#abbbcebf3a2d0c67f4c3cfb5511a97981',1,'test(uint64_t n, uint64_t expected): double_factorial.cpp'],['../d7/da6/eratosthenes_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): eratosthenes.cpp'],['../da/d23/eulers__totient__function_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): eulers_totient_function.cpp'],['../d9/d89/fibonacci_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci.cpp'],['../da/dc9/fibonacci__matrix__exponentiation_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): fibonacci_matrix_exponentiation.cpp'],['../de/dc3/fibonacci__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci_sum.cpp'],['../d1/d11/gcd__of__n__numbers_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gcd_of_n_numbers.cpp'],['../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): integral_approximation2.cpp'],['../d6/db8/inv__sqrt_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inv_sqrt.cpp'],['../db/d9f/iterative__factorial_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): iterative_factorial.cpp'],['../d5/d7a/largest__power_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): largest_power.cpp'],['../d5/d83/lcm__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lcm_sum.cpp'],['../df/d72/modular__division_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_division.cpp'],['../d0/d6d/modular__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_exponentiation.cpp'],['../d8/d53/modular__inverse__fermat__little__theorem_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_inverse_fermat_little_theorem.cpp'],['../d6/d2d/modular__inverse__simple_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_inverse_simple.cpp'],['../db/d27/n__bonacci_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): n_bonacci.cpp'],['../d1/dbb/n__choose__r_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): n_choose_r.cpp'],['../d3/dfe/perimeter_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): perimeter.cpp'],['../d4/d38/power__of__two_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): power_of_two.cpp'],['../da/d18/quadratic__equations__complex__numbers_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): quadratic_equations_complex_numbers.cpp'],['../d4/d9d/sum__of__binomial__coefficient_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sum_of_binomial_coefficient.cpp'],['../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): sum_of_digits.cpp'],['../df/d66/vector__cross__product_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): vector_cross_product.cpp'],['../da/d39/volume_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): volume.cpp'],['../dc/d9c/babylonian__method_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): babylonian_method.cpp'],['../d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e',1,'test(std::int32_t N, double h, double a, double b, bool used_argv_parameters): composite_simpson_rule.cpp'],['../d8/d9a/fast__fourier__transform_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fast_fourier_transform.cpp'],['../d5/d33/gram__schmidt_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gram_schmidt.cpp'],['../d9/d37/inverse__fast__fourier__transform_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inverse_fast_fourier_transform.cpp'],['../df/d11/midpoint__integral__method_8cpp.html#a2ae48a41e43dc6ab11b962742349646e',1,'test(std::int32_t N, double h, double a, double b, bool used_argv_parameters): midpoint_integral_method.cpp'],['../d1/da6/rungekutta_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): rungekutta.cpp'],['../d9/d14/array__left__rotation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): array_left_rotation.cpp'],['../d6/d57/array__right__rotation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): array_right_rotation.cpp'],['../de/d33/circular__linked__list_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): circular_linked_list.cpp'],['../d4/d32/inorder__successor__of__bst_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inorder_successor_of_bst.cpp'],['../de/dc5/intersection__of__two__arrays_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): intersection_of_two_arrays.cpp'],['../d4/db6/reverse__binary__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): reverse_binary_tree.cpp'],['../d7/def/trie__multiple__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_multiple_search.cpp'],['../d8/d9c/union__of__two__arrays_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): union_of_two_arrays.cpp'],['../de/dcd/kadanes3_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): kadanes3.cpp'],['../d9/d65/lfu__cache_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lfu_cache.cpp'],['../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lru_cache2.cpp'],['../d0/d01/smallest__circle_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): smallest_circle.cpp'],['../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): ground_to_ground_projectile_motion.cpp'],['../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): exponential_dist.cpp'],['../de/d72/geometric__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): geometric_dist.cpp'],['../d1/ded/windowed__median_8cpp.html#a6dc652a36ea42ba262c4e4236e3e6601',1,'test(const std::vector< int > &vals, int windowSize): windowed_median.cpp'],['../d5/d58/persistent__seg__tree__lazy__prop_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): persistent_seg_tree_lazy_prop.cpp'],['../d1/d9e/prefix__sum__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): prefix_sum_array.cpp'],['../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): segtree.cpp'],['../db/dc4/floyd__cycle__detection__algo_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): floyd_cycle_detection_algo.cpp'],['../d9/d69/median__search_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): median_search.cpp'],['../d8/dfa/median__search2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): median_search2.cpp'],['../d3/d22/saddleback__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): saddleback_search.cpp'],['../d5/d45/sublist__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sublist_search.cpp'],['../dc/db5/text__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): text_search.cpp'],['../d8/dcc/binary__insertion__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): binary_insertion_sort.cpp'],['../d5/ddb/bogo__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): bogo_sort.cpp'],['../d8/d13/bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): bubble_sort.cpp'],['../d2/d26/count__inversions_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_inversions.cpp'],['../de/d07/cycle__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): cycle_sort.cpp'],['../d6/d1a/dnf__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): dnf_sort.cpp'],['../d2/d21/gnome__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gnome_sort.cpp'],['../d2/d52/heap__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): heap_sort.cpp'],['../de/d7b/merge__insertion__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): merge_insertion_sort.cpp'],['../d3/d92/pancake__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): pancake_sort.cpp'],['../d1/daa/random__pivot__quick__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): random_pivot_quick_sort.cpp'],['../d3/df9/recursive__bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): recursive_bubble_sort.cpp'],['../d4/d9f/selection__sort__recursive_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): selection_sort_recursive.cpp'],['../dc/dd9/strand__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): strand_sort.cpp'],['../db/d3f/wave__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): wave_sort.cpp'],['../d5/d4c/group__sorting.html#gaa8dca7b867074164d5f45b0f3851269d',1,'test(): wiggle_sort.cpp'],['../db/d09/duval_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): duval.cpp'],['../d3/dfe/horspool_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): horspool.cpp'],['../d3/d39/manacher__algorithm_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): manacher_algorithm.cpp'],['../d3/d80/z__function_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): z_function.cpp']]], + ['test_23',['test',['http://en.cppreference.com/w/cpp/utility/bitset/test.html',0,'std::bitset::test()'],['../db/d82/classlarge__number.html#a959c5c1a982949bbf98e1ea0f9afe6a9',1,'large_number::test()'],['../dd/d1e/generate__parentheses_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): generate_parentheses.cpp'],['../dc/d5a/rat__maze_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): rat_maze.cpp'],['../df/d94/subarray__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subarray_sum.cpp'],['../d0/dfe/backtracking_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subset_sum.cpp'],['../dc/d14/wildcard__matching_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): wildcard_matching.cpp'],['../d7/d56/count__bits__flip_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_bits_flip.cpp'],['../da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_of_trailing_ciphers_in_factorial_n.cpp'],['../d6/d38/find__non__repeating__number_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): find_non_repeating_number.cpp'],['../d4/d48/hamming__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): hamming_distance.cpp'],['../d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): next_higher_number_with_same_number_of_set_bits.cpp'],['../dc/d6d/power__of__2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): power_of_2.cpp'],['../d5/db5/set__kth__bit_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): set_kth_bit.cpp'],['../d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): travelling_salesman_using_bit_manipulation.cpp'],['../de/db6/a1z26__cipher_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): a1z26_cipher.cpp'],['../dc/dfb/atbash__cipher_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): atbash_cipher.cpp'],['../d6/d2c/caesar__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): caesar_cipher.cpp'],['../df/d2c/elliptic__curve__key__exchange_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): elliptic_curve_key_exchange.cpp'],['../d8/d76/morse__code_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): morse_code.cpp'],['../dd/d12/vigenere__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): vigenere_cipher.cpp'],['../d3/d4c/xor__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): xor_cipher.cpp'],['../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fcfs_scheduling.cpp'],['../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): list_array.cpp'],['../d6/d05/reverse__a__linked__list_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): reverse_a_linked_list.cpp'],['../de/dd1/segment__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): segment_tree.cpp'],['../d6/d42/data__structures_2sparse__table_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sparse_table.cpp'],['../d0/dd2/treap_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): treap.cpp'],['../d7/d83/trie__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_tree.cpp'],['../d5/d8a/trie__using__hashmap_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_using_hashmap.cpp'],['../da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): karatsuba_algorithm_for_fast_multiplication.cpp'],['../db/d16/0__1__knapsack_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): 0_1_knapsack.cpp'],['../d7/d73/abbreviation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): abbreviation.cpp'],['../d9/d31/coin__change__topdown_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): coin_change_topdown.cpp'],['../d6/d10/cut__rod_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): cut_rod.cpp'],['../d6/d26/house__robber_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): house_robber.cpp'],['../d7/d57/longest__increasing__subsequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): longest_increasing_subsequence.cpp'],['../d0/d77/longest__palindromic__subsequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): longest_palindromic_subsequence.cpp'],['../db/dfb/maximum__circular__subarray_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): maximum_circular_subarray.cpp'],['../da/d52/minimum__edit__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): minimum_edit_distance.cpp'],['../d5/d90/palindrome__partitioning_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): palindrome_partitioning.cpp'],['../d7/d65/shortest__common__supersequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): shortest_common_supersequence.cpp'],['../d6/d80/dynamic__programming_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subset_sum.cpp'],['../d9/d80/trapped__rainwater_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trapped_rainwater.cpp'],['../d3/d84/word__break_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): word_break.cpp'],['../d4/d8d/jarvis__algorithm_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): jarvis_algorithm.cpp'],['../d8/d99/connected__components__with__dsu_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): connected_components_with_dsu.cpp'],['../d6/dd8/is__graph__bipartite_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): is_graph_bipartite.cpp'],['../d8/db9/topological__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): topological_sort.cpp'],['../da/dd3/namespacespirograph.html#a8e83a64e8443fff1e5ffdc1c299c1e99',1,'spirograph::test()'],['../d6/dba/jump__game_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): jump_game.cpp'],['../d8/d7d/kruskals__minimum__spanning__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): kruskals_minimum_spanning_tree.cpp'],['../d5/d96/md5_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): md5.cpp'],['../d8/d7a/sha1_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sha1.cpp'],['../d4/d3e/k__nearest__neighbors_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): k_nearest_neighbors.cpp'],['../d2/d58/neural__network_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): neural_network.cpp'],['../de/d99/aliquot__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): aliquot_sum.cpp'],['../dc/d82/area_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): area.cpp'],['../d7/d89/double__factorial_8cpp.html#abbbcebf3a2d0c67f4c3cfb5511a97981',1,'test(uint64_t n, uint64_t expected): double_factorial.cpp'],['../d7/da6/eratosthenes_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): eratosthenes.cpp'],['../da/d23/eulers__totient__function_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): eulers_totient_function.cpp'],['../d9/d89/fibonacci_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci.cpp'],['../da/dc9/fibonacci__matrix__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci_matrix_exponentiation.cpp'],['../de/dc3/fibonacci__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci_sum.cpp'],['../d1/d11/gcd__of__n__numbers_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gcd_of_n_numbers.cpp'],['../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): integral_approximation2.cpp'],['../d6/db8/inv__sqrt_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inv_sqrt.cpp'],['../db/d9f/iterative__factorial_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): iterative_factorial.cpp'],['../d5/d7a/largest__power_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): largest_power.cpp'],['../d5/d83/lcm__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lcm_sum.cpp'],['../df/d72/modular__division_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_division.cpp'],['../d0/d6d/modular__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_exponentiation.cpp'],['../d8/d53/modular__inverse__fermat__little__theorem_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_inverse_fermat_little_theorem.cpp'],['../d6/d2d/modular__inverse__simple_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_inverse_simple.cpp'],['../db/d27/n__bonacci_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): n_bonacci.cpp'],['../d1/dbb/n__choose__r_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): n_choose_r.cpp'],['../d3/dfe/perimeter_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): perimeter.cpp'],['../d4/d38/power__of__two_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): power_of_two.cpp'],['../da/d18/quadratic__equations__complex__numbers_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): quadratic_equations_complex_numbers.cpp'],['../d4/d9d/sum__of__binomial__coefficient_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sum_of_binomial_coefficient.cpp'],['../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): sum_of_digits.cpp'],['../df/d66/vector__cross__product_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): vector_cross_product.cpp'],['../da/d39/volume_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): volume.cpp'],['../dc/d9c/babylonian__method_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): babylonian_method.cpp'],['../d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e',1,'test(std::int32_t N, double h, double a, double b, bool used_argv_parameters): composite_simpson_rule.cpp'],['../d8/d9a/fast__fourier__transform_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fast_fourier_transform.cpp'],['../d5/d33/gram__schmidt_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gram_schmidt.cpp'],['../d9/d37/inverse__fast__fourier__transform_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inverse_fast_fourier_transform.cpp'],['../df/d11/midpoint__integral__method_8cpp.html#a2ae48a41e43dc6ab11b962742349646e',1,'test(std::int32_t N, double h, double a, double b, bool used_argv_parameters): midpoint_integral_method.cpp'],['../d1/da6/rungekutta_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): rungekutta.cpp'],['../d9/d14/array__left__rotation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): array_left_rotation.cpp'],['../d6/d57/array__right__rotation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): array_right_rotation.cpp'],['../de/d33/circular__linked__list_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): circular_linked_list.cpp'],['../d4/d32/inorder__successor__of__bst_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inorder_successor_of_bst.cpp'],['../de/dc5/intersection__of__two__arrays_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): intersection_of_two_arrays.cpp'],['../d4/db6/reverse__binary__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): reverse_binary_tree.cpp'],['../d7/def/trie__multiple__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_multiple_search.cpp'],['../d8/d9c/union__of__two__arrays_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): union_of_two_arrays.cpp'],['../de/dcd/kadanes3_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): kadanes3.cpp'],['../d9/d65/lfu__cache_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lfu_cache.cpp'],['../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lru_cache2.cpp'],['../d0/d01/smallest__circle_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): smallest_circle.cpp'],['../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): ground_to_ground_projectile_motion.cpp'],['../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): exponential_dist.cpp'],['../de/d72/geometric__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): geometric_dist.cpp'],['../d1/ded/windowed__median_8cpp.html#a6dc652a36ea42ba262c4e4236e3e6601',1,'test(const std::vector< int > &vals, int windowSize): windowed_median.cpp'],['../d5/d58/persistent__seg__tree__lazy__prop_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): persistent_seg_tree_lazy_prop.cpp'],['../d1/d9e/prefix__sum__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): prefix_sum_array.cpp'],['../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): segtree.cpp'],['../db/dc4/floyd__cycle__detection__algo_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): floyd_cycle_detection_algo.cpp'],['../d9/d69/median__search_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): median_search.cpp'],['../d8/dfa/median__search2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): median_search2.cpp'],['../d3/d22/saddleback__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): saddleback_search.cpp'],['../d5/d45/sublist__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sublist_search.cpp'],['../dc/db5/text__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): text_search.cpp'],['../d8/dcc/binary__insertion__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): binary_insertion_sort.cpp'],['../d5/ddb/bogo__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): bogo_sort.cpp'],['../d8/d13/bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): bubble_sort.cpp'],['../d2/d26/count__inversions_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_inversions.cpp'],['../de/d07/cycle__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): cycle_sort.cpp'],['../d6/d1a/dnf__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): dnf_sort.cpp'],['../d2/d21/gnome__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gnome_sort.cpp'],['../d2/d52/heap__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): heap_sort.cpp'],['../de/d7b/merge__insertion__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): merge_insertion_sort.cpp'],['../d3/d92/pancake__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): pancake_sort.cpp'],['../d1/daa/random__pivot__quick__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): random_pivot_quick_sort.cpp'],['../d3/df9/recursive__bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): recursive_bubble_sort.cpp'],['../d4/d9f/selection__sort__recursive_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): selection_sort_recursive.cpp'],['../dc/dd9/strand__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): strand_sort.cpp'],['../db/d3f/wave__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): wave_sort.cpp'],['../d5/d4c/group__sorting.html#gaa8dca7b867074164d5f45b0f3851269d',1,'test(): wiggle_sort.cpp'],['../db/d09/duval_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): duval.cpp'],['../d3/dfe/horspool_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): horspool.cpp'],['../d3/d39/manacher__algorithm_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): manacher_algorithm.cpp'],['../d3/d80/z__function_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): z_function.cpp']]], ['test_20examples_24',['Self-test examples',['../d6/dcd/md__c_o_n_t_r_i_b_u_t_i_n_g.html#autotoc_md30',1,'']]], ['test1_25',['test1',['../d7/db9/hill__cipher_8cpp.html#a3147ad576f8a94a2a6b66948672b452b',1,'test1(const std::string &text): hill_cipher.cpp'],['../d3/dae/dsu__path__compression_8cpp.html#ae7880ce913f3058a35ff106d5be9e243',1,'test1(): dsu_path_compression.cpp'],['../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243',1,'test1(): dsu_union_rank.cpp'],['../db/dbc/tree__234_8cpp.html#ae7880ce913f3058a35ff106d5be9e243',1,'test1(): tree_234.cpp'],['../dd/d0c/hamiltons__cycle_8cpp.html#ae7880ce913f3058a35ff106d5be9e243',1,'test1(): hamiltons_cycle.cpp'],['../d5/db0/adaline__learning_8cpp.html#a52053d88ea1bcbbed9aca67ab4eeb499',1,'test1(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): kohonen_som_trace.cpp'],['../d6/d9d/large__factorial_8cpp.html#a3f93b60e229b6683e24c4754a7106ee8',1,'test1(): large_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): sum_of_digits.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): brent_method_extrema.cpp'],['../da/df2/durand__kerner__roots_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): durand_kerner_roots.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): golden_search_extrema.cpp'],['../dd/d65/lu__decompose_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): lu_decompose.cpp'],['../de/d75/qr__eigen__values_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): qr_eigen_values.cpp'],['../d9/df4/namespacetests.html#a167c24bd817469ae47358d12e034f2d5',1,'tests::test1()'],['../d8/d90/iterative__tree__traversals_8cpp.html#a21d922dbb5905993960c6a7f0ba71ac0',1,'test1(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root): iterative_tree_traversals.cpp'],['../dc/de1/recursive__tree__traversal_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): recursive_tree_traversal.cpp'],['../d4/d4f/stooge__sort_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): stooge_sort.cpp']]], ['test2_26',['test2',['../d7/db9/hill__cipher_8cpp.html#a04391124480d2a49f2dec900237b0712',1,'test2(const std::string &text): hill_cipher.cpp'],['../d3/dae/dsu__path__compression_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae',1,'test2(): dsu_path_compression.cpp'],['../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae',1,'test2(): dsu_union_rank.cpp'],['../db/dbc/tree__234_8cpp.html#af1ac73779b0fcfbbdce3976c0ca57342',1,'test2(int64_t n): tree_234.cpp'],['../dd/d0c/hamiltons__cycle_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae',1,'test2(): hamiltons_cycle.cpp'],['../d5/db0/adaline__learning_8cpp.html#a379f7488a305f2571f2932b319931f82',1,'test2(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): kohonen_som_trace.cpp'],['../d6/d9d/large__factorial_8cpp.html#a76aae4778fbe89a3d59fd61fbc050cfa',1,'test2(): large_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): sum_of_digits.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): brent_method_extrema.cpp'],['../da/df2/durand__kerner__roots_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): durand_kerner_roots.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): golden_search_extrema.cpp'],['../dd/d65/lu__decompose_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): lu_decompose.cpp'],['../de/d75/qr__eigen__values_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): qr_eigen_values.cpp'],['../d9/df4/namespacetests.html#abdd77344d4af8fd56d14a5cabbf2f669',1,'tests::test2()'],['../d8/d90/iterative__tree__traversals_8cpp.html#ac35ae2868441f8a11c965b87b2494f21',1,'test2(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root): iterative_tree_traversals.cpp'],['../dc/de1/recursive__tree__traversal_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): recursive_tree_traversal.cpp'],['../d0/d01/smallest__circle_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): smallest_circle.cpp'],['../d4/d4f/stooge__sort_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): stooge_sort.cpp']]], diff --git a/search/functions_14.js b/search/functions_14.js index 14000960b..27bde557a 100644 --- a/search/functions_14.js +++ b/search/functions_14.js @@ -9,7 +9,7 @@ var searchData= ['tellp_6',['tellp',['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_ofstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::fstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_ostringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::ostringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_fstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::iostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::stringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::ostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::strstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_stringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wostringstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_ostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wiostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::ofstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::ostrstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wfstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::basic_iostream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wofstream::tellp()'],['http://en.cppreference.com/w/cpp/io/basic_ostream/tellp.html',0,'std::wstringstream::tellp()']]], ['terminate_7',['terminate',['http://en.cppreference.com/w/cpp/error/terminate.html',0,'std']]], ['ternary_5fsearch_8',['ternary_search',['../dc/dfe/ternary__search_8cpp.html#aef655a27eb82efa299bf9d0becf6e9c8',1,'ternary_search.cpp']]], - ['test_9',['test',['http://en.cppreference.com/w/cpp/utility/bitset/test.html',0,'std::bitset::test()'],['../db/d82/classlarge__number.html#a959c5c1a982949bbf98e1ea0f9afe6a9',1,'large_number::test()'],['../dd/d1e/generate__parentheses_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): generate_parentheses.cpp'],['../dc/d5a/rat__maze_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): rat_maze.cpp'],['../df/d94/subarray__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subarray_sum.cpp'],['../d0/dfe/backtracking_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subset_sum.cpp'],['../dc/d14/wildcard__matching_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): wildcard_matching.cpp'],['../d7/d56/count__bits__flip_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_bits_flip.cpp'],['../da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_of_trailing_ciphers_in_factorial_n.cpp'],['../d6/d38/find__non__repeating__number_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): find_non_repeating_number.cpp'],['../d4/d48/hamming__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): hamming_distance.cpp'],['../d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): next_higher_number_with_same_number_of_set_bits.cpp'],['../dc/d6d/power__of__2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): power_of_2.cpp'],['../d5/db5/set__kth__bit_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): set_kth_bit.cpp'],['../d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): travelling_salesman_using_bit_manipulation.cpp'],['../de/db6/a1z26__cipher_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): a1z26_cipher.cpp'],['../dc/dfb/atbash__cipher_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): atbash_cipher.cpp'],['../d6/d2c/caesar__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): caesar_cipher.cpp'],['../df/d2c/elliptic__curve__key__exchange_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): elliptic_curve_key_exchange.cpp'],['../d8/d76/morse__code_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): morse_code.cpp'],['../dd/d12/vigenere__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): vigenere_cipher.cpp'],['../d3/d4c/xor__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): xor_cipher.cpp'],['../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fcfs_scheduling.cpp'],['../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): list_array.cpp'],['../d6/d05/reverse__a__linked__list_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): reverse_a_linked_list.cpp'],['../de/dd1/segment__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): segment_tree.cpp'],['../d6/d42/data__structures_2sparse__table_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sparse_table.cpp'],['../d0/dd2/treap_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): treap.cpp'],['../d7/d83/trie__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_tree.cpp'],['../d5/d8a/trie__using__hashmap_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_using_hashmap.cpp'],['../da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): karatsuba_algorithm_for_fast_multiplication.cpp'],['../db/d16/0__1__knapsack_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): 0_1_knapsack.cpp'],['../d7/d73/abbreviation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): abbreviation.cpp'],['../d9/d31/coin__change__topdown_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): coin_change_topdown.cpp'],['../d6/d10/cut__rod_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): cut_rod.cpp'],['../d6/d26/house__robber_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): house_robber.cpp'],['../d7/d57/longest__increasing__subsequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): longest_increasing_subsequence.cpp'],['../d0/d77/longest__palindromic__subsequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): longest_palindromic_subsequence.cpp'],['../db/dfb/maximum__circular__subarray_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): maximum_circular_subarray.cpp'],['../da/d52/minimum__edit__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): minimum_edit_distance.cpp'],['../d5/d90/palindrome__partitioning_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): palindrome_partitioning.cpp'],['../d7/d65/shortest__common__supersequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): shortest_common_supersequence.cpp'],['../d6/d80/dynamic__programming_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subset_sum.cpp'],['../d9/d80/trapped__rainwater_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trapped_rainwater.cpp'],['../d3/d84/word__break_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): word_break.cpp'],['../d4/d8d/jarvis__algorithm_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): jarvis_algorithm.cpp'],['../d8/d99/connected__components__with__dsu_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): connected_components_with_dsu.cpp'],['../d6/dd8/is__graph__bipartite_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): is_graph_bipartite.cpp'],['../d8/db9/topological__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): topological_sort.cpp'],['../da/dd3/namespacespirograph.html#a8e83a64e8443fff1e5ffdc1c299c1e99',1,'spirograph::test()'],['../d6/dba/jump__game_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): jump_game.cpp'],['../d8/d7d/kruskals__minimum__spanning__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): kruskals_minimum_spanning_tree.cpp'],['../d5/d96/md5_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): md5.cpp'],['../d8/d7a/sha1_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sha1.cpp'],['../d4/d3e/k__nearest__neighbors_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): k_nearest_neighbors.cpp'],['../d2/d58/neural__network_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): neural_network.cpp'],['../de/d99/aliquot__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): aliquot_sum.cpp'],['../dc/d82/area_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): area.cpp'],['../d7/d89/double__factorial_8cpp.html#abbbcebf3a2d0c67f4c3cfb5511a97981',1,'test(uint64_t n, uint64_t expected): double_factorial.cpp'],['../d7/da6/eratosthenes_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): eratosthenes.cpp'],['../da/d23/eulers__totient__function_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): eulers_totient_function.cpp'],['../d9/d89/fibonacci_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci.cpp'],['../da/dc9/fibonacci__matrix__exponentiation_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): fibonacci_matrix_exponentiation.cpp'],['../de/dc3/fibonacci__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci_sum.cpp'],['../d1/d11/gcd__of__n__numbers_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gcd_of_n_numbers.cpp'],['../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): integral_approximation2.cpp'],['../d6/db8/inv__sqrt_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inv_sqrt.cpp'],['../db/d9f/iterative__factorial_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): iterative_factorial.cpp'],['../d5/d7a/largest__power_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): largest_power.cpp'],['../d5/d83/lcm__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lcm_sum.cpp'],['../df/d72/modular__division_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_division.cpp'],['../d0/d6d/modular__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_exponentiation.cpp'],['../d8/d53/modular__inverse__fermat__little__theorem_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_inverse_fermat_little_theorem.cpp'],['../d6/d2d/modular__inverse__simple_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_inverse_simple.cpp'],['../db/d27/n__bonacci_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): n_bonacci.cpp'],['../d1/dbb/n__choose__r_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): n_choose_r.cpp'],['../d3/dfe/perimeter_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): perimeter.cpp'],['../d4/d38/power__of__two_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): power_of_two.cpp'],['../da/d18/quadratic__equations__complex__numbers_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): quadratic_equations_complex_numbers.cpp'],['../d4/d9d/sum__of__binomial__coefficient_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sum_of_binomial_coefficient.cpp'],['../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): sum_of_digits.cpp'],['../df/d66/vector__cross__product_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): vector_cross_product.cpp'],['../da/d39/volume_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): volume.cpp'],['../dc/d9c/babylonian__method_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): babylonian_method.cpp'],['../d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e',1,'test(std::int32_t N, double h, double a, double b, bool used_argv_parameters): composite_simpson_rule.cpp'],['../d8/d9a/fast__fourier__transform_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fast_fourier_transform.cpp'],['../d5/d33/gram__schmidt_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gram_schmidt.cpp'],['../d9/d37/inverse__fast__fourier__transform_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inverse_fast_fourier_transform.cpp'],['../df/d11/midpoint__integral__method_8cpp.html#a2ae48a41e43dc6ab11b962742349646e',1,'test(std::int32_t N, double h, double a, double b, bool used_argv_parameters): midpoint_integral_method.cpp'],['../d1/da6/rungekutta_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): rungekutta.cpp'],['../d9/d14/array__left__rotation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): array_left_rotation.cpp'],['../d6/d57/array__right__rotation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): array_right_rotation.cpp'],['../de/d33/circular__linked__list_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): circular_linked_list.cpp'],['../d4/d32/inorder__successor__of__bst_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inorder_successor_of_bst.cpp'],['../de/dc5/intersection__of__two__arrays_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): intersection_of_two_arrays.cpp'],['../d4/db6/reverse__binary__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): reverse_binary_tree.cpp'],['../d7/def/trie__multiple__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_multiple_search.cpp'],['../d8/d9c/union__of__two__arrays_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): union_of_two_arrays.cpp'],['../de/dcd/kadanes3_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): kadanes3.cpp'],['../d9/d65/lfu__cache_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lfu_cache.cpp'],['../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lru_cache2.cpp'],['../d0/d01/smallest__circle_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): smallest_circle.cpp'],['../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): ground_to_ground_projectile_motion.cpp'],['../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): exponential_dist.cpp'],['../de/d72/geometric__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): geometric_dist.cpp'],['../d1/ded/windowed__median_8cpp.html#a6dc652a36ea42ba262c4e4236e3e6601',1,'test(const std::vector< int > &vals, int windowSize): windowed_median.cpp'],['../d5/d58/persistent__seg__tree__lazy__prop_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): persistent_seg_tree_lazy_prop.cpp'],['../d1/d9e/prefix__sum__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): prefix_sum_array.cpp'],['../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): segtree.cpp'],['../db/dc4/floyd__cycle__detection__algo_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): floyd_cycle_detection_algo.cpp'],['../d9/d69/median__search_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): median_search.cpp'],['../d8/dfa/median__search2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): median_search2.cpp'],['../d3/d22/saddleback__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): saddleback_search.cpp'],['../d5/d45/sublist__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sublist_search.cpp'],['../dc/db5/text__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): text_search.cpp'],['../d8/dcc/binary__insertion__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): binary_insertion_sort.cpp'],['../d5/ddb/bogo__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): bogo_sort.cpp'],['../d8/d13/bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): bubble_sort.cpp'],['../d2/d26/count__inversions_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_inversions.cpp'],['../de/d07/cycle__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): cycle_sort.cpp'],['../d6/d1a/dnf__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): dnf_sort.cpp'],['../d2/d21/gnome__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gnome_sort.cpp'],['../d2/d52/heap__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): heap_sort.cpp'],['../de/d7b/merge__insertion__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): merge_insertion_sort.cpp'],['../d3/d92/pancake__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): pancake_sort.cpp'],['../d1/daa/random__pivot__quick__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): random_pivot_quick_sort.cpp'],['../d3/df9/recursive__bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): recursive_bubble_sort.cpp'],['../d4/d9f/selection__sort__recursive_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): selection_sort_recursive.cpp'],['../dc/dd9/strand__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): strand_sort.cpp'],['../db/d3f/wave__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): wave_sort.cpp'],['../d5/d4c/group__sorting.html#gaa8dca7b867074164d5f45b0f3851269d',1,'test(): wiggle_sort.cpp'],['../db/d09/duval_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): duval.cpp'],['../d3/dfe/horspool_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): horspool.cpp'],['../d3/d39/manacher__algorithm_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): manacher_algorithm.cpp'],['../d3/d80/z__function_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): z_function.cpp']]], + ['test_9',['test',['http://en.cppreference.com/w/cpp/utility/bitset/test.html',0,'std::bitset::test()'],['../db/d82/classlarge__number.html#a959c5c1a982949bbf98e1ea0f9afe6a9',1,'large_number::test()'],['../dd/d1e/generate__parentheses_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): generate_parentheses.cpp'],['../dc/d5a/rat__maze_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): rat_maze.cpp'],['../df/d94/subarray__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subarray_sum.cpp'],['../d0/dfe/backtracking_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subset_sum.cpp'],['../dc/d14/wildcard__matching_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): wildcard_matching.cpp'],['../d7/d56/count__bits__flip_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_bits_flip.cpp'],['../da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_of_trailing_ciphers_in_factorial_n.cpp'],['../d6/d38/find__non__repeating__number_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): find_non_repeating_number.cpp'],['../d4/d48/hamming__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): hamming_distance.cpp'],['../d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): next_higher_number_with_same_number_of_set_bits.cpp'],['../dc/d6d/power__of__2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): power_of_2.cpp'],['../d5/db5/set__kth__bit_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): set_kth_bit.cpp'],['../d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): travelling_salesman_using_bit_manipulation.cpp'],['../de/db6/a1z26__cipher_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): a1z26_cipher.cpp'],['../dc/dfb/atbash__cipher_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): atbash_cipher.cpp'],['../d6/d2c/caesar__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): caesar_cipher.cpp'],['../df/d2c/elliptic__curve__key__exchange_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): elliptic_curve_key_exchange.cpp'],['../d8/d76/morse__code_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): morse_code.cpp'],['../dd/d12/vigenere__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): vigenere_cipher.cpp'],['../d3/d4c/xor__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): xor_cipher.cpp'],['../df/d47/fcfs__scheduling_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fcfs_scheduling.cpp'],['../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): list_array.cpp'],['../d6/d05/reverse__a__linked__list_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): reverse_a_linked_list.cpp'],['../de/dd1/segment__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): segment_tree.cpp'],['../d6/d42/data__structures_2sparse__table_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sparse_table.cpp'],['../d0/dd2/treap_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): treap.cpp'],['../d7/d83/trie__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_tree.cpp'],['../d5/d8a/trie__using__hashmap_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_using_hashmap.cpp'],['../da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): karatsuba_algorithm_for_fast_multiplication.cpp'],['../db/d16/0__1__knapsack_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): 0_1_knapsack.cpp'],['../d7/d73/abbreviation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): abbreviation.cpp'],['../d9/d31/coin__change__topdown_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): coin_change_topdown.cpp'],['../d6/d10/cut__rod_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): cut_rod.cpp'],['../d6/d26/house__robber_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): house_robber.cpp'],['../d7/d57/longest__increasing__subsequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): longest_increasing_subsequence.cpp'],['../d0/d77/longest__palindromic__subsequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): longest_palindromic_subsequence.cpp'],['../db/dfb/maximum__circular__subarray_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): maximum_circular_subarray.cpp'],['../da/d52/minimum__edit__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): minimum_edit_distance.cpp'],['../d5/d90/palindrome__partitioning_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): palindrome_partitioning.cpp'],['../d7/d65/shortest__common__supersequence_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): shortest_common_supersequence.cpp'],['../d6/d80/dynamic__programming_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): subset_sum.cpp'],['../d9/d80/trapped__rainwater_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trapped_rainwater.cpp'],['../d3/d84/word__break_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): word_break.cpp'],['../d4/d8d/jarvis__algorithm_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): jarvis_algorithm.cpp'],['../d8/d99/connected__components__with__dsu_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): connected_components_with_dsu.cpp'],['../d6/dd8/is__graph__bipartite_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): is_graph_bipartite.cpp'],['../d8/db9/topological__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): topological_sort.cpp'],['../da/dd3/namespacespirograph.html#a8e83a64e8443fff1e5ffdc1c299c1e99',1,'spirograph::test()'],['../d6/dba/jump__game_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): jump_game.cpp'],['../d8/d7d/kruskals__minimum__spanning__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): kruskals_minimum_spanning_tree.cpp'],['../d5/d96/md5_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): md5.cpp'],['../d8/d7a/sha1_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sha1.cpp'],['../d4/d3e/k__nearest__neighbors_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): k_nearest_neighbors.cpp'],['../d2/d58/neural__network_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): neural_network.cpp'],['../de/d99/aliquot__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): aliquot_sum.cpp'],['../dc/d82/area_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): area.cpp'],['../d7/d89/double__factorial_8cpp.html#abbbcebf3a2d0c67f4c3cfb5511a97981',1,'test(uint64_t n, uint64_t expected): double_factorial.cpp'],['../d7/da6/eratosthenes_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): eratosthenes.cpp'],['../da/d23/eulers__totient__function_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): eulers_totient_function.cpp'],['../d9/d89/fibonacci_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci.cpp'],['../da/dc9/fibonacci__matrix__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci_matrix_exponentiation.cpp'],['../de/dc3/fibonacci__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fibonacci_sum.cpp'],['../d1/d11/gcd__of__n__numbers_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gcd_of_n_numbers.cpp'],['../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): integral_approximation2.cpp'],['../d6/db8/inv__sqrt_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inv_sqrt.cpp'],['../db/d9f/iterative__factorial_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): iterative_factorial.cpp'],['../d5/d7a/largest__power_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): largest_power.cpp'],['../d5/d83/lcm__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lcm_sum.cpp'],['../df/d72/modular__division_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_division.cpp'],['../d0/d6d/modular__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_exponentiation.cpp'],['../d8/d53/modular__inverse__fermat__little__theorem_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_inverse_fermat_little_theorem.cpp'],['../d6/d2d/modular__inverse__simple_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): modular_inverse_simple.cpp'],['../db/d27/n__bonacci_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): n_bonacci.cpp'],['../d1/dbb/n__choose__r_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): n_choose_r.cpp'],['../d3/dfe/perimeter_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): perimeter.cpp'],['../d4/d38/power__of__two_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): power_of_two.cpp'],['../da/d18/quadratic__equations__complex__numbers_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): quadratic_equations_complex_numbers.cpp'],['../d4/d9d/sum__of__binomial__coefficient_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sum_of_binomial_coefficient.cpp'],['../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): sum_of_digits.cpp'],['../df/d66/vector__cross__product_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): vector_cross_product.cpp'],['../da/d39/volume_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): volume.cpp'],['../dc/d9c/babylonian__method_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): babylonian_method.cpp'],['../d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e',1,'test(std::int32_t N, double h, double a, double b, bool used_argv_parameters): composite_simpson_rule.cpp'],['../d8/d9a/fast__fourier__transform_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): fast_fourier_transform.cpp'],['../d5/d33/gram__schmidt_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gram_schmidt.cpp'],['../d9/d37/inverse__fast__fourier__transform_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inverse_fast_fourier_transform.cpp'],['../df/d11/midpoint__integral__method_8cpp.html#a2ae48a41e43dc6ab11b962742349646e',1,'test(std::int32_t N, double h, double a, double b, bool used_argv_parameters): midpoint_integral_method.cpp'],['../d1/da6/rungekutta_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): rungekutta.cpp'],['../d9/d14/array__left__rotation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): array_left_rotation.cpp'],['../d6/d57/array__right__rotation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): array_right_rotation.cpp'],['../de/d33/circular__linked__list_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): circular_linked_list.cpp'],['../d4/d32/inorder__successor__of__bst_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): inorder_successor_of_bst.cpp'],['../de/dc5/intersection__of__two__arrays_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): intersection_of_two_arrays.cpp'],['../d4/db6/reverse__binary__tree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): reverse_binary_tree.cpp'],['../d7/def/trie__multiple__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): trie_multiple_search.cpp'],['../d8/d9c/union__of__two__arrays_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): union_of_two_arrays.cpp'],['../de/dcd/kadanes3_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): kadanes3.cpp'],['../d9/d65/lfu__cache_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lfu_cache.cpp'],['../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): lru_cache2.cpp'],['../d0/d01/smallest__circle_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): smallest_circle.cpp'],['../d9/d29/ground__to__ground__projectile__motion_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): ground_to_ground_projectile_motion.cpp'],['../d9/da2/exponential__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): exponential_dist.cpp'],['../de/d72/geometric__dist_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): geometric_dist.cpp'],['../d1/ded/windowed__median_8cpp.html#a6dc652a36ea42ba262c4e4236e3e6601',1,'test(const std::vector< int > &vals, int windowSize): windowed_median.cpp'],['../d5/d58/persistent__seg__tree__lazy__prop_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): persistent_seg_tree_lazy_prop.cpp'],['../d1/d9e/prefix__sum__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): prefix_sum_array.cpp'],['../d2/d45/segtree_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): segtree.cpp'],['../db/dc4/floyd__cycle__detection__algo_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): floyd_cycle_detection_algo.cpp'],['../d9/d69/median__search_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): median_search.cpp'],['../d8/dfa/median__search2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): median_search2.cpp'],['../d3/d22/saddleback__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): saddleback_search.cpp'],['../d5/d45/sublist__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): sublist_search.cpp'],['../dc/db5/text__search_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): text_search.cpp'],['../d8/dcc/binary__insertion__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): binary_insertion_sort.cpp'],['../d5/ddb/bogo__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): bogo_sort.cpp'],['../d8/d13/bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): bubble_sort.cpp'],['../d2/d26/count__inversions_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): count_inversions.cpp'],['../de/d07/cycle__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): cycle_sort.cpp'],['../d6/d1a/dnf__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): dnf_sort.cpp'],['../d2/d21/gnome__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): gnome_sort.cpp'],['../d2/d52/heap__sort_8cpp.html#ae1a3968e7947464bee7714f6d43b7002',1,'test(): heap_sort.cpp'],['../de/d7b/merge__insertion__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): merge_insertion_sort.cpp'],['../d3/d92/pancake__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): pancake_sort.cpp'],['../d1/daa/random__pivot__quick__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): random_pivot_quick_sort.cpp'],['../d3/df9/recursive__bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): recursive_bubble_sort.cpp'],['../d4/d9f/selection__sort__recursive_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): selection_sort_recursive.cpp'],['../dc/dd9/strand__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): strand_sort.cpp'],['../db/d3f/wave__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): wave_sort.cpp'],['../d5/d4c/group__sorting.html#gaa8dca7b867074164d5f45b0f3851269d',1,'test(): wiggle_sort.cpp'],['../db/d09/duval_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): duval.cpp'],['../d3/dfe/horspool_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): horspool.cpp'],['../d3/d39/manacher__algorithm_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): manacher_algorithm.cpp'],['../d3/d80/z__function_8cpp.html#aa8dca7b867074164d5f45b0f3851269d',1,'test(): z_function.cpp']]], ['test1_10',['test1',['../d7/db9/hill__cipher_8cpp.html#a3147ad576f8a94a2a6b66948672b452b',1,'test1(const std::string &text): hill_cipher.cpp'],['../d3/dae/dsu__path__compression_8cpp.html#ae7880ce913f3058a35ff106d5be9e243',1,'test1(): dsu_path_compression.cpp'],['../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243',1,'test1(): dsu_union_rank.cpp'],['../db/dbc/tree__234_8cpp.html#ae7880ce913f3058a35ff106d5be9e243',1,'test1(): tree_234.cpp'],['../dd/d0c/hamiltons__cycle_8cpp.html#ae7880ce913f3058a35ff106d5be9e243',1,'test1(): hamiltons_cycle.cpp'],['../d5/db0/adaline__learning_8cpp.html#a52053d88ea1bcbbed9aca67ab4eeb499',1,'test1(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): kohonen_som_trace.cpp'],['../d6/d9d/large__factorial_8cpp.html#a3f93b60e229b6683e24c4754a7106ee8',1,'test1(): large_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): sum_of_digits.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): brent_method_extrema.cpp'],['../da/df2/durand__kerner__roots_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): durand_kerner_roots.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): golden_search_extrema.cpp'],['../dd/d65/lu__decompose_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): lu_decompose.cpp'],['../de/d75/qr__eigen__values_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): qr_eigen_values.cpp'],['../d9/df4/namespacetests.html#a167c24bd817469ae47358d12e034f2d5',1,'tests::test1()'],['../d8/d90/iterative__tree__traversals_8cpp.html#a21d922dbb5905993960c6a7f0ba71ac0',1,'test1(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root): iterative_tree_traversals.cpp'],['../dc/de1/recursive__tree__traversal_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): recursive_tree_traversal.cpp'],['../d4/d4f/stooge__sort_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0',1,'test1(): stooge_sort.cpp']]], ['test2_11',['test2',['../d7/db9/hill__cipher_8cpp.html#a04391124480d2a49f2dec900237b0712',1,'test2(const std::string &text): hill_cipher.cpp'],['../d3/dae/dsu__path__compression_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae',1,'test2(): dsu_path_compression.cpp'],['../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae',1,'test2(): dsu_union_rank.cpp'],['../db/dbc/tree__234_8cpp.html#af1ac73779b0fcfbbdce3976c0ca57342',1,'test2(int64_t n): tree_234.cpp'],['../dd/d0c/hamiltons__cycle_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae',1,'test2(): hamiltons_cycle.cpp'],['../d5/db0/adaline__learning_8cpp.html#a379f7488a305f2571f2932b319931f82',1,'test2(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): kohonen_som_trace.cpp'],['../d6/d9d/large__factorial_8cpp.html#a76aae4778fbe89a3d59fd61fbc050cfa',1,'test2(): large_factorial.cpp'],['../d4/d83/sum__of__digits_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): sum_of_digits.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): brent_method_extrema.cpp'],['../da/df2/durand__kerner__roots_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): durand_kerner_roots.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): golden_search_extrema.cpp'],['../dd/d65/lu__decompose_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): lu_decompose.cpp'],['../de/d75/qr__eigen__values_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): qr_eigen_values.cpp'],['../d9/df4/namespacetests.html#abdd77344d4af8fd56d14a5cabbf2f669',1,'tests::test2()'],['../d8/d90/iterative__tree__traversals_8cpp.html#ac35ae2868441f8a11c965b87b2494f21',1,'test2(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root): iterative_tree_traversals.cpp'],['../dc/de1/recursive__tree__traversal_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): recursive_tree_traversal.cpp'],['../d0/d01/smallest__circle_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): smallest_circle.cpp'],['../d4/d4f/stooge__sort_8cpp.html#a0283886819c7c140a023582b7269e2d0',1,'test2(): stooge_sort.cpp']]], ['test3_12',['test3',['../dd/d0c/hamiltons__cycle_8cpp.html#a0cc94918b6831f308d4fe4fa27f08299',1,'test3(): hamiltons_cycle.cpp'],['../d5/db0/adaline__learning_8cpp.html#a992bdf1fdb0b9d414bcf7981d2d87aa9',1,'test3(double eta=0.01): adaline_learning.cpp'],['../d4/def/kohonen__som__topology_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): kohonen_som_topology.cpp'],['../d9/d49/kohonen__som__trace_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): kohonen_som_trace.cpp'],['../db/d01/brent__method__extrema_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): brent_method_extrema.cpp'],['../d6/d7a/golden__search__extrema_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): golden_search_extrema.cpp'],['../d9/df4/namespacetests.html#aa515639572647508b94986489aab6d76',1,'tests::test3()'],['../d8/d90/iterative__tree__traversals_8cpp.html#a425c4c8520991999ee6dbe13d99b87f4',1,'test3(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root): iterative_tree_traversals.cpp'],['../dc/de1/recursive__tree__traversal_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): recursive_tree_traversal.cpp'],['../d0/d01/smallest__circle_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): smallest_circle.cpp'],['../d4/d4f/stooge__sort_8cpp.html#a6d0455dd5c30adda100e95f0423c786e',1,'test3(): stooge_sort.cpp']]],