Full Code of TheAlgorithms/Python for AI

master 68473afc4b22 cached
1489 files
8.4 MB
2.3M tokens
4127 symbols
4 requests
Download .txt
Showing preview only (9,012K chars total). Download the full file or copy to clipboard to get everything.
Repository: TheAlgorithms/Python
Branch: master
Commit: 68473afc4b22
Files: 1489
Total size: 8.4 MB

Directory structure:
gitextract_lj21xc5n/

├── .devcontainer/
│   ├── Dockerfile
│   ├── README.md
│   ├── devcontainer.json
│   └── post_install
├── .gitattributes
├── .github/
│   ├── CODEOWNERS
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.yml
│   │   ├── config.yml
│   │   ├── feature_request.yml
│   │   └── other.yml
│   ├── dependabot.yml
│   ├── pull_request_template.md
│   ├── stale.yml
│   └── workflows/
│       ├── build.yml
│       ├── devcontainer_ci.yml
│       ├── directory_writer.yml
│       ├── project_euler.yml
│       ├── ruff.yml
│       └── sphinx.yml
├── .gitignore
├── .gitpod.yml
├── .pre-commit-config.yaml
├── CONTRIBUTING.md
├── DIRECTORY.md
├── LICENSE.md
├── README.md
├── audio_filters/
│   ├── README.md
│   ├── __init__.py
│   ├── butterworth_filter.py
│   ├── equal_loudness_filter.py.broken.txt
│   ├── iir_filter.py
│   ├── loudness_curve.json
│   └── show_response.py
├── backtracking/
│   ├── README.md
│   ├── __init__.py
│   ├── all_combinations.py
│   ├── all_permutations.py
│   ├── all_subsequences.py
│   ├── coloring.py
│   ├── combination_sum.py
│   ├── crossword_puzzle_solver.py
│   ├── generate_parentheses.py
│   ├── generate_parentheses_iterative.py
│   ├── hamiltonian_cycle.py
│   ├── knight_tour.py
│   ├── match_word_pattern.py
│   ├── minimax.py
│   ├── n_queens.py
│   ├── n_queens_math.py
│   ├── power_sum.py
│   ├── rat_in_maze.py
│   ├── sudoku.py
│   ├── sum_of_subsets.py
│   ├── word_break.py
│   ├── word_ladder.py
│   └── word_search.py
├── bit_manipulation/
│   ├── README.md
│   ├── __init__.py
│   ├── binary_and_operator.py
│   ├── binary_coded_decimal.py
│   ├── binary_count_setbits.py
│   ├── binary_count_trailing_zeros.py
│   ├── binary_or_operator.py
│   ├── binary_shifts.py
│   ├── binary_twos_complement.py
│   ├── binary_xor_operator.py
│   ├── bitwise_addition_recursive.py
│   ├── count_1s_brian_kernighan_method.py
│   ├── count_number_of_one_bits.py
│   ├── excess_3_code.py
│   ├── find_previous_power_of_two.py
│   ├── find_unique_number.py
│   ├── gray_code_sequence.py
│   ├── highest_set_bit.py
│   ├── index_of_rightmost_set_bit.py
│   ├── is_even.py
│   ├── is_power_of_two.py
│   ├── largest_pow_of_two_le_num.py
│   ├── missing_number.py
│   ├── numbers_different_signs.py
│   ├── power_of_4.py
│   ├── reverse_bits.py
│   ├── single_bit_manipulation_operations.py
│   └── swap_all_odd_and_even_bits.py
├── blockchain/
│   ├── README.md
│   ├── __init__.py
│   └── diophantine_equation.py
├── boolean_algebra/
│   ├── README.md
│   ├── __init__.py
│   ├── and_gate.py
│   ├── imply_gate.py
│   ├── karnaugh_map_simplification.py
│   ├── multiplexer.py
│   ├── nand_gate.py
│   ├── nimply_gate.py
│   ├── nor_gate.py
│   ├── not_gate.py
│   ├── or_gate.py
│   ├── quine_mc_cluskey.py
│   ├── xnor_gate.py
│   └── xor_gate.py
├── cellular_automata/
│   ├── README.md
│   ├── __init__.py
│   ├── conways_game_of_life.py
│   ├── game_of_life.py
│   ├── langtons_ant.py
│   ├── nagel_schrekenberg.py
│   ├── one_dimensional.py
│   └── wa_tor.py
├── ciphers/
│   ├── README.md
│   ├── __init__.py
│   ├── a1z26.py
│   ├── affine_cipher.py
│   ├── atbash.py
│   ├── autokey.py
│   ├── baconian_cipher.py
│   ├── base16.py
│   ├── base32.py
│   ├── base64_cipher.py
│   ├── base85.py
│   ├── beaufort_cipher.py
│   ├── bifid.py
│   ├── brute_force_caesar_cipher.py
│   ├── caesar_cipher.py
│   ├── cryptomath_module.py
│   ├── decrypt_caesar_with_chi_squared.py
│   ├── deterministic_miller_rabin.py
│   ├── diffie.py
│   ├── diffie_hellman.py
│   ├── elgamal_key_generator.py
│   ├── enigma_machine2.py
│   ├── fractionated_morse_cipher.py
│   ├── gronsfeld_cipher.py
│   ├── hill_cipher.py
│   ├── mixed_keyword_cypher.py
│   ├── mono_alphabetic_ciphers.py
│   ├── morse_code.py
│   ├── onepad_cipher.py
│   ├── permutation_cipher.py
│   ├── playfair_cipher.py
│   ├── polybius.py
│   ├── porta_cipher.py
│   ├── prehistoric_men.txt
│   ├── rabin_miller.py
│   ├── rail_fence_cipher.py
│   ├── rot13.py
│   ├── rsa_cipher.py
│   ├── rsa_factorization.py
│   ├── rsa_key_generator.py
│   ├── running_key_cipher.py
│   ├── shuffled_shift_cipher.py
│   ├── simple_keyword_cypher.py
│   ├── simple_substitution_cipher.py
│   ├── transposition_cipher.py
│   ├── transposition_cipher_encrypt_decrypt_file.py
│   ├── trifid_cipher.py
│   ├── vernam_cipher.py
│   ├── vigenere_cipher.py
│   └── xor_cipher.py
├── computer_vision/
│   ├── README.md
│   ├── __init__.py
│   ├── cnn_classification.py
│   ├── flip_augmentation.py
│   ├── haralick_descriptors.py
│   ├── harris_corner.py
│   ├── horn_schunck.py
│   ├── intensity_based_segmentation.py
│   ├── mean_threshold.py
│   ├── mosaic_augmentation.py
│   └── pooling_functions.py
├── conversions/
│   ├── README.md
│   ├── __init__.py
│   ├── astronomical_length_scale_conversion.py
│   ├── binary_to_decimal.py
│   ├── binary_to_hexadecimal.py
│   ├── binary_to_octal.py
│   ├── convert_number_to_words.py
│   ├── decimal_to_any.py
│   ├── decimal_to_binary.py
│   ├── decimal_to_hexadecimal.py
│   ├── decimal_to_octal.py
│   ├── energy_conversions.py
│   ├── excel_title_to_column.py
│   ├── hex_to_bin.py
│   ├── hexadecimal_to_decimal.py
│   ├── ipv4_conversion.py
│   ├── length_conversion.py
│   ├── molecular_chemistry.py
│   ├── octal_to_binary.py
│   ├── octal_to_decimal.py
│   ├── octal_to_hexadecimal.py
│   ├── prefix_conversions.py
│   ├── prefix_conversions_string.py
│   ├── pressure_conversions.py
│   ├── rectangular_to_polar.py
│   ├── rgb_cmyk_conversion.py
│   ├── rgb_hsv_conversion.py
│   ├── roman_numerals.py
│   ├── speed_conversions.py
│   ├── temperature_conversions.py
│   ├── time_conversions.py
│   ├── volume_conversions.py
│   └── weight_conversion.py
├── data_compression/
│   ├── README.md
│   ├── __init__.py
│   ├── burrows_wheeler.py
│   ├── coordinate_compression.py
│   ├── huffman.py
│   ├── lempel_ziv.py
│   ├── lempel_ziv_decompress.py
│   ├── lz77.py
│   ├── peak_signal_to_noise_ratio.py
│   └── run_length_encoding.py
├── data_structures/
│   ├── __init__.py
│   ├── arrays/
│   │   ├── __init__.py
│   │   ├── equilibrium_index_in_array.py
│   │   ├── find_triplets_with_0_sum.py
│   │   ├── index_2d_array_in_1d.py
│   │   ├── kth_largest_element.py
│   │   ├── median_two_array.py
│   │   ├── monotonic_array.py
│   │   ├── pairs_with_given_sum.py
│   │   ├── permutations.py
│   │   ├── prefix_sum.py
│   │   ├── product_sum.py
│   │   ├── rotate_array.py
│   │   ├── sparse_table.py
│   │   └── sudoku_solver.py
│   ├── binary_tree/
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── avl_tree.py
│   │   ├── basic_binary_tree.py
│   │   ├── binary_search_tree.py
│   │   ├── binary_search_tree_recursive.py
│   │   ├── binary_tree_mirror.py
│   │   ├── binary_tree_node_sum.py
│   │   ├── binary_tree_path_sum.py
│   │   ├── binary_tree_traversals.py
│   │   ├── diameter_of_binary_tree.py
│   │   ├── diff_views_of_binary_tree.py
│   │   ├── distribute_coins.py
│   │   ├── fenwick_tree.py
│   │   ├── flatten_binarytree_to_linkedlist.py
│   │   ├── floor_and_ceiling.py
│   │   ├── inorder_tree_traversal_2022.py
│   │   ├── is_sorted.py
│   │   ├── is_sum_tree.py
│   │   ├── lazy_segment_tree.py
│   │   ├── lowest_common_ancestor.py
│   │   ├── maximum_fenwick_tree.py
│   │   ├── maximum_sum_bst.py
│   │   ├── merge_two_binary_trees.py
│   │   ├── mirror_binary_tree.py
│   │   ├── non_recursive_segment_tree.py
│   │   ├── number_of_possible_binary_trees.py
│   │   ├── red_black_tree.py
│   │   ├── segment_tree.py
│   │   ├── segment_tree_other.py
│   │   ├── serialize_deserialize_binary_tree.py
│   │   ├── symmetric_tree.py
│   │   ├── treap.py
│   │   └── wavelet_tree.py
│   ├── disjoint_set/
│   │   ├── __init__.py
│   │   ├── alternate_disjoint_set.py
│   │   └── disjoint_set.py
│   ├── hashing/
│   │   ├── __init__.py
│   │   ├── bloom_filter.py
│   │   ├── double_hash.py
│   │   ├── hash_map.py
│   │   ├── hash_table.py
│   │   ├── hash_table_with_linked_list.py
│   │   ├── number_theory/
│   │   │   ├── __init__.py
│   │   │   └── prime_numbers.py
│   │   ├── quadratic_probing.py
│   │   └── tests/
│   │       ├── __init__.py
│   │       └── test_hash_map.py
│   ├── heap/
│   │   ├── __init__.py
│   │   ├── binomial_heap.py
│   │   ├── heap.py
│   │   ├── heap_generic.py
│   │   ├── max_heap.py
│   │   ├── min_heap.py
│   │   ├── randomized_heap.py
│   │   └── skew_heap.py
│   ├── kd_tree/
│   │   ├── __init__.py
│   │   ├── build_kdtree.py
│   │   ├── example/
│   │   │   ├── __init__.py
│   │   │   ├── example_usage.py
│   │   │   └── hypercube_points.py
│   │   ├── kd_node.py
│   │   ├── nearest_neighbour_search.py
│   │   └── tests/
│   │       ├── __init__.py
│   │       └── test_kdtree.py
│   ├── linked_list/
│   │   ├── __init__.py
│   │   ├── circular_linked_list.py
│   │   ├── deque_doubly.py
│   │   ├── doubly_linked_list.py
│   │   ├── doubly_linked_list_two.py
│   │   ├── floyds_cycle_detection.py
│   │   ├── from_sequence.py
│   │   ├── has_loop.py
│   │   ├── is_palindrome.py
│   │   ├── merge_two_lists.py
│   │   ├── middle_element_of_linked_list.py
│   │   ├── print_reverse.py
│   │   ├── reverse_k_group.py
│   │   ├── rotate_to_the_right.py
│   │   ├── singly_linked_list.py
│   │   ├── skip_list.py
│   │   └── swap_nodes.py
│   ├── queues/
│   │   ├── __init__.py
│   │   ├── circular_queue.py
│   │   ├── circular_queue_linked_list.py
│   │   ├── double_ended_queue.py
│   │   ├── linked_queue.py
│   │   ├── priority_queue_using_list.py
│   │   ├── queue_by_list.py
│   │   ├── queue_by_two_stacks.py
│   │   └── queue_on_pseudo_stack.py
│   ├── stacks/
│   │   ├── __init__.py
│   │   ├── balanced_parentheses.py
│   │   ├── dijkstras_two_stack_algorithm.py
│   │   ├── infix_to_postfix_conversion.py
│   │   ├── infix_to_prefix_conversion.py
│   │   ├── largest_rectangle_histogram.py
│   │   ├── lexicographical_numbers.py
│   │   ├── next_greater_element.py
│   │   ├── postfix_evaluation.py
│   │   ├── prefix_evaluation.py
│   │   ├── stack.py
│   │   ├── stack_using_two_queues.py
│   │   ├── stack_with_doubly_linked_list.py
│   │   ├── stack_with_singly_linked_list.py
│   │   └── stock_span_problem.py
│   ├── suffix_tree/
│   │   ├── __init__.py
│   │   ├── example/
│   │   │   ├── __init__.py
│   │   │   └── example_usage.py
│   │   ├── suffix_tree.py
│   │   ├── suffix_tree_node.py
│   │   └── tests/
│   │       ├── __init__.py
│   │       └── test_suffix_tree.py
│   └── trie/
│       ├── __init__.py
│       ├── radix_tree.py
│       └── trie.py
├── digital_image_processing/
│   ├── __init__.py
│   ├── change_brightness.py
│   ├── change_contrast.py
│   ├── convert_to_negative.py
│   ├── dithering/
│   │   ├── __init__.py
│   │   └── burkes.py
│   ├── edge_detection/
│   │   ├── __init__.py
│   │   └── canny.py
│   ├── filters/
│   │   ├── __init__.py
│   │   ├── bilateral_filter.py
│   │   ├── convolve.py
│   │   ├── gabor_filter.py
│   │   ├── gaussian_filter.py
│   │   ├── laplacian_filter.py
│   │   ├── local_binary_pattern.py
│   │   ├── median_filter.py
│   │   └── sobel_filter.py
│   ├── histogram_equalization/
│   │   ├── __init__.py
│   │   ├── histogram_stretch.py
│   │   ├── image_data/
│   │   │   └── __init__.py
│   │   └── output_data/
│   │       └── __init__.py
│   ├── image_data/
│   │   └── __init__.py
│   ├── index_calculation.py
│   ├── morphological_operations/
│   │   ├── __init__.py
│   │   ├── dilation_operation.py
│   │   └── erosion_operation.py
│   ├── resize/
│   │   ├── __init__.py
│   │   └── resize.py
│   ├── rotation/
│   │   ├── __init__.py
│   │   └── rotation.py
│   ├── sepia.py
│   └── test_digital_image_processing.py
├── divide_and_conquer/
│   ├── __init__.py
│   ├── closest_pair_of_points.py
│   ├── convex_hull.py
│   ├── heaps_algorithm.py
│   ├── heaps_algorithm_iterative.py
│   ├── inversions.py
│   ├── kth_order_statistic.py
│   ├── max_difference_pair.py
│   ├── max_subarray.py
│   ├── mergesort.py
│   ├── peak.py
│   ├── power.py
│   └── strassen_matrix_multiplication.py
├── docs/
│   ├── __init__.py
│   ├── conf.py
│   └── source/
│       └── __init__.py
├── dynamic_programming/
│   ├── __init__.py
│   ├── abbreviation.py
│   ├── all_construct.py
│   ├── bitmask.py
│   ├── catalan_numbers.py
│   ├── climbing_stairs.py
│   ├── combination_sum_iv.py
│   ├── edit_distance.py
│   ├── factorial.py
│   ├── fast_fibonacci.py
│   ├── fibonacci.py
│   ├── fizz_buzz.py
│   ├── floyd_warshall.py
│   ├── integer_partition.py
│   ├── iterating_through_submasks.py
│   ├── k_means_clustering_tensorflow.py
│   ├── knapsack.py
│   ├── largest_divisible_subset.py
│   ├── longest_common_subsequence.py
│   ├── longest_common_substring.py
│   ├── longest_increasing_subsequence.py
│   ├── longest_increasing_subsequence_iterative.py
│   ├── longest_increasing_subsequence_o_nlogn.py
│   ├── longest_palindromic_subsequence.py
│   ├── matrix_chain_multiplication.py
│   ├── matrix_chain_order.py
│   ├── max_non_adjacent_sum.py
│   ├── max_product_subarray.py
│   ├── max_subarray_sum.py
│   ├── min_distance_up_bottom.py
│   ├── minimum_coin_change.py
│   ├── minimum_cost_path.py
│   ├── minimum_partition.py
│   ├── minimum_size_subarray_sum.py
│   ├── minimum_squares_to_represent_a_number.py
│   ├── minimum_steps_to_one.py
│   ├── minimum_tickets_cost.py
│   ├── narcissistic_number.py
│   ├── optimal_binary_search_tree.py
│   ├── palindrome_partitioning.py
│   ├── range_sum_query.py
│   ├── regex_match.py
│   ├── rod_cutting.py
│   ├── smith_waterman.py
│   ├── subset_generation.py
│   ├── sum_of_subset.py
│   ├── trapped_water.py
│   ├── tribonacci.py
│   ├── viterbi.py
│   ├── wildcard_matching.py
│   └── word_break.py
├── electronics/
│   ├── __init__.py
│   ├── apparent_power.py
│   ├── builtin_voltage.py
│   ├── capacitor_equivalence.py
│   ├── carrier_concentration.py
│   ├── charging_capacitor.py
│   ├── charging_inductor.py
│   ├── circular_convolution.py
│   ├── coulombs_law.py
│   ├── electric_conductivity.py
│   ├── electric_power.py
│   ├── electrical_impedance.py
│   ├── ic_555_timer.py
│   ├── ind_reactance.py
│   ├── ohms_law.py
│   ├── real_and_reactive_power.py
│   ├── resistor_color_code.py
│   ├── resistor_equivalence.py
│   ├── resonant_frequency.py
│   └── wheatstone_bridge.py
├── file_transfer/
│   ├── __init__.py
│   ├── mytext.txt
│   ├── receive_file.py
│   ├── send_file.py
│   └── tests/
│       ├── __init__.py
│       └── test_send_file.py
├── financial/
│   ├── README.md
│   ├── __init__.py
│   ├── equated_monthly_installments.py
│   ├── exponential_moving_average.py
│   ├── interest.py
│   ├── present_value.py
│   ├── price_plus_tax.py
│   ├── simple_moving_average.py
│   ├── straight_line_depreciation.py
│   └── time_and_half_pay.py
├── fractals/
│   ├── __init__.py
│   ├── julia_sets.py
│   ├── koch_snowflake.py
│   ├── mandelbrot.py
│   ├── sierpinski_triangle.py
│   └── vicsek.py
├── fuzzy_logic/
│   ├── __init__.py
│   ├── fuzzy_operations.py
│   └── fuzzy_operations.py.DISABLED.txt
├── genetic_algorithm/
│   ├── __init__.py
│   └── basic_string.py
├── geodesy/
│   ├── __init__.py
│   ├── haversine_distance.py
│   └── lamberts_ellipsoidal_distance.py
├── geometry/
│   ├── __init__.py
│   ├── geometry.py
│   ├── graham_scan.py
│   ├── jarvis_march.py
│   └── tests/
│       ├── __init__.py
│       ├── test_graham_scan.py
│       └── test_jarvis_march.py
├── graphics/
│   ├── __init__.py
│   ├── bezier_curve.py
│   ├── butterfly_pattern.py
│   ├── digital_differential_analyzer_line.py
│   └── vector3_for_2d_rendering.py
├── graphs/
│   ├── __init__.py
│   ├── a_star.py
│   ├── ant_colony_optimization_algorithms.py
│   ├── articulation_points.py
│   ├── basic_graphs.py
│   ├── bellman_ford.py
│   ├── bi_directional_dijkstra.py
│   ├── bidirectional_a_star.py
│   ├── bidirectional_breadth_first_search.py
│   ├── bidirectional_search.py
│   ├── boruvka.py
│   ├── breadth_first_search.py
│   ├── breadth_first_search_2.py
│   ├── breadth_first_search_shortest_path.py
│   ├── breadth_first_search_shortest_path_2.py
│   ├── breadth_first_search_zero_one_shortest_path.py
│   ├── check_bipatrite.py
│   ├── check_cycle.py
│   ├── connected_components.py
│   ├── deep_clone_graph.py
│   ├── depth_first_search.py
│   ├── depth_first_search_2.py
│   ├── dijkstra.py
│   ├── dijkstra_2.py
│   ├── dijkstra_algorithm.py
│   ├── dijkstra_alternate.py
│   ├── dijkstra_binary_grid.py
│   ├── dinic.py
│   ├── directed_and_undirected_weighted_graph.py
│   ├── edmonds_karp_multiple_source_and_sink.py
│   ├── eulerian_path_and_circuit_for_undirected_graph.py
│   ├── even_tree.py
│   ├── finding_bridges.py
│   ├── frequent_pattern_graph_miner.py
│   ├── g_topological_sort.py
│   ├── gale_shapley_bigraph.py
│   ├── graph_adjacency_list.py
│   ├── graph_adjacency_matrix.py
│   ├── graph_list.py
│   ├── graphs_floyd_warshall.py
│   ├── greedy_best_first.py
│   ├── greedy_min_vertex_cover.py
│   ├── kahns_algorithm_long.py
│   ├── kahns_algorithm_topo.py
│   ├── karger.py
│   ├── lanczos_eigenvectors.py
│   ├── markov_chain.py
│   ├── matching_min_vertex_cover.py
│   ├── minimum_path_sum.py
│   ├── minimum_spanning_tree_boruvka.py
│   ├── minimum_spanning_tree_kruskal.py
│   ├── minimum_spanning_tree_kruskal2.py
│   ├── minimum_spanning_tree_prims.py
│   ├── minimum_spanning_tree_prims2.py
│   ├── multi_heuristic_astar.py
│   ├── page_rank.py
│   ├── prim.py
│   ├── random_graph_generator.py
│   ├── scc_kosaraju.py
│   ├── strongly_connected_components.py
│   ├── tarjans_scc.py
│   └── tests/
│       ├── __init__.py
│       ├── test_min_spanning_tree_kruskal.py
│       └── test_min_spanning_tree_prim.py
├── greedy_methods/
│   ├── __init__.py
│   ├── best_time_to_buy_and_sell_stock.py
│   ├── fractional_cover_problem.py
│   ├── fractional_knapsack.py
│   ├── fractional_knapsack_2.py
│   ├── gas_station.py
│   ├── minimum_coin_change.py
│   ├── minimum_waiting_time.py
│   ├── optimal_merge_pattern.py
│   └── smallest_range.py
├── hashes/
│   ├── README.md
│   ├── __init__.py
│   ├── adler32.py
│   ├── chaos_machine.py
│   ├── djb2.py
│   ├── elf.py
│   ├── enigma_machine.py
│   ├── fletcher16.py
│   ├── hamming_code.py
│   ├── luhn.py
│   ├── md5.py
│   ├── sdbm.py
│   ├── sha1.py
│   └── sha256.py
├── index.md
├── knapsack/
│   ├── README.md
│   ├── __init__.py
│   ├── greedy_knapsack.py
│   ├── knapsack.py
│   ├── recursive_approach_knapsack.py
│   └── tests/
│       ├── __init__.py
│       ├── test_greedy_knapsack.py
│       └── test_knapsack.py
├── linear_algebra/
│   ├── README.md
│   ├── __init__.py
│   ├── gaussian_elimination.py
│   ├── jacobi_iteration_method.py
│   ├── lu_decomposition.py
│   ├── matrix_inversion.py
│   └── src/
│       ├── __init__.py
│       ├── conjugate_gradient.py
│       ├── gaussian_elimination_pivoting.py
│       ├── lib.py
│       ├── polynom_for_points.py
│       ├── power_iteration.py
│       ├── rank_of_matrix.py
│       ├── rayleigh_quotient.py
│       ├── schur_complement.py
│       ├── test_linear_algebra.py
│       └── transformations_2d.py
├── linear_programming/
│   ├── __init__.py
│   └── simplex.py
├── machine_learning/
│   ├── __init__.py
│   ├── apriori_algorithm.py
│   ├── astar.py
│   ├── automatic_differentiation.py
│   ├── data_transformations.py
│   ├── decision_tree.py
│   ├── dimensionality_reduction.py
│   ├── forecasting/
│   │   ├── __init__.py
│   │   ├── ex_data.csv
│   │   └── run.py
│   ├── frequent_pattern_growth.py
│   ├── gaussian_naive_bayes.py.broken.txt
│   ├── gradient_boosting_classifier.py
│   ├── gradient_boosting_regressor.py.broken.txt
│   ├── gradient_descent.py
│   ├── k_means_clust.py
│   ├── k_nearest_neighbours.py
│   ├── linear_discriminant_analysis.py
│   ├── linear_regression.py
│   ├── local_weighted_learning/
│   │   ├── README.md
│   │   ├── __init__.py
│   │   └── local_weighted_learning.py
│   ├── logistic_regression.py
│   ├── loss_functions.py
│   ├── lstm/
│   │   ├── __init__.py
│   │   ├── lstm_prediction.py
│   │   └── sample_data.csv
│   ├── mfcc.py
│   ├── multilayer_perceptron_classifier.py
│   ├── polynomial_regression.py
│   ├── principle_component_analysis.py
│   ├── random_forest_classifier.py.broken.txt
│   ├── random_forest_regressor.py.broken.txt
│   ├── scoring_functions.py
│   ├── self_organizing_map.py
│   ├── sequential_minimum_optimization.py
│   ├── similarity_search.py
│   ├── support_vector_machines.py
│   ├── t_stochastic_neighbour_embedding.py
│   ├── word_frequency_functions.py
│   ├── xgboost_classifier.py
│   └── xgboost_regressor.py
├── maths/
│   ├── __init__.py
│   ├── abs.py
│   ├── addition_without_arithmetic.py
│   ├── aliquot_sum.py
│   ├── allocation_number.py
│   ├── arc_length.py
│   ├── area.py
│   ├── area_under_curve.py
│   ├── average_absolute_deviation.py
│   ├── average_mean.py
│   ├── average_median.py
│   ├── average_mode.py
│   ├── bailey_borwein_plouffe.py
│   ├── base_neg2_conversion.py
│   ├── basic_maths.py
│   ├── binary_exponentiation.py
│   ├── binary_multiplication.py
│   ├── binomial_coefficient.py
│   ├── binomial_distribution.py
│   ├── ceil.py
│   ├── chebyshev_distance.py
│   ├── check_polygon.py
│   ├── chinese_remainder_theorem.py
│   ├── chudnovsky_algorithm.py
│   ├── collatz_sequence.py
│   ├── combinations.py
│   ├── continued_fraction.py
│   ├── decimal_isolate.py
│   ├── decimal_to_fraction.py
│   ├── dodecahedron.py
│   ├── double_factorial.py
│   ├── dual_number_automatic_differentiation.py
│   ├── entropy.py
│   ├── euclidean_distance.py
│   ├── euler_method.py
│   ├── euler_modified.py
│   ├── eulers_totient.py
│   ├── extended_euclidean_algorithm.py
│   ├── factorial.py
│   ├── factors.py
│   ├── fast_inverse_sqrt.py
│   ├── fermat_little_theorem.py
│   ├── fibonacci.py
│   ├── find_max.py
│   ├── find_min.py
│   ├── floor.py
│   ├── gamma.py
│   ├── gaussian.py
│   ├── gcd_of_n_numbers.py
│   ├── geometric_mean.py
│   ├── germain_primes.py
│   ├── greatest_common_divisor.py
│   ├── hardy_ramanujanalgo.py
│   ├── images/
│   │   └── __init__.py
│   ├── integer_square_root.py
│   ├── interquartile_range.py
│   ├── is_int_palindrome.py
│   ├── is_ip_v4_address_valid.py
│   ├── is_square_free.py
│   ├── jaccard_similarity.py
│   ├── joint_probability_distribution.py
│   ├── josephus_problem.py
│   ├── juggler_sequence.py
│   ├── karatsuba.py
│   ├── kth_lexicographic_permutation.py
│   ├── largest_of_very_large_numbers.py
│   ├── least_common_multiple.py
│   ├── line_length.py
│   ├── liouville_lambda.py
│   ├── lucas_lehmer_primality_test.py
│   ├── lucas_series.py
│   ├── maclaurin_series.py
│   ├── manhattan_distance.py
│   ├── matrix_exponentiation.py
│   ├── max_sum_sliding_window.py
│   ├── minkowski_distance.py
│   ├── mobius_function.py
│   ├── modular_division.py
│   ├── modular_exponential.py
│   ├── monte_carlo.py
│   ├── monte_carlo_dice.py
│   ├── number_of_digits.py
│   ├── numerical_analysis/
│   │   ├── __init__.py
│   │   ├── adams_bashforth.py
│   │   ├── bisection.py
│   │   ├── bisection_2.py
│   │   ├── integration_by_simpson_approx.py
│   │   ├── intersection.py
│   │   ├── nevilles_method.py
│   │   ├── newton_forward_interpolation.py
│   │   ├── newton_raphson.py
│   │   ├── numerical_integration.py
│   │   ├── proper_fractions.py
│   │   ├── runge_kutta.py
│   │   ├── runge_kutta_fehlberg_45.py
│   │   ├── runge_kutta_gills.py
│   │   ├── secant_method.py
│   │   ├── simpson_rule.py
│   │   ├── square_root.py
│   │   └── weierstrass_method.py
│   ├── odd_sieve.py
│   ├── perfect_cube.py
│   ├── perfect_number.py
│   ├── perfect_square.py
│   ├── persistence.py
│   ├── pi_generator.py
│   ├── pi_monte_carlo_estimation.py
│   ├── points_are_collinear_3d.py
│   ├── pollard_rho.py
│   ├── polynomial_evaluation.py
│   ├── polynomials/
│   │   ├── __init__.py
│   │   └── single_indeterminate_operations.py
│   ├── power_using_recursion.py
│   ├── prime_check.py
│   ├── prime_factors.py
│   ├── prime_numbers.py
│   ├── prime_sieve_eratosthenes.py
│   ├── primelib.py
│   ├── print_multiplication_table.py
│   ├── pythagoras.py
│   ├── qr_decomposition.py
│   ├── quadratic_equations_complex_numbers.py
│   ├── radians.py
│   ├── radix2_fft.py
│   ├── remove_digit.py
│   ├── segmented_sieve.py
│   ├── series/
│   │   ├── __init__.py
│   │   ├── arithmetic.py
│   │   ├── geometric.py
│   │   ├── geometric_series.py
│   │   ├── harmonic.py
│   │   ├── harmonic_series.py
│   │   ├── hexagonal_numbers.py
│   │   └── p_series.py
│   ├── sieve_of_eratosthenes.py
│   ├── sigmoid.py
│   ├── signum.py
│   ├── simultaneous_linear_equation_solver.py
│   ├── sin.py
│   ├── sock_merchant.py
│   ├── softmax.py
│   ├── solovay_strassen_primality_test.py
│   ├── spearman_rank_correlation_coefficient.py
│   ├── special_numbers/
│   │   ├── __init__.py
│   │   ├── armstrong_numbers.py
│   │   ├── automorphic_number.py
│   │   ├── bell_numbers.py
│   │   ├── carmichael_number.py
│   │   ├── catalan_number.py
│   │   ├── hamming_numbers.py
│   │   ├── happy_number.py
│   │   ├── harshad_numbers.py
│   │   ├── hexagonal_number.py
│   │   ├── krishnamurthy_number.py
│   │   ├── perfect_number.py
│   │   ├── polygonal_numbers.py
│   │   ├── pronic_number.py
│   │   ├── proth_number.py
│   │   ├── triangular_numbers.py
│   │   ├── ugly_numbers.py
│   │   └── weird_number.py
│   ├── sum_of_arithmetic_series.py
│   ├── sum_of_digits.py
│   ├── sum_of_geometric_progression.py
│   ├── sum_of_harmonic_series.py
│   ├── sumset.py
│   ├── sylvester_sequence.py
│   ├── tanh.py
│   ├── test_factorial.py
│   ├── test_prime_check.py
│   ├── three_sum.py
│   ├── trapezoidal_rule.py
│   ├── triplet_sum.py
│   ├── twin_prime.py
│   ├── two_pointer.py
│   ├── two_sum.py
│   ├── volume.py
│   └── zellers_congruence.py
├── matrix/
│   ├── __init__.py
│   ├── binary_search_matrix.py
│   ├── count_islands_in_matrix.py
│   ├── count_negative_numbers_in_sorted_matrix.py
│   ├── count_paths.py
│   ├── cramers_rule_2x2.py
│   ├── inverse_of_matrix.py
│   ├── largest_square_area_in_matrix.py
│   ├── matrix_based_game.py
│   ├── matrix_class.py
│   ├── matrix_equalization.py
│   ├── matrix_multiplication_recursion.py
│   ├── matrix_operation.py
│   ├── max_area_of_island.py
│   ├── median_matrix.py
│   ├── nth_fibonacci_using_matrix_exponentiation.py
│   ├── pascal_triangle.py
│   ├── rotate_matrix.py
│   ├── searching_in_sorted_matrix.py
│   ├── sherman_morrison.py
│   ├── spiral_print.py
│   ├── tests/
│   │   ├── __init__.py
│   │   ├── pytest.ini
│   │   └── test_matrix_operation.py
│   └── validate_sudoku_board.py
├── networking_flow/
│   ├── __init__.py
│   ├── ford_fulkerson.py
│   └── minimum_cut.py
├── neural_network/
│   ├── __init__.py
│   ├── activation_functions/
│   │   ├── __init__.py
│   │   ├── binary_step.py
│   │   ├── exponential_linear_unit.py
│   │   ├── gaussian_error_linear_unit.py
│   │   ├── leaky_rectified_linear_unit.py
│   │   ├── mish.py
│   │   ├── rectified_linear_unit.py
│   │   ├── scaled_exponential_linear_unit.py
│   │   ├── soboleva_modified_hyperbolic_tangent.py
│   │   ├── softplus.py
│   │   ├── squareplus.py
│   │   └── swish.py
│   ├── back_propagation_neural_network.py
│   ├── convolution_neural_network.py
│   ├── gan.py_tf
│   ├── input_data.py
│   ├── perceptron.py.DISABLED
│   ├── simple_neural_network.py
│   └── two_hidden_layers_neural_network.py
├── other/
│   ├── __init__.py
│   ├── activity_selection.py
│   ├── alternative_list_arrange.py
│   ├── bankers_algorithm.py
│   ├── davis_putnam_logemann_loveland.py
│   ├── doomsday.py
│   ├── fischer_yates_shuffle.py
│   ├── gauss_easter.py
│   ├── graham_scan.py
│   ├── greedy.py
│   ├── guess_the_number_search.py
│   ├── h_index.py
│   ├── least_recently_used.py
│   ├── lfu_cache.py
│   ├── linear_congruential_generator.py
│   ├── lru_cache.py
│   ├── magicdiamondpattern.py
│   ├── majority_vote_algorithm.py
│   ├── maximum_subsequence.py
│   ├── nested_brackets.py
│   ├── number_container_system.py
│   ├── password.py
│   ├── quine.py
│   ├── scoring_algorithm.py
│   ├── sdes.py
│   ├── sliding_window_maximum.py
│   ├── tower_of_hanoi.py
│   └── word_search.py
├── physics/
│   ├── __init__.py
│   ├── altitude_pressure.py
│   ├── archimedes_principle_of_buoyant_force.py
│   ├── basic_orbital_capture.py
│   ├── casimir_effect.py
│   ├── center_of_mass.py
│   ├── centripetal_force.py
│   ├── coulombs_law.py
│   ├── doppler_frequency.py
│   ├── escape_velocity.py
│   ├── grahams_law.py
│   ├── horizontal_projectile_motion.py
│   ├── hubble_parameter.py
│   ├── ideal_gas_law.py
│   ├── image_data/
│   │   └── __init__.py
│   ├── in_static_equilibrium.py
│   ├── kinetic_energy.py
│   ├── lens_formulae.py
│   ├── lorentz_transformation_four_vector.py
│   ├── malus_law.py
│   ├── mass_energy_equivalence.py
│   ├── mirror_formulae.py
│   ├── n_body_simulation.py
│   ├── newtons_law_of_gravitation.py
│   ├── newtons_second_law_of_motion.py
│   ├── orbital_transfer_work.py
│   ├── period_of_pendulum.py
│   ├── photoelectric_effect.py
│   ├── potential_energy.py
│   ├── rainfall_intensity.py
│   ├── reynolds_number.py
│   ├── rms_speed_of_molecule.py
│   ├── shear_stress.py
│   ├── speed_of_sound.py
│   ├── speeds_of_gas_molecules.py
│   └── terminal_velocity.py
├── project_euler/
│   ├── README.md
│   ├── __init__.py
│   ├── problem_001/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   ├── sol4.py
│   │   ├── sol5.py
│   │   ├── sol6.py
│   │   └── sol7.py
│   ├── problem_002/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   ├── sol4.py
│   │   └── sol5.py
│   ├── problem_003/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_004/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_005/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_006/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   └── sol4.py
│   ├── problem_007/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_008/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_009/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   └── sol4.py
│   ├── problem_010/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_011/
│   │   ├── __init__.py
│   │   ├── grid.txt
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_012/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_013/
│   │   ├── __init__.py
│   │   ├── num.txt
│   │   └── sol1.py
│   ├── problem_014/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_015/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_016/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_017/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_018/
│   │   ├── __init__.py
│   │   ├── solution.py
│   │   └── triangle.txt
│   ├── problem_019/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_020/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   └── sol4.py
│   ├── problem_021/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_022/
│   │   ├── __init__.py
│   │   ├── p022_names.txt
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_023/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_024/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_025/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_026/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_027/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_028/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_029/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_030/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_031/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_032/
│   │   ├── __init__.py
│   │   └── sol32.py
│   ├── problem_033/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_034/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_035/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_036/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_037/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_038/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_039/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_040/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_041/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_042/
│   │   ├── __init__.py
│   │   ├── solution42.py
│   │   └── words.txt
│   ├── problem_043/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_044/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_045/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_046/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_047/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_048/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_049/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_050/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_051/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_052/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_053/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_054/
│   │   ├── __init__.py
│   │   ├── poker_hands.txt
│   │   ├── sol1.py
│   │   └── test_poker_hand.py
│   ├── problem_055/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_056/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_057/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_058/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_059/
│   │   ├── __init__.py
│   │   ├── p059_cipher.txt
│   │   ├── sol1.py
│   │   └── test_cipher.txt
│   ├── problem_062/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_063/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_064/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_065/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_067/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── triangle.txt
│   ├── problem_068/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_069/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_070/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_071/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_072/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_073/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_074/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_075/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_076/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_077/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_078/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_079/
│   │   ├── __init__.py
│   │   ├── keylog.txt
│   │   ├── keylog_test.txt
│   │   └── sol1.py
│   ├── problem_080/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_081/
│   │   ├── __init__.py
│   │   ├── matrix.txt
│   │   └── sol1.py
│   ├── problem_082/
│   │   ├── __init__.py
│   │   ├── input.txt
│   │   ├── sol1.py
│   │   └── test_matrix.txt
│   ├── problem_085/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_086/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_087/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_089/
│   │   ├── __init__.py
│   │   ├── numeralcleanup_test.txt
│   │   ├── p089_roman.txt
│   │   └── sol1.py
│   ├── problem_091/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_092/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_094/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_095/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_097/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_099/
│   │   ├── __init__.py
│   │   ├── base_exp.txt
│   │   └── sol1.py
│   ├── problem_100/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_101/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_102/
│   │   ├── __init__.py
│   │   ├── p102_triangles.txt
│   │   ├── sol1.py
│   │   └── test_triangles.txt
│   ├── problem_104/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_107/
│   │   ├── __init__.py
│   │   ├── p107_network.txt
│   │   ├── sol1.py
│   │   └── test_network.txt
│   ├── problem_109/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_112/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_113/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_114/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_115/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_116/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_117/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_119/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_120/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_121/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_122/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_123/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_125/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_129/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_131/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_135/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_136/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_144/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_145/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_164/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_173/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_174/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_180/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_187/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_188/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_190/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_191/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_203/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_205/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_206/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_207/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_234/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_301/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_345/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_493/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_551/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_587/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_686/
│   │   ├── __init__.py
│   │   └── sol1.py
│   └── problem_800/
│       ├── __init__.py
│       └── sol1.py
├── pyproject.toml
├── quantum/
│   ├── README.md
│   ├── __init__.py
│   ├── bb84.py.DISABLED.txt
│   ├── deutsch_jozsa.py.DISABLED.txt
│   ├── half_adder.py.DISABLED.txt
│   ├── not_gate.py.DISABLED.txt
│   ├── q_fourier_transform.py
│   ├── q_full_adder.py.DISABLED.txt
│   ├── quantum_entanglement.py.DISABLED.txt
│   ├── quantum_random.py.DISABLED.txt
│   ├── quantum_teleportation.py.DISABLED.txt
│   ├── ripple_adder_classic.py.DISABLED.txt
│   ├── single_qubit_measure.py.DISABLED.txt
│   └── superdense_coding.py.DISABLED.txt
├── scheduling/
│   ├── __init__.py
│   ├── first_come_first_served.py
│   ├── highest_response_ratio_next.py
│   ├── job_sequence_with_deadline.py
│   ├── job_sequencing_with_deadline.py
│   ├── multi_level_feedback_queue.py
│   ├── non_preemptive_shortest_job_first.py
│   ├── round_robin.py
│   └── shortest_job_first.py
├── scripts/
│   ├── README.md
│   ├── __init__.py
│   ├── build_directory_md.py
│   ├── close_pull_requests_with_awaiting_changes.sh
│   ├── close_pull_requests_with_failing_tests.sh
│   ├── close_pull_requests_with_require_descriptive_names.sh
│   ├── close_pull_requests_with_require_tests.sh
│   ├── close_pull_requests_with_require_type_hints.sh
│   ├── find_git_conflicts.sh
│   ├── project_euler_answers.json
│   ├── validate_filenames.py
│   └── validate_solutions.py
├── searches/
│   ├── __init__.py
│   ├── binary_search.py
│   ├── binary_tree_traversal.py
│   ├── double_linear_search.py
│   ├── double_linear_search_recursion.py
│   ├── exponential_search.py
│   ├── fibonacci_search.py
│   ├── hill_climbing.py
│   ├── interpolation_search.py
│   ├── jump_search.py
│   ├── linear_search.py
│   ├── median_of_medians.py
│   ├── quick_select.py
│   ├── sentinel_linear_search.py
│   ├── simple_binary_search.py
│   ├── simulated_annealing.py
│   ├── tabu_search.py
│   ├── tabu_test_data.txt
│   └── ternary_search.py
├── sorts/
│   ├── README.md
│   ├── __init__.py
│   ├── bead_sort.py
│   ├── binary_insertion_sort.py
│   ├── bitonic_sort.py
│   ├── bogo_sort.py
│   ├── bubble_sort.py
│   ├── bucket_sort.py
│   ├── circle_sort.py
│   ├── cocktail_shaker_sort.py
│   ├── comb_sort.py
│   ├── counting_sort.py
│   ├── cycle_sort.py
│   ├── cyclic_sort.py
│   ├── double_sort.py
│   ├── dutch_national_flag_sort.py
│   ├── exchange_sort.py
│   ├── external_sort.py
│   ├── gnome_sort.py
│   ├── heap_sort.py
│   ├── insertion_sort.py
│   ├── intro_sort.py
│   ├── iterative_merge_sort.py
│   ├── merge_insertion_sort.py
│   ├── merge_sort.py
│   ├── msd_radix_sort.py
│   ├── natural_sort.py
│   ├── normal_distribution_quick_sort.md
│   ├── odd_even_sort.py
│   ├── odd_even_transposition_parallel.py
│   ├── odd_even_transposition_single_threaded.py
│   ├── pancake_sort.py
│   ├── patience_sort.py
│   ├── pigeon_sort.py
│   ├── pigeonhole_sort.py
│   ├── quick_sort.py
│   ├── quick_sort_3_partition.py
│   ├── radix_sort.py
│   ├── recursive_insertion_sort.py
│   ├── recursive_mergesort_array.py
│   ├── recursive_quick_sort.py
│   ├── selection_sort.py
│   ├── shell_sort.py
│   ├── shrink_shell_sort.py
│   ├── slowsort.py
│   ├── stalin_sort.py
│   ├── stooge_sort.py
│   ├── strand_sort.py
│   ├── tim_sort.py
│   ├── topological_sort.py
│   ├── tree_sort.py
│   ├── unknown_sort.py
│   └── wiggle_sort.py
├── strings/
│   ├── __init__.py
│   ├── aho_corasick.py
│   ├── alternative_string_arrange.py
│   ├── anagrams.py
│   ├── anagrams.txt
│   ├── autocomplete_using_trie.py
│   ├── barcode_validator.py
│   ├── bitap_string_match.py
│   ├── boyer_moore_search.py
│   ├── camel_case_to_snake_case.py
│   ├── can_string_be_rearranged_as_palindrome.py
│   ├── capitalize.py
│   ├── check_anagrams.py
│   ├── count_vowels.py
│   ├── credit_card_validator.py
│   ├── damerau_levenshtein_distance.py
│   ├── detecting_english_programmatically.py
│   ├── dictionary.txt
│   ├── dna.py
│   ├── edit_distance.py
│   ├── frequency_finder.py
│   ├── hamming_distance.py
│   ├── indian_phone_validator.py
│   ├── is_contains_unique_chars.py
│   ├── is_isogram.py
│   ├── is_pangram.py
│   ├── is_polish_national_id.py
│   ├── is_spain_national_id.py
│   ├── is_srilankan_phone_number.py
│   ├── is_valid_email_address.py
│   ├── jaro_winkler.py
│   ├── join.py
│   ├── knuth_morris_pratt.py
│   ├── levenshtein_distance.py
│   ├── lower.py
│   ├── manacher.py
│   ├── min_cost_string_conversion.py
│   ├── naive_string_search.py
│   ├── ngram.py
│   ├── palindrome.py
│   ├── pig_latin.py
│   ├── prefix_function.py
│   ├── rabin_karp.py
│   ├── remove_duplicate.py
│   ├── reverse_letters.py
│   ├── reverse_words.py
│   ├── snake_case_to_camel_pascal_case.py
│   ├── split.py
│   ├── string_switch_case.py
│   ├── strip.py
│   ├── text_justification.py
│   ├── title.py
│   ├── top_k_frequent_words.py
│   ├── upper.py
│   ├── wave_string.py
│   ├── wildcard_pattern_matching.py
│   ├── word_occurrence.py
│   ├── word_patterns.py
│   ├── words.txt
│   └── z_function.py
└── web_programming/
    ├── __init__.py
    ├── co2_emission.py
    ├── covid_stats_via_xpath.py
    ├── crawl_google_results.py
    ├── crawl_google_scholar_citation.py
    ├── currency_converter.py
    ├── current_stock_price.py
    ├── current_weather.py
    ├── daily_horoscope.py
    ├── download_images_from_google_query.py
    ├── emails_from_url.py
    ├── fetch_anime_and_play.py
    ├── fetch_bbc_news.py
    ├── fetch_github_info.py
    ├── fetch_jobs.py
    ├── fetch_quotes.py
    ├── fetch_well_rx_price.py
    ├── get_amazon_product_data.py
    ├── get_imdb_top_250_movies_csv.py
    ├── get_imdbtop.py.DISABLED
    ├── get_ip_geolocation.py
    ├── get_top_billionaires.py
    ├── get_top_hn_posts.py
    ├── get_user_tweets.py.DISABLED
    ├── giphy.py
    ├── instagram_crawler.py
    ├── instagram_pic.py
    ├── instagram_video.py
    ├── nasa_data.py
    ├── open_google_results.py
    ├── random_anime_character.py
    ├── recaptcha_verification.py
    ├── reddit.py
    ├── search_books_by_isbn.py
    ├── slack_message.py
    ├── test_fetch_github_info.py
    └── world_covid19_stats.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .devcontainer/Dockerfile
================================================
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/README.md
ARG VARIANT=3.13-bookworm
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
COPY requirements.txt /tmp/pip-tmp/
RUN python3 -m pip install --upgrade pip \
  && python3 -m pip install --no-cache-dir -r /tmp/pip-tmp/requirements.txt \
  && pipx install pre-commit ruff


================================================
FILE: .devcontainer/README.md
================================================
# Development Container

This is **Devcontainer** configuration to provide a consistent development environment for all contributors.

## Features

- [x] Pre-configured **Python environment**
- [x] Automatic installation of **pre-commit hooks**
- [x] **Ruff** linter ready to check your code
- [x] **Oh My Zsh** with plugins:
- `zsh-autosuggestions`
- `zsh-syntax-highlighting`

## Usage

1. Install [**Docker** ](https://www.docker.com/get-started/) and [**Visual Studio Code**](https://code.visualstudio.com/)
2. Install the **Remote - Containers** extension in VS Code

    - Do `CTRL+P`, paste this command and press `Enter`

        ```shell
        ext install ms-vscode-remote.remote-containers
        ```
3. Open this repository in VS Code
4. When prompted, click **"Reopen in Container"**
5. Wait for the environment to build and initialize

After setup:

- `pre-commit` hooks are installed
- `ruff` and other tools are available
- The shell uses Zsh by default

## Tips

To manually run checks on all files:

```bash
pre-commit run --all-files
```

> For further information here's [Microsoft tutorial about devcontainers.](https://code.visualstudio.com/docs/devcontainers/tutorial)


================================================
FILE: .devcontainer/devcontainer.json
================================================
{
	"name": "Python 3",
	"build": {
		"dockerfile": "Dockerfile",
		"context": "..",
		"args": {
			// Update 'VARIANT' to pick a Python version: 3, 3.11, 3.10, 3.9, 3.8
			// Append -bullseye or -buster to pin to an OS version.
			// Use -bullseye variants on local on arm64/Apple Silicon.
			"VARIANT": "3.13-bookworm"
		}
	},

	"postCreateCommand": "zsh .devcontainer/post_install",

	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			// Set *default* container specific settings.json values on container create.
			"settings": {
				"python.defaultInterpreterPath": "/usr/local/bin/python",
				"python.linting.enabled": true,
				"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
				"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
				"terminal.integrated.defaultProfile.linux": "zsh"
			},

			// Add the IDs of extensions you want installed when the container is created.
			"extensions": [
				"ms-python.python",
				"ms-python.vscode-pylance"
			]
		}
	},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Use 'postCreateCommand' to run commands after the container is created.
	// "postCreateCommand": "pip3 install --user -r requirements.txt",

	// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
	"remoteUser": "vscode"
}


================================================
FILE: .devcontainer/post_install
================================================
#!/usr/bin/env bash

echo "Begin post-installation steps..."

set -e

echo "Installing pre-commit hooks..."
pre-commit install

echo "Installing Oh My Zsh plugins..."

# Install zsh-autosuggestions if not present
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" ]; then
  echo "Cloning zsh-autosuggestions..."
  git clone https://github.com/zsh-users/zsh-autosuggestions \
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"
fi

# Install zsh-syntax-highlighting if not present
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting" ]; then
  echo "Cloning zsh-syntax-highlighting..."
  git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"
fi

echo "Configuring plugins in ~/.zshrc..."
sed -i '/^plugins=/c\plugins=(git zsh-autosuggestions zsh-syntax-highlighting)' ~/.zshrc

echo "Post-installation steps completed successfully. Enjoy!"


================================================
FILE: .gitattributes
================================================
* text=auto


================================================
FILE: .github/CODEOWNERS
================================================
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# More details are here: https://help.github.com/articles/about-codeowners/

# The '*' pattern is global owners.

# Order is important. The last matching pattern has the most precedence.

/.*  @cclauss

# /backtracking/

# /bit_manipulation/

# /blockchain/

# /boolean_algebra/

# /cellular_automata/

# /ciphers/

# /compression/

# /computer_vision/

# /conversions/

# /data_structures/

# /digital_image_processing/

# /divide_and_conquer/

# /dynamic_programming/

# /file_transfer/

# /fuzzy_logic/

# /genetic_algorithm/

# /geodesy/

# /graphics/

# /graphs/

# /greedy_method/

# /hashes/

# /images/

# /linear_algebra/

# /machine_learning/

# /maths/

# /matrix/

# /networking_flow/

# /neural_network/

# /other/

# /project_euler/

# /quantum/

# /scheduling/

# /scripts/

# /searches/

# /sorts/

# /strings/

# /traversals/

/web_programming/  @cclauss


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug report
description: Create a bug report to help us address errors in the repository
labels: [bug]
body:
  - type: markdown
    attributes:
      value: >
        Before requesting please search [existing issues](https://github.com/TheAlgorithms/Python/labels/bug).
        Usage questions such as "How do I...?"  belong on the
        [Discord](https://discord.gg/c7MnfGFGa6) and will be closed.

  - type: input
    attributes:
      label: "Repository commit"
      description: >
        The commit hash for `TheAlgorithms/Python` repository. You can get this
        by running the command `git rev-parse HEAD` locally.
      placeholder: "a0b0f414ae134aa1772d33bb930e5a960f9979e8"
    validations:
      required: true

  - type: input
    attributes:
      label: "Python version (python --version)"
      placeholder: "Python 3.10.7"
    validations:
      required: true

  - type: textarea
    attributes:
      label: "Dependencies version (pip freeze)"
      description: >
        This is the output of the command `pip freeze --all`. Note that the
        actual output might be different as compared to the placeholder text.
      placeholder: |
        appnope==0.1.3
        asttokens==2.0.8
        backcall==0.2.0
        ...
    validations:
      required: true

  - type: textarea
    attributes:
      label: "Expected behavior"
      description: "Describe the behavior you expect. May include images or videos."
    validations:
      required: true

  - type: textarea
    attributes:
      label: "Actual behavior"
    validations:
      required: true


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
  - name: Discord community
    url: https://discord.gg/c7MnfGFGa6
    about: Have any questions or need any help? Please contact us via Discord


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: Feature request
description: Suggest features, propose improvements, discuss new ideas.
labels: [enhancement]
body:
  - type: markdown
    attributes:
      value: >
        Before requesting please search [existing issues](https://github.com/TheAlgorithms/Python/labels/enhancement).
        Do not create issues to implement new algorithms as these will be closed.
        Usage questions such as "How do I...?"  belong on the
        [Discord](https://discord.gg/c7MnfGFGa6) and will be closed.

  - type: textarea
    attributes:
      label: "Feature description"
      description: >
        This could include new topics or improving any existing implementations.
    validations:
      required: true


================================================
FILE: .github/ISSUE_TEMPLATE/other.yml
================================================
name: Other
description: Use this for any other issues. PLEASE do not create blank issues
labels: ["awaiting triage"]
body:
  - type: textarea
    id: issuedescription
    attributes:
      label: What would you like to share?
      description: Provide a clear and concise explanation of your issue.
    validations:
      required: true

  - type: textarea
    id: extrainfo
    attributes:
      label: Additional information
      description: Is there anything else we should know about this issue?
    validations:
      required: false


================================================
FILE: .github/dependabot.yml
================================================
# Keep GitHub Actions up to date with Dependabot...
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "daily"


================================================
FILE: .github/pull_request_template.md
================================================
### Describe your change:



* [ ] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
* [ ] Documentation change?

### Checklist:
* [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [ ] This pull request is all my own work -- I have not plagiarized.
* [ ] I know that pull requests will not be merged if they fail the automated tests.
* [ ] This PR only changes one algorithm file.  To ease review, please open separate PRs for separate algorithms.
* [ ] All new Python files are placed inside an existing directory.
* [ ] All filenames are in all lowercase characters with no spaces or dashes.
* [ ] All functions and variable names follow Python naming conventions.
* [ ] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).
* [ ] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.
* [ ] All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
* [ ] If this pull request resolves one or more open issues then the description above includes the issue number(s) with a [closing keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue): "Fixes #ISSUE-NUMBER".


================================================
FILE: .github/stale.yml
================================================
# Configuration for probot-stale - https://github.com/probot/stale

# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 30

# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7

# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []

# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
  - "Status: on hold"

# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false

# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false

# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false

# Label to use when marking as stale
staleLabel: stale

# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 5

# Comment to post when removing the stale label.
# unmarkComment: >
#   Your comment here.

# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
pulls:
  # Comment to post when marking as stale. Set to `false` to disable
  markComment: >
    This pull request has been automatically marked as stale because it has not had
    recent activity. It will be closed if no further activity occurs. Thank you
    for your contributions.

  # Comment to post when closing a stale Pull Request.
  closeComment: >
    Please reopen this pull request once you commit the changes requested
    or make improvements on the code. If this is not the case and you need
    some help, feel free to seek help from our [Gitter](https://gitter.im/TheAlgorithms/community)
    or ping one of the reviewers. Thank you for your contributions!

issues:
  # Comment to post when marking as stale. Set to `false` to disable
  markComment: >
    This issue has been automatically marked as stale because it has not had
    recent activity. It will be closed if no further activity occurs. Thank you
    for your contributions.

  # Comment to post when closing a stale Issue.
  closeComment: >
    Please reopen this issue once you add more information and updates here.
    If this is not the case and you need some help, feel free to seek help
    from our [Gitter](https://gitter.im/TheAlgorithms/community) or ping one of the
    reviewers. Thank you for your contributions!


================================================
FILE: .github/workflows/build.yml
================================================
name: "build"

on:
  pull_request:
  schedule:
    - cron: "0 0 * * *" # Run everyday

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: sudo apt-get update && sudo apt-get install -y libhdf5-dev
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          cache-dependency-glob: uv.lock
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - run: uv sync --group=test
      - name: Run tests
        # TODO: #8818 Re-enable quantum tests
        run: uv run --with=pytest-run-parallel pytest
          --iterations=8 --parallel-threads=auto
          --ignore=computer_vision/cnn_classification.py
          --ignore=docs/conf.py
          --ignore=dynamic_programming/k_means_clustering_tensorflow.py
          --ignore=machine_learning/local_weighted_learning/local_weighted_learning.py
          --ignore=machine_learning/lstm/lstm_prediction.py
          --ignore=neural_network/input_data.py
          --ignore=project_euler/
          --ignore=quantum/q_fourier_transform.py
          --ignore=scripts/validate_solutions.py
          --ignore=web_programming/current_stock_price.py
          --ignore=web_programming/fetch_anime_and_play.py
          --cov-report=term-missing:skip-covered
          --cov=. .
      - if: ${{ success() }}
        run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md


================================================
FILE: .github/workflows/devcontainer_ci.yml
================================================
name: Test DevContainer Build

on:
  push:
    paths:
      - ".devcontainer/**"
  pull_request:
    paths:
      - ".devcontainer/**"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: devcontainers/ci@v0.3
        with:
          push: never
          runCmd: "true"


================================================
FILE: .github/workflows/directory_writer.yml
================================================
# The objective of this GitHub Action is to update the DIRECTORY.md file (if needed)
# when doing a git push
name: directory_writer
on: [push]
jobs:
  directory_writer:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - name: Write DIRECTORY.md
        run: |
          scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
          git config --global user.name "$GITHUB_ACTOR"
          git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
          git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
      - name: Update DIRECTORY.md
        run: |
          git add DIRECTORY.md
          git commit -am "updating DIRECTORY.md" ||  true
          git push --force origin HEAD:$GITHUB_REF || true


================================================
FILE: .github/workflows/project_euler.yml
================================================
on:
  pull_request:
    # Run only if a file is changed within the project_euler directory and related files
    paths:
      - "project_euler/**"
      - ".github/workflows/project_euler.yml"
      - "scripts/validate_solutions.py"
  schedule:
    - cron: "0 0 * * *" # Run everyday

name: "Project Euler"

jobs:
  project-euler:
    runs-on: ubuntu-latest
    steps:
      - run:
          sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
          zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
          libharfbuzz-dev libfribidi-dev libxcb1-dev
          libxml2-dev libxslt-dev
          libhdf5-dev
          libopenblas-dev
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - run: uv sync --group=euler-validate --group=test
      - run: uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
  validate-solutions:
    runs-on: ubuntu-latest
    steps:
      - run:
          sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
          zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
          libharfbuzz-dev libfribidi-dev libxcb1-dev
          libxml2-dev libxslt-dev
          libhdf5-dev
          libopenblas-dev
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - run: uv sync --group=euler-validate --group=test
      - run: uv run pytest scripts/validate_solutions.py
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


================================================
FILE: .github/workflows/ruff.yml
================================================
# https://beta.ruff.rs
name: ruff
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  ruff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
      - run: uvx ruff check --output-format=github .


================================================
FILE: .github/workflows/sphinx.yml
================================================
name: sphinx

on:
  # Triggers the workflow on push or pull request events but only for the "master" branch
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]
  # Or manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  build_docs:
    runs-on: ubuntu-24.04-arm
    steps:
      - run:
          sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
          zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
          libharfbuzz-dev libfribidi-dev libxcb1-dev
          libxml2-dev libxslt-dev
          libhdf5-dev
          libopenblas-dev
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - run: uv sync --group=docs
      - uses: actions/configure-pages@v5
      - run: uv run sphinx-build -c docs . docs/_build/html
      - uses: actions/upload-pages-artifact@v4
        with:
          path: docs/_build/html

  deploy_docs:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    if: github.event_name != 'pull_request'
    needs: build_docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/deploy-pages@v4
        id: deployment


================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a Python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.DS_Store
.idea
.try
.vscode/
.vs/


================================================
FILE: .gitpod.yml
================================================
tasks:
  - init: pip3 install -r ./requirements.txt


================================================
FILE: .pre-commit-config.yaml
================================================
ci:
  autoupdate_schedule: monthly

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-executables-have-shebangs
      - id: check-toml
      - id: check-yaml
      - id: end-of-file-fixer
        types: [python]
      - id: trailing-whitespace
      - id: requirements-txt-fixer

  - repo: https://github.com/MarcoGorelli/auto-walrus
    rev: 0.4.1
    hooks:
      - id: auto-walrus

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.14
    hooks:
      - id: ruff-check
      - id: ruff-format

  - repo: https://github.com/codespell-project/codespell
    rev: v2.4.1
    hooks:
      - id: codespell
        additional_dependencies:
          - tomli

  - repo: https://github.com/tox-dev/pyproject-fmt
    rev: v2.12.1
    hooks:
      - id: pyproject-fmt

  - repo: local
    hooks:
      - id: validate-filenames
        name: Validate filenames
        entry: ./scripts/validate_filenames.py
        language: script
        pass_filenames: false

  - repo: https://github.com/abravalheri/validate-pyproject
    rev: v0.24.1
    hooks:
      - id: validate-pyproject

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.19.1
    hooks:
      - id: mypy
        args:
          - --explicit-package-bases
          - --ignore-missing-imports
          - --install-types
          - --non-interactive

  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: v4.0.0-alpha.8
    hooks:
      - id: prettier
        types_or: [toml, yaml]


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing guidelines

## Before contributing

Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before submitting your pull requests, please ensure that you __read the whole guidelines__. If you have any doubts about the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community on [Gitter](https://gitter.im/TheAlgorithms/community).

## Contributing

### Contributor

We are delighted that you are considering implementing algorithms and data structures for others! This repository is referenced and used by learners from all over the globe. By being one of our contributors, you agree and confirm that:

- You did your work - no plagiarism allowed.
  - Any plagiarized work will not be merged.
- Your work will be distributed under [MIT License](LICENSE.md) once your pull request is merged.
- Your submitted work fulfills or mostly fulfills our styles and standards.

__New implementation__ is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity, but __identical implementation__ of an existing implementation is not allowed. Please check whether the solution is already implemented or not before submitting your pull request.

__Improving comments__ and __writing proper tests__ are also highly welcome.

### Contribution

We appreciate any contribution, from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work.

Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy.  After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button to read through the GitHub Actions output to understand the failure.  If you do not understand, please leave a comment on your submission page and a community member will try to help.

#### Issues

If you are interested in resolving an [open issue](https://github.com/TheAlgorithms/Python/issues), simply make a pull request with your proposed fix. __We do not assign issues in this repo__ so please do not ask for permission to work on an issue.

__Do not__ create an issue to contribute an algorithm. Please submit a pull request instead.

Please help us keep our issue list small by adding `Fixes #{$ISSUE_NUMBER}` to the description of pull requests that resolve open issues.
For example, if your pull request fixes issue #10, then please add the following to its description:
```
Fixes #10
```
GitHub will use this tag to [auto-close the issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if and when the PR is merged.

#### What is an Algorithm?

An Algorithm is one or more functions (or classes) that:
* take one or more inputs,
* perform some internal calculations or data manipulations,
* return one or more outputs,
* have minimal side effects (Ex. `print()`, `plot()`, `read()`, `write()`).

Algorithms should be packaged in a way that would make it easy for readers to put them into larger programs.

Algorithms should:
* have intuitive class and function names that make their purpose clear to readers
* use Python naming conventions and intuitive variable names to ease comprehension
* be flexible to take different input values
* have Python type hints for their input parameters and return values
* raise Python exceptions (`ValueError`, etc.) on erroneous input values
* have docstrings with clear explanations and/or URLs to source materials
* contain doctests that test both valid and erroneous input values
* return all calculation results instead of printing or plotting them

Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value.

#### Pre-commit plugin
Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style:

```bash
python3 -m pip install pre-commit  # only required the first time
pre-commit install
```
That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files:

```bash
pre-commit run --all-files --show-diff-on-failure
```

#### Coding Style

We want your work to be readable by others; therefore, we encourage you to note the following:

- Please write in Python 3.13+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
- Please focus hard on the naming of functions, classes, and variables.  Help your reader by using __descriptive names__ that can help you to remove redundant comments.
  - Single letter variable names are *old school* so please avoid them unless their life only spans a few lines.
  - Expand acronyms because `gcd()` is hard to understand but `greatest_common_divisor()` is not.
  - Please follow the [Python Naming Conventions](https://pep8.org/#prescriptive-naming-conventions) so variable_names and function_names should be lower_case, CONSTANTS in UPPERCASE, ClassNames should be CamelCase, etc.

- We encourage the use of Python [f-strings](https://realpython.com/python-f-strings/#f-strings-a-new-and-improved-way-to-format-strings-in-python) where they make the code easier to read.

- Please consider running [__psf/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request.  This is not yet a requirement but it does make your code more readable and automatically aligns it with much of [PEP 8](https://www.python.org/dev/peps/pep-0008/). There are other code formatters (autopep8, yapf) but the __black__ formatter is now hosted by the Python Software Foundation. To use it,

  ```bash
  python3 -m pip install black  # only required the first time
  black .
  ```

- All submissions will need to pass the test `ruff .` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.

  ```bash
  python3 -m pip install ruff  # only required the first time
  ruff check
  ```

- Original code submissions require docstrings or comments to describe your work.

- More on docstrings and comments:

  If you used a Wikipedia article or some other source material to create your algorithm, please add the URL in a docstring or comment to help your reader.

  The following are considered to be bad and may be requested to be improved:

  ```python
  x = x + 2	# increased by 2
  ```

  This is too trivial. Comments are expected to be explanatory. For comments, you can write them above, on or below a line of code, as long as you are consistent within the same piece of code.

  We encourage you to put docstrings inside your functions but please pay attention to the indentation of docstrings. The following is a good example:

  ```python
  def sum_ab(a, b):
      """
      Return the sum of two integers a and b.
      """
      return a + b
  ```

- Write tests (especially [__doctests__](https://docs.python.org/3/library/doctest.html)) to illustrate and verify your work.  We highly encourage the use of _doctests on all functions_.

  ```python
  def sum_ab(a, b):
      """
      Return the sum of two integers a and b
      >>> sum_ab(2, 2)
      4
      >>> sum_ab(-2, 3)
      1
      >>> sum_ab(4.9, 5.1)
      10.0
      """
      return a + b
  ```

  These doctests will be run by pytest as part of our automated testing so please try to run your doctests locally and make sure that they are found and pass:

  ```bash
  python3 -m doctest -v my_submission.py
  ```

  The use of the Python built-in `input()` function is __not__ encouraged:

  ```python
  input('Enter your input:')
  # Or even worse...
  input = eval(input("Enter your input: "))
  ```

  However, if your code uses `input()` then we encourage you to gracefully deal with leading and trailing whitespace in user input by adding `.strip()` as in:

  ```python
  starting_value = int(input("Please enter a starting value: ").strip())
  ```

  The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values.  Our automated testing will run [mypy](https://mypy-lang.org) so run that locally before making your submission.

  ```python
  def sum_ab(a: int, b: int) -> int:
      return a + b
  ```

  Instructions on how to install mypy can be found [here](https://github.com/python/mypy). Please use the command `mypy --ignore-missing-imports .` to test all files or `mypy --ignore-missing-imports path/to/file.py` to test a specific file.

- [__List comprehensions and generators__](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions) are preferred over the use of `lambda`, `map`, `filter`, `reduce` but the important thing is to demonstrate the power of Python in code that is easy to read and maintain.

- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.
- If you need a third-party module that is not in the file __requirements.txt__, please add it to that file as part of your submission.

#### Other Requirements for Submissions
- If you are submitting code in the `project_euler/` directory, please also read [the dedicated Guideline](https://github.com/TheAlgorithms/Python/blob/master/project_euler/README.md) before contributing to our Project Euler library.
- The file extension for code files should be `.py`. Jupyter Notebooks should be submitted to [TheAlgorithms/Jupyter](https://github.com/TheAlgorithms/Jupyter).
- Strictly use snake_case (underscore_separated) in your file_name, as it will be easy to parse in future using scripts.
- Please avoid creating new directories if at all possible. Try to fit your work into the existing directory structure.
- If possible, follow the standard *within* the folder you are submitting to.
- If you have modified/added code work, make sure the code compiles before submitting.
- If you have modified/added documentation work, ensure your language is concise and contains no grammar errors.
- Do not update the README.md or DIRECTORY.md file which will be periodically autogenerated by our GitHub Actions processes.
- Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).
- All submissions will be tested with [__mypy__](http://www.mypy-lang.org) so we encourage you to add [__Python type hints__](https://docs.python.org/3/library/typing.html) where it makes sense to do so.

- Most importantly,
  - __Be consistent in the use of these guidelines when submitting.__
  - __Join__ us on [Discord](https://discord.com/invite/c7MnfGFGa6) and [Gitter](https://gitter.im/TheAlgorithms/community) __now!__
  - Happy coding!

Writer [@poyea](https://github.com/poyea), Jun 2019.


================================================
FILE: DIRECTORY.md
================================================

## Audio Filters
  * [Butterworth Filter](audio_filters/butterworth_filter.py)
  * [Iir Filter](audio_filters/iir_filter.py)
  * [Show Response](audio_filters/show_response.py)

## Backtracking
  * [All Combinations](backtracking/all_combinations.py)
  * [All Permutations](backtracking/all_permutations.py)
  * [All Subsequences](backtracking/all_subsequences.py)
  * [Coloring](backtracking/coloring.py)
  * [Combination Sum](backtracking/combination_sum.py)
  * [Crossword Puzzle Solver](backtracking/crossword_puzzle_solver.py)
  * [Generate Parentheses](backtracking/generate_parentheses.py)
  * [Generate Parentheses Iterative](backtracking/generate_parentheses_iterative.py)
  * [Hamiltonian Cycle](backtracking/hamiltonian_cycle.py)
  * [Knight Tour](backtracking/knight_tour.py)
  * [Match Word Pattern](backtracking/match_word_pattern.py)
  * [Minimax](backtracking/minimax.py)
  * [N Queens](backtracking/n_queens.py)
  * [N Queens Math](backtracking/n_queens_math.py)
  * [Power Sum](backtracking/power_sum.py)
  * [Rat In Maze](backtracking/rat_in_maze.py)
  * [Sudoku](backtracking/sudoku.py)
  * [Sum Of Subsets](backtracking/sum_of_subsets.py)
  * [Word Break](backtracking/word_break.py)
  * [Word Ladder](backtracking/word_ladder.py)
  * [Word Search](backtracking/word_search.py)

## Bit Manipulation
  * [Binary And Operator](bit_manipulation/binary_and_operator.py)
  * [Binary Coded Decimal](bit_manipulation/binary_coded_decimal.py)
  * [Binary Count Setbits](bit_manipulation/binary_count_setbits.py)
  * [Binary Count Trailing Zeros](bit_manipulation/binary_count_trailing_zeros.py)
  * [Binary Or Operator](bit_manipulation/binary_or_operator.py)
  * [Binary Shifts](bit_manipulation/binary_shifts.py)
  * [Binary Twos Complement](bit_manipulation/binary_twos_complement.py)
  * [Binary Xor Operator](bit_manipulation/binary_xor_operator.py)
  * [Bitwise Addition Recursive](bit_manipulation/bitwise_addition_recursive.py)
  * [Count 1S Brian Kernighan Method](bit_manipulation/count_1s_brian_kernighan_method.py)
  * [Count Number Of One Bits](bit_manipulation/count_number_of_one_bits.py)
  * [Excess 3 Code](bit_manipulation/excess_3_code.py)
  * [Find Previous Power Of Two](bit_manipulation/find_previous_power_of_two.py)
  * [Find Unique Number](bit_manipulation/find_unique_number.py)
  * [Gray Code Sequence](bit_manipulation/gray_code_sequence.py)
  * [Highest Set Bit](bit_manipulation/highest_set_bit.py)
  * [Index Of Rightmost Set Bit](bit_manipulation/index_of_rightmost_set_bit.py)
  * [Is Even](bit_manipulation/is_even.py)
  * [Is Power Of Two](bit_manipulation/is_power_of_two.py)
  * [Largest Pow Of Two Le Num](bit_manipulation/largest_pow_of_two_le_num.py)
  * [Missing Number](bit_manipulation/missing_number.py)
  * [Numbers Different Signs](bit_manipulation/numbers_different_signs.py)
  * [Power Of 4](bit_manipulation/power_of_4.py)
  * [Reverse Bits](bit_manipulation/reverse_bits.py)
  * [Single Bit Manipulation Operations](bit_manipulation/single_bit_manipulation_operations.py)
  * [Swap All Odd And Even Bits](bit_manipulation/swap_all_odd_and_even_bits.py)

## Blockchain
  * [Diophantine Equation](blockchain/diophantine_equation.py)

## Boolean Algebra
  * [And Gate](boolean_algebra/and_gate.py)
  * [Imply Gate](boolean_algebra/imply_gate.py)
  * [Karnaugh Map Simplification](boolean_algebra/karnaugh_map_simplification.py)
  * [Multiplexer](boolean_algebra/multiplexer.py)
  * [Nand Gate](boolean_algebra/nand_gate.py)
  * [Nimply Gate](boolean_algebra/nimply_gate.py)
  * [Nor Gate](boolean_algebra/nor_gate.py)
  * [Not Gate](boolean_algebra/not_gate.py)
  * [Or Gate](boolean_algebra/or_gate.py)
  * [Quine Mc Cluskey](boolean_algebra/quine_mc_cluskey.py)
  * [Xnor Gate](boolean_algebra/xnor_gate.py)
  * [Xor Gate](boolean_algebra/xor_gate.py)

## Cellular Automata
  * [Conways Game Of Life](cellular_automata/conways_game_of_life.py)
  * [Game Of Life](cellular_automata/game_of_life.py)
  * [Langtons Ant](cellular_automata/langtons_ant.py)
  * [Nagel Schrekenberg](cellular_automata/nagel_schrekenberg.py)
  * [One Dimensional](cellular_automata/one_dimensional.py)
  * [Wa Tor](cellular_automata/wa_tor.py)

## Ciphers
  * [A1Z26](ciphers/a1z26.py)
  * [Affine Cipher](ciphers/affine_cipher.py)
  * [Atbash](ciphers/atbash.py)
  * [Autokey](ciphers/autokey.py)
  * [Baconian Cipher](ciphers/baconian_cipher.py)
  * [Base16](ciphers/base16.py)
  * [Base32](ciphers/base32.py)
  * [Base64 Cipher](ciphers/base64_cipher.py)
  * [Base85](ciphers/base85.py)
  * [Beaufort Cipher](ciphers/beaufort_cipher.py)
  * [Bifid](ciphers/bifid.py)
  * [Brute Force Caesar Cipher](ciphers/brute_force_caesar_cipher.py)
  * [Caesar Cipher](ciphers/caesar_cipher.py)
  * [Cryptomath Module](ciphers/cryptomath_module.py)
  * [Decrypt Caesar With Chi Squared](ciphers/decrypt_caesar_with_chi_squared.py)
  * [Deterministic Miller Rabin](ciphers/deterministic_miller_rabin.py)
  * [Diffie](ciphers/diffie.py)
  * [Diffie Hellman](ciphers/diffie_hellman.py)
  * [Elgamal Key Generator](ciphers/elgamal_key_generator.py)
  * [Enigma Machine2](ciphers/enigma_machine2.py)
  * [Fractionated Morse Cipher](ciphers/fractionated_morse_cipher.py)
  * [Gronsfeld Cipher](ciphers/gronsfeld_cipher.py)
  * [Hill Cipher](ciphers/hill_cipher.py)
  * [Mixed Keyword Cypher](ciphers/mixed_keyword_cypher.py)
  * [Mono Alphabetic Ciphers](ciphers/mono_alphabetic_ciphers.py)
  * [Morse Code](ciphers/morse_code.py)
  * [Onepad Cipher](ciphers/onepad_cipher.py)
  * [Permutation Cipher](ciphers/permutation_cipher.py)
  * [Playfair Cipher](ciphers/playfair_cipher.py)
  * [Polybius](ciphers/polybius.py)
  * [Porta Cipher](ciphers/porta_cipher.py)
  * [Rabin Miller](ciphers/rabin_miller.py)
  * [Rail Fence Cipher](ciphers/rail_fence_cipher.py)
  * [Rot13](ciphers/rot13.py)
  * [Rsa Cipher](ciphers/rsa_cipher.py)
  * [Rsa Factorization](ciphers/rsa_factorization.py)
  * [Rsa Key Generator](ciphers/rsa_key_generator.py)
  * [Running Key Cipher](ciphers/running_key_cipher.py)
  * [Shuffled Shift Cipher](ciphers/shuffled_shift_cipher.py)
  * [Simple Keyword Cypher](ciphers/simple_keyword_cypher.py)
  * [Simple Substitution Cipher](ciphers/simple_substitution_cipher.py)
  * [Transposition Cipher](ciphers/transposition_cipher.py)
  * [Transposition Cipher Encrypt Decrypt File](ciphers/transposition_cipher_encrypt_decrypt_file.py)
  * [Trifid Cipher](ciphers/trifid_cipher.py)
  * [Vernam Cipher](ciphers/vernam_cipher.py)
  * [Vigenere Cipher](ciphers/vigenere_cipher.py)
  * [Xor Cipher](ciphers/xor_cipher.py)

## Computer Vision
  * [Cnn Classification](computer_vision/cnn_classification.py)
  * [Flip Augmentation](computer_vision/flip_augmentation.py)
  * [Haralick Descriptors](computer_vision/haralick_descriptors.py)
  * [Harris Corner](computer_vision/harris_corner.py)
  * [Horn Schunck](computer_vision/horn_schunck.py)
  * [Intensity Based Segmentation](computer_vision/intensity_based_segmentation.py)
  * [Mean Threshold](computer_vision/mean_threshold.py)
  * [Mosaic Augmentation](computer_vision/mosaic_augmentation.py)
  * [Pooling Functions](computer_vision/pooling_functions.py)

## Conversions
  * [Astronomical Length Scale Conversion](conversions/astronomical_length_scale_conversion.py)
  * [Binary To Decimal](conversions/binary_to_decimal.py)
  * [Binary To Hexadecimal](conversions/binary_to_hexadecimal.py)
  * [Binary To Octal](conversions/binary_to_octal.py)
  * [Convert Number To Words](conversions/convert_number_to_words.py)
  * [Decimal To Any](conversions/decimal_to_any.py)
  * [Decimal To Binary](conversions/decimal_to_binary.py)
  * [Decimal To Hexadecimal](conversions/decimal_to_hexadecimal.py)
  * [Decimal To Octal](conversions/decimal_to_octal.py)
  * [Energy Conversions](conversions/energy_conversions.py)
  * [Excel Title To Column](conversions/excel_title_to_column.py)
  * [Hex To Bin](conversions/hex_to_bin.py)
  * [Hexadecimal To Decimal](conversions/hexadecimal_to_decimal.py)
  * [Ipv4 Conversion](conversions/ipv4_conversion.py)
  * [Length Conversion](conversions/length_conversion.py)
  * [Molecular Chemistry](conversions/molecular_chemistry.py)
  * [Octal To Binary](conversions/octal_to_binary.py)
  * [Octal To Decimal](conversions/octal_to_decimal.py)
  * [Octal To Hexadecimal](conversions/octal_to_hexadecimal.py)
  * [Prefix Conversions](conversions/prefix_conversions.py)
  * [Prefix Conversions String](conversions/prefix_conversions_string.py)
  * [Pressure Conversions](conversions/pressure_conversions.py)
  * [Rectangular To Polar](conversions/rectangular_to_polar.py)
  * [Rgb Cmyk Conversion](conversions/rgb_cmyk_conversion.py)
  * [Rgb Hsv Conversion](conversions/rgb_hsv_conversion.py)
  * [Roman Numerals](conversions/roman_numerals.py)
  * [Speed Conversions](conversions/speed_conversions.py)
  * [Temperature Conversions](conversions/temperature_conversions.py)
  * [Time Conversions](conversions/time_conversions.py)
  * [Volume Conversions](conversions/volume_conversions.py)
  * [Weight Conversion](conversions/weight_conversion.py)

## Data Compression
  * [Burrows Wheeler](data_compression/burrows_wheeler.py)
  * [Coordinate Compression](data_compression/coordinate_compression.py)
  * [Huffman](data_compression/huffman.py)
  * [Lempel Ziv](data_compression/lempel_ziv.py)
  * [Lempel Ziv Decompress](data_compression/lempel_ziv_decompress.py)
  * [Lz77](data_compression/lz77.py)
  * [Peak Signal To Noise Ratio](data_compression/peak_signal_to_noise_ratio.py)
  * [Run Length Encoding](data_compression/run_length_encoding.py)

## Data Structures
  * Arrays
    * [Equilibrium Index In Array](data_structures/arrays/equilibrium_index_in_array.py)
    * [Find Triplets With 0 Sum](data_structures/arrays/find_triplets_with_0_sum.py)
    * [Index 2D Array In 1D](data_structures/arrays/index_2d_array_in_1d.py)
    * [Kth Largest Element](data_structures/arrays/kth_largest_element.py)
    * [Median Two Array](data_structures/arrays/median_two_array.py)
    * [Monotonic Array](data_structures/arrays/monotonic_array.py)
    * [Pairs With Given Sum](data_structures/arrays/pairs_with_given_sum.py)
    * [Permutations](data_structures/arrays/permutations.py)
    * [Prefix Sum](data_structures/arrays/prefix_sum.py)
    * [Product Sum](data_structures/arrays/product_sum.py)
    * [Rotate Array](data_structures/arrays/rotate_array.py)
    * [Sparse Table](data_structures/arrays/sparse_table.py)
    * [Sudoku Solver](data_structures/arrays/sudoku_solver.py)
  * Binary Tree
    * [Avl Tree](data_structures/binary_tree/avl_tree.py)
    * [Basic Binary Tree](data_structures/binary_tree/basic_binary_tree.py)
    * [Binary Search Tree](data_structures/binary_tree/binary_search_tree.py)
    * [Binary Search Tree Recursive](data_structures/binary_tree/binary_search_tree_recursive.py)
    * [Binary Tree Mirror](data_structures/binary_tree/binary_tree_mirror.py)
    * [Binary Tree Node Sum](data_structures/binary_tree/binary_tree_node_sum.py)
    * [Binary Tree Path Sum](data_structures/binary_tree/binary_tree_path_sum.py)
    * [Binary Tree Traversals](data_structures/binary_tree/binary_tree_traversals.py)
    * [Diameter Of Binary Tree](data_structures/binary_tree/diameter_of_binary_tree.py)
    * [Diff Views Of Binary Tree](data_structures/binary_tree/diff_views_of_binary_tree.py)
    * [Distribute Coins](data_structures/binary_tree/distribute_coins.py)
    * [Fenwick Tree](data_structures/binary_tree/fenwick_tree.py)
    * [Flatten Binarytree To Linkedlist](data_structures/binary_tree/flatten_binarytree_to_linkedlist.py)
    * [Floor And Ceiling](data_structures/binary_tree/floor_and_ceiling.py)
    * [Inorder Tree Traversal 2022](data_structures/binary_tree/inorder_tree_traversal_2022.py)
    * [Is Sorted](data_structures/binary_tree/is_sorted.py)
    * [Is Sum Tree](data_structures/binary_tree/is_sum_tree.py)
    * [Lazy Segment Tree](data_structures/binary_tree/lazy_segment_tree.py)
    * [Lowest Common Ancestor](data_structures/binary_tree/lowest_common_ancestor.py)
    * [Maximum Fenwick Tree](data_structures/binary_tree/maximum_fenwick_tree.py)
    * [Maximum Sum Bst](data_structures/binary_tree/maximum_sum_bst.py)
    * [Merge Two Binary Trees](data_structures/binary_tree/merge_two_binary_trees.py)
    * [Mirror Binary Tree](data_structures/binary_tree/mirror_binary_tree.py)
    * [Non Recursive Segment Tree](data_structures/binary_tree/non_recursive_segment_tree.py)
    * [Number Of Possible Binary Trees](data_structures/binary_tree/number_of_possible_binary_trees.py)
    * [Red Black Tree](data_structures/binary_tree/red_black_tree.py)
    * [Segment Tree](data_structures/binary_tree/segment_tree.py)
    * [Segment Tree Other](data_structures/binary_tree/segment_tree_other.py)
    * [Serialize Deserialize Binary Tree](data_structures/binary_tree/serialize_deserialize_binary_tree.py)
    * [Symmetric Tree](data_structures/binary_tree/symmetric_tree.py)
    * [Treap](data_structures/binary_tree/treap.py)
    * [Wavelet Tree](data_structures/binary_tree/wavelet_tree.py)
  * Disjoint Set
    * [Alternate Disjoint Set](data_structures/disjoint_set/alternate_disjoint_set.py)
    * [Disjoint Set](data_structures/disjoint_set/disjoint_set.py)
  * Hashing
    * [Bloom Filter](data_structures/hashing/bloom_filter.py)
    * [Double Hash](data_structures/hashing/double_hash.py)
    * [Hash Map](data_structures/hashing/hash_map.py)
    * [Hash Table](data_structures/hashing/hash_table.py)
    * [Hash Table With Linked List](data_structures/hashing/hash_table_with_linked_list.py)
    * Number Theory
      * [Prime Numbers](data_structures/hashing/number_theory/prime_numbers.py)
    * [Quadratic Probing](data_structures/hashing/quadratic_probing.py)
    * Tests
      * [Test Hash Map](data_structures/hashing/tests/test_hash_map.py)
  * Heap
    * [Binomial Heap](data_structures/heap/binomial_heap.py)
    * [Heap](data_structures/heap/heap.py)
    * [Heap Generic](data_structures/heap/heap_generic.py)
    * [Max Heap](data_structures/heap/max_heap.py)
    * [Min Heap](data_structures/heap/min_heap.py)
    * [Randomized Heap](data_structures/heap/randomized_heap.py)
    * [Skew Heap](data_structures/heap/skew_heap.py)
  * Kd Tree
    * [Build Kdtree](data_structures/kd_tree/build_kdtree.py)
    * Example
      * [Example Usage](data_structures/kd_tree/example/example_usage.py)
      * [Hypercube Points](data_structures/kd_tree/example/hypercube_points.py)
    * [Kd Node](data_structures/kd_tree/kd_node.py)
    * [Nearest Neighbour Search](data_structures/kd_tree/nearest_neighbour_search.py)
    * Tests
      * [Test Kdtree](data_structures/kd_tree/tests/test_kdtree.py)
  * Linked List
    * [Circular Linked List](data_structures/linked_list/circular_linked_list.py)
    * [Deque Doubly](data_structures/linked_list/deque_doubly.py)
    * [Doubly Linked List](data_structures/linked_list/doubly_linked_list.py)
    * [Doubly Linked List Two](data_structures/linked_list/doubly_linked_list_two.py)
    * [Floyds Cycle Detection](data_structures/linked_list/floyds_cycle_detection.py)
    * [From Sequence](data_structures/linked_list/from_sequence.py)
    * [Has Loop](data_structures/linked_list/has_loop.py)
    * [Is Palindrome](data_structures/linked_list/is_palindrome.py)
    * [Merge Two Lists](data_structures/linked_list/merge_two_lists.py)
    * [Middle Element Of Linked List](data_structures/linked_list/middle_element_of_linked_list.py)
    * [Print Reverse](data_structures/linked_list/print_reverse.py)
    * [Reverse K Group](data_structures/linked_list/reverse_k_group.py)
    * [Rotate To The Right](data_structures/linked_list/rotate_to_the_right.py)
    * [Singly Linked List](data_structures/linked_list/singly_linked_list.py)
    * [Skip List](data_structures/linked_list/skip_list.py)
    * [Swap Nodes](data_structures/linked_list/swap_nodes.py)
  * Queues
    * [Circular Queue](data_structures/queues/circular_queue.py)
    * [Circular Queue Linked List](data_structures/queues/circular_queue_linked_list.py)
    * [Double Ended Queue](data_structures/queues/double_ended_queue.py)
    * [Linked Queue](data_structures/queues/linked_queue.py)
    * [Priority Queue Using List](data_structures/queues/priority_queue_using_list.py)
    * [Queue By List](data_structures/queues/queue_by_list.py)
    * [Queue By Two Stacks](data_structures/queues/queue_by_two_stacks.py)
    * [Queue On Pseudo Stack](data_structures/queues/queue_on_pseudo_stack.py)
  * Stacks
    * [Balanced Parentheses](data_structures/stacks/balanced_parentheses.py)
    * [Dijkstras Two Stack Algorithm](data_structures/stacks/dijkstras_two_stack_algorithm.py)
    * [Infix To Postfix Conversion](data_structures/stacks/infix_to_postfix_conversion.py)
    * [Infix To Prefix Conversion](data_structures/stacks/infix_to_prefix_conversion.py)
    * [Largest Rectangle Histogram](data_structures/stacks/largest_rectangle_histogram.py)
    * [Lexicographical Numbers](data_structures/stacks/lexicographical_numbers.py)
    * [Next Greater Element](data_structures/stacks/next_greater_element.py)
    * [Postfix Evaluation](data_structures/stacks/postfix_evaluation.py)
    * [Prefix Evaluation](data_structures/stacks/prefix_evaluation.py)
    * [Stack](data_structures/stacks/stack.py)
    * [Stack Using Two Queues](data_structures/stacks/stack_using_two_queues.py)
    * [Stack With Doubly Linked List](data_structures/stacks/stack_with_doubly_linked_list.py)
    * [Stack With Singly Linked List](data_structures/stacks/stack_with_singly_linked_list.py)
    * [Stock Span Problem](data_structures/stacks/stock_span_problem.py)
  * Suffix Tree
    * Example
      * [Example Usage](data_structures/suffix_tree/example/example_usage.py)
    * [Suffix Tree](data_structures/suffix_tree/suffix_tree.py)
    * [Suffix Tree Node](data_structures/suffix_tree/suffix_tree_node.py)
    * Tests
      * [Test Suffix Tree](data_structures/suffix_tree/tests/test_suffix_tree.py)
  * Trie
    * [Radix Tree](data_structures/trie/radix_tree.py)
    * [Trie](data_structures/trie/trie.py)

## Digital Image Processing
  * [Change Brightness](digital_image_processing/change_brightness.py)
  * [Change Contrast](digital_image_processing/change_contrast.py)
  * [Convert To Negative](digital_image_processing/convert_to_negative.py)
  * Dithering
    * [Burkes](digital_image_processing/dithering/burkes.py)
  * Edge Detection
    * [Canny](digital_image_processing/edge_detection/canny.py)
  * Filters
    * [Bilateral Filter](digital_image_processing/filters/bilateral_filter.py)
    * [Convolve](digital_image_processing/filters/convolve.py)
    * [Gabor Filter](digital_image_processing/filters/gabor_filter.py)
    * [Gaussian Filter](digital_image_processing/filters/gaussian_filter.py)
    * [Laplacian Filter](digital_image_processing/filters/laplacian_filter.py)
    * [Local Binary Pattern](digital_image_processing/filters/local_binary_pattern.py)
    * [Median Filter](digital_image_processing/filters/median_filter.py)
    * [Sobel Filter](digital_image_processing/filters/sobel_filter.py)
  * Histogram Equalization
    * [Histogram Stretch](digital_image_processing/histogram_equalization/histogram_stretch.py)
  * [Index Calculation](digital_image_processing/index_calculation.py)
  * Morphological Operations
    * [Dilation Operation](digital_image_processing/morphological_operations/dilation_operation.py)
    * [Erosion Operation](digital_image_processing/morphological_operations/erosion_operation.py)
  * Resize
    * [Resize](digital_image_processing/resize/resize.py)
  * Rotation
    * [Rotation](digital_image_processing/rotation/rotation.py)
  * [Sepia](digital_image_processing/sepia.py)
  * [Test Digital Image Processing](digital_image_processing/test_digital_image_processing.py)

## Divide And Conquer
  * [Closest Pair Of Points](divide_and_conquer/closest_pair_of_points.py)
  * [Convex Hull](divide_and_conquer/convex_hull.py)
  * [Heaps Algorithm](divide_and_conquer/heaps_algorithm.py)
  * [Heaps Algorithm Iterative](divide_and_conquer/heaps_algorithm_iterative.py)
  * [Inversions](divide_and_conquer/inversions.py)
  * [Kth Order Statistic](divide_and_conquer/kth_order_statistic.py)
  * [Max Difference Pair](divide_and_conquer/max_difference_pair.py)
  * [Max Subarray](divide_and_conquer/max_subarray.py)
  * [Mergesort](divide_and_conquer/mergesort.py)
  * [Peak](divide_and_conquer/peak.py)
  * [Power](divide_and_conquer/power.py)
  * [Strassen Matrix Multiplication](divide_and_conquer/strassen_matrix_multiplication.py)

## Docs
  * [Conf](docs/conf.py)

## Dynamic Programming
  * [Abbreviation](dynamic_programming/abbreviation.py)
  * [All Construct](dynamic_programming/all_construct.py)
  * [Bitmask](dynamic_programming/bitmask.py)
  * [Catalan Numbers](dynamic_programming/catalan_numbers.py)
  * [Climbing Stairs](dynamic_programming/climbing_stairs.py)
  * [Combination Sum Iv](dynamic_programming/combination_sum_iv.py)
  * [Edit Distance](dynamic_programming/edit_distance.py)
  * [Factorial](dynamic_programming/factorial.py)
  * [Fast Fibonacci](dynamic_programming/fast_fibonacci.py)
  * [Fibonacci](dynamic_programming/fibonacci.py)
  * [Fizz Buzz](dynamic_programming/fizz_buzz.py)
  * [Floyd Warshall](dynamic_programming/floyd_warshall.py)
  * [Integer Partition](dynamic_programming/integer_partition.py)
  * [Iterating Through Submasks](dynamic_programming/iterating_through_submasks.py)
  * [K Means Clustering Tensorflow](dynamic_programming/k_means_clustering_tensorflow.py)
  * [Knapsack](dynamic_programming/knapsack.py)
  * [Largest Divisible Subset](dynamic_programming/largest_divisible_subset.py)
  * [Longest Common Subsequence](dynamic_programming/longest_common_subsequence.py)
  * [Longest Common Substring](dynamic_programming/longest_common_substring.py)
  * [Longest Increasing Subsequence](dynamic_programming/longest_increasing_subsequence.py)
  * [Longest Increasing Subsequence Iterative](dynamic_programming/longest_increasing_subsequence_iterative.py)
  * [Longest Increasing Subsequence O Nlogn](dynamic_programming/longest_increasing_subsequence_o_nlogn.py)
  * [Longest Palindromic Subsequence](dynamic_programming/longest_palindromic_subsequence.py)
  * [Matrix Chain Multiplication](dynamic_programming/matrix_chain_multiplication.py)
  * [Matrix Chain Order](dynamic_programming/matrix_chain_order.py)
  * [Max Non Adjacent Sum](dynamic_programming/max_non_adjacent_sum.py)
  * [Max Product Subarray](dynamic_programming/max_product_subarray.py)
  * [Max Subarray Sum](dynamic_programming/max_subarray_sum.py)
  * [Min Distance Up Bottom](dynamic_programming/min_distance_up_bottom.py)
  * [Minimum Coin Change](dynamic_programming/minimum_coin_change.py)
  * [Minimum Cost Path](dynamic_programming/minimum_cost_path.py)
  * [Minimum Partition](dynamic_programming/minimum_partition.py)
  * [Minimum Size Subarray Sum](dynamic_programming/minimum_size_subarray_sum.py)
  * [Minimum Squares To Represent A Number](dynamic_programming/minimum_squares_to_represent_a_number.py)
  * [Minimum Steps To One](dynamic_programming/minimum_steps_to_one.py)
  * [Minimum Tickets Cost](dynamic_programming/minimum_tickets_cost.py)
  * [Narcissistic Number](dynamic_programming/narcissistic_number.py)
  * [Optimal Binary Search Tree](dynamic_programming/optimal_binary_search_tree.py)
  * [Palindrome Partitioning](dynamic_programming/palindrome_partitioning.py)
  * [Range Sum Query](dynamic_programming/range_sum_query.py)
  * [Regex Match](dynamic_programming/regex_match.py)
  * [Rod Cutting](dynamic_programming/rod_cutting.py)
  * [Smith Waterman](dynamic_programming/smith_waterman.py)
  * [Subset Generation](dynamic_programming/subset_generation.py)
  * [Sum Of Subset](dynamic_programming/sum_of_subset.py)
  * [Trapped Water](dynamic_programming/trapped_water.py)
  * [Tribonacci](dynamic_programming/tribonacci.py)
  * [Viterbi](dynamic_programming/viterbi.py)
  * [Wildcard Matching](dynamic_programming/wildcard_matching.py)
  * [Word Break](dynamic_programming/word_break.py)

## Electronics
  * [Apparent Power](electronics/apparent_power.py)
  * [Builtin Voltage](electronics/builtin_voltage.py)
  * [Capacitor Equivalence](electronics/capacitor_equivalence.py)
  * [Carrier Concentration](electronics/carrier_concentration.py)
  * [Charging Capacitor](electronics/charging_capacitor.py)
  * [Charging Inductor](electronics/charging_inductor.py)
  * [Circular Convolution](electronics/circular_convolution.py)
  * [Coulombs Law](electronics/coulombs_law.py)
  * [Electric Conductivity](electronics/electric_conductivity.py)
  * [Electric Power](electronics/electric_power.py)
  * [Electrical Impedance](electronics/electrical_impedance.py)
  * [Ic 555 Timer](electronics/ic_555_timer.py)
  * [Ind Reactance](electronics/ind_reactance.py)
  * [Ohms Law](electronics/ohms_law.py)
  * [Real And Reactive Power](electronics/real_and_reactive_power.py)
  * [Resistor Color Code](electronics/resistor_color_code.py)
  * [Resistor Equivalence](electronics/resistor_equivalence.py)
  * [Resonant Frequency](electronics/resonant_frequency.py)
  * [Wheatstone Bridge](electronics/wheatstone_bridge.py)

## File Transfer
  * [Receive File](file_transfer/receive_file.py)
  * [Send File](file_transfer/send_file.py)
  * Tests
    * [Test Send File](file_transfer/tests/test_send_file.py)

## Financial
  * [Equated Monthly Installments](financial/equated_monthly_installments.py)
  * [Exponential Moving Average](financial/exponential_moving_average.py)
  * [Interest](financial/interest.py)
  * [Present Value](financial/present_value.py)
  * [Price Plus Tax](financial/price_plus_tax.py)
  * [Simple Moving Average](financial/simple_moving_average.py)
  * [Straight Line Depreciation](financial/straight_line_depreciation.py)
  * [Time And Half Pay](financial/time_and_half_pay.py)

## Fractals
  * [Julia Sets](fractals/julia_sets.py)
  * [Koch Snowflake](fractals/koch_snowflake.py)
  * [Mandelbrot](fractals/mandelbrot.py)
  * [Sierpinski Triangle](fractals/sierpinski_triangle.py)
  * [Vicsek](fractals/vicsek.py)

## Fuzzy Logic
  * [Fuzzy Operations](fuzzy_logic/fuzzy_operations.py)

## Genetic Algorithm
  * [Basic String](genetic_algorithm/basic_string.py)

## Geodesy
  * [Haversine Distance](geodesy/haversine_distance.py)
  * [Lamberts Ellipsoidal Distance](geodesy/lamberts_ellipsoidal_distance.py)

## Geometry
  * [Geometry](geometry/geometry.py)
  * [Graham Scan](geometry/graham_scan.py)
  * [Jarvis March](geometry/jarvis_march.py)
  * Tests
    * [Test Graham Scan](geometry/tests/test_graham_scan.py)
    * [Test Jarvis March](geometry/tests/test_jarvis_march.py)

## Graphics
  * [Bezier Curve](graphics/bezier_curve.py)
  * [Butterfly Pattern](graphics/butterfly_pattern.py)
  * [Digital Differential Analyzer Line](graphics/digital_differential_analyzer_line.py)
  * [Vector3 For 2D Rendering](graphics/vector3_for_2d_rendering.py)

## Graphs
  * [A Star](graphs/a_star.py)
  * [Ant Colony Optimization Algorithms](graphs/ant_colony_optimization_algorithms.py)
  * [Articulation Points](graphs/articulation_points.py)
  * [Basic Graphs](graphs/basic_graphs.py)
  * [Bellman Ford](graphs/bellman_ford.py)
  * [Bi Directional Dijkstra](graphs/bi_directional_dijkstra.py)
  * [Bidirectional A Star](graphs/bidirectional_a_star.py)
  * [Bidirectional Breadth First Search](graphs/bidirectional_breadth_first_search.py)
  * [Bidirectional Search](graphs/bidirectional_search.py)
  * [Boruvka](graphs/boruvka.py)
  * [Breadth First Search](graphs/breadth_first_search.py)
  * [Breadth First Search 2](graphs/breadth_first_search_2.py)
  * [Breadth First Search Shortest Path](graphs/breadth_first_search_shortest_path.py)
  * [Breadth First Search Shortest Path 2](graphs/breadth_first_search_shortest_path_2.py)
  * [Breadth First Search Zero One Shortest Path](graphs/breadth_first_search_zero_one_shortest_path.py)
  * [Check Bipatrite](graphs/check_bipatrite.py)
  * [Check Cycle](graphs/check_cycle.py)
  * [Connected Components](graphs/connected_components.py)
  * [Deep Clone Graph](graphs/deep_clone_graph.py)
  * [Depth First Search](graphs/depth_first_search.py)
  * [Depth First Search 2](graphs/depth_first_search_2.py)
  * [Dijkstra](graphs/dijkstra.py)
  * [Dijkstra 2](graphs/dijkstra_2.py)
  * [Dijkstra Algorithm](graphs/dijkstra_algorithm.py)
  * [Dijkstra Alternate](graphs/dijkstra_alternate.py)
  * [Dijkstra Binary Grid](graphs/dijkstra_binary_grid.py)
  * [Dinic](graphs/dinic.py)
  * [Directed And Undirected Weighted Graph](graphs/directed_and_undirected_weighted_graph.py)
  * [Edmonds Karp Multiple Source And Sink](graphs/edmonds_karp_multiple_source_and_sink.py)
  * [Eulerian Path And Circuit For Undirected Graph](graphs/eulerian_path_and_circuit_for_undirected_graph.py)
  * [Even Tree](graphs/even_tree.py)
  * [Finding Bridges](graphs/finding_bridges.py)
  * [Frequent Pattern Graph Miner](graphs/frequent_pattern_graph_miner.py)
  * [G Topological Sort](graphs/g_topological_sort.py)
  * [Gale Shapley Bigraph](graphs/gale_shapley_bigraph.py)
  * [Graph Adjacency List](graphs/graph_adjacency_list.py)
  * [Graph Adjacency Matrix](graphs/graph_adjacency_matrix.py)
  * [Graph List](graphs/graph_list.py)
  * [Graphs Floyd Warshall](graphs/graphs_floyd_warshall.py)
  * [Greedy Best First](graphs/greedy_best_first.py)
  * [Greedy Min Vertex Cover](graphs/greedy_min_vertex_cover.py)
  * [Kahns Algorithm Long](graphs/kahns_algorithm_long.py)
  * [Kahns Algorithm Topo](graphs/kahns_algorithm_topo.py)
  * [Karger](graphs/karger.py)
  * [Lanczos Eigenvectors](graphs/lanczos_eigenvectors.py)
  * [Markov Chain](graphs/markov_chain.py)
  * [Matching Min Vertex Cover](graphs/matching_min_vertex_cover.py)
  * [Minimum Path Sum](graphs/minimum_path_sum.py)
  * [Minimum Spanning Tree Boruvka](graphs/minimum_spanning_tree_boruvka.py)
  * [Minimum Spanning Tree Kruskal](graphs/minimum_spanning_tree_kruskal.py)
  * [Minimum Spanning Tree Kruskal2](graphs/minimum_spanning_tree_kruskal2.py)
  * [Minimum Spanning Tree Prims](graphs/minimum_spanning_tree_prims.py)
  * [Minimum Spanning Tree Prims2](graphs/minimum_spanning_tree_prims2.py)
  * [Multi Heuristic Astar](graphs/multi_heuristic_astar.py)
  * [Page Rank](graphs/page_rank.py)
  * [Prim](graphs/prim.py)
  * [Random Graph Generator](graphs/random_graph_generator.py)
  * [Scc Kosaraju](graphs/scc_kosaraju.py)
  * [Strongly Connected Components](graphs/strongly_connected_components.py)
  * [Tarjans Scc](graphs/tarjans_scc.py)
  * Tests
    * [Test Min Spanning Tree Kruskal](graphs/tests/test_min_spanning_tree_kruskal.py)
    * [Test Min Spanning Tree Prim](graphs/tests/test_min_spanning_tree_prim.py)

## Greedy Methods
  * [Best Time To Buy And Sell Stock](greedy_methods/best_time_to_buy_and_sell_stock.py)
  * [Fractional Cover Problem](greedy_methods/fractional_cover_problem.py)
  * [Fractional Knapsack](greedy_methods/fractional_knapsack.py)
  * [Fractional Knapsack 2](greedy_methods/fractional_knapsack_2.py)
  * [Gas Station](greedy_methods/gas_station.py)
  * [Minimum Coin Change](greedy_methods/minimum_coin_change.py)
  * [Minimum Waiting Time](greedy_methods/minimum_waiting_time.py)
  * [Optimal Merge Pattern](greedy_methods/optimal_merge_pattern.py)
  * [Smallest Range](greedy_methods/smallest_range.py)

## Hashes
  * [Adler32](hashes/adler32.py)
  * [Chaos Machine](hashes/chaos_machine.py)
  * [Djb2](hashes/djb2.py)
  * [Elf](hashes/elf.py)
  * [Enigma Machine](hashes/enigma_machine.py)
  * [Fletcher16](hashes/fletcher16.py)
  * [Hamming Code](hashes/hamming_code.py)
  * [Luhn](hashes/luhn.py)
  * [Md5](hashes/md5.py)
  * [Sdbm](hashes/sdbm.py)
  * [Sha1](hashes/sha1.py)
  * [Sha256](hashes/sha256.py)

## Knapsack
  * [Greedy Knapsack](knapsack/greedy_knapsack.py)
  * [Knapsack](knapsack/knapsack.py)
  * [Recursive Approach Knapsack](knapsack/recursive_approach_knapsack.py)
  * Tests
    * [Test Greedy Knapsack](knapsack/tests/test_greedy_knapsack.py)
    * [Test Knapsack](knapsack/tests/test_knapsack.py)

## Linear Algebra
  * [Gaussian Elimination](linear_algebra/gaussian_elimination.py)
  * [Jacobi Iteration Method](linear_algebra/jacobi_iteration_method.py)
  * [Lu Decomposition](linear_algebra/lu_decomposition.py)
  * [Matrix Inversion](linear_algebra/matrix_inversion.py)
  * Src
    * [Conjugate Gradient](linear_algebra/src/conjugate_gradient.py)
    * [Gaussian Elimination Pivoting](linear_algebra/src/gaussian_elimination_pivoting.py)
    * [Lib](linear_algebra/src/lib.py)
    * [Polynom For Points](linear_algebra/src/polynom_for_points.py)
    * [Power Iteration](linear_algebra/src/power_iteration.py)
    * [Rank Of Matrix](linear_algebra/src/rank_of_matrix.py)
    * [Rayleigh Quotient](linear_algebra/src/rayleigh_quotient.py)
    * [Schur Complement](linear_algebra/src/schur_complement.py)
    * [Test Linear Algebra](linear_algebra/src/test_linear_algebra.py)
    * [Transformations 2D](linear_algebra/src/transformations_2d.py)

## Linear Programming
  * [Simplex](linear_programming/simplex.py)

## Machine Learning
  * [Apriori Algorithm](machine_learning/apriori_algorithm.py)
  * [Astar](machine_learning/astar.py)
  * [Automatic Differentiation](machine_learning/automatic_differentiation.py)
  * [Data Transformations](machine_learning/data_transformations.py)
  * [Decision Tree](machine_learning/decision_tree.py)
  * [Dimensionality Reduction](machine_learning/dimensionality_reduction.py)
  * Forecasting
    * [Run](machine_learning/forecasting/run.py)
  * [Frequent Pattern Growth](machine_learning/frequent_pattern_growth.py)
  * [Gradient Boosting Classifier](machine_learning/gradient_boosting_classifier.py)
  * [Gradient Descent](machine_learning/gradient_descent.py)
  * [K Means Clust](machine_learning/k_means_clust.py)
  * [K Nearest Neighbours](machine_learning/k_nearest_neighbours.py)
  * [Linear Discriminant Analysis](machine_learning/linear_discriminant_analysis.py)
  * [Linear Regression](machine_learning/linear_regression.py)
  * Local Weighted Learning
    * [Local Weighted Learning](machine_learning/local_weighted_learning/local_weighted_learning.py)
  * [Logistic Regression](machine_learning/logistic_regression.py)
  * [Loss Functions](machine_learning/loss_functions.py)
  * Lstm
    * [Lstm Prediction](machine_learning/lstm/lstm_prediction.py)
  * [Mfcc](machine_learning/mfcc.py)
  * [Multilayer Perceptron Classifier](machine_learning/multilayer_perceptron_classifier.py)
  * [Polynomial Regression](machine_learning/polynomial_regression.py)
  * [Principle Component Analysis](machine_learning/principle_component_analysis.py)
  * [Scoring Functions](machine_learning/scoring_functions.py)
  * [Self Organizing Map](machine_learning/self_organizing_map.py)
  * [Sequential Minimum Optimization](machine_learning/sequential_minimum_optimization.py)
  * [Similarity Search](machine_learning/similarity_search.py)
  * [Support Vector Machines](machine_learning/support_vector_machines.py)
  * [T Stochastic Neighbour Embedding](machine_learning/t_stochastic_neighbour_embedding.py)
  * [Word Frequency Functions](machine_learning/word_frequency_functions.py)
  * [Xgboost Classifier](machine_learning/xgboost_classifier.py)
  * [Xgboost Regressor](machine_learning/xgboost_regressor.py)

## Maths
  * [Abs](maths/abs.py)
  * [Addition Without Arithmetic](maths/addition_without_arithmetic.py)
  * [Aliquot Sum](maths/aliquot_sum.py)
  * [Allocation Number](maths/allocation_number.py)
  * [Arc Length](maths/arc_length.py)
  * [Area](maths/area.py)
  * [Area Under Curve](maths/area_under_curve.py)
  * [Average Absolute Deviation](maths/average_absolute_deviation.py)
  * [Average Mean](maths/average_mean.py)
  * [Average Median](maths/average_median.py)
  * [Average Mode](maths/average_mode.py)
  * [Bailey Borwein Plouffe](maths/bailey_borwein_plouffe.py)
  * [Base Neg2 Conversion](maths/base_neg2_conversion.py)
  * [Basic Maths](maths/basic_maths.py)
  * [Binary Exponentiation](maths/binary_exponentiation.py)
  * [Binary Multiplication](maths/binary_multiplication.py)
  * [Binomial Coefficient](maths/binomial_coefficient.py)
  * [Binomial Distribution](maths/binomial_distribution.py)
  * [Ceil](maths/ceil.py)
  * [Chebyshev Distance](maths/chebyshev_distance.py)
  * [Check Polygon](maths/check_polygon.py)
  * [Chinese Remainder Theorem](maths/chinese_remainder_theorem.py)
  * [Chudnovsky Algorithm](maths/chudnovsky_algorithm.py)
  * [Collatz Sequence](maths/collatz_sequence.py)
  * [Combinations](maths/combinations.py)
  * [Continued Fraction](maths/continued_fraction.py)
  * [Decimal Isolate](maths/decimal_isolate.py)
  * [Decimal To Fraction](maths/decimal_to_fraction.py)
  * [Dodecahedron](maths/dodecahedron.py)
  * [Double Factorial](maths/double_factorial.py)
  * [Dual Number Automatic Differentiation](maths/dual_number_automatic_differentiation.py)
  * [Entropy](maths/entropy.py)
  * [Euclidean Distance](maths/euclidean_distance.py)
  * [Euler Method](maths/euler_method.py)
  * [Euler Modified](maths/euler_modified.py)
  * [Eulers Totient](maths/eulers_totient.py)
  * [Extended Euclidean Algorithm](maths/extended_euclidean_algorithm.py)
  * [Factorial](maths/factorial.py)
  * [Factors](maths/factors.py)
  * [Fast Inverse Sqrt](maths/fast_inverse_sqrt.py)
  * [Fermat Little Theorem](maths/fermat_little_theorem.py)
  * [Fibonacci](maths/fibonacci.py)
  * [Find Max](maths/find_max.py)
  * [Find Min](maths/find_min.py)
  * [Floor](maths/floor.py)
  * [Gamma](maths/gamma.py)
  * [Gaussian](maths/gaussian.py)
  * [Gcd Of N Numbers](maths/gcd_of_n_numbers.py)
  * [Geometric Mean](maths/geometric_mean.py)
  * [Germain Primes](maths/germain_primes.py)
  * [Greatest Common Divisor](maths/greatest_common_divisor.py)
  * [Hardy Ramanujanalgo](maths/hardy_ramanujanalgo.py)
  * [Integer Square Root](maths/integer_square_root.py)
  * [Interquartile Range](maths/interquartile_range.py)
  * [Is Int Palindrome](maths/is_int_palindrome.py)
  * [Is Ip V4 Address Valid](maths/is_ip_v4_address_valid.py)
  * [Is Square Free](maths/is_square_free.py)
  * [Jaccard Similarity](maths/jaccard_similarity.py)
  * [Joint Probability Distribution](maths/joint_probability_distribution.py)
  * [Josephus Problem](maths/josephus_problem.py)
  * [Juggler Sequence](maths/juggler_sequence.py)
  * [Karatsuba](maths/karatsuba.py)
  * [Kth Lexicographic Permutation](maths/kth_lexicographic_permutation.py)
  * [Largest Of Very Large Numbers](maths/largest_of_very_large_numbers.py)
  * [Least Common Multiple](maths/least_common_multiple.py)
  * [Line Length](maths/line_length.py)
  * [Liouville Lambda](maths/liouville_lambda.py)
  * [Lucas Lehmer Primality Test](maths/lucas_lehmer_primality_test.py)
  * [Lucas Series](maths/lucas_series.py)
  * [Maclaurin Series](maths/maclaurin_series.py)
  * [Manhattan Distance](maths/manhattan_distance.py)
  * [Matrix Exponentiation](maths/matrix_exponentiation.py)
  * [Max Sum Sliding Window](maths/max_sum_sliding_window.py)
  * [Minkowski Distance](maths/minkowski_distance.py)
  * [Mobius Function](maths/mobius_function.py)
  * [Modular Division](maths/modular_division.py)
  * [Modular Exponential](maths/modular_exponential.py)
  * [Monte Carlo](maths/monte_carlo.py)
  * [Monte Carlo Dice](maths/monte_carlo_dice.py)
  * [Number Of Digits](maths/number_of_digits.py)
  * Numerical Analysis
    * [Adams Bashforth](maths/numerical_analysis/adams_bashforth.py)
    * [Bisection](maths/numerical_analysis/bisection.py)
    * [Bisection 2](maths/numerical_analysis/bisection_2.py)
    * [Integration By Simpson Approx](maths/numerical_analysis/integration_by_simpson_approx.py)
    * [Intersection](maths/numerical_analysis/intersection.py)
    * [Nevilles Method](maths/numerical_analysis/nevilles_method.py)
    * [Newton Forward Interpolation](maths/numerical_analysis/newton_forward_interpolation.py)
    * [Newton Raphson](maths/numerical_analysis/newton_raphson.py)
    * [Numerical Integration](maths/numerical_analysis/numerical_integration.py)
    * [Proper Fractions](maths/numerical_analysis/proper_fractions.py)
    * [Runge Kutta](maths/numerical_analysis/runge_kutta.py)
    * [Runge Kutta Fehlberg 45](maths/numerical_analysis/runge_kutta_fehlberg_45.py)
    * [Runge Kutta Gills](maths/numerical_analysis/runge_kutta_gills.py)
    * [Secant Method](maths/numerical_analysis/secant_method.py)
    * [Simpson Rule](maths/numerical_analysis/simpson_rule.py)
    * [Square Root](maths/numerical_analysis/square_root.py)
    * [Weierstrass Method](maths/numerical_analysis/weierstrass_method.py)
  * [Odd Sieve](maths/odd_sieve.py)
  * [Perfect Cube](maths/perfect_cube.py)
  * [Perfect Number](maths/perfect_number.py)
  * [Perfect Square](maths/perfect_square.py)
  * [Persistence](maths/persistence.py)
  * [Pi Generator](maths/pi_generator.py)
  * [Pi Monte Carlo Estimation](maths/pi_monte_carlo_estimation.py)
  * [Points Are Collinear 3D](maths/points_are_collinear_3d.py)
  * [Pollard Rho](maths/pollard_rho.py)
  * [Polynomial Evaluation](maths/polynomial_evaluation.py)
  * Polynomials
    * [Single Indeterminate Operations](maths/polynomials/single_indeterminate_operations.py)
  * [Power Using Recursion](maths/power_using_recursion.py)
  * [Prime Check](maths/prime_check.py)
  * [Prime Factors](maths/prime_factors.py)
  * [Prime Numbers](maths/prime_numbers.py)
  * [Prime Sieve Eratosthenes](maths/prime_sieve_eratosthenes.py)
  * [Primelib](maths/primelib.py)
  * [Print Multiplication Table](maths/print_multiplication_table.py)
  * [Pythagoras](maths/pythagoras.py)
  * [Qr Decomposition](maths/qr_decomposition.py)
  * [Quadratic Equations Complex Numbers](maths/quadratic_equations_complex_numbers.py)
  * [Radians](maths/radians.py)
  * [Radix2 Fft](maths/radix2_fft.py)
  * [Remove Digit](maths/remove_digit.py)
  * [Segmented Sieve](maths/segmented_sieve.py)
  * Series
    * [Arithmetic](maths/series/arithmetic.py)
    * [Geometric](maths/series/geometric.py)
    * [Geometric Series](maths/series/geometric_series.py)
    * [Harmonic](maths/series/harmonic.py)
    * [Harmonic Series](maths/series/harmonic_series.py)
    * [Hexagonal Numbers](maths/series/hexagonal_numbers.py)
    * [P Series](maths/series/p_series.py)
  * [Sieve Of Eratosthenes](maths/sieve_of_eratosthenes.py)
  * [Sigmoid](maths/sigmoid.py)
  * [Signum](maths/signum.py)
  * [Simultaneous Linear Equation Solver](maths/simultaneous_linear_equation_solver.py)
  * [Sin](maths/sin.py)
  * [Sock Merchant](maths/sock_merchant.py)
  * [Softmax](maths/softmax.py)
  * [Solovay Strassen Primality Test](maths/solovay_strassen_primality_test.py)
  * [Spearman Rank Correlation Coefficient](maths/spearman_rank_correlation_coefficient.py)
  * Special Numbers
    * [Armstrong Numbers](maths/special_numbers/armstrong_numbers.py)
    * [Automorphic Number](maths/special_numbers/automorphic_number.py)
    * [Bell Numbers](maths/special_numbers/bell_numbers.py)
    * [Carmichael Number](maths/special_numbers/carmichael_number.py)
    * [Catalan Number](maths/special_numbers/catalan_number.py)
    * [Hamming Numbers](maths/special_numbers/hamming_numbers.py)
    * [Happy Number](maths/special_numbers/happy_number.py)
    * [Harshad Numbers](maths/special_numbers/harshad_numbers.py)
    * [Hexagonal Number](maths/special_numbers/hexagonal_number.py)
    * [Krishnamurthy Number](maths/special_numbers/krishnamurthy_number.py)
    * [Perfect Number](maths/special_numbers/perfect_number.py)
    * [Polygonal Numbers](maths/special_numbers/polygonal_numbers.py)
    * [Pronic Number](maths/special_numbers/pronic_number.py)
    * [Proth Number](maths/special_numbers/proth_number.py)
    * [Triangular Numbers](maths/special_numbers/triangular_numbers.py)
    * [Ugly Numbers](maths/special_numbers/ugly_numbers.py)
    * [Weird Number](maths/special_numbers/weird_number.py)
  * [Sum Of Arithmetic Series](maths/sum_of_arithmetic_series.py)
  * [Sum Of Digits](maths/sum_of_digits.py)
  * [Sum Of Geometric Progression](maths/sum_of_geometric_progression.py)
  * [Sum Of Harmonic Series](maths/sum_of_harmonic_series.py)
  * [Sumset](maths/sumset.py)
  * [Sylvester Sequence](maths/sylvester_sequence.py)
  * [Tanh](maths/tanh.py)
  * [Test Factorial](maths/test_factorial.py)
  * [Test Prime Check](maths/test_prime_check.py)
  * [Three Sum](maths/three_sum.py)
  * [Trapezoidal Rule](maths/trapezoidal_rule.py)
  * [Triplet Sum](maths/triplet_sum.py)
  * [Twin Prime](maths/twin_prime.py)
  * [Two Pointer](maths/two_pointer.py)
  * [Two Sum](maths/two_sum.py)
  * [Volume](maths/volume.py)
  * [Zellers Congruence](maths/zellers_congruence.py)

## Matrix
  * [Binary Search Matrix](matrix/binary_search_matrix.py)
  * [Count Islands In Matrix](matrix/count_islands_in_matrix.py)
  * [Count Negative Numbers In Sorted Matrix](matrix/count_negative_numbers_in_sorted_matrix.py)
  * [Count Paths](matrix/count_paths.py)
  * [Cramers Rule 2X2](matrix/cramers_rule_2x2.py)
  * [Inverse Of Matrix](matrix/inverse_of_matrix.py)
  * [Largest Square Area In Matrix](matrix/largest_square_area_in_matrix.py)
  * [Matrix Based Game](matrix/matrix_based_game.py)
  * [Matrix Class](matrix/matrix_class.py)
  * [Matrix Equalization](matrix/matrix_equalization.py)
  * [Matrix Multiplication Recursion](matrix/matrix_multiplication_recursion.py)
  * [Matrix Operation](matrix/matrix_operation.py)
  * [Max Area Of Island](matrix/max_area_of_island.py)
  * [Median Matrix](matrix/median_matrix.py)
  * [Nth Fibonacci Using Matrix Exponentiation](matrix/nth_fibonacci_using_matrix_exponentiation.py)
  * [Pascal Triangle](matrix/pascal_triangle.py)
  * [Rotate Matrix](matrix/rotate_matrix.py)
  * [Searching In Sorted Matrix](matrix/searching_in_sorted_matrix.py)
  * [Sherman Morrison](matrix/sherman_morrison.py)
  * [Spiral Print](matrix/spiral_print.py)
  * Tests
    * [Test Matrix Operation](matrix/tests/test_matrix_operation.py)
  * [Validate Sudoku Board](matrix/validate_sudoku_board.py)

## Networking Flow
  * [Ford Fulkerson](networking_flow/ford_fulkerson.py)
  * [Minimum Cut](networking_flow/minimum_cut.py)

## Neural Network
  * Activation Functions
    * [Binary Step](neural_network/activation_functions/binary_step.py)
    * [Exponential Linear Unit](neural_network/activation_functions/exponential_linear_unit.py)
    * [Gaussian Error Linear Unit](neural_network/activation_functions/gaussian_error_linear_unit.py)
    * [Leaky Rectified Linear Unit](neural_network/activation_functions/leaky_rectified_linear_unit.py)
    * [Mish](neural_network/activation_functions/mish.py)
    * [Rectified Linear Unit](neural_network/activation_functions/rectified_linear_unit.py)
    * [Scaled Exponential Linear Unit](neural_network/activation_functions/scaled_exponential_linear_unit.py)
    * [Soboleva Modified Hyperbolic Tangent](neural_network/activation_functions/soboleva_modified_hyperbolic_tangent.py)
    * [Softplus](neural_network/activation_functions/softplus.py)
    * [Squareplus](neural_network/activation_functions/squareplus.py)
    * [Swish](neural_network/activation_functions/swish.py)
  * [Back Propagation Neural Network](neural_network/back_propagation_neural_network.py)
  * [Convolution Neural Network](neural_network/convolution_neural_network.py)
  * [Input Data](neural_network/input_data.py)
  * [Simple Neural Network](neural_network/simple_neural_network.py)
  * [Two Hidden Layers Neural Network](neural_network/two_hidden_layers_neural_network.py)

## Other
  * [Activity Selection](other/activity_selection.py)
  * [Alternative List Arrange](other/alternative_list_arrange.py)
  * [Bankers Algorithm](other/bankers_algorithm.py)
  * [Davis Putnam Logemann Loveland](other/davis_putnam_logemann_loveland.py)
  * [Doomsday](other/doomsday.py)
  * [Fischer Yates Shuffle](other/fischer_yates_shuffle.py)
  * [Gauss Easter](other/gauss_easter.py)
  * [Graham Scan](other/graham_scan.py)
  * [Greedy](other/greedy.py)
  * [Guess The Number Search](other/guess_the_number_search.py)
  * [H Index](other/h_index.py)
  * [Least Recently Used](other/least_recently_used.py)
  * [Lfu Cache](other/lfu_cache.py)
  * [Linear Congruential Generator](other/linear_congruential_generator.py)
  * [Lru Cache](other/lru_cache.py)
  * [Magicdiamondpattern](other/magicdiamondpattern.py)
  * [Majority Vote Algorithm](other/majority_vote_algorithm.py)
  * [Maximum Subsequence](other/maximum_subsequence.py)
  * [Nested Brackets](other/nested_brackets.py)
  * [Number Container System](other/number_container_system.py)
  * [Password](other/password.py)
  * [Quine](other/quine.py)
  * [Scoring Algorithm](other/scoring_algorithm.py)
  * [Sdes](other/sdes.py)
  * [Sliding Window Maximum](other/sliding_window_maximum.py)
  * [Tower Of Hanoi](other/tower_of_hanoi.py)
  * [Word Search](other/word_search.py)

## Physics
  * [Altitude Pressure](physics/altitude_pressure.py)
  * [Archimedes Principle Of Buoyant Force](physics/archimedes_principle_of_buoyant_force.py)
  * [Basic Orbital Capture](physics/basic_orbital_capture.py)
  * [Casimir Effect](physics/casimir_effect.py)
  * [Center Of Mass](physics/center_of_mass.py)
  * [Centripetal Force](physics/centripetal_force.py)
  * [Coulombs Law](physics/coulombs_law.py)
  * [Doppler Frequency](physics/doppler_frequency.py)
  * [Escape Velocity](physics/escape_velocity.py)
  * [Grahams Law](physics/grahams_law.py)
  * [Horizontal Projectile Motion](physics/horizontal_projectile_motion.py)
  * [Hubble Parameter](physics/hubble_parameter.py)
  * [Ideal Gas Law](physics/ideal_gas_law.py)
  * [In Static Equilibrium](physics/in_static_equilibrium.py)
  * [Kinetic Energy](physics/kinetic_energy.py)
  * [Lens Formulae](physics/lens_formulae.py)
  * [Lorentz Transformation Four Vector](physics/lorentz_transformation_four_vector.py)
  * [Malus Law](physics/malus_law.py)
  * [Mass Energy Equivalence](physics/mass_energy_equivalence.py)
  * [Mirror Formulae](physics/mirror_formulae.py)
  * [N Body Simulation](physics/n_body_simulation.py)
  * [Newtons Law Of Gravitation](physics/newtons_law_of_gravitation.py)
  * [Newtons Second Law Of Motion](physics/newtons_second_law_of_motion.py)
  * [Orbital Transfer Work](physics/orbital_transfer_work.py)
  * [Period Of Pendulum](physics/period_of_pendulum.py)
  * [Photoelectric Effect](physics/photoelectric_effect.py)
  * [Potential Energy](physics/potential_energy.py)
  * [Rainfall Intensity](physics/rainfall_intensity.py)
  * [Reynolds Number](physics/reynolds_number.py)
  * [Rms Speed Of Molecule](physics/rms_speed_of_molecule.py)
  * [Shear Stress](physics/shear_stress.py)
  * [Speed Of Sound](physics/speed_of_sound.py)
  * [Speeds Of Gas Molecules](physics/speeds_of_gas_molecules.py)
  * [Terminal Velocity](physics/terminal_velocity.py)

## Project Euler
  * Problem 001
    * [Sol1](project_euler/problem_001/sol1.py)
    * [Sol2](project_euler/problem_001/sol2.py)
    * [Sol3](project_euler/problem_001/sol3.py)
    * [Sol4](project_euler/problem_001/sol4.py)
    * [Sol5](project_euler/problem_001/sol5.py)
    * [Sol6](project_euler/problem_001/sol6.py)
    * [Sol7](project_euler/problem_001/sol7.py)
  * Problem 002
    * [Sol1](project_euler/problem_002/sol1.py)
    * [Sol2](project_euler/problem_002/sol2.py)
    * [Sol3](project_euler/problem_002/sol3.py)
    * [Sol4](project_euler/problem_002/sol4.py)
    * [Sol5](project_euler/problem_002/sol5.py)
  * Problem 003
    * [Sol1](project_euler/problem_003/sol1.py)
    * [Sol2](project_euler/problem_003/sol2.py)
    * [Sol3](project_euler/problem_003/sol3.py)
  * Problem 004
    * [Sol1](project_euler/problem_004/sol1.py)
    * [Sol2](project_euler/problem_004/sol2.py)
  * Problem 005
    * [Sol1](project_euler/problem_005/sol1.py)
    * [Sol2](project_euler/problem_005/sol2.py)
  * Problem 006
    * [Sol1](project_euler/problem_006/sol1.py)
    * [Sol2](project_euler/problem_006/sol2.py)
    * [Sol3](project_euler/problem_006/sol3.py)
    * [Sol4](project_euler/problem_006/sol4.py)
  * Problem 007
    * [Sol1](project_euler/problem_007/sol1.py)
    * [Sol2](project_euler/problem_007/sol2.py)
    * [Sol3](project_euler/problem_007/sol3.py)
  * Problem 008
    * [Sol1](project_euler/problem_008/sol1.py)
    * [Sol2](project_euler/problem_008/sol2.py)
    * [Sol3](project_euler/problem_008/sol3.py)
  * Problem 009
    * [Sol1](project_euler/problem_009/sol1.py)
    * [Sol2](project_euler/problem_009/sol2.py)
    * [Sol3](project_euler/problem_009/sol3.py)
    * [Sol4](project_euler/problem_009/sol4.py)
  * Problem 010
    * [Sol1](project_euler/problem_010/sol1.py)
    * [Sol2](project_euler/problem_010/sol2.py)
    * [Sol3](project_euler/problem_010/sol3.py)
  * Problem 011
    * [Sol1](project_euler/problem_011/sol1.py)
    * [Sol2](project_euler/problem_011/sol2.py)
  * Problem 012
    * [Sol1](project_euler/problem_012/sol1.py)
    * [Sol2](project_euler/problem_012/sol2.py)
  * Problem 013
    * [Sol1](project_euler/problem_013/sol1.py)
  * Problem 014
    * [Sol1](project_euler/problem_014/sol1.py)
    * [Sol2](project_euler/problem_014/sol2.py)
  * Problem 015
    * [Sol1](project_euler/problem_015/sol1.py)
    * [Sol2](project_euler/problem_015/sol2.py)
  * Problem 016
    * [Sol1](project_euler/problem_016/sol1.py)
    * [Sol2](project_euler/problem_016/sol2.py)
  * Problem 017
    * [Sol1](project_euler/problem_017/sol1.py)
  * Problem 018
    * [Solution](project_euler/problem_018/solution.py)
  * Problem 019
    * [Sol1](project_euler/problem_019/sol1.py)
  * Problem 020
    * [Sol1](project_euler/problem_020/sol1.py)
    * [Sol2](project_euler/problem_020/sol2.py)
    * [Sol3](project_euler/problem_020/sol3.py)
    * [Sol4](project_euler/problem_020/sol4.py)
  * Problem 021
    * [Sol1](project_euler/problem_021/sol1.py)
  * Problem 022
    * [Sol1](project_euler/problem_022/sol1.py)
    * [Sol2](project_euler/problem_022/sol2.py)
  * Problem 023
    * [Sol1](project_euler/problem_023/sol1.py)
  * Problem 024
    * [Sol1](project_euler/problem_024/sol1.py)
  * Problem 025
    * [Sol1](project_euler/problem_025/sol1.py)
    * [Sol2](project_euler/problem_025/sol2.py)
    * [Sol3](project_euler/problem_025/sol3.py)
  * Problem 026
    * [Sol1](project_euler/problem_026/sol1.py)
  * Problem 027
    * [Sol1](project_euler/problem_027/sol1.py)
  * Problem 028
    * [Sol1](project_euler/problem_028/sol1.py)
  * Problem 029
    * [Sol1](project_euler/problem_029/sol1.py)
  * Problem 030
    * [Sol1](project_euler/problem_030/sol1.py)
  * Problem 031
    * [Sol1](project_euler/problem_031/sol1.py)
    * [Sol2](project_euler/problem_031/sol2.py)
  * Problem 032
    * [Sol32](project_euler/problem_032/sol32.py)
  * Problem 033
    * [Sol1](project_euler/problem_033/sol1.py)
  * Problem 034
    * [Sol1](project_euler/problem_034/sol1.py)
  * Problem 035
    * [Sol1](project_euler/problem_035/sol1.py)
  * Problem 036
    * [Sol1](project_euler/problem_036/sol1.py)
  * Problem 037
    * [Sol1](project_euler/problem_037/sol1.py)
  * Problem 038
    * [Sol1](project_euler/problem_038/sol1.py)
  * Problem 039
    * [Sol1](project_euler/problem_039/sol1.py)
  * Problem 040
    * [Sol1](project_euler/problem_040/sol1.py)
  * Problem 041
    * [Sol1](project_euler/problem_041/sol1.py)
  * Problem 042
    * [Solution42](project_euler/problem_042/solution42.py)
  * Problem 043
    * [Sol1](project_euler/problem_043/sol1.py)
  * Problem 044
    * [Sol1](project_euler/problem_044/sol1.py)
  * Problem 045
    * [Sol1](project_euler/problem_045/sol1.py)
  * Problem 046
    * [Sol1](project_euler/problem_046/sol1.py)
  * Problem 047
    * [Sol1](project_euler/problem_047/sol1.py)
  * Problem 048
    * [Sol1](project_euler/problem_048/sol1.py)
  * Problem 049
    * [Sol1](project_euler/problem_049/sol1.py)
  * Problem 050
    * [Sol1](project_euler/problem_050/sol1.py)
  * Problem 051
    * [Sol1](project_euler/problem_051/sol1.py)
  * Problem 052
    * [Sol1](project_euler/problem_052/sol1.py)
  * Problem 053
    * [Sol1](project_euler/problem_053/sol1.py)
  * Problem 054
    * [Sol1](project_euler/problem_054/sol1.py)
    * [Test Poker Hand](project_euler/problem_054/test_poker_hand.py)
  * Problem 055
    * [Sol1](project_euler/problem_055/sol1.py)
  * Problem 056
    * [Sol1](project_euler/problem_056/sol1.py)
  * Problem 057
    * [Sol1](project_euler/problem_057/sol1.py)
  * Problem 058
    * [Sol1](project_euler/problem_058/sol1.py)
  * Problem 059
    * [Sol1](project_euler/problem_059/sol1.py)
  * Problem 062
    * [Sol1](project_euler/problem_062/sol1.py)
  * Problem 063
    * [Sol1](project_euler/problem_063/sol1.py)
  * Problem 064
    * [Sol1](project_euler/problem_064/sol1.py)
  * Problem 065
    * [Sol1](project_euler/problem_065/sol1.py)
  * Problem 067
    * [Sol1](project_euler/problem_067/sol1.py)
    * [Sol2](project_euler/problem_067/sol2.py)
  * Problem 068
    * [Sol1](project_euler/problem_068/sol1.py)
  * Problem 069
    * [Sol1](project_euler/problem_069/sol1.py)
  * Problem 070
    * [Sol1](project_euler/problem_070/sol1.py)
  * Problem 071
    * [Sol1](project_euler/problem_071/sol1.py)
  * Problem 072
    * [Sol1](project_euler/problem_072/sol1.py)
    * [Sol2](project_euler/problem_072/sol2.py)
  * Problem 073
    * [Sol1](project_euler/problem_073/sol1.py)
  * Problem 074
    * [Sol1](project_euler/problem_074/sol1.py)
    * [Sol2](project_euler/problem_074/sol2.py)
  * Problem 075
    * [Sol1](project_euler/problem_075/sol1.py)
  * Problem 076
    * [Sol1](project_euler/problem_076/sol1.py)
  * Problem 077
    * [Sol1](project_euler/problem_077/sol1.py)
  * Problem 078
    * [Sol1](project_euler/problem_078/sol1.py)
  * Problem 079
    * [Sol1](project_euler/problem_079/sol1.py)
  * Problem 080
    * [Sol1](project_euler/problem_080/sol1.py)
  * Problem 081
    * [Sol1](project_euler/problem_081/sol1.py)
  * Problem 082
    * [Sol1](project_euler/problem_082/sol1.py)
  * Problem 085
    * [Sol1](project_euler/problem_085/sol1.py)
  * Problem 086
    * [Sol1](project_euler/problem_086/sol1.py)
  * Problem 087
    * [Sol1](project_euler/problem_087/sol1.py)
  * Problem 089
    * [Sol1](project_euler/problem_089/sol1.py)
  * Problem 091
    * [Sol1](project_euler/problem_091/sol1.py)
  * Problem 092
    * [Sol1](project_euler/problem_092/sol1.py)
  * Problem 094
    * [Sol1](project_euler/problem_094/sol1.py)
  * Problem 095
    * [Sol1](project_euler/problem_095/sol1.py)
  * Problem 097
    * [Sol1](project_euler/problem_097/sol1.py)
  * Problem 099
    * [Sol1](project_euler/problem_099/sol1.py)
  * Problem 100
    * [Sol1](project_euler/problem_100/sol1.py)
  * Problem 101
    * [Sol1](project_euler/problem_101/sol1.py)
  * Problem 102
    * [Sol1](project_euler/problem_102/sol1.py)
  * Problem 104
    * [Sol1](project_euler/problem_104/sol1.py)
  * Problem 107
    * [Sol1](project_euler/problem_107/sol1.py)
  * Problem 109
    * [Sol1](project_euler/problem_109/sol1.py)
  * Problem 112
    * [Sol1](project_euler/problem_112/sol1.py)
  * Problem 113
    * [Sol1](project_euler/problem_113/sol1.py)
  * Problem 114
    * [Sol1](project_euler/problem_114/sol1.py)
  * Problem 115
    * [Sol1](project_euler/problem_115/sol1.py)
  * Problem 116
    * [Sol1](project_euler/problem_116/sol1.py)
  * Problem 117
    * [Sol1](project_euler/problem_117/sol1.py)
  * Problem 119
    * [Sol1](project_euler/problem_119/sol1.py)
  * Problem 120
    * [Sol1](project_euler/problem_120/sol1.py)
  * Problem 121
    * [Sol1](project_euler/problem_121/sol1.py)
  * Problem 122
    * [Sol1](project_euler/problem_122/sol1.py)
  * Problem 123
    * [Sol1](project_euler/problem_123/sol1.py)
  * Problem 125
    * [Sol1](project_euler/problem_125/sol1.py)
  * Problem 129
    * [Sol1](project_euler/problem_129/sol1.py)
  * Problem 131
    * [Sol1](project_euler/problem_131/sol1.py)
  * Problem 135
    * [Sol1](project_euler/problem_135/sol1.py)
  * Problem 136
    * [Sol1](project_euler/problem_136/sol1.py)
  * Problem 144
    * [Sol1](project_euler/problem_144/sol1.py)
  * Problem 145
    * [Sol1](project_euler/problem_145/sol1.py)
  * Problem 164
    * [Sol1](project_euler/problem_164/sol1.py)
  * Problem 173
    * [Sol1](project_euler/problem_173/sol1.py)
  * Problem 174
    * [Sol1](project_euler/problem_174/sol1.py)
  * Problem 180
    * [Sol1](project_euler/problem_180/sol1.py)
  * Problem 187
    * [Sol1](project_euler/problem_187/sol1.py)
  * Problem 188
    * [Sol1](project_euler/problem_188/sol1.py)
  * Problem 190
    * [Sol1](project_euler/problem_190/sol1.py)
  * Problem 191
    * [Sol1](project_euler/problem_191/sol1.py)
  * Problem 203
    * [Sol1](project_euler/problem_203/sol1.py)
  * Problem 205
    * [Sol1](project_euler/problem_205/sol1.py)
  * Problem 206
    * [Sol1](project_euler/problem_206/sol1.py)
  * Problem 207
    * [Sol1](project_euler/problem_207/sol1.py)
  * Problem 234
    * [Sol1](project_euler/problem_234/sol1.py)
  * Problem 301
    * [Sol1](project_euler/problem_301/sol1.py)
  * Problem 345
    * [Sol1](project_euler/problem_345/sol1.py)
  * Problem 493
    * [Sol1](project_euler/problem_493/sol1.py)
  * Problem 551
    * [Sol1](project_euler/problem_551/sol1.py)
  * Problem 587
    * [Sol1](project_euler/problem_587/sol1.py)
  * Problem 686
    * [Sol1](project_euler/problem_686/sol1.py)
  * Problem 800
    * [Sol1](project_euler/problem_800/sol1.py)

## Quantum
  * [Q Fourier Transform](quantum/q_fourier_transform.py)

## Scheduling
  * [First Come First Served](scheduling/first_come_first_served.py)
  * [Highest Response Ratio Next](scheduling/highest_response_ratio_next.py)
  * [Job Sequence With Deadline](scheduling/job_sequence_with_deadline.py)
  * [Job Sequencing With Deadline](scheduling/job_sequencing_with_deadline.py)
  * [Multi Level Feedback Queue](scheduling/multi_level_feedback_queue.py)
  * [Non Preemptive Shortest Job First](scheduling/non_preemptive_shortest_job_first.py)
  * [Round Robin](scheduling/round_robin.py)
  * [Shortest Job First](scheduling/shortest_job_first.py)

## Searches
  * [Binary Search](searches/binary_search.py)
  * [Binary Tree Traversal](searches/binary_tree_traversal.py)
  * [Double Linear Search](searches/double_linear_search.py)
  * [Double Linear Search Recursion](searches/double_linear_search_recursion.py)
  * [Exponential Search](searches/exponential_search.py)
  * [Fibonacci Search](searches/fibonacci_search.py)
  * [Hill Climbing](searches/hill_climbing.py)
  * [Interpolation Search](searches/interpolation_search.py)
  * [Jump Search](searches/jump_search.py)
  * [Linear Search](searches/linear_search.py)
  * [Median Of Medians](searches/median_of_medians.py)
  * [Quick Select](searches/quick_select.py)
  * [Sentinel Linear Search](searches/sentinel_linear_search.py)
  * [Simple Binary Search](searches/simple_binary_search.py)
  * [Simulated Annealing](searches/simulated_annealing.py)
  * [Tabu Search](searches/tabu_search.py)
  * [Ternary Search](searches/ternary_search.py)

## Sorts
  * [Bead Sort](sorts/bead_sort.py)
  * [Binary Insertion Sort](sorts/binary_insertion_sort.py)
  * [Bitonic Sort](sorts/bitonic_sort.py)
  * [Bogo Sort](sorts/bogo_sort.py)
  * [Bubble Sort](sorts/bubble_sort.py)
  * [Bucket Sort](sorts/bucket_sort.py)
  * [Circle Sort](sorts/circle_sort.py)
  * [Cocktail Shaker Sort](sorts/cocktail_shaker_sort.py)
  * [Comb Sort](sorts/comb_sort.py)
  * [Counting Sort](sorts/counting_sort.py)
  * [Cycle Sort](sorts/cycle_sort.py)
  * [Cyclic Sort](sorts/cyclic_sort.py)
  * [Double Sort](sorts/double_sort.py)
  * [Dutch National Flag Sort](sorts/dutch_national_flag_sort.py)
  * [Exchange Sort](sorts/exchange_sort.py)
  * [External Sort](sorts/external_sort.py)
  * [Gnome Sort](sorts/gnome_sort.py)
  * [Heap Sort](sorts/heap_sort.py)
  * [Insertion Sort](sorts/insertion_sort.py)
  * [Intro Sort](sorts/intro_sort.py)
  * [Iterative Merge Sort](sorts/iterative_merge_sort.py)
  * [Merge Insertion Sort](sorts/merge_insertion_sort.py)
  * [Merge Sort](sorts/merge_sort.py)
  * [Msd Radix Sort](sorts/msd_radix_sort.py)
  * [Natural Sort](sorts/natural_sort.py)
  * [Odd Even Sort](sorts/odd_even_sort.py)
  * [Odd Even Transposition Parallel](sorts/odd_even_transposition_parallel.py)
  * [Odd Even Transposition Single Threaded](sorts/odd_even_transposition_single_threaded.py)
  * [Pancake Sort](sorts/pancake_sort.py)
  * [Patience Sort](sorts/patience_sort.py)
  * [Pigeon Sort](sorts/pigeon_sort.py)
  * [Pigeonhole Sort](sorts/pigeonhole_sort.py)
  * [Quick Sort](sorts/quick_sort.py)
  * [Quick Sort 3 Partition](sorts/quick_sort_3_partition.py)
  * [Radix Sort](sorts/radix_sort.py)
  * [Recursive Insertion Sort](sorts/recursive_insertion_sort.py)
  * [Recursive Mergesort Array](sorts/recursive_mergesort_array.py)
  * [Recursive Quick Sort](sorts/recursive_quick_sort.py)
  * [Selection Sort](sorts/selection_sort.py)
  * [Shell Sort](sorts/shell_sort.py)
  * [Shrink Shell Sort](sorts/shrink_shell_sort.py)
  * [Slowsort](sorts/slowsort.py)
  * [Stalin Sort](sorts/stalin_sort.py)
  * [Stooge Sort](sorts/stooge_sort.py)
  * [Strand Sort](sorts/strand_sort.py)
  * [Tim Sort](sorts/tim_sort.py)
  * [Topological Sort](sorts/topological_sort.py)
  * [Tree Sort](sorts/tree_sort.py)
  * [Unknown Sort](sorts/unknown_sort.py)
  * [Wiggle Sort](sorts/wiggle_sort.py)

## Strings
  * [Aho Corasick](strings/aho_corasick.py)
  * [Alternative String Arrange](strings/alternative_string_arrange.py)
  * [Anagrams](strings/anagrams.py)
  * [Autocomplete Using Trie](strings/autocomplete_using_trie.py)
  * [Barcode Validator](strings/barcode_validator.py)
  * [Bitap String Match](strings/bitap_string_match.py)
  * [Boyer Moore Search](strings/boyer_moore_search.py)
  * [Camel Case To Snake Case](strings/camel_case_to_snake_case.py)
  * [Can String Be Rearranged As Palindrome](strings/can_string_be_rearranged_as_palindrome.py)
  * [Capitalize](strings/capitalize.py)
  * [Check Anagrams](strings/check_anagrams.py)
  * [Count Vowels](strings/count_vowels.py)
  * [Credit Card Validator](strings/credit_card_validator.py)
  * [Damerau Levenshtein Distance](strings/damerau_levenshtein_distance.py)
  * [Detecting English Programmatically](strings/detecting_english_programmatically.py)
  * [Dna](strings/dna.py)
  * [Edit Distance](strings/edit_distance.py)
  * [Frequency Finder](strings/frequency_finder.py)
  * [Hamming Distance](strings/hamming_distance.py)
  * [Indian Phone Validator](strings/indian_phone_validator.py)
  * [Is Contains Unique Chars](strings/is_contains_unique_chars.py)
  * [Is Isogram](strings/is_isogram.py)
  * [Is Pangram](strings/is_pangram.py)
  * [Is Polish National Id](strings/is_polish_national_id.py)
  * [Is Spain National Id](strings/is_spain_national_id.py)
  * [Is Srilankan Phone Number](strings/is_srilankan_phone_number.py)
  * [Is Valid Email Address](strings/is_valid_email_address.py)
  * [Jaro Winkler](strings/jaro_winkler.py)
  * [Join](strings/join.py)
  * [Knuth Morris Pratt](strings/knuth_morris_pratt.py)
  * [Levenshtein Distance](strings/levenshtein_distance.py)
  * [Lower](strings/lower.py)
  * [Manacher](strings/manacher.py)
  * [Min Cost String Conversion](strings/min_cost_string_conversion.py)
  * [Naive String Search](strings/naive_string_search.py)
  * [Ngram](strings/ngram.py)
  * [Palindrome](strings/palindrome.py)
  * [Pig Latin](strings/pig_latin.py)
  * [Prefix Function](strings/prefix_function.py)
  * [Rabin Karp](strings/rabin_karp.py)
  * [Remove Duplicate](strings/remove_duplicate.py)
  * [Reverse Letters](strings/reverse_letters.py)
  * [Reverse Words](strings/reverse_words.py)
  * [Snake Case To Camel Pascal Case](strings/snake_case_to_camel_pascal_case.py)
  * [Split](strings/split.py)
  * [String Switch Case](strings/string_switch_case.py)
  * [Strip](strings/strip.py)
  * [Text Justification](strings/text_justification.py)
  * [Title](strings/title.py)
  * [Top K Frequent Words](strings/top_k_frequent_words.py)
  * [Upper](strings/upper.py)
  * [Wave String](strings/wave_string.py)
  * [Wildcard Pattern Matching](strings/wildcard_pattern_matching.py)
  * [Word Occurrence](strings/word_occurrence.py)
  * [Word Patterns](strings/word_patterns.py)
  * [Z Function](strings/z_function.py)

## Web Programming
  * [Co2 Emission](web_programming/co2_emission.py)
  * [Covid Stats Via Xpath](web_programming/covid_stats_via_xpath.py)
  * [Crawl Google Results](web_programming/crawl_google_results.py)
  * [Crawl Google Scholar Citation](web_programming/crawl_google_scholar_citation.py)
  * [Currency Converter](web_programming/currency_converter.py)
  * [Current Stock Price](web_programming/current_stock_price.py)
  * [Current Weather](web_programming/current_weather.py)
  * [Daily Horoscope](web_programming/daily_horoscope.py)
  * [Download Images From Google Query](web_programming/download_images_from_google_query.py)
  * [Emails From Url](web_programming/emails_from_url.py)
  * [Fetch Anime And Play](web_programming/fetch_anime_and_play.py)
  * [Fetch Bbc News](web_programming/fetch_bbc_news.py)
  * [Fetch Github Info](web_programming/fetch_github_info.py)
  * [Fetch Jobs](web_programming/fetch_jobs.py)
  * [Fetch Quotes](web_programming/fetch_quotes.py)
  * [Fetch Well Rx Price](web_programming/fetch_well_rx_price.py)
  * [Get Amazon Product Data](web_programming/get_amazon_product_data.py)
  * [Get Imdb Top 250 Movies Csv](web_programming/get_imdb_top_250_movies_csv.py)
  * [Get Ip Geolocation](web_programming/get_ip_geolocation.py)
  * [Get Top Billionaires](web_programming/get_top_billionaires.py)
  * [Get Top Hn Posts](web_programming/get_top_hn_posts.py)
  * [Giphy](web_programming/giphy.py)
  * [Instagram Crawler](web_programming/instagram_crawler.py)
  * [Instagram Pic](web_programming/instagram_pic.py)
  * [Instagram Video](web_programming/instagram_video.py)
  * [Nasa Data](web_programming/nasa_data.py)
  * [Open Google Results](web_programming/open_google_results.py)
  * [Random Anime Character](web_programming/random_anime_character.py)
  * [Recaptcha Verification](web_programming/recaptcha_verification.py)
  * [Reddit](web_programming/reddit.py)
  * [Search Books By Isbn](web_programming/search_books_by_isbn.py)
  * [Slack Message](web_programming/slack_message.py)
  * [Test Fetch Github Info](web_programming/test_fetch_github_info.py)
  * [World Covid19 Stats](web_programming/world_covid19_stats.py)


================================================
FILE: LICENSE.md
================================================
## MIT License

Copyright (c) 2016-2022 TheAlgorithms and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
<div align="center">
<!-- Title: -->
  <a href="https://github.com/TheAlgorithms/">
    <img src="https://raw.githubusercontent.com/TheAlgorithms/website/1cd824df116b27029f17c2d1b42d81731f28a920/public/logo.svg" height="100">
  </a>
  <h1><a href="https://github.com/TheAlgorithms/">The Algorithms</a> - Python</h1>

<!-- Labels: -->
  <!-- First row: -->
  <a href="https://gitpod.io/#https://github.com/TheAlgorithms/Python">
    <img src="https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square" height="20" alt="Gitpod Ready-to-Code">
  </a>
  <a href="https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md">
    <img src="https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3&style=flat-square" height="20" alt="Contributions Welcome">
  </a>
  <img src="https://img.shields.io/github/repo-size/TheAlgorithms/Python.svg?label=Repo%20size&style=flat-square" height="20">
  <a href="https://the-algorithms.com/discord">
    <img src="https://img.shields.io/discord/808045925556682782.svg?logo=discord&colorB=7289DA&style=flat-square" height="20" alt="Discord chat">
  </a>
  <a href="https://gitter.im/TheAlgorithms/community">
    <img src="https://img.shields.io/badge/Chat-Gitter-ff69b4.svg?label=Chat&logo=gitter&style=flat-square" height="20" alt="Gitter chat">
  </a>

  <!-- Second row: -->
  <br>
  <a href="https://github.com/TheAlgorithms/Python/actions">
    <img src="https://img.shields.io/github/actions/workflow/status/TheAlgorithms/Python/build.yml?branch=master&label=CI&logo=github&style=flat-square" height="20" alt="GitHub Workflow Status">
  </a>
  <a href="https://github.com/pre-commit/pre-commit">
    <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" height="20" alt="pre-commit">
  </a>
  <a href="https://docs.astral.sh/ruff/formatter/">
    <img src="https://img.shields.io/static/v1?label=code%20style&message=ruff&color=black&style=flat-square" height="20" alt="code style: black">
  </a>

<!-- Short description: -->
  <h3>All algorithms implemented in Python - for education 📚</h3>
</div>

Implementations are for learning purposes only. They may be less efficient than the implementations in the Python standard library. Use them at your discretion.

## 🚀 Getting Started

📋 Read through our [Contribution Guidelines](CONTRIBUTING.md) before you contribute.

## 🌐 Community Channels

We are on [Discord](https://the-algorithms.com/discord) and [Gitter](https://gitter.im/TheAlgorithms/community)! Community channels are a great way for you to ask questions and get help. Please join us!

## 📜 List of Algorithms

See our [directory](DIRECTORY.md) for easier navigation and a better overview of the project.


================================================
FILE: audio_filters/README.md
================================================
# Audio Filter

Audio filters work on the frequency of an audio signal to attenuate unwanted frequency and amplify wanted ones.
They are used within anything related to sound, whether it is radio communication or a hi-fi system.

* <https://www.masteringbox.com/filter-types/>
* <http://ethanwiner.com/filters.html>
* <https://en.wikipedia.org/wiki/Audio_filter>
* <https://en.wikipedia.org/wiki/Electronic_filter>


================================================
FILE: audio_filters/__init__.py
================================================


================================================
FILE: audio_filters/butterworth_filter.py
================================================
from math import cos, sin, sqrt, tau

from audio_filters.iir_filter import IIRFilter

"""
Create 2nd-order IIR filters with Butterworth design.

Code based on https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html
Alternatively you can use scipy.signal.butter, which should yield the same results.
"""


def make_lowpass(
    frequency: int,
    samplerate: int,
    q_factor: float = 1 / sqrt(2),
) -> IIRFilter:
    """
    Creates a low-pass filter

    >>> filter = make_lowpass(1000, 48000)
    >>> filter.a_coeffs + filter.b_coeffs  # doctest: +NORMALIZE_WHITESPACE
    [1.0922959556412573, -1.9828897227476208, 0.9077040443587427, 0.004277569313094809,
     0.008555138626189618, 0.004277569313094809]
    """
    w0 = tau * frequency / samplerate
    _sin = sin(w0)
    _cos = cos(w0)
    alpha = _sin / (2 * q_factor)

    b0 = (1 - _cos) / 2
    b1 = 1 - _cos

    a0 = 1 + alpha
    a1 = -2 * _cos
    a2 = 1 - alpha

    filt = IIRFilter(2)
    filt.set_coefficients([a0, a1, a2], [b0, b1, b0])
    return filt


def make_highpass(
    frequency: int,
    samplerate: int,
    q_factor: float = 1 / sqrt(2),
) -> IIRFilter:
    """
    Creates a high-pass filter

    >>> filter = make_highpass(1000, 48000)
    >>> filter.a_coeffs + filter.b_coeffs  # doctest: +NORMALIZE_WHITESPACE
    [1.0922959556412573, -1.9828897227476208, 0.9077040443587427, 0.9957224306869052,
     -1.9914448613738105, 0.9957224306869052]
    """
    w0 = tau * frequency / samplerate
    _sin = sin(w0)
    _cos = cos(w0)
    alpha = _sin / (2 * q_factor)

    b0 = (1 + _cos) / 2
    b1 = -1 - _cos

    a0 = 1 + alpha
    a1 = -2 * _cos
    a2 = 1 - alpha

    filt = IIRFilter(2)
    filt.set_coefficients([a0, a1, a2], [b0, b1, b0])
    return filt


def make_bandpass(
    frequency: int,
    samplerate: int,
    q_factor: float = 1 / sqrt(2),
) -> IIRFilter:
    """
    Creates a band-pass filter

    >>> filter = make_bandpass(1000, 48000)
    >>> filter.a_coeffs + filter.b_coeffs  # doctest: +NORMALIZE_WHITESPACE
    [1.0922959556412573, -1.9828897227476208, 0.9077040443587427, 0.06526309611002579,
     0, -0.06526309611002579]
    """
    w0 = tau * frequency / samplerate
    _sin = sin(w0)
    _cos = cos(w0)
    alpha = _sin / (2 * q_factor)

    b0 = _sin / 2
    b1 = 0
    b2 = -b0

    a0 = 1 + alpha
    a1 = -2 * _cos
    a2 = 1 - alpha

    filt = IIRFilter(2)
    filt.set_coefficients([a0, a1, a2], [b0, b1, b2])
    return filt


def make_allpass(
    frequency: int,
    samplerate: int,
    q_factor: float = 1 / sqrt(2),
) -> IIRFilter:
    """
    Creates an all-pass filter

    >>> filter = make_allpass(1000, 48000)
    >>> filter.a_coeffs + filter.b_coeffs  # doctest: +NORMALIZE_WHITESPACE
    [1.0922959556412573, -1.9828897227476208, 0.9077040443587427, 0.9077040443587427,
     -1.9828897227476208, 1.0922959556412573]
    """
    w0 = tau * frequency / samplerate
    _sin = sin(w0)
    _cos = cos(w0)
    alpha = _sin / (2 * q_factor)

    b0 = 1 - alpha
    b1 = -2 * _cos
    b2 = 1 + alpha

    filt = IIRFilter(2)
    filt.set_coefficients([b2, b1, b0], [b0, b1, b2])
    return filt


def make_peak(
    frequency: int,
    samplerate: int,
    gain_db: float,
    q_factor: float = 1 / sqrt(2),
) -> IIRFilter:
    """
    Creates a peak filter

    >>> filter = make_peak(1000, 48000, 6)
    >>> filter.a_coeffs + filter.b_coeffs  # doctest: +NORMALIZE_WHITESPACE
    [1.0653405327119334, -1.9828897227476208, 0.9346594672880666, 1.1303715025601122,
     -1.9828897227476208, 0.8696284974398878]
    """
    w0 = tau * frequency / samplerate
    _sin = sin(w0)
    _cos = cos(w0)
    alpha = _sin / (2 * q_factor)
    big_a = 10 ** (gain_db / 40)

    b0 = 1 + alpha * big_a
    b1 = -2 * _cos
    b2 = 1 - alpha * big_a
    a0 = 1 + alpha / big_a
    a1 = -2 * _cos
    a2 = 1 - alpha / big_a

    filt = IIRFilter(2)
    filt.set_coefficients([a0, a1, a2], [b0, b1, b2])
    return filt


def make_lowshelf(
    frequency: int,
    samplerate: int,
    gain_db: float,
    q_factor: float = 1 / sqrt(2),
) -> IIRFilter:
    """
    Creates a low-shelf filter

    >>> filter = make_lowshelf(1000, 48000, 6)
    >>> filter.a_coeffs + filter.b_coeffs  # doctest: +NORMALIZE_WHITESPACE
    [3.0409336710888786, -5.608870992220748, 2.602157875636628, 3.139954022810743,
     -5.591841778072785, 2.5201667380627257]
    """
    w0 = tau * frequency / samplerate
    _sin = sin(w0)
    _cos = cos(w0)
    alpha = _sin / (2 * q_factor)
    big_a = 10 ** (gain_db / 40)
    pmc = (big_a + 1) - (big_a - 1) * _cos
    ppmc = (big_a + 1) + (big_a - 1) * _cos
    mpc = (big_a - 1) - (big_a + 1) * _cos
    pmpc = (big_a - 1) + (big_a + 1) * _cos
    aa2 = 2 * sqrt(big_a) * alpha

    b0 = big_a * (pmc + aa2)
    b1 = 2 * big_a * mpc
    b2 = big_a * (pmc - aa2)
    a0 = ppmc + aa2
    a1 = -2 * pmpc
    a2 = ppmc - aa2

    filt = IIRFilter(2)
    filt.set_coefficients([a0, a1, a2], [b0, b1, b2])
    return filt


def make_highshelf(
    frequency: int,
    samplerate: int,
    gain_db: float,
    q_factor: float = 1 / sqrt(2),
) -> IIRFilter:
    """
    Creates a high-shelf filter

    >>> filter = make_highshelf(1000, 48000, 6)
    >>> filter.a_coeffs + filter.b_coeffs  # doctest: +NORMALIZE_WHITESPACE
    [2.2229172136088806, -3.9587208137297303, 1.7841414181566304, 4.295432981120543,
     -7.922740859457287, 3.6756456963725253]
    """
    w0 = tau * frequency / samplerate
    _sin = sin(w0)
    _cos = cos(w0)
    alpha = _sin / (2 * q_factor)
    big_a = 10 ** (gain_db / 40)
    pmc = (big_a + 1) - (big_a - 1) * _cos
    ppmc = (big_a + 1) + (big_a - 1) * _cos
    mpc = (big_a - 1) - (big_a + 1) * _cos
    pmpc = (big_a - 1) + (big_a + 1) * _cos
    aa2 = 2 * sqrt(big_a) * alpha

    b0 = big_a * (ppmc + aa2)
    b1 = -2 * big_a * pmpc
    b2 = big_a * (ppmc - aa2)
    a0 = pmc + aa2
    a1 = 2 * mpc
    a2 = pmc - aa2

    filt = IIRFilter(2)
    filt.set_coefficients([a0, a1, a2], [b0, b1, b2])
    return filt


================================================
FILE: audio_filters/equal_loudness_filter.py.broken.txt
================================================
from json import loads
from pathlib import Path

import numpy as np
from yulewalker import yulewalk

from audio_filters.butterworth_filter import make_highpass
from audio_filters.iir_filter import IIRFilter

data = loads((Path(__file__).resolve().parent / "loudness_curve.json").read_text())


class EqualLoudnessFilter:
    r"""
    An equal-loudness filter which compensates for the human ear's non-linear response
     to sound.
    This filter corrects this by cascading a yulewalk filter and a butterworth filter.

    Designed for use with samplerate of 44.1kHz and above. If you're using a lower
     samplerate, use with caution.

    Code based on matlab implementation at https://bit.ly/3eqh2HU
    (url shortened for ruff)

    Target curve: https://i.imgur.com/3g2VfaM.png
    Yulewalk response: https://i.imgur.com/J9LnJ4C.png
    Butterworth and overall response: https://i.imgur.com/3g2VfaM.png

    Images and original matlab implementation by David Robinson, 2001
    """

    def __init__(self, samplerate: int = 44100) -> None:
        self.yulewalk_filter = IIRFilter(10)
        self.butterworth_filter = make_highpass(150, samplerate)

        # pad the data to nyquist
        curve_freqs = np.array(data["frequencies"] + [max(20000.0, samplerate / 2)])
        curve_gains = np.array(data["gains"] + [140])

        # Convert to angular frequency
        freqs_normalized = curve_freqs / samplerate * 2
        # Invert the curve and normalize to 0dB
        gains_normalized = np.power(10, (np.min(curve_gains) - curve_gains) / 20)

        # Scipy's `yulewalk` function is a stub, so we're using the
        #  `yulewalker` library instead.
        # This function computes the coefficients using a least-squares
        #  fit to the specified curve.
        ya, yb = yulewalk(10, freqs_normalized, gains_normalized)
        self.yulewalk_filter.set_coefficients(ya, yb)

    def process(self, sample: float) -> float:
        """
        Process a single sample through both filters

        >>> filt = EqualLoudnessFilter()
        >>> filt.process(0.0)
        0.0
        """
        tmp = self.yulewalk_filter.process(sample)
        return self.butterworth_filter.process(tmp)


================================================
FILE: audio_filters/iir_filter.py
================================================
from __future__ import annotations


class IIRFilter:
    r"""
    N-Order IIR filter
    Assumes working with float samples normalized on [-1, 1]

    ---

    Implementation details:
    Based on the 2nd-order function from
    https://en.wikipedia.org/wiki/Digital_biquad_filter,
    this generalized N-order function was made.

    Using the following transfer function
        .. math:: H(z)=\frac{b_{0}+b_{1}z^{-1}+b_{2}z^{-2}+...+b_{k}z^{-k}}
                  {a_{0}+a_{1}z^{-1}+a_{2}z^{-2}+...+a_{k}z^{-k}}

    we can rewrite this to
        .. math:: y[n]={\frac{1}{a_{0}}}
                  \left(\left(b_{0}x[n]+b_{1}x[n-1]+b_{2}x[n-2]+...+b_{k}x[n-k]\right)-
                  \left(a_{1}y[n-1]+a_{2}y[n-2]+...+a_{k}y[n-k]\right)\right)
    """

    def __init__(self, order: int) -> None:
        self.order = order

        # a_{0} ... a_{k}
        self.a_coeffs = [1.0] + [0.0] * order
        # b_{0} ... b_{k}
        self.b_coeffs = [1.0] + [0.0] * order

        # x[n-1] ... x[n-k]
        self.input_history = [0.0] * self.order
        # y[n-1] ... y[n-k]
        self.output_history = [0.0] * self.order

    def set_coefficients(self, a_coeffs: list[float], b_coeffs: list[float]) -> None:
        """
        Set the coefficients for the IIR filter.
        These should both be of size `order` + 1.
        :math:`a_0` may be left out, and it will use 1.0 as default value.

        This method works well with scipy's filter design functions

        >>> # Make a 2nd-order 1000Hz butterworth lowpass filter
        >>> import scipy.signal
        >>> b_coeffs, a_coeffs = scipy.signal.butter(2, 1000,
        ...                                          btype='lowpass',
        ...                                          fs=48000)
        >>> filt = IIRFilter(2)
        >>> filt.set_coefficients(a_coeffs, b_coeffs)
        """
        if len(a_coeffs) < self.order:
            a_coeffs = [1.0, *a_coeffs]

        if len(a_coeffs) != self.order + 1:
            msg = (
                f"Expected a_coeffs to have {self.order + 1} elements "
                f"for {self.order}-order filter, got {len(a_coeffs)}"
            )
            raise ValueError(msg)

        if len(b_coeffs) != self.order + 1:
            msg = (
                f"Expected b_coeffs to have {self.order + 1} elements "
                f"for {self.order}-order filter, got {len(a_coeffs)}"
            )
            raise ValueError(msg)

        self.a_coeffs = a_coeffs
        self.b_coeffs = b_coeffs

    def process(self, sample: float) -> float:
        """
        Calculate :math:`y[n]`

        >>> filt = IIRFilter(2)
        >>> filt.process(0)
        0.0
        """
        result = 0.0

        # Start at index 1 and do index 0 at the end.
        for i in range(1, self.order + 1):
            result += (
                self.b_coeffs[i] * self.input_history[i - 1]
                - self.a_coeffs[i] * self.output_history[i - 1]
            )

        result = (result + self.b_coeffs[0] * sample) / self.a_coeffs[0]

        self.input_history[1:] = self.input_history[:-1]
        self.output_history[1:] = self.output_history[:-1]

        self.input_history[0] = sample
        self.output_history[0] = result

        return result


================================================
FILE: audio_filters/loudness_curve.json
================================================
{
  "_comment": "The following is a representative average of the Equal Loudness Contours as measured by Robinson and Dadson, 1956",
  "_doi": "10.1088/0508-3443/7/5/302",
  "frequencies": [
    0,
    20,
    30,
    40,
    50,
    60,
    70,
    80,
    90,
    100,
    200,
    300,
    400,
    500,
    600,
    700,
    800,
    900,
    1000,
    1500,
    2000,
    2500,
    3000,
    3700,
    4000,
    5000,
    6000,
    7000,
    8000,
    9000,
    10000,
    12000,
    15000,
    20000
  ],
  "gains": [
    120,
    113,
    103,
    97,
    93,
    91,
    89,
    87,
    86,
    85,
    78,
    76,
    76,
    76,
    76,
    77,
    78,
    79.5,
    80,
    79,
    77,
    74,
    71.5,
    70,
    70.5,
    74,
    79,
    84,
    86,
    86,
    85,
    95,
    110,
    125
  ]
}


================================================
FILE: audio_filters/show_response.py
================================================
from __future__ import annotations

from abc import abstractmethod
from math import pi
from typing import Protocol

import matplotlib.pyplot as plt
import numpy as np


class FilterType(Protocol):
    @abstractmethod
    def process(self, sample: float) -> float:
        """
        Calculate y[n]

        >>> issubclass(FilterType, Protocol)
        True
        """


def get_bounds(
    fft_results: np.ndarray, samplerate: int
) -> tuple[int | float, int | float]:
    """
    Get bounds for printing fft results

    >>> import numpy
    >>> array = numpy.linspace(-20.0, 20.0, 1000)
    >>> get_bounds(array, 1000)
    (-20, 20)
    """
    lowest = min([-20, np.min(fft_results[1 : samplerate // 2 - 1])])
    highest = max([20, np.max(fft_results[1 : samplerate // 2 - 1])])
    return lowest, highest


def show_frequency_response(filter_type: FilterType, samplerate: int) -> None:
    """
    Show frequency response of a filter

    >>> from audio_filters.iir_filter import IIRFilter
    >>> filt = IIRFilter(4)
    >>> show_frequency_response(filt, 48000)
    """

    size = 512
    inputs = [1] + [0] * (size - 1)
    outputs = [filter_type.process(item) for item in inputs]

    filler = [0] * (samplerate - size)  # zero-padding
    outputs += filler
    fft_out = np.abs(np.fft.fft(outputs))
    fft_db = 20 * np.log10(fft_out)

    # Frequencies on log scale from 24 to nyquist frequency
    plt.xlim(24, samplerate / 2 - 1)
    plt.xlabel("Frequency (Hz)")
    plt.xscale("log")

    # Display within reasonable bounds
    bounds = get_bounds(fft_db, samplerate)
    plt.ylim(max([-80, bounds[0]]), min([80, bounds[1]]))
    plt.ylabel("Gain (dB)")

    plt.plot(fft_db)
    plt.show()


def show_phase_response(filter_type: FilterType, samplerate: int) -> None:
    """
    Show phase response of a filter

    >>> from audio_filters.iir_filter import IIRFilter
    >>> filt = IIRFilter(4)
    >>> show_phase_response(filt, 48000)
    """

    size = 512
    inputs = [1] + [0] * (size - 1)
    outputs = [filter_type.process(item) for item in inputs]

    filler = [0] * (samplerate - size)  # zero-padding
    outputs += filler
    fft_out = np.angle(np.fft.fft(outputs))

    # Frequencies on log scale from 24 to nyquist frequency
    plt.xlim(24, samplerate / 2 - 1)
    plt.xlabel("Frequency (Hz)")
    plt.xscale("log")

    plt.ylim(-2 * pi, 2 * pi)
    plt.ylabel("Phase shift (Radians)")
    plt.plot(np.unwrap(fft_out, -2 * pi))
    plt.show()


================================================
FILE: backtracking/README.md
================================================
# Backtracking

Backtracking is a way to speed up the search process by removing candidates when they can't be the solution of a problem.

* <https://en.wikipedia.org/wiki/Backtracking>
* <https://en.wikipedia.org/wiki/Decision_tree_pruning>
* <https://medium.com/@priyankmistry1999/backtracking-sudoku-6e4439e4825c>
* <https://www.geeksforgeeks.org/sudoku-backtracking-7/>


================================================
FILE: backtracking/__init__.py
================================================


================================================
FILE: backtracking/all_combinations.py
================================================
"""
In this problem, we want to determine all possible combinations of k
numbers out of 1 ... n. We use backtracking to solve this problem.

Time complexity: O(C(n,k)) which is O(n choose k) = O((n!/(k! * (n - k)!))),
"""

from __future__ import annotations

from itertools import combinations


def combination_lists(n: int, k: int) -> list[list[int]]:
    """
    Generates all possible combinations of k numbers out of 1 ... n using itertools.

    >>> combination_lists(n=4, k=2)
    [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
    """
    return [list(x) for x in combinations(range(1, n + 1), k)]


def generate_all_combinations(n: int, k: int) -> list[list[int]]:
    """
    Generates all possible combinations of k numbers out of 1 ... n using backtracking.

    >>> generate_all_combinations(n=4, k=2)
    [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
    >>> generate_all_combinations(n=0, k=0)
    [[]]
    >>> generate_all_combinations(n=10, k=-1)
    Traceback (most recent call last):
        ...
    ValueError: k must not be negative
    >>> generate_all_combinations(n=-1, k=10)
    Traceback (most recent call last):
        ...
    ValueError: n must not be negative
    >>> generate_all_combinations(n=5, k=4)
    [[1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]]
    >>> generate_all_combinations(n=3, k=3)
    [[1, 2, 3]]
    >>> generate_all_combinations(n=3, k=1)
    [[1], [2], [3]]
    >>> generate_all_combinations(n=1, k=0)
    [[]]
    >>> generate_all_combinations(n=1, k=1)
    [[1]]
    >>> from itertools import combinations
    >>> all(generate_all_combinations(n, k) == combination_lists(n, k)
    ...     for n in range(1, 6) for k in range(1, 6))
    True
    """
    if k < 0:
        raise ValueError("k must not be negative")
    if n < 0:
        raise ValueError("n must not be negative")

    result: list[list[int]] = []
    create_all_state(1, n, k, [], result)
    return result


def create_all_state(
    increment: int,
    total_number: int,
    level: int,
    current_list: list[int],
    total_list: list[list[int]],
) -> None:
    """
    Helper function to recursively build all combinations.

    >>> create_all_state(1, 4, 2, [], result := [])
    >>> result
    [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
    >>> create_all_state(1, 3, 3, [], result := [])
    >>> result
    [[1, 2, 3]]
    >>> create_all_state(2, 2, 1, [1], result := [])
    >>> result
    [[1, 2]]
    >>> create_all_state(1, 0, 0, [], result := [])
    >>> result
    [[]]
    >>> create_all_state(1, 4, 0, [1, 2], result := [])
    >>> result
    [[1, 2]]
    >>> create_all_state(5, 4, 2, [1, 2], result := [])
    >>> result
    []
    """
    if level == 0:
        total_list.append(current_list[:])
        return

    for i in range(increment, total_number - level + 2):
        current_list.append(i)
        create_all_state(i + 1, total_number, level - 1, current_list, total_list)
        current_list.pop()


if __name__ == "__main__":
    from doctest import testmod

    testmod()
    print(generate_all_combinations(n=4, k=2))
    tests = ((n, k) for n in range(1, 5) for k in range(1, 5))
    for n, k in tests:
        print(n, k, generate_all_combinations(n, k) == combination_lists(n, k))

    print("Benchmark:")
    from timeit import timeit

    for func in ("combination_lists", "generate_all_combinations"):
        print(f"{func:>25}(): {timeit(f'{func}(n=4, k = 2)', globals=globals())}")


================================================
FILE: backtracking/all_permutations.py
================================================
"""
In this problem, we want to determine all possible permutations
of the given sequence. We use backtracking to solve this problem.

Time complexity: O(n! * n),
where n denotes the length of the given sequence.
"""

from __future__ import annotations


def generate_all_permutations(sequence: list[int | str]) -> None:
    create_state_space_tree(sequence, [], 0, [0 for i in range(len(sequence))])


def create_state_space_tree(
    sequence: list[int | str],
    current_sequence: list[int | str],
    index: int,
    index_used: list[int],
) -> None:
    """
    Creates a state space tree to iterate through each branch using DFS.
    We know that each state has exactly len(sequence) - index children.
    It terminates when it reaches the end of the given sequence.

    :param sequence: The input sequence for which permutations are generated.
    :param current_sequence: The current permutation being built.
    :param index: The current index in the sequence.
    :param index_used: list to track which elements are used in permutation.

    Example 1:
    >>> sequence = [1, 2, 3]
    >>> current_sequence = []
    >>> index_used = [False, False, False]
    >>> create_state_space_tree(sequence, current_sequence, 0, index_used)
    [1, 2, 3]
    [1, 3, 2]
    [2, 1, 3]
    [2, 3, 1]
    [3, 1, 2]
    [3, 2, 1]

    Example 2:
    >>> sequence = ["A", "B", "C"]
    >>> current_sequence = []
    >>> index_used = [False, False, False]
    >>> create_state_space_tree(sequence, current_sequence, 0, index_used)
    ['A', 'B', 'C']
    ['A', 'C', 'B']
    ['B', 'A', 'C']
    ['B', 'C', 'A']
    ['C', 'A', 'B']
    ['C', 'B', 'A']

    Example 3:
    >>> sequence = [1]
    >>> current_sequence = []
    >>> index_used = [False]
    >>> create_state_space_tree(sequence, current_sequence, 0, index_used)
    [1]
    """

    if index == len(sequence):
        print(current_sequence)
        return

    for i in range(len(sequence)):
        if not index_used[i]:
            current_sequence.append(sequence[i])
            index_used[i] = True
            create_state_space_tree(sequence, current_sequence, index + 1, index_used)
            current_sequence.pop()
            index_used[i] = False


"""
remove the comment to take an input from the user

print("Enter the elements")
sequence = list(map(int, input().split()))
"""

sequence: list[int | str] = [3, 1, 2, 4]
generate_all_permutations(sequence)

sequence_2: list[int | str] = ["A", "B", "C"]
generate_all_permutations(sequence_2)


================================================
FILE: backtracking/all_subsequences.py
================================================
"""
In this problem, we want to determine all possible subsequences
of the given sequence. We use backtracking to solve this problem.

Time complexity: O(2^n),
where n denotes the length of the given sequence.
"""

from __future__ import annotations

from typing import Any


def generate_all_subsequences(sequence: list[Any]) -> None:
    create_state_space_tree(sequence, [], 0)


def create_state_space_tree(
    sequence: list[Any], current_subsequence: list[Any], index: int
) -> None:
    """
    Creates a state space tree to iterate through each branch using DFS.
    We know that each state has exactly two children.
    It terminates when it reaches the end of the given sequence.

    :param sequence: The input sequence for which subsequences are generated.
    :param current_subsequence: The current subsequence being built.
    :param index: The current index in the sequence.

    Example:
    >>> sequence = [3, 2, 1]
    >>> current_subsequence = []
    >>> create_state_space_tree(sequence, current_subsequence, 0)
    []
    [1]
    [2]
    [2, 1]
    [3]
    [3, 1]
    [3, 2]
    [3, 2, 1]

    >>> sequence = ["A", "B"]
    >>> current_subsequence = []
    >>> create_state_space_tree(sequence, current_subsequence, 0)
    []
    ['B']
    ['A']
    ['A', 'B']

    >>> sequence = []
    >>> current_subsequence = []
    >>> create_state_space_tree(sequence, current_subsequence, 0)
    []

    >>> sequence = [1, 2, 3, 4]
    >>> current_subsequence = []
    >>> create_state_space_tree(sequence, current_subsequence, 0)
    []
    [4]
    [3]
    [3, 4]
    [2]
    [2, 4]
    [2, 3]
    [2, 3, 4]
    [1]
    [1, 4]
    [1, 3]
    [1, 3, 4]
    [1, 2]
    [1, 2, 4]
    [1, 2, 3]
    [1, 2, 3, 4]
    """

    if index == len(sequence):
        print(current_subsequence)
        return

    create_state_space_tree(sequence, current_subsequence, index + 1)
    current_subsequence.append(sequence[index])
    create_state_space_tree(sequence, current_subsequence, index + 1)
    current_subsequence.pop()


if __name__ == "__main__":
    seq: list[Any] = [1, 2, 3]
    generate_all_subsequences(seq)

    seq.clear()
    seq.extend(["A", "B", "C"])
    generate_all_subsequences(seq)


================================================
FILE: backtracking/coloring.py
================================================
"""
Graph Coloring also called "m coloring problem"
consists of coloring a given graph with at most m colors
such that no adjacent vertices are assigned the same color

Wikipedia: https://en.wikipedia.org/wiki/Graph_coloring
"""


def valid_coloring(
    neighbours: list[int], colored_vertices: list[int], color: int
) -> bool:
    """
    For each neighbour check if the coloring constraint is satisfied
    If any of the neighbours fail the constraint return False
    If all neighbours validate the constraint return True

    >>> neighbours = [0,1,0,1,0]
    >>> colored_vertices = [0, 2, 1, 2, 0]

    >>> color = 1
    >>> valid_coloring(neighbours, colored_vertices, color)
    True

    >>> color = 2
    >>> valid_coloring(neighbours, colored_vertices, color)
    False
    """
    # Does any neighbour not satisfy the constraints
    return not any(
        neighbour == 1 and colored_vertices[i] == color
        for i, neighbour in enumerate(neighbours)
    )


def util_color(
    graph: list[list[int]], max_colors: int, colored_vertices: list[int], index: int
) -> bool:
    """
    Pseudo-Code

    Base Case:
    1. Check if coloring is complete
        1.1 If complete return True (meaning that we successfully colored the graph)

    Recursive Step:
    2. Iterates over each color:
        Check if the current coloring is valid:
            2.1. Color given vertex
            2.2. Do recursive call, check if this coloring leads to a solution
            2.4. if current coloring leads to a solution return
            2.5. Uncolor given vertex

    >>> graph = [[0, 1, 0, 0, 0],
    ...          [1, 0, 1, 0, 1],
    ...          [0, 1, 0, 1, 0],
    ...          [0, 1, 1, 0, 0],
    ...          [0, 1, 0, 0, 0]]
    >>> max_colors = 3
    >>> colored_vertices = [0, 1, 0, 0, 0]
    >>> index = 3

    >>> util_color(graph, max_colors, colored_vertices, index)
    True

    >>> max_colors = 2
    >>> util_color(graph, max_colors, colored_vertices, index)
    False
    """

    # Base Case
    if index == len(graph):
        return True

    # Recursive Step
    for i in range(max_colors):
        if valid_coloring(graph[index], colored_vertices, i):
            # Color current vertex
            colored_vertices[index] = i
            # Validate coloring
            if util_color(graph, max_colors, colored_vertices, index + 1):
                return True
            # Backtrack
            colored_vertices[index] = -1
    return False


def color(graph: list[list[int]], max_colors: int) -> list[int]:
    """
    Wrapper function to call subroutine called util_color
    which will either return True or False.
    If True is returned colored_vertices list is filled with correct colorings

    >>> graph = [[0, 1, 0, 0, 0],
    ...          [1, 0, 1, 0, 1],
    ...          [0, 1, 0, 1, 0],
    ...          [0, 1, 1, 0, 0],
    ...          [0, 1, 0, 0, 0]]

    >>> max_colors = 3
    >>> color(graph, max_colors)
    [0, 1, 0, 2, 0]

    >>> max_colors = 2
    >>> color(graph, max_colors)
    []
    >>> color([], 2)  # empty graph
    []
    >>> color([[0]], 1)  # single node, 1 color
    [0]
    >>> color([[0, 1], [1, 0]], 1)  # 2 nodes, 1 color (impossible)
    []
    >>> color([[0, 1], [1, 0]], 2)  # 2 nodes, 2 colors (possible)
    [0, 1]
    """
    colored_vertices = [-1] * len(graph)

    if util_color(graph, max_colors, colored_vertices, 0):
        return colored_vertices

    return []


================================================
FILE: backtracking/combination_sum.py
================================================
"""
In the Combination Sum problem, we are given a list consisting of distinct integers.
We need to find all the combinations whose sum equals to target given.
We can use an element more than one.

Time complexity(Average Case): O(n!)

Constraints:
1 <= candidates.length <= 30
2 <= candidates[i] <= 40
All elements of candidates are distinct.
1 <= target <= 40
"""


def backtrack(
    candidates: list, path: list, answer: list, target: int, previous_index: int
) -> None:
    """
    A recursive function that searches for possible combinations. Backtracks in case
    of a bigger current combination value than the target value.

    Parameters
    ----------
    previous_index: Last index from the previous search
    target: The value we need to obtain by summing our integers in the path list.
    answer: A list of possible combinations
    path: Current combination
    candidates: A list of integers we can use.
    """
    if target == 0:
        answer.append(path.copy())
    else:
        for index in range(previous_index, len(candidates)):
            if target >= candidates[index]:
                path.append(candidates[index])
                backtrack(candidates, path, answer, target - candidates[index], index)
                path.pop(len(path) - 1)


def combination_sum(candidates: list, target: int) -> list:
    """
    >>> combination_sum([2, 3, 5], 8)
    [[2, 2, 2, 2], [2, 3, 3], [3, 5]]
    >>> combination_sum([2, 3, 6, 7], 7)
    [[2, 2, 3], [7]]
    >>> combination_sum([-8, 2.3, 0], 1)
    Traceback (most recent call last):
        ...
    ValueError: All elements in candidates must be non-negative
    >>> combination_sum([], 1)
    Traceback (most recent call last):
        ...
    ValueError: Candidates list should not be empty
    """
    if not candidates:
        raise ValueError("Candidates list should not be empty")

    if any(x < 0 for x in candidates):
        raise ValueError("All elements in candidates must be non-negative")

    path = []  # type: list[int]
    answer = []  # type: list[int]
    backtrack(candidates, path, answer, target, 0)
    return answer


def main() -> None:
    print(combination_sum([-8, 2.3, 0], 1))


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    main()


================================================
FILE: backtracking/crossword_puzzle_solver.py
================================================
# https://www.geeksforgeeks.org/solve-crossword-puzzle/


def is_valid(
    puzzle: list[list[str]], word: str, row: int, col: int, vertical: bool
) -> bool:
    """
    Check if a word can be placed at the given position.

    >>> puzzle = [
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', '']
    ... ]
    >>> is_valid(puzzle, 'word', 0, 0, True)
    True
    >>> puzzle = [
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', '']
    ... ]
    >>> is_valid(puzzle, 'word', 0, 0, False)
    True
    """
    for i in range(len(word)):
        if vertical:
            if row + i >= len(puzzle) or puzzle[row + i][col] != "":
                return False
        elif col + i >= len(puzzle[0]) or puzzle[row][col + i] != "":
            return False
    return True


def place_word(
    puzzle: list[list[str]], word: str, row: int, col: int, vertical: bool
) -> None:
    """
    Place a word at the given position.

    >>> puzzle = [
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', '']
    ... ]
    >>> place_word(puzzle, 'word', 0, 0, True)
    >>> puzzle
    [['w', '', '', ''], ['o', '', '', ''], ['r', '', '', ''], ['d', '', '', '']]
    """
    for i, char in enumerate(word):
        if vertical:
            puzzle[row + i][col] = char
        else:
            puzzle[row][col + i] = char


def remove_word(
    puzzle: list[list[str]], word: str, row: int, col: int, vertical: bool
) -> None:
    """
    Remove a word from the given position.

    >>> puzzle = [
    ...     ['w', '', '', ''],
    ...     ['o', '', '', ''],
    ...     ['r', '', '', ''],
    ...     ['d', '', '', '']
    ... ]
    >>> remove_word(puzzle, 'word', 0, 0, True)
    >>> puzzle
    [['', '', '', ''], ['', '', '', ''], ['', '', '', ''], ['', '', '', '']]
    """
    for i in range(len(word)):
        if vertical:
            puzzle[row + i][col] = ""
        else:
            puzzle[row][col + i] = ""


def solve_crossword(puzzle: list[list[str]], words: list[str]) -> bool:
    """
    Solve the crossword puzzle using backtracking.

    >>> puzzle = [
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', '']
    ... ]

    >>> words = ['word', 'four', 'more', 'last']
    >>> solve_crossword(puzzle, words)
    True
    >>> puzzle = [
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', ''],
    ...     ['', '', '', '']
    ... ]
    >>> words = ['word', 'four', 'more', 'paragraphs']
    >>> solve_crossword(puzzle, words)
    False
    """
    for row in range(len(puzzle)):
        for col in range(len(puzzle[0])):
            if puzzle[row][col] == "":
                for word in words:
                    for vertical in [True, False]:
                        if is_valid(puzzle, word, row, col, vertical):
                            place_word(puzzle, word, row, col, vertical)
                            words.remove(word)
                            if solve_crossword(puzzle, words):
                                return True
                            words.append(word)
                            remove_word(puzzle, word, row, col, vertical)
                return False
    return True


if __name__ == "__main__":
    PUZZLE = [[""] * 3 for _ in range(3)]
    WORDS = ["cat", "dog", "car"]

    if solve_crossword(PUZZLE, WORDS):
        print("Solution found:")
        for row in PUZZLE:
            print(" ".join(row))
    else:
        print("No solution found:")


================================================
FILE: backtracking/generate_parentheses.py
================================================
"""
author: Aayush Soni
Given n pairs of parentheses, write a function to generate all
combinations of well-formed parentheses.
Input: n = 2
Output: ["(())","()()"]
Leetcode link: https://leetcode.com/problems/generate-parentheses/description/
"""


def backtrack(
    partial: str, open_count: int, close_count: int, n: int, result: list[str]
) -> None:
    """
    Generate valid combinations of balanced parentheses using recursion.

    :param partial: A string representing the current combination.
    :param open_count: An integer representing the count of open parentheses.
    :param close_count: An integer representing the count of close parentheses.
    :param n: An integer representing the total number of pairs.
    :param result: A list to store valid combinations.
    :return: None

    This function uses recursion to explore all possible combinations,
    ensuring that at each step, the parentheses remain balanced.

    Example:
    >>> result = []
    >>> backtrack("", 0, 0, 2, result)
    >>> result
    ['(())', '()()']
    """
    if len(partial) == 2 * n:
        # When the combination is complete, add it to the result.
        result.append(partial)
        return

    if open_count < n:
        # If we can add an open parenthesis, do so, and recurse.
        backtrack(partial + "(", open_count + 1, close_count, n, result)

    if close_count < open_count:
        # If we can add a close parenthesis (it won't make the combination invalid),
        # do so, and recurse.
        backtrack(partial + ")", open_count, close_count + 1, n, result)


def generate_parenthesis(n: int) -> list[str]:
    """
    Generate valid combinations of balanced parentheses for a given n.

    :param n: An integer representing the number of pairs of parentheses.
    :return: A list of strings with valid combinations.

    This function uses a recursive approach to generate the combinations.

    Time Complexity: O(2^(2n)) - In the worst case, we have 2^(2n) combinations.
    Space Complexity: O(n) - where 'n' is the number of pairs.

    Example 1:
    >>> generate_parenthesis(3)
    ['((()))', '(()())', '(())()', '()(())', '()()()']

    Example 2:
    >>> generate_parenthesis(1)
    ['()']

    Example 3:
    >>> generate_parenthesis(0)
    ['']
    """

    result: list[str] = []
    backtrack("", 0, 0, n, result)
    return result


if __name__ == "__main__":
    import doctest

    doctest.testmod()


================================================
FILE: backtracking/generate_parentheses_iterative.py
================================================
def generate_parentheses_iterative(length: int) -> list[str]:
    """
    Generate all valid combinations of parentheses (Iterative Approach).

    The algorithm works as follows:
    1. Initialize an empty list to store the combinations.
    2. Initialize a stack to keep track of partial combinations.
    3. Start with empty string and push it on stack along with
       the counts of '(' and ')'.
    4. While the stack is not empty:
        a. Pop a partial combination and its open and close counts from the stack.
        b. If the combination length is equal to 2*length, add it to the result.
        c. If open count < length, push new combination with added '(' on stack.
        d. If close count < open count, push new combination with added ')' on stack.
    5. Return the result containing all valid combinations.

    Args:
        length: The desired length of the parentheses combinations

    Returns:
        A list of strings representing valid combinations of parentheses

    Time Complexity:
        O(2^(2*length))

    Space Complexity:
        O(2^(2*length))

    >>> generate_parentheses_iterative(3)
    ['()()()', '()(())', '(())()', '(()())', '((()))']
    >>> generate_parentheses_iterative(2)
    ['()()', '(())']
    >>> generate_parentheses_iterative(1)
    ['()']
    >>> generate_parentheses_iterative(0)
    ['']
    """
    if length == 0:
        return [""]

    result: list[str] = []
    stack: list[tuple[str, int, int]] = []

    # Each element in stack is a tuple (current_combination, open_count, close_count)
    stack.append(("", 0, 0))

    while stack:
        current_combination, open_count, close_count = stack.pop()

        if len(current_combination) == 2 * length:
            result.append(current_combination)
            continue

        if open_count < length:
            stack.append((current_combination + "(", open_count + 1, close_count))

        if close_count < open_count:
            stack.append((current_combination + ")", open_count, close_count + 1))

    return result


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    print(generate_parentheses_iterative(3))


================================================
FILE: backtracking/hamiltonian_cycle.py
================================================
"""
A Hamiltonian cycle (Hamiltonian circuit) is a graph cycle
through a graph that visits each node exactly once.
Determining whether such paths and cycles exist in graphs
is the 'Hamiltonian path problem', which is NP-complete.

Wikipedia: https://en.wikipedia.org/wiki/Hamiltonian_path
"""


def valid_connection(
    graph: list[list[int]], next_ver: int, curr_ind: int, path: list[int]
) -> bool:
    """
    Checks whether it is possible to add next into path by validating 2 statements
    1. There should be path between current and next vertex
    2. Next vertex should not be in path
    If both validations succeed we return True, saying that it is possible to connect
    this vertices, otherwise we return False

    Case 1:Use exact graph as in main function, with initialized values
    >>> graph = [[0, 1, 0, 1, 0],
    ...          [1, 0, 1, 1, 1],
    ...          [0, 1, 0, 0, 1],
    ...          [1, 1, 0, 0, 1],
    ...          [0, 1, 1, 1, 0]]
    >>> path = [0, -1, -1, -1, -1, 0]
    >>> curr_ind = 1
    >>> next_ver = 1
    >>> valid_connection(graph, next_ver, curr_ind, path)
    True

    Case 2: Same graph, but trying to connect to node that is already in path
    >>> path = [0, 1, 2, 4, -1, 0]
    >>> curr_ind = 4
    >>> next_ver = 1
    >>> valid_connection(graph, next_ver, curr_ind, path)
    False
    """

    # 1. Validate that path exists between current and next vertices
    if graph[path[curr_ind - 1]][next_ver] == 0:
        return False

    # 2. Validate that next vertex is not already in path
    return not any(vertex == next_ver for vertex in path)


def util_hamilton_cycle(graph: list[list[int]], path: list[int], curr_ind: int) -> bool:
    """
    Pseudo-Code
    Base Case:
    1. Check if we visited all of vertices
        1.1 If last visited vertex has path to starting vertex return True either
            return False
    Recursive Step:
    2. Iterate over each vertex
        Check if next vertex is valid for transiting from current vertex
            2.1 Remember next vertex as next transition
            2.2 Do recursive call and check if going to this vertex solves problem
            2.3 If next vertex leads to solution return True
            2.4 Else backtrack, delete remembered vertex

    Case 1: Use exact graph as in main function, with initialized values
    >>> graph = [[0, 1, 0, 1, 0],
    ...          [1, 0, 1, 1, 1],
    ...          [0, 1, 0, 0, 1],
    ...          [1, 1, 0, 0, 1],
    ...          [0, 1, 1, 1, 0]]
    >>> path = [0, -1, -1, -1, -1, 0]
    >>> curr_ind = 1
    >>> util_hamilton_cycle(graph, path, curr_ind)
    True
    >>> path
    [0, 1, 2, 4, 3, 0]

    Case 2: Use exact graph as in previous case, but in the properties taken from
        middle of calculation
    >>> graph = [[0, 1, 0, 1, 0],
    ...          [1, 0, 1, 1, 1],
    ...          [0, 1, 0, 0, 1],
    ...          [1, 1, 0, 0, 1],
    ...          [0, 1, 1, 1, 0]]
    >>> path = [0, 1, 2, -1, -1, 0]
    >>> curr_ind = 3
    >>> util_hamilton_cycle(graph, path, curr_ind)
    True
    >>> path
    [0, 1, 2, 4, 3, 0]
    """

    # Base Case
    if curr_ind == len(graph):
        # return whether path exists between current and starting vertices
        return graph[path[curr_ind - 1]][path[0]] == 1

    # Recursive Step
    for next_ver in range(len(graph)):
        if valid_connection(graph, next_ver, curr_ind, path):
            # Insert current vertex  into path as next transition
            path[curr_ind] = next_ver
            # Validate created path
            if util_hamilton_cycle(graph, path, curr_ind + 1):
                return True
            # Backtrack
            path[curr_ind] = -1
    return False


def hamilton_cycle(graph: list[list[int]], start_index: int = 0) -> list[int]:
    r"""
    Wrapper function to call subroutine called util_hamilton_cycle,
    which will either return array of vertices indicating hamiltonian cycle
    or an empty list indicating that hamiltonian cycle was not found.
    Case 1:
    Following graph consists of 5 edges.
    If we look closely, we can see that there are multiple Hamiltonian cycles.
    For example one result is when we iterate like:
    (0)->(1)->(2)->(4)->(3)->(0)

    (0)---(1)---(2)
     |   /   \   |
     |  /     \  |
     | /       \ |
     |/         \|
    (3)---------(4)
    >>> graph = [[0, 1, 0, 1, 0],
    ...          [1, 0, 1, 1, 1],
    ...          [0, 1, 0, 0, 1],
    ...          [1, 1, 0, 0, 1],
    ...          [0, 1, 1, 1, 0]]
    >>> hamilton_cycle(graph)
    [0, 1, 2, 4, 3, 0]

    Case 2:
    Same Graph as it was in Case 1, changed starting index from default to 3

    (0)---(1)---(2)
     |   /   \   |
     |  /     \  |
     | /       \ |
     |/         \|
    (3)---------(4)
    >>> graph = [[0, 1, 0, 1, 0],
    ...          [1, 0, 1, 1, 1],
    ...          [0, 1, 0, 0, 1],
    ...          [1, 1, 0, 0, 1],
    ...          [0, 1, 1, 1, 0]]
    >>> hamilton_cycle(graph, 3)
    [3, 0, 1, 2, 4, 3]

    Case 3:
    Following Graph is exactly what it was before, but edge 3-4 is removed.
    Result is that there is no Hamiltonian Cycle anymore.

    (0)---(1)---(2)
     |   /   \   |
     |  /     \  |
     | /       \ |
     |/         \|
    (3)         (4)
    >>> graph = [[0, 1, 0, 1, 0],
    ...          [1, 0, 1, 1, 1],
    ...          [0, 1, 0, 0, 1],
    ...          [1, 1, 0, 0, 0],
    ...          [0, 1, 1, 0, 0]]
    >>> hamilton_cycle(graph,4)
    []
    """

    # Initialize path with -1, indicating that we have not visited them yet
    path = [-1] * (len(graph) + 1)
    # initialize start and end of path with starting index
    path[0] = path[-1] = start_index
    # evaluate and if we find answer return path either return empty array
    return path if util_hamilton_cycle(graph, path, 1) else []


================================================
FILE: backtracking/knight_tour.py
================================================
# Knight Tour Intro: https://www.youtube.com/watch?v=ab_dY3dZFHM

from __future__ import annotations


def get_valid_pos(position: tuple[int, int], n: int) -> list[tuple[int, int]]:
    """
    Find all the valid positions a knight can move to from the current position.

    >>> get_valid_pos((1, 3), 4)
    [(2, 1), (0, 1), (3, 2)]
    """

    y, x = position
    positions = [
        (y + 1, x + 2),
        (y - 1, x + 2),
        (y + 1, x - 2),
        (y - 1, x - 2),
        (y + 2, x + 1),
        (y + 2, x - 1),
        (y - 2, x + 1),
        (y - 2, x - 1),
    ]
    permissible_positions = []

    for inner_position in positions:
        y_test, x_test = inner_position
        if 0 <= y_test < n and 0 <= x_test < n:
            permissible_positions.append(inner_position)

    return permissible_positions


def is_complete(board: list[list[int]]) -> bool:
    """
    Check if the board (matrix) has been completely filled with non-zero values.

    >>> is_complete([[1]])
    True

    >>> is_complete([[1, 2], [3, 0]])
    False
    """

    return not any(elem == 0 for row in board for elem in row)


def open_knight_tour_helper(
    board: list[list[int]], pos: tuple[int, int], curr: int
) -> bool:
    """
    Helper function to solve knight tour problem.
    """

    if is_complete(board):
        return True

    for position in get_valid_pos(pos, len(board)):
        y, x = position

        if board[y][x] == 0:
            board[y][x] = curr + 1
            if open_knight_tour_helper(board, position, curr + 1):
                return True
            board[y][x] = 0

    return False


def open_knight_tour(n: int) -> list[list[int]]:
    """
    Find the solution for the knight tour problem for a board of size n. Raises
    ValueError if the tour cannot be performed for the given size.

    >>> open_knight_tour(1)
    [[1]]

    >>> open_knight_tour(2)
    Traceback (most recent call last):
        ...
    ValueError: Open Knight Tour cannot be performed on a board of size 2
    """

    board = [[0 for i in range(n)] for j in range(n)]

    for i in range(n):
        for j in range(n):
            board[i][j] = 1
            if open_knight_tour_helper(board, (i, j), 1):
                return board
            board[i][j] = 0

    msg = f"Open Knight Tour cannot be performed on a board of size {n}"
    raise ValueError(msg)


if __name__ == "__main__":
    import doctest

    doctest.testmod()


================================================
FILE: backtracking/match_word_pattern.py
================================================
def match_word_pattern(pattern: str, input_string: str) -> bool:
    """
    Determine if a given pattern matches a string using backtracking.

    pattern: The pattern to match.
    input_string: The string to match against the pattern.
    return: True if the pattern matches the string, False otherwise.

    >>> match_word_pattern("aba", "GraphTreesGraph")
    True

    >>> match_word_pattern("xyx", "PythonRubyPython")
    True

    >>> match_word_pattern("GG", "PythonJavaPython")
    False
    """

    def backtrack(pattern_index: int, str_index: int) -> bool:
        """
        >>> backtrack(0, 0)
        True

        >>> backtrack(0, 1)
        True

        >>> backtrack(0, 4)
        False
        """
        if pattern_index == len(pattern) and str_index == len(input_string):
            return True
        if pattern_index == len(pattern) or str_index == len(input_string):
            return False
        char = pattern[pattern_index]
        if char in pattern_map:
            mapped_str = pattern_map[char]
            if input_string.startswith(mapped_str, str_index):
                return backtrack(pattern_index + 1, str_index + len(mapped_str))
            else:
                return False
        for end in range(str_index + 1, len(input_string) + 1):
            substr = input_string[str_index:end]
            if substr in str_map:
                continue
            pattern_map[char] = substr
            str_map[substr] = char
            if backtrack(pattern_index + 1, end):
                return True
            del pattern_map[char]
            del str_map[substr]
        return False

    pattern_map: dict[str, str] = {}
    str_map: dict[str, str] = {}
    return backtrack(0, 0)


if __name__ == "__main__":
    import doctest

    doctest.testmod()


================================================
FILE: backtracking/minimax.py
================================================
"""
Minimax helps to achieve maximum score in a game by checking all possible moves
depth is current depth in game tree.

nodeIndex is index of current node in scores[].
if move is of maximizer return true else false
leaves of game tree is stored in scores[]
height is maximum height of Game tree
"""

from __future__ import annotations

import math


def minimax(
    depth: int, node_index: int, is_max: bool, scores: list[int], height: float
) -> int:
    """
    This function implements the minimax algorithm, which helps achieve the optimal
    score for a player in a two-player game by checking all possible moves.
    If the player is the maximizer, then the score is maximized.
    If the player is the minimizer, then the score is minimized.

    Parameters:
    - depth: Current depth in the game tree.
    - node_index: Index of the current node in the scores list.
    - is_max: A boolean indicating whether the current move
              is for the maximizer (True) or minimizer (False).
    - scores: A list containing the scores of the leaves of the game tree.
    - height: The maximum height of the game tree.

    Returns:
    - An integer representing the optimal score for the current player.

    >>> import math
    >>> scores = [90, 23, 6, 33, 21, 65, 123, 34423]
    >>> height = math.log(len(scores), 2)
    >>> minimax(0, 0, True, scores, height)
    65
    >>> minimax(-1, 0, True, scores, height)
    Traceback (most recent call last):
        ...
    ValueError: Depth cannot be less than 0
    >>> minimax(0, 0, True, [], 2)
    Traceback (most recent call last):
        ...
    ValueError: Scores cannot be empty
    >>> scores = [3, 5, 2, 9, 12, 5, 23, 23]
    >>> height = math.log(len(scores), 2)
    >>> minimax(0, 0, True, scores, height)
    12
    """

    if depth < 0:
        raise ValueError("Depth cannot be less than 0")
    if len(scores) == 0:
        raise ValueError("Scores cannot be empty")

    # Base case: If the current depth equals the height of the tree,
    # return the score of the current node.
    if depth == height:
        return scores[node_index]

    # If it's the maximizer's turn, choose the maximum score
    # between the two possible moves.
    if is_max:
        return max(
            minimax(depth + 1, node_index * 2, False, scores, height),
            minimax(depth + 1, node_index * 2 + 1, False, scores, height),
        )

    # If it's the minimizer's turn, choose the minimum score
    # between the two possible moves.
    return min(
        minimax(depth + 1, node_index * 2, True, scores, height),
        minimax(depth + 1, node_index * 2 + 1, True, scores, height),
    )


def main() -> None:
    # Sample scores and height calculation
    scores = [90, 23, 6, 33, 21, 65, 123, 34423]
    height = math.log(len(scores), 2)

    # Calculate and print the optimal value using the minimax algorithm
    print("Optimal value : ", end="")
    print(minimax(0, 0, True, scores, height))


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    main()


================================================
FILE: backtracking/n_queens.py
================================================
"""

The nqueens problem is of placing N queens on a N * N
chess board such that no queen can attack any other queens placed
on that chess board.
This means that one queen cannot have any other queen on its horizontal, vertical and
diagonal lines.

"""

from __future__ import annotations

solution = []


def is_safe(board: list[list[int]], row: int, column: int) -> bool:
    """
    This function returns a boolean value True if it is safe to place a queen there
    considering the current state of the board.

    Parameters:
    board (2D matrix): The chessboard
    row, column: Coordinates of the cell on the board

    Returns:
    Boolean Value

    >>> is_safe([[0, 0, 0], [0, 0, 0], [0, 0, 0]], 1, 1)
    True
    >>> is_safe([[0, 1, 0], [0, 0, 0], [0, 0, 0]], 1, 1)
    False
    >>> is_safe([[1, 0, 0], [0, 0, 0], [0, 0, 0]], 1, 1)
    False
    >>> is_safe([[0, 0, 1], [0, 0, 0], [0, 0, 0]], 1, 1)
    False
    >>> is_safe([[1, 0, 0], [0, 0, 0], [0, 0, 0]], 1, 2)
    True
    >>> is_safe([[1, 0, 0], [0, 0, 0], [0, 0, 0]], 2, 1)
    True
    >>> is_safe([[0, 0, 0], [1, 0, 0], [0, 0, 0]], 0, 2)
    True
    >>> is_safe([[0, 0, 0], [1, 0, 0], [0, 0, 0]], 2, 2)
    True
    """

    n = len(board)  # Size of the board

    # Check if there is any queen in the same upper column,
    # left upper diagonal and right upper diagonal
    return (
        all(board[i][j] != 1 for i, j in zip(range(row), [column] * row))
        and all(
            board[i][j] != 1
            for i, j in zip(range(row - 1, -1, -1), range(column - 1, -1, -1))
        )
        and all(
            board[i][j] != 1
            for i, j in zip(range(row - 1, -1, -1), range(column + 1, n))
        )
    )


def solve(board: list[list[int]], row: int) -> bool:
    """
    This function creates a state space tree and calls the safe function until it
    receives a False Boolean and terminates that branch and backtracks to the next
    possible solution branch.
    """
    if row >= len(board):
        """
        If the row number exceeds N, we have a board with a successful combination
        and that combination is appended to the solution list and the board is printed.
        """
        solution.append(board)
        printboard(board)
        print()
        return True
    for i in range(len(board)):
        """
        For every row, it iterates through each column to check if it is feasible to
        place a queen there.
        If all the combinations for that particular branch are successful, the board is
        reinitialized for the next possible combination.
        """
        if is_safe(board, row, i):
            board[row][i] = 1
            solve(board, row + 1)
            board[row][i] = 0
    return False


def printboard(board: list[list[int]]) -> None:
    """
    Prints the boards that have a successful combination.
    """
    for i in range(len(board)):
        for j in range(len(board)):
            if board[i][j] == 1:
                print("Q", end=" ")  # Queen is present
            else:
                print(".", end=" ")  # Empty cell
        print()


# Number of queens (e.g., n=8 for an 8x8 board)
n = 8
board = [[0 for i in range(n)] for j in range(n)]
solve(board, 0)
print("The total number of solutions are:", len(solution))


================================================
FILE: backtracking/n_queens_math.py
================================================
r"""
Problem:

The n queens problem is: placing N queens on a N * N chess board such that no queen
can attack any other queens placed on that chess board.  This means that one queen
cannot have any other queen on its horizontal, vertical and diagonal lines.

Solution:

To solve this problem we will use simple math. First we know the queen can move in all
the possible ways, we can simplify it in this: vertical, horizontal, diagonal left and
 diagonal right.

We can visualize it like this:

left diagonal = \
right diagonal = /

On a chessboard vertical movement could be the rows and horizontal movement could be
the columns.

In programming we can use an array, and in this array each index could be the rows and
each value in the array could be the column. For example:

    . Q . .     We have this chessboard with one queen in each column and each queen
    . . . Q     can't attack to each other.
    Q . . .     The array for this example would look like this: [1, 3, 0, 2]
    . . Q .

So if we use an array and we verify that each value in the array is different to each
other we know that at least the queens can't attack each other in horizontal and
vertical.

At this point we have it halfway completed and we will treat the chessboard as a
Cartesian plane.  Hereinafter we are going to remember basic math, so in the school we
learned this formula:

    Slope of a line:

           y2 - y1
     m = ----------
          x2 - x1

This formula allow us to get the slope. For the angles 45º (right diagonal) and 135º
(left diagonal) this formula gives us m = 1, and m = -1 respectively.

See::
https://www.enotes.com/homework-help/write-equation-line-that-hits-origin-45-degree-1474860

Then we have this other formula:

Slope intercept:

y = mx + b

b is where the line crosses the Y axis (to get more information see:
https://www.mathsisfun.com/y_intercept.html), if we change the formula to solve for b
we would have:

y - mx = b

And since we already have the m values for the angles 45º and 135º, this formula would
look like this:

45º: y - (1)x = b
45º: y - x = b

135º: y - (-1)x = b
135º: y + x = b

y = row
x = column

Applying these two formulas we can check if a queen in some position is being attacked
for another one or vice versa.

"""

from __future__ import annotations


def depth_first_search(
    possible_board: list[int],
    diagonal_right_collisions: list[int],
    diagonal_left_collisions: list[int],
    boards: list[list[str]],
    n: int,
) -> None:
    """
    >>> boards = []
    >>> depth_first_search([], [], [], boards, 4)
    >>> for board in boards:
    ...     print(board)
    ['. Q . . ', '. . . Q ', 'Q . . . ', '. . Q . ']
    ['. . Q . ', 'Q . . . ', '. . . Q ', '. Q . . ']
    """

    # Get next row in the current board (possible_board) to fill it with a queen
    row = len(possible_board)

    # If row is equal to the size of the board it means there are a queen in each row in
    # the current board (possible_board)
    if row == n:
        # We convert the variable possible_board that looks like this: [1, 3, 0, 2] to
        # this: ['. Q . . ', '. . . Q ', 'Q . . . ', '. . Q . ']
        boards.append([". " * i + "Q " + ". " * (n - 1 - i) for i in possible_board])
        return

    # We iterate each column in the row to find all possible results in each row
    for col in range(n):
        # We apply that we learned previously. First we check that in the current board
        # (possible_board) there are not other same value because if there is it means
        # that there are a collision in vertical. Then we apply the two formulas we
        # learned before:
        #
        # 45º: y - x = b or 45: row - col = b
        # 135º: y + x = b or row + col = b.
        #
        # And we verify if the results of this two formulas not exist in their variables
        # respectively.  (diagonal_right_collisions, diagonal_left_collisions)
        #
        # If any or these are True it means there is a collision so we continue to the
        # next value in the for loop.
        if (
            col in possible_board
            or row - col in diagonal_right_collisions
            or row + col in diagonal_left_collisions
        ):
            continue

        # If it is False we call dfs function again and we update the inputs
        depth_first_search(
            [*possible_board, col],
            [*diagonal_right_collisions, row - col],
            [*diagonal_left_collisions, row + col],
            boards,
            n,
        )


def n_queens_solution(n: int) -> None:
    boards: list[list[str]] = []
    depth_first_search([], [], [], boards, n)

    # Print all the boards
    for board in boards:
        for column in board:
            print(column)
        print("")

    print(len(boards), "solutions were found.")


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    n_queens_solution(4)


================================================
FILE: backtracking/power_sum.py
================================================
"""
Problem source: https://www.hackerrank.com/challenges/the-power-sum/problem
Find the number of ways that a given integer X, can be expressed as the sum
of the Nth powers of unique, natural numbers. For example, if X=13 and N=2.
We have to find all combinations of unique squares adding up to 13.
The only solution is 2^2+3^2. Constraints: 1<=X<=1000, 2<=N<=10.
"""


def backtrack(
    needed_sum: int,
    power: int,
    current_number: int,
    current_sum: int,
    solutions_count: int,
) -> tuple[int, int]:
    """
    >>> backtrack(13, 2, 1, 0, 0)
    (0, 1)
    >>> backtrack(10, 2, 1, 0, 0)
    (0, 1)
    >>> backtrack(10, 3, 1, 0, 0)
    (0, 0)
    >>> backtrack(20, 2, 1, 0, 0)
    (0, 1)
    >>> backtrack(15, 10, 1, 0, 0)
    (0, 0)
    >>> backtrack(16, 2, 1, 0, 0)
    (0, 1)
    >>> backtrack(20, 1, 1, 0, 0)
    (0, 64)
    """
    if current_sum == needed_sum:
        # If the sum of the powers is equal to needed_sum, then we have a solution.
        solutions_count += 1
        return current_sum, solutions_count

    i_to_n = current_number**power
    if current_sum + i_to_n <= needed_sum:
        # If the sum of the powers is less than needed_sum, then continue adding powers.
        current_sum += i_to_n
        current_sum, solutions_count = backtrack(
            needed_sum, power, current_number + 1, current_sum, solutions_count
        )
        current_sum -= i_to_n
    if i_to_n < needed_sum:
        # If the power of i is less than needed_sum, then try with the next power.
        current_sum, solutions_count = backtrack(
            needed_sum, power, current_number + 1, current_sum, solutions_count
        )
    return current_sum, solutions_count


def solve(needed_sum: int, power: int) -> int:
    """
    >>> solve(13, 2)
    1
    >>> solve(10, 2)
    1
    >>> solve(10, 3)
    0
    >>> solve(20, 2)
    1
    >>> solve(15, 10)
    0
    >>> solve(16, 2)
    1
    >>> solve(20, 1)
    Traceback (most recent call last):
        ...
    ValueError: Invalid input
    needed_sum must be between 1 and 1000, power between 2 and 10.
    >>> solve(-10, 5)
    Traceback (most recent call last):
        ...
    ValueError: Invalid input
    needed_sum must be between 1 and 1000, power between 2 and 10.
    """
    if not (1 <= needed_sum <= 1000 and 2 <= power <= 10):
        raise ValueError(
            "Invalid input\n"
            "needed_sum must be between 1 and 1000, power between 2 and 10."
        )

    return backtrack(needed_sum, power, 1, 0, 0)[1]  # Return the solutions_count


if __name__ == "__main__":
    import doctest

    doctest.testmod()


================================================
FILE: backtracking/rat_in_maze.py
================================================
from __future__ import annotations


def solve_maze(
    maze: list[list[int]],
    source_row: int,
    source_column: int,
    destination_row: int,
    destination_column: int,
) -> list[list[int]]:
    """
    This method solves the "rat in maze" problem.
    Parameters :
        - maze: A two dimensional matrix of zeros and ones.
        - source_row: The row index of the starting point.
        - source_column: The column index of the starting point.
        - destination_row: The row index of the destination point.
        - destination_column: The column index of the destination point.
    Returns:
        - solution: A 2D matrix representing the solution path if it exists.
    Raises:
        - ValueError: If no solution exists or if the source or
            destination coordinates are invalid.
    Description:
        This method navigates through a maze represented as an n by n matrix,
        starting from a specified source cell and
        aiming to reach a destination cell.
        The maze consists of walls (1s) and open paths (0s).
        By providing custom row and column values, the source and destination
        cells can be adjusted.
    >>> maze = [[0, 1, 0, 1, 1],
    ...         [0, 0, 0, 0, 0],
    ...         [1, 0, 1, 0, 1],
    ...         [0, 0, 1, 0, 0],
    ...         [1, 0, 0, 1, 0]]
    >>> solve_maze(maze,0,0,len(maze)-1,len(maze)-1)    # doctest: +NORMALIZE_WHITESPACE
    [[0, 1, 1, 1, 1],
    [0, 0, 0, 0, 1],
    [1, 1, 1, 0, 1],
    [1, 1, 1, 0, 0],
    [1, 1, 1, 1, 0]]

    Note:
        In the output maze, the zeros (0s) represent one of the possible
        paths from the source to the destination.

    >>> maze = [[0, 1, 0, 1, 1],
    ...         [0, 0, 0, 0, 0],
    ...         [0, 0, 0, 0, 1],
    ...         [0, 0, 0, 0, 0],
    ...         [0, 0, 0, 0, 0]]
    >>> solve_maze(maze,0,0,len(maze)-1,len(maze)-1)    # doctest: +NORMALIZE_WHITESPACE
    [[0, 1, 1, 1, 1],
    [0, 1, 1, 1, 1],
    [0, 1, 1, 1, 1],
    [0, 1, 1, 1, 1],
    [0, 0, 0, 0, 0]]

    >>> maze = [[0, 0, 0],
    ...         [0, 1, 0],
    ...         [1, 0, 0]]
    >>> solve_maze(maze,0,0,len(maze)-1,len(maze)-1)    # doctest: +NORMALIZE_WHITESPACE
    [[0, 0, 0],
    [1, 1, 0],
    [1, 1, 0]]

    >>> maze = [[1, 0, 0],
    ...         [0, 1, 0],
    ...         [1, 0, 0]]
    >>> solve_maze(maze,0,1,len(maze)-1,len(maze)-1)    # doctest: +NORMALIZE_WHITESPACE
    [[1, 0, 0],
    [1, 1, 0],
    [1, 1, 0]]

    >>> maze = [[1, 1, 0, 0, 1, 0, 0, 1],
    ...         [1, 0, 1, 0, 0, 1, 1, 1],
    ...         [0, 1, 0, 1, 0, 0, 1, 0],
    ...         [1, 1, 1, 0, 0, 1, 0, 1],
    ...         [0, 1, 0, 0, 1, 0, 1, 1],
    ...         [0, 0, 0, 1, 1, 1, 0, 1],
    ...         [0, 1, 0, 1, 0, 1, 1, 1],
    ...         [1, 1, 0, 0, 0, 0, 0, 1]]
    >>> solve_maze(maze,0,2,len(maze)-1,2)  # doctest: +NORMALIZE_WHITESPACE
    [[1, 1, 0, 0, 1, 1, 1, 1],
    [1, 1, 1, 0, 0, 1, 1, 1],
    [1, 1, 1, 1, 0, 1, 1, 1],
    [1, 1, 1, 0, 0, 1, 1, 1],
    [1, 1, 0, 0, 1, 1, 1, 1],
    [1, 1, 0, 1, 1, 1, 1, 1],
    [1, 1, 0, 1, 1, 1, 1, 1],
    [1, 1, 0, 1, 1, 1, 1, 1]]
    >>> maze = [[1, 0, 0],
    ...         [0, 1, 1],
    ...         [1, 0, 1]]
    >>> solve_maze(maze,0,1,len(maze)-1,len(maze)-1)
    Traceback (most recent call last):
        ...
    ValueError: No solution exists!

    >>> maze = [[0, 0],
    ...         [1, 1]]
    >>> solve_maze(maze,0,0,len(maze)-1,len(maze)-1)
    Traceback (most recent call last):
        ...
    ValueError: No solution exists!

    >>> maze = [[0, 1],
    ...         [1, 0]]
    >>> solve_maze(maze,2,0,len(maze)-1,len(maze)-1)
    Traceback (most recent call last):
        ...
    ValueError: Invalid source or destination coordinates

    >>> maze = [[1, 0, 0],
    ...         [0, 1, 0],
    ...         [1, 0, 0]]
    >>> solve_maze(maze,0,1,len(maze),len(maze)-1)
    Traceback (most recent call last):
        ...
    ValueError: Invalid source or destination coordinates
    """
    size = len(maze)
    # Check if source and destination coordinates are Invalid.
    if not (0 <= source_row <= size - 1 and 0 <= source_column <= size - 1) or (
        not (0 <= destination_row <= size - 1 and 0 <= destination_column <= size - 1)
    ):
        raise ValueError("Invalid source or destination coordinates")
    # We need to create solution object to save path.
    solutions = [[1 for _ in range(size)] for _ in range(size)]
    solved = run_maze(
        maze, source_row, source_column, destination_row, destination_column, solutions
    )
    if solved:
        return solutions
    else:
        raise ValueError("No solution exists!")


def run_maze(
    maze: list[list[int]],
    i: int,
    j: int,
    destination_row: int,
    destination_column: int,
    solutions: list[list[int]],
) -> bool:
    """
    This method is recursive starting from (i, j) and going in one of four directions:
    up, down, left, right.
    If a path is found to destination it returns True otherwise it returns False.
    Parameters
        maze: A two dimensional matrix of zeros and ones.
        i, j : coordinates of matrix
        solutions: A two dimensional matrix of solutions.
    Returns:
        Boolean if path is found True, Otherwise False.
    """
    size = len(maze)
    # Final check point.
    if i == destination_row and j == destination_column and maze[i][j] == 0:
        solutions[i][j] = 0
        return True

    lower_flag = (not i < 0) and (not j < 0)  # Check lower bounds
    upper_flag = (i < size) and (j < size)  # Check upper bounds

    if lower_flag and upper_flag:
        # check for already visited and block points.
        block_flag = (solutions[i][j]) and (not maze[i][j])
        if block_flag:
            # check visited
            solutions[i][j] = 0

            # check for directions
            if (
                run_maze(maze, i + 1, j, destination_row, destination_column, solutions)
                or run_maze(
                    maze, i, j + 1, destination_row, destination_column, solutions
                )
                or run_maze(
                    maze, i - 1, j, destination_row, destination_column, solutions
                )
                or run_maze(
                    maze, i, j - 1, destination_row, destination_column, solutions
                )
            ):
                return True

            solutions[i][j] = 1
            return False
    return False


if __name__ == "__main__":
    import doctest

    doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)


================================================
FILE: backtracking/sudoku.py
================================================
"""
Given a partially filled 9x9 2D array, the objective is to fill a 9x9
square grid with digits numbered 1 to 9, so that every row, column, and
and each of the nine 3x3 sub-grids contains all of the digits.

This can be solved using Backtracking and is similar to n-queens.
We check to see if a cell is safe or not and recursively call the
function on the next column to see if it returns True. if yes, we
have solved the puzzle. else, we backtrack and place another number
in that cell and repeat this process.
"""

from __future__ import annotations

Matrix = list[list[int]]

# assigning initial values to the grid
initial_grid: Matrix = [
    [3, 0, 6, 5, 0, 8, 4, 0, 0],
    [5, 2, 0, 0, 0, 0, 0, 0, 0],
    [0, 8, 7, 0, 0, 0, 0, 3, 1],
    [0, 0, 3, 0, 1, 0, 0, 8, 0],
    [9, 0, 0, 8, 6, 3, 0, 0, 5],
    [0, 5, 0, 0, 9, 0, 6, 0, 0],
    [1, 3, 0, 0, 0, 0, 2, 5, 0],
    [0, 0, 0, 0, 0, 0, 0, 7, 4],
    [0, 0, 5, 2, 0, 6, 3, 0, 0],
]

# a grid with no solution
no_solution: Matrix = [
    [5, 0, 6, 5, 0, 8, 4, 0, 3],
    [5, 2, 0, 0, 0, 0, 0, 0, 2],
    [1, 8, 7, 0, 0, 0, 0, 3, 1],
    [0, 0, 3, 0, 1, 0, 0, 8, 0],
    [9, 0, 0, 8, 6, 3, 0, 0, 5],
    [0, 5, 0, 0, 9, 0, 6, 0, 0],
    [1, 3, 0, 0, 0, 0, 2, 5, 0],
    [0, 0, 0, 0, 0, 0, 0, 7, 4],
    [0, 0, 5, 2, 0, 6, 3, 0, 0],
]


def is_safe(grid: Matrix, row: int, column: int, n: int) -> bool:
    """
    This function checks the grid to see if each row,
    column, and the 3x3 subgrids contain the digit 'n'.
    It returns False if it is not 'safe' (a duplicate digit
    is found) else returns True if it is 'safe'
    """
    for i in range(9):
        if n in {grid[row][i], grid[i][column]}:
            return False

    for i in range(3):
        for j in range(3):
            if grid[(row - row % 3) + i][(column - column % 3) + j] == n:
                return False

    return True


def find_empty_location(grid: Matrix) -> tuple[int, int] | None:
    """
    This function finds an empty location so that we can assign a number
    for that particular row and column.
    """
    for i in range(9):
        for j in range(9):
            if grid[i][j] == 0:
                return i, j
    return None


def sudoku(grid: Matrix) -> Matrix | None:
    """
    Takes a partially filled-in grid and attempts to assign values to
    all unassigned locations in such a way to meet the requirements
    for Sudoku solution (non-duplication across rows, columns, and boxes)

    >>> sudoku(initial_grid)  # doctest: +NORMALIZE_WHITESPACE
    [[3, 1, 6, 5, 7, 8, 4, 9, 2],
     [5, 2, 9, 1, 3, 4, 7, 6, 8],
     [4, 8, 7, 6, 2, 9, 5, 3, 1],
     [2, 6, 3, 4, 1, 5, 9, 8, 7],
     [9, 7, 4, 8, 6, 3, 1, 2, 5],
     [8, 5, 1, 7, 9, 2, 6, 4, 3],
     [1, 3, 8, 9, 4, 7, 2, 5, 6],
     [6, 9, 2, 3, 5, 1, 8, 7, 4],
     [7, 4, 5, 2, 8, 6, 3, 1, 9]]
     >>> sudoku(no_solution) is None
     True
    """
    if location := find_empty_location(grid):
        row, column = location
    else:
        # If the location is ``None``, then the grid is solved.
        return grid

    for digit in range(1, 10):
        if is_safe(grid, row, column, digit):
            grid[row][column] = digit

            if sudoku(grid) is not None:
                return grid

            grid[row][column] = 0

    return None


def print_solution(grid: Matrix) -> None:
    """
    A function to print the solution in the form
    of a 9x9 grid
    """
    for row in grid:
        for cell in row:
            print(cell, end=" ")
        print()


if __name__ == "__main__":
    # make a copy of grid so that you can compare with the unmodified grid
    for example_grid in (initial_grid, no_solution):
        print("\nExample grid:\n" + "=" * 20)
        print_solution(example_grid)
        print("\nExample grid solution:")
        solution = sudoku(example_grid)
        if solution is not None:
            print_solution(solution)
        else:
            print("Cannot find a solution.")


================================================
FILE: backtracking/sum_of_subsets.py
================================================
"""
The sum-of-subsets problem states that a set of non-negative integers, and a
value M, determine all possible subsets of the given set whose summation sum
equal to given M.

Summation of the chosen numbers must be equal to given number M and one number
can be used only once.
"""


def generate_sum_of_subsets_solutions(nums: list[int], max_sum: int) -> list[list[int]]:
    """
    The main function. For list of numbers 'nums' find the subsets with sum
    equal to 'max_sum'

    >>> generate_sum_of_subsets_solutions(nums=[3, 34, 4, 12, 5, 2], max_sum=9)
    [[3, 4, 2], [4, 5]]
    >>> generate_sum_of_subsets_solutions(nums=[3, 34, 4, 12, 5, 2], max_sum=3)
    [[3]]
    >>> generate_sum_of_subsets_solutions(nums=[3, 34, 4, 12, 5, 2], max_sum=1)
    []
    """

    result: list[list[int]] = []
    path: list[int] = []
    num_index = 0
    remaining_nums_sum = sum(nums)
    create_state_space_tree(nums, max_sum, num_index, path, result, remaining_nums_sum)
    return result


def create_state_space_tree(
    nums: list[int],
    max_sum: int,
    num_index: int,
    path: list[int],
    result: list[list[int]],
    remaining_nums_sum: int,
) -> None:
    """
    Creates a state space tree to iterate through each branch using DFS.
    It terminates the branching of a node when any of the two conditions
    given below satisfy.
    This algorithm follows depth-fist-search and backtracks when the node is not
    branchable.

    >>> path = []
    >>> result = []
    >>> create_state_space_tree(
    ...     nums=[1],
    ...     max_sum=1,
    ...     num_index=0,
    ...     path=path,
    ...     result=result,
    ...     remaining_nums_sum=1)
    >>> path
    []
    >>> result
    [[1]]
    """

    if sum(path) > max_sum or (remaining_nums_sum + sum(path)) < max_sum:
        return
    if sum(path) == max_sum:
        result.append(path)
        return
    for index in range(num_index, len(nums)):
        create_state_space_tree(
            nums,
            max_sum,
            index + 1,
            [*path, nums[index]],
            result,
            remaining_nums_sum - nums[index],
        )


if __name__ == "__main__":
    import doctest

    doctest.testmod()


================================================
FILE: backtracking/word_break.py
================================================
"""
Word Break Problem is a well-known problem in computer science.
Given a string and a dictionary of words, the task is to determine if
the string can be segmented into a sequence of one or more dictionary words.

Wikipedia: https://en.wikipedia.org/wiki/Word_break_problem
"""


def backtrack(input_string: str, word_dict: set[str], start: int) -> bool:
    """
    Helper function that uses backtracking to determine if a valid
    word segmentation is possible starting from index 'start'.

    Parameters:
    input_string (str): The input string to be segmented.
    word_dict (set[str]): A set of valid dictionary words.
    start (int): The starting index of the substring to be checked.

    Returns:
    bool: True if a valid segmentation is possible, otherwise False.

    Example:
    >>> backtrack("leetcode", {"leet", "code"}, 0)
    True

    >>> backtrack("applepenapple", {"apple", "pen"}, 0)
    True

    >>> backtrack("catsandog", {"cats", "dog", "sand", "and", "cat"}, 0)
    False
    """

    # Base case: if the starting index has reached the end of the string
    if start == len(input_string):
        return True

    # Try every possible substring from 'start' to 'end'
    for end in range(start + 1, len(input_string) + 1):
        if input_string[start:end] in word_dict and backtrack(
            input_string, word_dict, end
        ):
            return True

    return False


def word_break(input_string: str, word_dict: set[str]) -> bool:
    """
    Determines if the input string can be segmented into a sequence of
    valid dictionary words using backtracking.

    Parameters:
    input_string (str): The input string to segment.
    word_dict (set[str]): The set of valid words.

    Returns:
    bool: True if the string can be segmented into valid words, otherwise False.

    Example:
    >>> word_break("leetcode", {"leet", "code"})
    True

    >>> word_break("applepenapple", {"apple", "pen"})
    True

    >>> word_break("catsandog", {"cats", "dog", "sand", "and", "cat"})
    False

    >>> word_break("applepenapple", {})
    False
    """

    return backtrack(input_string, word_dict, 0)


================================================
FILE: backtracking/word_ladder.py
================================================
"""
Word Ladder is a classic problem in computer science.
The problem is to transform a start word into an end word
by changing one letter at a time.
Each intermediate word must be a valid word from a given list of words.
The goal is to find a transformation sequence
from the start word to the end word.

Wikipedia: https://en.wikipedia.org/wiki/Word_ladder
"""

import string


def backtrack(
    current_word: str, path: list[str], end_word: str, word_set: set[str]
) -> list[str]:
    """
    Helper function to perform backtracking to find the transformation
    from the current_word to the end_word.

    Parameters:
    current_word (str): The current word in the transformation sequence.
    path (list[str]): The list of transformations from begin_word to current_word.
    end_word (str): The target word for transformation.
    word_set (set[str]): The set of valid words for transformation.

    Returns:
    list[str]: The list of transformations from begin_word to end_word.
               Returns an empty list if there is no valid
                transformation from current_word to end_word.

    Example:
    >>> backtrack("hit", ["hit"], "cog", {"hot", "dot", "dog", "lot", "log", "cog"})
    ['hit', 'hot', 'dot', 'lot', 'log', 'cog']

    >>> backtrack("hit", ["hit"], "cog", {"hot", "dot", "dog", "lot", "log"})
    []

    >>> backtrack("lead", ["lead"], "gold", {"load", "goad", "gold", "lead", "lord"})
    ['lead', 'lead', 'load', 'goad', 'gold']

    >>> backtrack("game", ["game"], "code", {"came", "cage", "code", "cade", "gave"})
    ['game', 'came', 'cade', 'code']
    """

    # Base case: If the current word is the end word, return the path
    if current_word == end_word:
        return path

    # Try all possible single-letter transformations
    for i in range(len(current_word)):
        for c in string.ascii_lowercase:  # Try changing each letter
            transformed_word = current_word[:i] + c + current_word[i + 1 :]
            if transformed_word in word_set:
                word_set.remove(transformed_word)
                # Recur with the new word added to the path
                result = backtrack(
                    transformed_word, [*path, transformed_word], end_word, word_set
                )
                if result:  # valid transformation found
                    return result
                word_set.add(transformed_word)  # backtrack

    return []  # No valid transformation found


def word_ladder(begin_word: str, end_word: str, word_set: set[str]) -> list[str]:
    """
    Solve the Word Ladder problem using Backtracking and return
    the list of transformations from begin_word to end_word.

    Parameters:
    begin_word (str): The word from which the transformation starts.
    end_word (str): The target word for transformation.
    word_list (list[str]): The list of valid words for transformation.

    Returns:
    list[str]: The list of transformations from begin_word to end_word.
               Returns an empty list if there is no valid transformation.

    Example:
    >>> word_ladder("hit", "cog", ["hot", "dot", "dog", "lot", "log", "cog"])
    ['hit', 'hot', 'dot', 'lot', 'log', 'cog']

    >>> word_ladder("hit", "cog", ["hot", "dot", "dog", "lot", "log"])
    []

    >>> word_ladder("lead", "gold", ["load", "goad", "gold", "lead", "lord"])
    ['lead', 'lead', 'load', 'goad', 'gold']

    >>> word_ladder("game", "code", ["came", "cage", "code", "cade", "gave"])
    ['game', 'came', 'cade', 'code']
    """

    if end_word not in word_set:  # no valid transformation possible
        return []

    # Perform backtracking starting from the begin_word
    return backtrack(begin_word, [begin_word], end_word, word_set)


================================================
FILE: backtracking/word_search.py
================================================
"""
Author  : Alexander Pantyukhin
Date    : November 24, 2022

Task:
Given an m x n grid of characters board and a string word,
return true if word exists in the grid.

The word can be constructed from letters of sequentially adjacent cells,
where adjacent cells are horizontally or vertically neighboring.
The same letter cell may not be used more than once.

Example:

Matrix:
---------
|A|B|C|E|
|S|F|C|S|
|A|D|E|E|
---------

Word:
"ABCCED"

Result:
True

Implementation notes: Use backtracking approach.
At each point, check all neighbors to try to find the next letter of the word.

leetcode: https://leetcode.com/problems/word-search/

"""


def get_point_key(len_board: int, len_board_column: int, row: int, column: int) -> int:
    """
    Returns the hash key of matrix indexes.

    >>> get_point_key(10, 20, 1, 0)
    200
    """

    return len_board * len_board_column * row + column


def exits_word(
    board: list[list[str]],
    word: str,
    row: int,
    column: int,
    word_index: int,
    visited_points_set: set[int],
) -> bool:
    """
    Return True if it's possible to search the word suffix
    starting from the word_index.

    >>> exits_word([["A"]], "B", 0, 0, 0, set())
    False
    """

    if board[row][column] != word[word_index]:
        return False

    if word_index == len(word) - 1:
        return True

    traverts_directions = [(0, 1), (0, -1), (-1, 0), (1, 0)]
    len_board = len(board)
    len_board_column = len(board[0])
    for direction in traverts_directions:
        next_i = row + direction[0]
        next_j = column + direction[1]
        if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
            continue

        key = get_point_key(len_board, len_board_column, next_i, next_j)
        if key in visited_points_set:
            continue

        visited_points_set.add(key)
        if exits_word(board, word, next_i, next_j, word_index + 1, visited_points_set):
            return True

        visited_points_set.remove(key)

    return False


def word_exists(board: list[list[str]], word: str) -> bool:
    """
    >>> word_exists([["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], "ABCCED")
    True
    >>> word_exists([["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], "SEE")
    True
    >>> word_exists([["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], "ABCB")
    False
    >>> word_exists([["A"]], "A")
    True
    >>> word_exists([["B", "A", "A"], ["A", "A", "A"], ["A", "B", "A"]], "ABB")
    False
    >>> word_exists([["A"]], 123)
    Traceback (most recent call last):
        ...
    ValueError: The word parameter should be a string of length greater than 0.
    >>> word_exists([["A"]], "")
    Traceback (most recent call last):
        ...
    ValueError: The word parameter should be a string of length greater than 0.
    >>> word_exists([[]], "AB")
    Traceback (most recent call last):
        ...
    ValueError: The board should be a non empty matrix of single chars strings.
    >>> word_exists([], "AB")
    Traceback (most recent call last):
        ...
    ValueError: The board should be a non empty matrix of single chars strings.
    >>> word_exists([["A"], [21]], "AB")
    Traceback (most recent call last):
        ...
    ValueError: The board should be a non empty matrix of single chars strings.
    """

    # Validate board
    board_error_message = (
        "The board should be a non empty matrix of single chars strings."
    )

    len_board = len(board)
    if not isinstance(board, list) or len(board) == 0:
        raise ValueError(board_error_message)

    for row in board:
        if not isinstance(row, list) or len(row) == 0:
            raise ValueError(board_error_message)

        for item in row:
            if not isinstance(item, str) or len(item) != 1:
                raise ValueError(board_error_message)

    # Validate word
    if not isinstance(word, str) or len(word) == 0:
        raise ValueError(
            "The word parameter should be a string of length greater than 0."
        )

    len_board_column = len(board[0])
    for i in range(len_board):
        for j in range(len_board_column):
            if exits_word(
                board, word, i, j, 0, {get_point_key(len_board, len_board_column, i, j)}
            ):
                return True

    return False


if __name__ == "__main__":
    import doctest

    doctest.testmod()


================================================
FILE: bit_manipulation/README.md
================================================
# Bit manipulation

Bit manipulation is the act of manipulating bits to detect errors (hamming cod
Download .txt
gitextract_lj21xc5n/

├── .devcontainer/
│   ├── Dockerfile
│   ├── README.md
│   ├── devcontainer.json
│   └── post_install
├── .gitattributes
├── .github/
│   ├── CODEOWNERS
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.yml
│   │   ├── config.yml
│   │   ├── feature_request.yml
│   │   └── other.yml
│   ├── dependabot.yml
│   ├── pull_request_template.md
│   ├── stale.yml
│   └── workflows/
│       ├── build.yml
│       ├── devcontainer_ci.yml
│       ├── directory_writer.yml
│       ├── project_euler.yml
│       ├── ruff.yml
│       └── sphinx.yml
├── .gitignore
├── .gitpod.yml
├── .pre-commit-config.yaml
├── CONTRIBUTING.md
├── DIRECTORY.md
├── LICENSE.md
├── README.md
├── audio_filters/
│   ├── README.md
│   ├── __init__.py
│   ├── butterworth_filter.py
│   ├── equal_loudness_filter.py.broken.txt
│   ├── iir_filter.py
│   ├── loudness_curve.json
│   └── show_response.py
├── backtracking/
│   ├── README.md
│   ├── __init__.py
│   ├── all_combinations.py
│   ├── all_permutations.py
│   ├── all_subsequences.py
│   ├── coloring.py
│   ├── combination_sum.py
│   ├── crossword_puzzle_solver.py
│   ├── generate_parentheses.py
│   ├── generate_parentheses_iterative.py
│   ├── hamiltonian_cycle.py
│   ├── knight_tour.py
│   ├── match_word_pattern.py
│   ├── minimax.py
│   ├── n_queens.py
│   ├── n_queens_math.py
│   ├── power_sum.py
│   ├── rat_in_maze.py
│   ├── sudoku.py
│   ├── sum_of_subsets.py
│   ├── word_break.py
│   ├── word_ladder.py
│   └── word_search.py
├── bit_manipulation/
│   ├── README.md
│   ├── __init__.py
│   ├── binary_and_operator.py
│   ├── binary_coded_decimal.py
│   ├── binary_count_setbits.py
│   ├── binary_count_trailing_zeros.py
│   ├── binary_or_operator.py
│   ├── binary_shifts.py
│   ├── binary_twos_complement.py
│   ├── binary_xor_operator.py
│   ├── bitwise_addition_recursive.py
│   ├── count_1s_brian_kernighan_method.py
│   ├── count_number_of_one_bits.py
│   ├── excess_3_code.py
│   ├── find_previous_power_of_two.py
│   ├── find_unique_number.py
│   ├── gray_code_sequence.py
│   ├── highest_set_bit.py
│   ├── index_of_rightmost_set_bit.py
│   ├── is_even.py
│   ├── is_power_of_two.py
│   ├── largest_pow_of_two_le_num.py
│   ├── missing_number.py
│   ├── numbers_different_signs.py
│   ├── power_of_4.py
│   ├── reverse_bits.py
│   ├── single_bit_manipulation_operations.py
│   └── swap_all_odd_and_even_bits.py
├── blockchain/
│   ├── README.md
│   ├── __init__.py
│   └── diophantine_equation.py
├── boolean_algebra/
│   ├── README.md
│   ├── __init__.py
│   ├── and_gate.py
│   ├── imply_gate.py
│   ├── karnaugh_map_simplification.py
│   ├── multiplexer.py
│   ├── nand_gate.py
│   ├── nimply_gate.py
│   ├── nor_gate.py
│   ├── not_gate.py
│   ├── or_gate.py
│   ├── quine_mc_cluskey.py
│   ├── xnor_gate.py
│   └── xor_gate.py
├── cellular_automata/
│   ├── README.md
│   ├── __init__.py
│   ├── conways_game_of_life.py
│   ├── game_of_life.py
│   ├── langtons_ant.py
│   ├── nagel_schrekenberg.py
│   ├── one_dimensional.py
│   └── wa_tor.py
├── ciphers/
│   ├── README.md
│   ├── __init__.py
│   ├── a1z26.py
│   ├── affine_cipher.py
│   ├── atbash.py
│   ├── autokey.py
│   ├── baconian_cipher.py
│   ├── base16.py
│   ├── base32.py
│   ├── base64_cipher.py
│   ├── base85.py
│   ├── beaufort_cipher.py
│   ├── bifid.py
│   ├── brute_force_caesar_cipher.py
│   ├── caesar_cipher.py
│   ├── cryptomath_module.py
│   ├── decrypt_caesar_with_chi_squared.py
│   ├── deterministic_miller_rabin.py
│   ├── diffie.py
│   ├── diffie_hellman.py
│   ├── elgamal_key_generator.py
│   ├── enigma_machine2.py
│   ├── fractionated_morse_cipher.py
│   ├── gronsfeld_cipher.py
│   ├── hill_cipher.py
│   ├── mixed_keyword_cypher.py
│   ├── mono_alphabetic_ciphers.py
│   ├── morse_code.py
│   ├── onepad_cipher.py
│   ├── permutation_cipher.py
│   ├── playfair_cipher.py
│   ├── polybius.py
│   ├── porta_cipher.py
│   ├── prehistoric_men.txt
│   ├── rabin_miller.py
│   ├── rail_fence_cipher.py
│   ├── rot13.py
│   ├── rsa_cipher.py
│   ├── rsa_factorization.py
│   ├── rsa_key_generator.py
│   ├── running_key_cipher.py
│   ├── shuffled_shift_cipher.py
│   ├── simple_keyword_cypher.py
│   ├── simple_substitution_cipher.py
│   ├── transposition_cipher.py
│   ├── transposition_cipher_encrypt_decrypt_file.py
│   ├── trifid_cipher.py
│   ├── vernam_cipher.py
│   ├── vigenere_cipher.py
│   └── xor_cipher.py
├── computer_vision/
│   ├── README.md
│   ├── __init__.py
│   ├── cnn_classification.py
│   ├── flip_augmentation.py
│   ├── haralick_descriptors.py
│   ├── harris_corner.py
│   ├── horn_schunck.py
│   ├── intensity_based_segmentation.py
│   ├── mean_threshold.py
│   ├── mosaic_augmentation.py
│   └── pooling_functions.py
├── conversions/
│   ├── README.md
│   ├── __init__.py
│   ├── astronomical_length_scale_conversion.py
│   ├── binary_to_decimal.py
│   ├── binary_to_hexadecimal.py
│   ├── binary_to_octal.py
│   ├── convert_number_to_words.py
│   ├── decimal_to_any.py
│   ├── decimal_to_binary.py
│   ├── decimal_to_hexadecimal.py
│   ├── decimal_to_octal.py
│   ├── energy_conversions.py
│   ├── excel_title_to_column.py
│   ├── hex_to_bin.py
│   ├── hexadecimal_to_decimal.py
│   ├── ipv4_conversion.py
│   ├── length_conversion.py
│   ├── molecular_chemistry.py
│   ├── octal_to_binary.py
│   ├── octal_to_decimal.py
│   ├── octal_to_hexadecimal.py
│   ├── prefix_conversions.py
│   ├── prefix_conversions_string.py
│   ├── pressure_conversions.py
│   ├── rectangular_to_polar.py
│   ├── rgb_cmyk_conversion.py
│   ├── rgb_hsv_conversion.py
│   ├── roman_numerals.py
│   ├── speed_conversions.py
│   ├── temperature_conversions.py
│   ├── time_conversions.py
│   ├── volume_conversions.py
│   └── weight_conversion.py
├── data_compression/
│   ├── README.md
│   ├── __init__.py
│   ├── burrows_wheeler.py
│   ├── coordinate_compression.py
│   ├── huffman.py
│   ├── lempel_ziv.py
│   ├── lempel_ziv_decompress.py
│   ├── lz77.py
│   ├── peak_signal_to_noise_ratio.py
│   └── run_length_encoding.py
├── data_structures/
│   ├── __init__.py
│   ├── arrays/
│   │   ├── __init__.py
│   │   ├── equilibrium_index_in_array.py
│   │   ├── find_triplets_with_0_sum.py
│   │   ├── index_2d_array_in_1d.py
│   │   ├── kth_largest_element.py
│   │   ├── median_two_array.py
│   │   ├── monotonic_array.py
│   │   ├── pairs_with_given_sum.py
│   │   ├── permutations.py
│   │   ├── prefix_sum.py
│   │   ├── product_sum.py
│   │   ├── rotate_array.py
│   │   ├── sparse_table.py
│   │   └── sudoku_solver.py
│   ├── binary_tree/
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── avl_tree.py
│   │   ├── basic_binary_tree.py
│   │   ├── binary_search_tree.py
│   │   ├── binary_search_tree_recursive.py
│   │   ├── binary_tree_mirror.py
│   │   ├── binary_tree_node_sum.py
│   │   ├── binary_tree_path_sum.py
│   │   ├── binary_tree_traversals.py
│   │   ├── diameter_of_binary_tree.py
│   │   ├── diff_views_of_binary_tree.py
│   │   ├── distribute_coins.py
│   │   ├── fenwick_tree.py
│   │   ├── flatten_binarytree_to_linkedlist.py
│   │   ├── floor_and_ceiling.py
│   │   ├── inorder_tree_traversal_2022.py
│   │   ├── is_sorted.py
│   │   ├── is_sum_tree.py
│   │   ├── lazy_segment_tree.py
│   │   ├── lowest_common_ancestor.py
│   │   ├── maximum_fenwick_tree.py
│   │   ├── maximum_sum_bst.py
│   │   ├── merge_two_binary_trees.py
│   │   ├── mirror_binary_tree.py
│   │   ├── non_recursive_segment_tree.py
│   │   ├── number_of_possible_binary_trees.py
│   │   ├── red_black_tree.py
│   │   ├── segment_tree.py
│   │   ├── segment_tree_other.py
│   │   ├── serialize_deserialize_binary_tree.py
│   │   ├── symmetric_tree.py
│   │   ├── treap.py
│   │   └── wavelet_tree.py
│   ├── disjoint_set/
│   │   ├── __init__.py
│   │   ├── alternate_disjoint_set.py
│   │   └── disjoint_set.py
│   ├── hashing/
│   │   ├── __init__.py
│   │   ├── bloom_filter.py
│   │   ├── double_hash.py
│   │   ├── hash_map.py
│   │   ├── hash_table.py
│   │   ├── hash_table_with_linked_list.py
│   │   ├── number_theory/
│   │   │   ├── __init__.py
│   │   │   └── prime_numbers.py
│   │   ├── quadratic_probing.py
│   │   └── tests/
│   │       ├── __init__.py
│   │       └── test_hash_map.py
│   ├── heap/
│   │   ├── __init__.py
│   │   ├── binomial_heap.py
│   │   ├── heap.py
│   │   ├── heap_generic.py
│   │   ├── max_heap.py
│   │   ├── min_heap.py
│   │   ├── randomized_heap.py
│   │   └── skew_heap.py
│   ├── kd_tree/
│   │   ├── __init__.py
│   │   ├── build_kdtree.py
│   │   ├── example/
│   │   │   ├── __init__.py
│   │   │   ├── example_usage.py
│   │   │   └── hypercube_points.py
│   │   ├── kd_node.py
│   │   ├── nearest_neighbour_search.py
│   │   └── tests/
│   │       ├── __init__.py
│   │       └── test_kdtree.py
│   ├── linked_list/
│   │   ├── __init__.py
│   │   ├── circular_linked_list.py
│   │   ├── deque_doubly.py
│   │   ├── doubly_linked_list.py
│   │   ├── doubly_linked_list_two.py
│   │   ├── floyds_cycle_detection.py
│   │   ├── from_sequence.py
│   │   ├── has_loop.py
│   │   ├── is_palindrome.py
│   │   ├── merge_two_lists.py
│   │   ├── middle_element_of_linked_list.py
│   │   ├── print_reverse.py
│   │   ├── reverse_k_group.py
│   │   ├── rotate_to_the_right.py
│   │   ├── singly_linked_list.py
│   │   ├── skip_list.py
│   │   └── swap_nodes.py
│   ├── queues/
│   │   ├── __init__.py
│   │   ├── circular_queue.py
│   │   ├── circular_queue_linked_list.py
│   │   ├── double_ended_queue.py
│   │   ├── linked_queue.py
│   │   ├── priority_queue_using_list.py
│   │   ├── queue_by_list.py
│   │   ├── queue_by_two_stacks.py
│   │   └── queue_on_pseudo_stack.py
│   ├── stacks/
│   │   ├── __init__.py
│   │   ├── balanced_parentheses.py
│   │   ├── dijkstras_two_stack_algorithm.py
│   │   ├── infix_to_postfix_conversion.py
│   │   ├── infix_to_prefix_conversion.py
│   │   ├── largest_rectangle_histogram.py
│   │   ├── lexicographical_numbers.py
│   │   ├── next_greater_element.py
│   │   ├── postfix_evaluation.py
│   │   ├── prefix_evaluation.py
│   │   ├── stack.py
│   │   ├── stack_using_two_queues.py
│   │   ├── stack_with_doubly_linked_list.py
│   │   ├── stack_with_singly_linked_list.py
│   │   └── stock_span_problem.py
│   ├── suffix_tree/
│   │   ├── __init__.py
│   │   ├── example/
│   │   │   ├── __init__.py
│   │   │   └── example_usage.py
│   │   ├── suffix_tree.py
│   │   ├── suffix_tree_node.py
│   │   └── tests/
│   │       ├── __init__.py
│   │       └── test_suffix_tree.py
│   └── trie/
│       ├── __init__.py
│       ├── radix_tree.py
│       └── trie.py
├── digital_image_processing/
│   ├── __init__.py
│   ├── change_brightness.py
│   ├── change_contrast.py
│   ├── convert_to_negative.py
│   ├── dithering/
│   │   ├── __init__.py
│   │   └── burkes.py
│   ├── edge_detection/
│   │   ├── __init__.py
│   │   └── canny.py
│   ├── filters/
│   │   ├── __init__.py
│   │   ├── bilateral_filter.py
│   │   ├── convolve.py
│   │   ├── gabor_filter.py
│   │   ├── gaussian_filter.py
│   │   ├── laplacian_filter.py
│   │   ├── local_binary_pattern.py
│   │   ├── median_filter.py
│   │   └── sobel_filter.py
│   ├── histogram_equalization/
│   │   ├── __init__.py
│   │   ├── histogram_stretch.py
│   │   ├── image_data/
│   │   │   └── __init__.py
│   │   └── output_data/
│   │       └── __init__.py
│   ├── image_data/
│   │   └── __init__.py
│   ├── index_calculation.py
│   ├── morphological_operations/
│   │   ├── __init__.py
│   │   ├── dilation_operation.py
│   │   └── erosion_operation.py
│   ├── resize/
│   │   ├── __init__.py
│   │   └── resize.py
│   ├── rotation/
│   │   ├── __init__.py
│   │   └── rotation.py
│   ├── sepia.py
│   └── test_digital_image_processing.py
├── divide_and_conquer/
│   ├── __init__.py
│   ├── closest_pair_of_points.py
│   ├── convex_hull.py
│   ├── heaps_algorithm.py
│   ├── heaps_algorithm_iterative.py
│   ├── inversions.py
│   ├── kth_order_statistic.py
│   ├── max_difference_pair.py
│   ├── max_subarray.py
│   ├── mergesort.py
│   ├── peak.py
│   ├── power.py
│   └── strassen_matrix_multiplication.py
├── docs/
│   ├── __init__.py
│   ├── conf.py
│   └── source/
│       └── __init__.py
├── dynamic_programming/
│   ├── __init__.py
│   ├── abbreviation.py
│   ├── all_construct.py
│   ├── bitmask.py
│   ├── catalan_numbers.py
│   ├── climbing_stairs.py
│   ├── combination_sum_iv.py
│   ├── edit_distance.py
│   ├── factorial.py
│   ├── fast_fibonacci.py
│   ├── fibonacci.py
│   ├── fizz_buzz.py
│   ├── floyd_warshall.py
│   ├── integer_partition.py
│   ├── iterating_through_submasks.py
│   ├── k_means_clustering_tensorflow.py
│   ├── knapsack.py
│   ├── largest_divisible_subset.py
│   ├── longest_common_subsequence.py
│   ├── longest_common_substring.py
│   ├── longest_increasing_subsequence.py
│   ├── longest_increasing_subsequence_iterative.py
│   ├── longest_increasing_subsequence_o_nlogn.py
│   ├── longest_palindromic_subsequence.py
│   ├── matrix_chain_multiplication.py
│   ├── matrix_chain_order.py
│   ├── max_non_adjacent_sum.py
│   ├── max_product_subarray.py
│   ├── max_subarray_sum.py
│   ├── min_distance_up_bottom.py
│   ├── minimum_coin_change.py
│   ├── minimum_cost_path.py
│   ├── minimum_partition.py
│   ├── minimum_size_subarray_sum.py
│   ├── minimum_squares_to_represent_a_number.py
│   ├── minimum_steps_to_one.py
│   ├── minimum_tickets_cost.py
│   ├── narcissistic_number.py
│   ├── optimal_binary_search_tree.py
│   ├── palindrome_partitioning.py
│   ├── range_sum_query.py
│   ├── regex_match.py
│   ├── rod_cutting.py
│   ├── smith_waterman.py
│   ├── subset_generation.py
│   ├── sum_of_subset.py
│   ├── trapped_water.py
│   ├── tribonacci.py
│   ├── viterbi.py
│   ├── wildcard_matching.py
│   └── word_break.py
├── electronics/
│   ├── __init__.py
│   ├── apparent_power.py
│   ├── builtin_voltage.py
│   ├── capacitor_equivalence.py
│   ├── carrier_concentration.py
│   ├── charging_capacitor.py
│   ├── charging_inductor.py
│   ├── circular_convolution.py
│   ├── coulombs_law.py
│   ├── electric_conductivity.py
│   ├── electric_power.py
│   ├── electrical_impedance.py
│   ├── ic_555_timer.py
│   ├── ind_reactance.py
│   ├── ohms_law.py
│   ├── real_and_reactive_power.py
│   ├── resistor_color_code.py
│   ├── resistor_equivalence.py
│   ├── resonant_frequency.py
│   └── wheatstone_bridge.py
├── file_transfer/
│   ├── __init__.py
│   ├── mytext.txt
│   ├── receive_file.py
│   ├── send_file.py
│   └── tests/
│       ├── __init__.py
│       └── test_send_file.py
├── financial/
│   ├── README.md
│   ├── __init__.py
│   ├── equated_monthly_installments.py
│   ├── exponential_moving_average.py
│   ├── interest.py
│   ├── present_value.py
│   ├── price_plus_tax.py
│   ├── simple_moving_average.py
│   ├── straight_line_depreciation.py
│   └── time_and_half_pay.py
├── fractals/
│   ├── __init__.py
│   ├── julia_sets.py
│   ├── koch_snowflake.py
│   ├── mandelbrot.py
│   ├── sierpinski_triangle.py
│   └── vicsek.py
├── fuzzy_logic/
│   ├── __init__.py
│   ├── fuzzy_operations.py
│   └── fuzzy_operations.py.DISABLED.txt
├── genetic_algorithm/
│   ├── __init__.py
│   └── basic_string.py
├── geodesy/
│   ├── __init__.py
│   ├── haversine_distance.py
│   └── lamberts_ellipsoidal_distance.py
├── geometry/
│   ├── __init__.py
│   ├── geometry.py
│   ├── graham_scan.py
│   ├── jarvis_march.py
│   └── tests/
│       ├── __init__.py
│       ├── test_graham_scan.py
│       └── test_jarvis_march.py
├── graphics/
│   ├── __init__.py
│   ├── bezier_curve.py
│   ├── butterfly_pattern.py
│   ├── digital_differential_analyzer_line.py
│   └── vector3_for_2d_rendering.py
├── graphs/
│   ├── __init__.py
│   ├── a_star.py
│   ├── ant_colony_optimization_algorithms.py
│   ├── articulation_points.py
│   ├── basic_graphs.py
│   ├── bellman_ford.py
│   ├── bi_directional_dijkstra.py
│   ├── bidirectional_a_star.py
│   ├── bidirectional_breadth_first_search.py
│   ├── bidirectional_search.py
│   ├── boruvka.py
│   ├── breadth_first_search.py
│   ├── breadth_first_search_2.py
│   ├── breadth_first_search_shortest_path.py
│   ├── breadth_first_search_shortest_path_2.py
│   ├── breadth_first_search_zero_one_shortest_path.py
│   ├── check_bipatrite.py
│   ├── check_cycle.py
│   ├── connected_components.py
│   ├── deep_clone_graph.py
│   ├── depth_first_search.py
│   ├── depth_first_search_2.py
│   ├── dijkstra.py
│   ├── dijkstra_2.py
│   ├── dijkstra_algorithm.py
│   ├── dijkstra_alternate.py
│   ├── dijkstra_binary_grid.py
│   ├── dinic.py
│   ├── directed_and_undirected_weighted_graph.py
│   ├── edmonds_karp_multiple_source_and_sink.py
│   ├── eulerian_path_and_circuit_for_undirected_graph.py
│   ├── even_tree.py
│   ├── finding_bridges.py
│   ├── frequent_pattern_graph_miner.py
│   ├── g_topological_sort.py
│   ├── gale_shapley_bigraph.py
│   ├── graph_adjacency_list.py
│   ├── graph_adjacency_matrix.py
│   ├── graph_list.py
│   ├── graphs_floyd_warshall.py
│   ├── greedy_best_first.py
│   ├── greedy_min_vertex_cover.py
│   ├── kahns_algorithm_long.py
│   ├── kahns_algorithm_topo.py
│   ├── karger.py
│   ├── lanczos_eigenvectors.py
│   ├── markov_chain.py
│   ├── matching_min_vertex_cover.py
│   ├── minimum_path_sum.py
│   ├── minimum_spanning_tree_boruvka.py
│   ├── minimum_spanning_tree_kruskal.py
│   ├── minimum_spanning_tree_kruskal2.py
│   ├── minimum_spanning_tree_prims.py
│   ├── minimum_spanning_tree_prims2.py
│   ├── multi_heuristic_astar.py
│   ├── page_rank.py
│   ├── prim.py
│   ├── random_graph_generator.py
│   ├── scc_kosaraju.py
│   ├── strongly_connected_components.py
│   ├── tarjans_scc.py
│   └── tests/
│       ├── __init__.py
│       ├── test_min_spanning_tree_kruskal.py
│       └── test_min_spanning_tree_prim.py
├── greedy_methods/
│   ├── __init__.py
│   ├── best_time_to_buy_and_sell_stock.py
│   ├── fractional_cover_problem.py
│   ├── fractional_knapsack.py
│   ├── fractional_knapsack_2.py
│   ├── gas_station.py
│   ├── minimum_coin_change.py
│   ├── minimum_waiting_time.py
│   ├── optimal_merge_pattern.py
│   └── smallest_range.py
├── hashes/
│   ├── README.md
│   ├── __init__.py
│   ├── adler32.py
│   ├── chaos_machine.py
│   ├── djb2.py
│   ├── elf.py
│   ├── enigma_machine.py
│   ├── fletcher16.py
│   ├── hamming_code.py
│   ├── luhn.py
│   ├── md5.py
│   ├── sdbm.py
│   ├── sha1.py
│   └── sha256.py
├── index.md
├── knapsack/
│   ├── README.md
│   ├── __init__.py
│   ├── greedy_knapsack.py
│   ├── knapsack.py
│   ├── recursive_approach_knapsack.py
│   └── tests/
│       ├── __init__.py
│       ├── test_greedy_knapsack.py
│       └── test_knapsack.py
├── linear_algebra/
│   ├── README.md
│   ├── __init__.py
│   ├── gaussian_elimination.py
│   ├── jacobi_iteration_method.py
│   ├── lu_decomposition.py
│   ├── matrix_inversion.py
│   └── src/
│       ├── __init__.py
│       ├── conjugate_gradient.py
│       ├── gaussian_elimination_pivoting.py
│       ├── lib.py
│       ├── polynom_for_points.py
│       ├── power_iteration.py
│       ├── rank_of_matrix.py
│       ├── rayleigh_quotient.py
│       ├── schur_complement.py
│       ├── test_linear_algebra.py
│       └── transformations_2d.py
├── linear_programming/
│   ├── __init__.py
│   └── simplex.py
├── machine_learning/
│   ├── __init__.py
│   ├── apriori_algorithm.py
│   ├── astar.py
│   ├── automatic_differentiation.py
│   ├── data_transformations.py
│   ├── decision_tree.py
│   ├── dimensionality_reduction.py
│   ├── forecasting/
│   │   ├── __init__.py
│   │   ├── ex_data.csv
│   │   └── run.py
│   ├── frequent_pattern_growth.py
│   ├── gaussian_naive_bayes.py.broken.txt
│   ├── gradient_boosting_classifier.py
│   ├── gradient_boosting_regressor.py.broken.txt
│   ├── gradient_descent.py
│   ├── k_means_clust.py
│   ├── k_nearest_neighbours.py
│   ├── linear_discriminant_analysis.py
│   ├── linear_regression.py
│   ├── local_weighted_learning/
│   │   ├── README.md
│   │   ├── __init__.py
│   │   └── local_weighted_learning.py
│   ├── logistic_regression.py
│   ├── loss_functions.py
│   ├── lstm/
│   │   ├── __init__.py
│   │   ├── lstm_prediction.py
│   │   └── sample_data.csv
│   ├── mfcc.py
│   ├── multilayer_perceptron_classifier.py
│   ├── polynomial_regression.py
│   ├── principle_component_analysis.py
│   ├── random_forest_classifier.py.broken.txt
│   ├── random_forest_regressor.py.broken.txt
│   ├── scoring_functions.py
│   ├── self_organizing_map.py
│   ├── sequential_minimum_optimization.py
│   ├── similarity_search.py
│   ├── support_vector_machines.py
│   ├── t_stochastic_neighbour_embedding.py
│   ├── word_frequency_functions.py
│   ├── xgboost_classifier.py
│   └── xgboost_regressor.py
├── maths/
│   ├── __init__.py
│   ├── abs.py
│   ├── addition_without_arithmetic.py
│   ├── aliquot_sum.py
│   ├── allocation_number.py
│   ├── arc_length.py
│   ├── area.py
│   ├── area_under_curve.py
│   ├── average_absolute_deviation.py
│   ├── average_mean.py
│   ├── average_median.py
│   ├── average_mode.py
│   ├── bailey_borwein_plouffe.py
│   ├── base_neg2_conversion.py
│   ├── basic_maths.py
│   ├── binary_exponentiation.py
│   ├── binary_multiplication.py
│   ├── binomial_coefficient.py
│   ├── binomial_distribution.py
│   ├── ceil.py
│   ├── chebyshev_distance.py
│   ├── check_polygon.py
│   ├── chinese_remainder_theorem.py
│   ├── chudnovsky_algorithm.py
│   ├── collatz_sequence.py
│   ├── combinations.py
│   ├── continued_fraction.py
│   ├── decimal_isolate.py
│   ├── decimal_to_fraction.py
│   ├── dodecahedron.py
│   ├── double_factorial.py
│   ├── dual_number_automatic_differentiation.py
│   ├── entropy.py
│   ├── euclidean_distance.py
│   ├── euler_method.py
│   ├── euler_modified.py
│   ├── eulers_totient.py
│   ├── extended_euclidean_algorithm.py
│   ├── factorial.py
│   ├── factors.py
│   ├── fast_inverse_sqrt.py
│   ├── fermat_little_theorem.py
│   ├── fibonacci.py
│   ├── find_max.py
│   ├── find_min.py
│   ├── floor.py
│   ├── gamma.py
│   ├── gaussian.py
│   ├── gcd_of_n_numbers.py
│   ├── geometric_mean.py
│   ├── germain_primes.py
│   ├── greatest_common_divisor.py
│   ├── hardy_ramanujanalgo.py
│   ├── images/
│   │   └── __init__.py
│   ├── integer_square_root.py
│   ├── interquartile_range.py
│   ├── is_int_palindrome.py
│   ├── is_ip_v4_address_valid.py
│   ├── is_square_free.py
│   ├── jaccard_similarity.py
│   ├── joint_probability_distribution.py
│   ├── josephus_problem.py
│   ├── juggler_sequence.py
│   ├── karatsuba.py
│   ├── kth_lexicographic_permutation.py
│   ├── largest_of_very_large_numbers.py
│   ├── least_common_multiple.py
│   ├── line_length.py
│   ├── liouville_lambda.py
│   ├── lucas_lehmer_primality_test.py
│   ├── lucas_series.py
│   ├── maclaurin_series.py
│   ├── manhattan_distance.py
│   ├── matrix_exponentiation.py
│   ├── max_sum_sliding_window.py
│   ├── minkowski_distance.py
│   ├── mobius_function.py
│   ├── modular_division.py
│   ├── modular_exponential.py
│   ├── monte_carlo.py
│   ├── monte_carlo_dice.py
│   ├── number_of_digits.py
│   ├── numerical_analysis/
│   │   ├── __init__.py
│   │   ├── adams_bashforth.py
│   │   ├── bisection.py
│   │   ├── bisection_2.py
│   │   ├── integration_by_simpson_approx.py
│   │   ├── intersection.py
│   │   ├── nevilles_method.py
│   │   ├── newton_forward_interpolation.py
│   │   ├── newton_raphson.py
│   │   ├── numerical_integration.py
│   │   ├── proper_fractions.py
│   │   ├── runge_kutta.py
│   │   ├── runge_kutta_fehlberg_45.py
│   │   ├── runge_kutta_gills.py
│   │   ├── secant_method.py
│   │   ├── simpson_rule.py
│   │   ├── square_root.py
│   │   └── weierstrass_method.py
│   ├── odd_sieve.py
│   ├── perfect_cube.py
│   ├── perfect_number.py
│   ├── perfect_square.py
│   ├── persistence.py
│   ├── pi_generator.py
│   ├── pi_monte_carlo_estimation.py
│   ├── points_are_collinear_3d.py
│   ├── pollard_rho.py
│   ├── polynomial_evaluation.py
│   ├── polynomials/
│   │   ├── __init__.py
│   │   └── single_indeterminate_operations.py
│   ├── power_using_recursion.py
│   ├── prime_check.py
│   ├── prime_factors.py
│   ├── prime_numbers.py
│   ├── prime_sieve_eratosthenes.py
│   ├── primelib.py
│   ├── print_multiplication_table.py
│   ├── pythagoras.py
│   ├── qr_decomposition.py
│   ├── quadratic_equations_complex_numbers.py
│   ├── radians.py
│   ├── radix2_fft.py
│   ├── remove_digit.py
│   ├── segmented_sieve.py
│   ├── series/
│   │   ├── __init__.py
│   │   ├── arithmetic.py
│   │   ├── geometric.py
│   │   ├── geometric_series.py
│   │   ├── harmonic.py
│   │   ├── harmonic_series.py
│   │   ├── hexagonal_numbers.py
│   │   └── p_series.py
│   ├── sieve_of_eratosthenes.py
│   ├── sigmoid.py
│   ├── signum.py
│   ├── simultaneous_linear_equation_solver.py
│   ├── sin.py
│   ├── sock_merchant.py
│   ├── softmax.py
│   ├── solovay_strassen_primality_test.py
│   ├── spearman_rank_correlation_coefficient.py
│   ├── special_numbers/
│   │   ├── __init__.py
│   │   ├── armstrong_numbers.py
│   │   ├── automorphic_number.py
│   │   ├── bell_numbers.py
│   │   ├── carmichael_number.py
│   │   ├── catalan_number.py
│   │   ├── hamming_numbers.py
│   │   ├── happy_number.py
│   │   ├── harshad_numbers.py
│   │   ├── hexagonal_number.py
│   │   ├── krishnamurthy_number.py
│   │   ├── perfect_number.py
│   │   ├── polygonal_numbers.py
│   │   ├── pronic_number.py
│   │   ├── proth_number.py
│   │   ├── triangular_numbers.py
│   │   ├── ugly_numbers.py
│   │   └── weird_number.py
│   ├── sum_of_arithmetic_series.py
│   ├── sum_of_digits.py
│   ├── sum_of_geometric_progression.py
│   ├── sum_of_harmonic_series.py
│   ├── sumset.py
│   ├── sylvester_sequence.py
│   ├── tanh.py
│   ├── test_factorial.py
│   ├── test_prime_check.py
│   ├── three_sum.py
│   ├── trapezoidal_rule.py
│   ├── triplet_sum.py
│   ├── twin_prime.py
│   ├── two_pointer.py
│   ├── two_sum.py
│   ├── volume.py
│   └── zellers_congruence.py
├── matrix/
│   ├── __init__.py
│   ├── binary_search_matrix.py
│   ├── count_islands_in_matrix.py
│   ├── count_negative_numbers_in_sorted_matrix.py
│   ├── count_paths.py
│   ├── cramers_rule_2x2.py
│   ├── inverse_of_matrix.py
│   ├── largest_square_area_in_matrix.py
│   ├── matrix_based_game.py
│   ├── matrix_class.py
│   ├── matrix_equalization.py
│   ├── matrix_multiplication_recursion.py
│   ├── matrix_operation.py
│   ├── max_area_of_island.py
│   ├── median_matrix.py
│   ├── nth_fibonacci_using_matrix_exponentiation.py
│   ├── pascal_triangle.py
│   ├── rotate_matrix.py
│   ├── searching_in_sorted_matrix.py
│   ├── sherman_morrison.py
│   ├── spiral_print.py
│   ├── tests/
│   │   ├── __init__.py
│   │   ├── pytest.ini
│   │   └── test_matrix_operation.py
│   └── validate_sudoku_board.py
├── networking_flow/
│   ├── __init__.py
│   ├── ford_fulkerson.py
│   └── minimum_cut.py
├── neural_network/
│   ├── __init__.py
│   ├── activation_functions/
│   │   ├── __init__.py
│   │   ├── binary_step.py
│   │   ├── exponential_linear_unit.py
│   │   ├── gaussian_error_linear_unit.py
│   │   ├── leaky_rectified_linear_unit.py
│   │   ├── mish.py
│   │   ├── rectified_linear_unit.py
│   │   ├── scaled_exponential_linear_unit.py
│   │   ├── soboleva_modified_hyperbolic_tangent.py
│   │   ├── softplus.py
│   │   ├── squareplus.py
│   │   └── swish.py
│   ├── back_propagation_neural_network.py
│   ├── convolution_neural_network.py
│   ├── gan.py_tf
│   ├── input_data.py
│   ├── perceptron.py.DISABLED
│   ├── simple_neural_network.py
│   └── two_hidden_layers_neural_network.py
├── other/
│   ├── __init__.py
│   ├── activity_selection.py
│   ├── alternative_list_arrange.py
│   ├── bankers_algorithm.py
│   ├── davis_putnam_logemann_loveland.py
│   ├── doomsday.py
│   ├── fischer_yates_shuffle.py
│   ├── gauss_easter.py
│   ├── graham_scan.py
│   ├── greedy.py
│   ├── guess_the_number_search.py
│   ├── h_index.py
│   ├── least_recently_used.py
│   ├── lfu_cache.py
│   ├── linear_congruential_generator.py
│   ├── lru_cache.py
│   ├── magicdiamondpattern.py
│   ├── majority_vote_algorithm.py
│   ├── maximum_subsequence.py
│   ├── nested_brackets.py
│   ├── number_container_system.py
│   ├── password.py
│   ├── quine.py
│   ├── scoring_algorithm.py
│   ├── sdes.py
│   ├── sliding_window_maximum.py
│   ├── tower_of_hanoi.py
│   └── word_search.py
├── physics/
│   ├── __init__.py
│   ├── altitude_pressure.py
│   ├── archimedes_principle_of_buoyant_force.py
│   ├── basic_orbital_capture.py
│   ├── casimir_effect.py
│   ├── center_of_mass.py
│   ├── centripetal_force.py
│   ├── coulombs_law.py
│   ├── doppler_frequency.py
│   ├── escape_velocity.py
│   ├── grahams_law.py
│   ├── horizontal_projectile_motion.py
│   ├── hubble_parameter.py
│   ├── ideal_gas_law.py
│   ├── image_data/
│   │   └── __init__.py
│   ├── in_static_equilibrium.py
│   ├── kinetic_energy.py
│   ├── lens_formulae.py
│   ├── lorentz_transformation_four_vector.py
│   ├── malus_law.py
│   ├── mass_energy_equivalence.py
│   ├── mirror_formulae.py
│   ├── n_body_simulation.py
│   ├── newtons_law_of_gravitation.py
│   ├── newtons_second_law_of_motion.py
│   ├── orbital_transfer_work.py
│   ├── period_of_pendulum.py
│   ├── photoelectric_effect.py
│   ├── potential_energy.py
│   ├── rainfall_intensity.py
│   ├── reynolds_number.py
│   ├── rms_speed_of_molecule.py
│   ├── shear_stress.py
│   ├── speed_of_sound.py
│   ├── speeds_of_gas_molecules.py
│   └── terminal_velocity.py
├── project_euler/
│   ├── README.md
│   ├── __init__.py
│   ├── problem_001/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   ├── sol4.py
│   │   ├── sol5.py
│   │   ├── sol6.py
│   │   └── sol7.py
│   ├── problem_002/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   ├── sol4.py
│   │   └── sol5.py
│   ├── problem_003/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_004/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_005/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_006/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   └── sol4.py
│   ├── problem_007/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_008/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_009/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   └── sol4.py
│   ├── problem_010/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_011/
│   │   ├── __init__.py
│   │   ├── grid.txt
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_012/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_013/
│   │   ├── __init__.py
│   │   ├── num.txt
│   │   └── sol1.py
│   ├── problem_014/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_015/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_016/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_017/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_018/
│   │   ├── __init__.py
│   │   ├── solution.py
│   │   └── triangle.txt
│   ├── problem_019/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_020/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   ├── sol3.py
│   │   └── sol4.py
│   ├── problem_021/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_022/
│   │   ├── __init__.py
│   │   ├── p022_names.txt
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_023/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_024/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_025/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── sol3.py
│   ├── problem_026/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_027/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_028/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_029/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_030/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_031/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_032/
│   │   ├── __init__.py
│   │   └── sol32.py
│   ├── problem_033/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_034/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_035/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_036/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_037/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_038/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_039/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_040/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_041/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_042/
│   │   ├── __init__.py
│   │   ├── solution42.py
│   │   └── words.txt
│   ├── problem_043/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_044/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_045/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_046/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_047/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_048/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_049/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_050/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_051/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_052/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_053/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_054/
│   │   ├── __init__.py
│   │   ├── poker_hands.txt
│   │   ├── sol1.py
│   │   └── test_poker_hand.py
│   ├── problem_055/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_056/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_057/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_058/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_059/
│   │   ├── __init__.py
│   │   ├── p059_cipher.txt
│   │   ├── sol1.py
│   │   └── test_cipher.txt
│   ├── problem_062/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_063/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_064/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_065/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_067/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   ├── sol2.py
│   │   └── triangle.txt
│   ├── problem_068/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_069/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_070/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_071/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_072/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_073/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_074/
│   │   ├── __init__.py
│   │   ├── sol1.py
│   │   └── sol2.py
│   ├── problem_075/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_076/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_077/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_078/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_079/
│   │   ├── __init__.py
│   │   ├── keylog.txt
│   │   ├── keylog_test.txt
│   │   └── sol1.py
│   ├── problem_080/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_081/
│   │   ├── __init__.py
│   │   ├── matrix.txt
│   │   └── sol1.py
│   ├── problem_082/
│   │   ├── __init__.py
│   │   ├── input.txt
│   │   ├── sol1.py
│   │   └── test_matrix.txt
│   ├── problem_085/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_086/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_087/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_089/
│   │   ├── __init__.py
│   │   ├── numeralcleanup_test.txt
│   │   ├── p089_roman.txt
│   │   └── sol1.py
│   ├── problem_091/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_092/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_094/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_095/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_097/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_099/
│   │   ├── __init__.py
│   │   ├── base_exp.txt
│   │   └── sol1.py
│   ├── problem_100/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_101/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_102/
│   │   ├── __init__.py
│   │   ├── p102_triangles.txt
│   │   ├── sol1.py
│   │   └── test_triangles.txt
│   ├── problem_104/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_107/
│   │   ├── __init__.py
│   │   ├── p107_network.txt
│   │   ├── sol1.py
│   │   └── test_network.txt
│   ├── problem_109/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_112/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_113/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_114/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_115/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_116/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_117/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_119/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_120/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_121/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_122/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_123/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_125/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_129/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_131/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_135/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_136/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_144/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_145/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_164/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_173/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_174/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_180/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_187/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_188/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_190/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_191/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_203/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_205/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_206/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_207/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_234/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_301/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_345/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_493/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_551/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_587/
│   │   ├── __init__.py
│   │   └── sol1.py
│   ├── problem_686/
│   │   ├── __init__.py
│   │   └── sol1.py
│   └── problem_800/
│       ├── __init__.py
│       └── sol1.py
├── pyproject.toml
├── quantum/
│   ├── README.md
│   ├── __init__.py
│   ├── bb84.py.DISABLED.txt
│   ├── deutsch_jozsa.py.DISABLED.txt
│   ├── half_adder.py.DISABLED.txt
│   ├── not_gate.py.DISABLED.txt
│   ├── q_fourier_transform.py
│   ├── q_full_adder.py.DISABLED.txt
│   ├── quantum_entanglement.py.DISABLED.txt
│   ├── quantum_random.py.DISABLED.txt
│   ├── quantum_teleportation.py.DISABLED.txt
│   ├── ripple_adder_classic.py.DISABLED.txt
│   ├── single_qubit_measure.py.DISABLED.txt
│   └── superdense_coding.py.DISABLED.txt
├── scheduling/
│   ├── __init__.py
│   ├── first_come_first_served.py
│   ├── highest_response_ratio_next.py
│   ├── job_sequence_with_deadline.py
│   ├── job_sequencing_with_deadline.py
│   ├── multi_level_feedback_queue.py
│   ├── non_preemptive_shortest_job_first.py
│   ├── round_robin.py
│   └── shortest_job_first.py
├── scripts/
│   ├── README.md
│   ├── __init__.py
│   ├── build_directory_md.py
│   ├── close_pull_requests_with_awaiting_changes.sh
│   ├── close_pull_requests_with_failing_tests.sh
│   ├── close_pull_requests_with_require_descriptive_names.sh
│   ├── close_pull_requests_with_require_tests.sh
│   ├── close_pull_requests_with_require_type_hints.sh
│   ├── find_git_conflicts.sh
│   ├── project_euler_answers.json
│   ├── validate_filenames.py
│   └── validate_solutions.py
├── searches/
│   ├── __init__.py
│   ├── binary_search.py
│   ├── binary_tree_traversal.py
│   ├── double_linear_search.py
│   ├── double_linear_search_recursion.py
│   ├── exponential_search.py
│   ├── fibonacci_search.py
│   ├── hill_climbing.py
│   ├── interpolation_search.py
│   ├── jump_search.py
│   ├── linear_search.py
│   ├── median_of_medians.py
│   ├── quick_select.py
│   ├── sentinel_linear_search.py
│   ├── simple_binary_search.py
│   ├── simulated_annealing.py
│   ├── tabu_search.py
│   ├── tabu_test_data.txt
│   └── ternary_search.py
├── sorts/
│   ├── README.md
│   ├── __init__.py
│   ├── bead_sort.py
│   ├── binary_insertion_sort.py
│   ├── bitonic_sort.py
│   ├── bogo_sort.py
│   ├── bubble_sort.py
│   ├── bucket_sort.py
│   ├── circle_sort.py
│   ├── cocktail_shaker_sort.py
│   ├── comb_sort.py
│   ├── counting_sort.py
│   ├── cycle_sort.py
│   ├── cyclic_sort.py
│   ├── double_sort.py
│   ├── dutch_national_flag_sort.py
│   ├── exchange_sort.py
│   ├── external_sort.py
│   ├── gnome_sort.py
│   ├── heap_sort.py
│   ├── insertion_sort.py
│   ├── intro_sort.py
│   ├── iterative_merge_sort.py
│   ├── merge_insertion_sort.py
│   ├── merge_sort.py
│   ├── msd_radix_sort.py
│   ├── natural_sort.py
│   ├── normal_distribution_quick_sort.md
│   ├── odd_even_sort.py
│   ├── odd_even_transposition_parallel.py
│   ├── odd_even_transposition_single_threaded.py
│   ├── pancake_sort.py
│   ├── patience_sort.py
│   ├── pigeon_sort.py
│   ├── pigeonhole_sort.py
│   ├── quick_sort.py
│   ├── quick_sort_3_partition.py
│   ├── radix_sort.py
│   ├── recursive_insertion_sort.py
│   ├── recursive_mergesort_array.py
│   ├── recursive_quick_sort.py
│   ├── selection_sort.py
│   ├── shell_sort.py
│   ├── shrink_shell_sort.py
│   ├── slowsort.py
│   ├── stalin_sort.py
│   ├── stooge_sort.py
│   ├── strand_sort.py
│   ├── tim_sort.py
│   ├── topological_sort.py
│   ├── tree_sort.py
│   ├── unknown_sort.py
│   └── wiggle_sort.py
├── strings/
│   ├── __init__.py
│   ├── aho_corasick.py
│   ├── alternative_string_arrange.py
│   ├── anagrams.py
│   ├── anagrams.txt
│   ├── autocomplete_using_trie.py
│   ├── barcode_validator.py
│   ├── bitap_string_match.py
│   ├── boyer_moore_search.py
│   ├── camel_case_to_snake_case.py
│   ├── can_string_be_rearranged_as_palindrome.py
│   ├── capitalize.py
│   ├── check_anagrams.py
│   ├── count_vowels.py
│   ├── credit_card_validator.py
│   ├── damerau_levenshtein_distance.py
│   ├── detecting_english_programmatically.py
│   ├── dictionary.txt
│   ├── dna.py
│   ├── edit_distance.py
│   ├── frequency_finder.py
│   ├── hamming_distance.py
│   ├── indian_phone_validator.py
│   ├── is_contains_unique_chars.py
│   ├── is_isogram.py
│   ├── is_pangram.py
│   ├── is_polish_national_id.py
│   ├── is_spain_national_id.py
│   ├── is_srilankan_phone_number.py
│   ├── is_valid_email_address.py
│   ├── jaro_winkler.py
│   ├── join.py
│   ├── knuth_morris_pratt.py
│   ├── levenshtein_distance.py
│   ├── lower.py
│   ├── manacher.py
│   ├── min_cost_string_conversion.py
│   ├── naive_string_search.py
│   ├── ngram.py
│   ├── palindrome.py
│   ├── pig_latin.py
│   ├── prefix_function.py
│   ├── rabin_karp.py
│   ├── remove_duplicate.py
│   ├── reverse_letters.py
│   ├── reverse_words.py
│   ├── snake_case_to_camel_pascal_case.py
│   ├── split.py
│   ├── string_switch_case.py
│   ├── strip.py
│   ├── text_justification.py
│   ├── title.py
│   ├── top_k_frequent_words.py
│   ├── upper.py
│   ├── wave_string.py
│   ├── wildcard_pattern_matching.py
│   ├── word_occurrence.py
│   ├── word_patterns.py
│   ├── words.txt
│   └── z_function.py
└── web_programming/
    ├── __init__.py
    ├── co2_emission.py
    ├── covid_stats_via_xpath.py
    ├── crawl_google_results.py
    ├── crawl_google_scholar_citation.py
    ├── currency_converter.py
    ├── current_stock_price.py
    ├── current_weather.py
    ├── daily_horoscope.py
    ├── download_images_from_google_query.py
    ├── emails_from_url.py
    ├── fetch_anime_and_play.py
    ├── fetch_bbc_news.py
    ├── fetch_github_info.py
    ├── fetch_jobs.py
    ├── fetch_quotes.py
    ├── fetch_well_rx_price.py
    ├── get_amazon_product_data.py
    ├── get_imdb_top_250_movies_csv.py
    ├── get_imdbtop.py.DISABLED
    ├── get_ip_geolocation.py
    ├── get_top_billionaires.py
    ├── get_top_hn_posts.py
    ├── get_user_tweets.py.DISABLED
    ├── giphy.py
    ├── instagram_crawler.py
    ├── instagram_pic.py
    ├── instagram_video.py
    ├── nasa_data.py
    ├── open_google_results.py
    ├── random_anime_character.py
    ├── recaptcha_verification.py
    ├── reddit.py
    ├── search_books_by_isbn.py
    ├── slack_message.py
    ├── test_fetch_github_info.py
    └── world_covid19_stats.py
Download .txt
Showing preview only (362K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (4127 symbols across 1152 files)

FILE: audio_filters/butterworth_filter.py
  function make_lowpass (line 13) | def make_lowpass(
  function make_highpass (line 43) | def make_highpass(
  function make_bandpass (line 73) | def make_bandpass(
  function make_allpass (line 104) | def make_allpass(
  function make_peak (line 131) | def make_peak(
  function make_lowshelf (line 163) | def make_lowshelf(
  function make_highshelf (line 200) | def make_highshelf(

FILE: audio_filters/iir_filter.py
  class IIRFilter (line 4) | class IIRFilter:
    method __init__ (line 26) | def __init__(self, order: int) -> None:
    method set_coefficients (line 39) | def set_coefficients(self, a_coeffs: list[float], b_coeffs: list[float...
    method process (line 75) | def process(self, sample: float) -> float:

FILE: audio_filters/show_response.py
  class FilterType (line 11) | class FilterType(Protocol):
    method process (line 13) | def process(self, sample: float) -> float:
  function get_bounds (line 22) | def get_bounds(
  function show_frequency_response (line 38) | def show_frequency_response(filter_type: FilterType, samplerate: int) ->...
  function show_phase_response (line 70) | def show_phase_response(filter_type: FilterType, samplerate: int) -> None:

FILE: backtracking/all_combinations.py
  function combination_lists (line 13) | def combination_lists(n: int, k: int) -> list[list[int]]:
  function generate_all_combinations (line 23) | def generate_all_combinations(n: int, k: int) -> list[list[int]]:
  function create_all_state (line 64) | def create_all_state(

FILE: backtracking/all_permutations.py
  function generate_all_permutations (line 12) | def generate_all_permutations(sequence: list[int | str]) -> None:
  function create_state_space_tree (line 16) | def create_state_space_tree(

FILE: backtracking/all_subsequences.py
  function generate_all_subsequences (line 14) | def generate_all_subsequences(sequence: list[Any]) -> None:
  function create_state_space_tree (line 18) | def create_state_space_tree(

FILE: backtracking/coloring.py
  function valid_coloring (line 10) | def valid_coloring(
  function util_color (line 36) | def util_color(
  function color (line 88) | def color(graph: list[list[int]], max_colors: int) -> list[int]:

FILE: backtracking/combination_sum.py
  function backtrack (line 16) | def backtrack(
  function combination_sum (line 41) | def combination_sum(candidates: list, target: int) -> list:
  function main (line 68) | def main() -> None:

FILE: backtracking/crossword_puzzle_solver.py
  function is_valid (line 4) | def is_valid(
  function place_word (line 36) | def place_word(
  function remove_word (line 59) | def remove_word(
  function solve_crossword (line 82) | def solve_crossword(puzzle: list[list[str]], words: list[str]) -> bool:

FILE: backtracking/generate_parentheses.py
  function backtrack (line 11) | def backtrack(
  function generate_parenthesis (line 48) | def generate_parenthesis(n: int) -> list[str]:

FILE: backtracking/generate_parentheses_iterative.py
  function generate_parentheses_iterative (line 1) | def generate_parentheses_iterative(length: int) -> list[str]:

FILE: backtracking/hamiltonian_cycle.py
  function valid_connection (line 11) | def valid_connection(
  function util_hamilton_cycle (line 49) | def util_hamilton_cycle(graph: list[list[int]], path: list[int], curr_in...
  function hamilton_cycle (line 110) | def hamilton_cycle(graph: list[list[int]], start_index: int = 0) -> list...

FILE: backtracking/knight_tour.py
  function get_valid_pos (line 6) | def get_valid_pos(position: tuple[int, int], n: int) -> list[tuple[int, ...
  function is_complete (line 35) | def is_complete(board: list[list[int]]) -> bool:
  function open_knight_tour_helper (line 49) | def open_knight_tour_helper(
  function open_knight_tour (line 71) | def open_knight_tour(n: int) -> list[list[int]]:

FILE: backtracking/match_word_pattern.py
  function match_word_pattern (line 1) | def match_word_pattern(pattern: str, input_string: str) -> bool:

FILE: backtracking/minimax.py
  function minimax (line 16) | def minimax(
  function main (line 81) | def main() -> None:

FILE: backtracking/n_queens.py
  function is_safe (line 16) | def is_safe(board: list[list[int]], row: int, column: int) -> bool:
  function solve (line 63) | def solve(board: list[list[int]], row: int) -> bool:
  function printboard (line 92) | def printboard(board: list[list[int]]) -> None:

FILE: backtracking/n_queens_math.py
  function depth_first_search (line 82) | def depth_first_search(
  function n_queens_solution (line 141) | def n_queens_solution(n: int) -> None:

FILE: backtracking/power_sum.py
  function backtrack (line 10) | def backtrack(
  function solve (line 54) | def solve(needed_sum: int, power: int) -> int:

FILE: backtracking/rat_in_maze.py
  function solve_maze (line 4) | def solve_maze(
  function run_maze (line 139) | def run_maze(

FILE: backtracking/sudoku.py
  function is_safe (line 44) | def is_safe(grid: Matrix, row: int, column: int, n: int) -> bool:
  function find_empty_location (line 63) | def find_empty_location(grid: Matrix) -> tuple[int, int] | None:
  function sudoku (line 75) | def sudoku(grid: Matrix) -> Matrix | None:
  function print_solution (line 112) | def print_solution(grid: Matrix) -> None:

FILE: backtracking/sum_of_subsets.py
  function generate_sum_of_subsets_solutions (line 11) | def generate_sum_of_subsets_solutions(nums: list[int], max_sum: int) -> ...
  function create_state_space_tree (line 32) | def create_state_space_tree(

FILE: backtracking/word_break.py
  function backtrack (line 10) | def backtrack(input_string: str, word_dict: set[str], start: int) -> bool:
  function word_break (line 48) | def word_break(input_string: str, word_dict: set[str]) -> bool:

FILE: backtracking/word_ladder.py
  function backtrack (line 15) | def backtrack(
  function word_ladder (line 68) | def word_ladder(begin_word: str, end_word: str, word_set: set[str]) -> l...

FILE: backtracking/word_search.py
  function get_point_key (line 36) | def get_point_key(len_board: int, len_board_column: int, row: int, colum...
  function exits_word (line 47) | def exits_word(
  function word_exists (line 91) | def word_exists(board: list[list[str]], word: str) -> bool:

FILE: bit_manipulation/binary_and_operator.py
  function binary_and (line 4) | def binary_and(a: int, b: int) -> str:

FILE: bit_manipulation/binary_coded_decimal.py
  function binary_coded_decimal (line 1) | def binary_coded_decimal(number: int) -> str:

FILE: bit_manipulation/binary_count_setbits.py
  function binary_count_setbits (line 1) | def binary_count_setbits(a: int) -> int:

FILE: bit_manipulation/binary_count_trailing_zeros.py
  function binary_count_trailing_zeros (line 4) | def binary_count_trailing_zeros(a: int) -> int:

FILE: bit_manipulation/binary_or_operator.py
  function binary_or (line 4) | def binary_or(a: int, b: int) -> str:

FILE: bit_manipulation/binary_shifts.py
  function logical_left_shift (line 6) | def logical_left_shift(number: int, shift_amount: int) -> str:
  function logical_right_shift (line 36) | def logical_right_shift(number: int, shift_amount: int) -> str:
  function arithmetic_right_shift (line 68) | def arithmetic_right_shift(number: int, shift_amount: int) -> str:

FILE: bit_manipulation/binary_twos_complement.py
  function twos_complement (line 4) | def twos_complement(number: int) -> str:

FILE: bit_manipulation/binary_xor_operator.py
  function binary_xor (line 4) | def binary_xor(a: int, b: int) -> str:

FILE: bit_manipulation/bitwise_addition_recursive.py
  function bitwise_addition_recursive (line 7) | def bitwise_addition_recursive(number: int, other_number: int) -> int:

FILE: bit_manipulation/count_1s_brian_kernighan_method.py
  function get_1s_count (line 1) | def get_1s_count(number: int) -> int:

FILE: bit_manipulation/count_number_of_one_bits.py
  function get_set_bits_count_using_brian_kernighans_algorithm (line 4) | def get_set_bits_count_using_brian_kernighans_algorithm(number: int) -> ...
  function get_set_bits_count_using_modulo_operator (line 33) | def get_set_bits_count_using_modulo_operator(number: int) -> int:
  function benchmark (line 63) | def benchmark() -> None:

FILE: bit_manipulation/excess_3_code.py
  function excess_3_code (line 1) | def excess_3_code(number: int) -> str:

FILE: bit_manipulation/find_previous_power_of_two.py
  function find_previous_power_of_two (line 1) | def find_previous_power_of_two(number: int) -> int:

FILE: bit_manipulation/find_unique_number.py
  function find_unique_number (line 1) | def find_unique_number(arr: list[int]) -> int:

FILE: bit_manipulation/gray_code_sequence.py
  function gray_code (line 1) | def gray_code(bit_count: int) -> list:
  function gray_code_sequence_string (line 50) | def gray_code_sequence_string(bit_count: int) -> list:

FILE: bit_manipulation/highest_set_bit.py
  function get_highest_set_bit_position (line 1) | def get_highest_set_bit_position(number: int) -> int:

FILE: bit_manipulation/index_of_rightmost_set_bit.py
  function get_index_of_rightmost_set_bit (line 4) | def get_index_of_rightmost_set_bit(number: int) -> int:

FILE: bit_manipulation/is_even.py
  function is_even (line 1) | def is_even(number: int) -> bool:

FILE: bit_manipulation/is_power_of_two.py
  function is_power_of_two (line 18) | def is_power_of_two(number: int) -> bool:

FILE: bit_manipulation/largest_pow_of_two_le_num.py
  function largest_pow_of_two_le_num (line 22) | def largest_pow_of_two_le_num(number: int) -> int:

FILE: bit_manipulation/missing_number.py
  function find_missing_number (line 1) | def find_missing_number(nums: list[int]) -> int:

FILE: bit_manipulation/numbers_different_signs.py
  function different_signs (line 14) | def different_signs(num1: int, num2: int) -> bool:

FILE: bit_manipulation/power_of_4.py
  function power_of_4 (line 18) | def power_of_4(number: int) -> bool:

FILE: bit_manipulation/reverse_bits.py
  function get_reverse_bit_string (line 1) | def get_reverse_bit_string(number: int) -> str:
  function reverse_bit (line 31) | def reverse_bit(number: int) -> int:

FILE: bit_manipulation/single_bit_manipulation_operations.py
  function set_bit (line 6) | def set_bit(number: int, position: int) -> int:
  function clear_bit (line 24) | def clear_bit(number: int, position: int) -> int:
  function flip_bit (line 40) | def flip_bit(number: int, position: int) -> int:
  function is_bit_set (line 56) | def is_bit_set(number: int, position: int) -> bool:
  function get_bit (line 77) | def get_bit(number: int, position: int) -> int:

FILE: bit_manipulation/swap_all_odd_and_even_bits.py
  function show_bits (line 1) | def show_bits(before: int, after: int) -> str:
  function swap_odd_even_bits (line 10) | def swap_odd_even_bits(num: int) -> int:

FILE: blockchain/diophantine_equation.py
  function diophantine (line 6) | def diophantine(a: int, b: int, c: int) -> tuple[float, float]:
  function diophantine_all_soln (line 33) | def diophantine_all_soln(a: int, b: int, c: int, n: int = 2) -> None:
  function extended_gcd (line 74) | def extended_gcd(a: int, b: int) -> tuple[int, int, int]:

FILE: boolean_algebra/and_gate.py
  function and_gate (line 19) | def and_gate(input_1: int, input_2: int) -> int:
  function n_input_and_gate (line 35) | def n_input_and_gate(inputs: list[int]) -> int:

FILE: boolean_algebra/imply_gate.py
  function imply_gate (line 20) | def imply_gate(input_1: int, input_2: int) -> int:
  function recursive_imply_list (line 36) | def recursive_imply_list(input_list: list[int]) -> int:

FILE: boolean_algebra/karnaugh_map_simplification.py
  function simplify_kmap (line 7) | def simplify_kmap(kmap: list[list[int]]) -> str:
  function main (line 32) | def main() -> None:

FILE: boolean_algebra/multiplexer.py
  function mux (line 1) | def mux(input0: int, input1: int, select: int) -> int:

FILE: boolean_algebra/nand_gate.py
  function nand_gate (line 18) | def nand_gate(input_1: int, input_2: int) -> int:

FILE: boolean_algebra/nimply_gate.py
  function nimply_gate (line 20) | def nimply_gate(input_1: int, input_2: int) -> int:

FILE: boolean_algebra/nor_gate.py
  function nor_gate (line 19) | def nor_gate(input_1: int, input_2: int) -> int:
  function truth_table (line 37) | def truth_table(func: Callable) -> str:

FILE: boolean_algebra/not_gate.py
  function not_gate (line 15) | def not_gate(input_1: int) -> int:

FILE: boolean_algebra/or_gate.py
  function or_gate (line 17) | def or_gate(input_1: int, input_2: int) -> int:

FILE: boolean_algebra/quine_mc_cluskey.py
  function compare_string (line 7) | def compare_string(string1: str, string2: str) -> str | Literal[False]:
  function check (line 28) | def check(binary: list[str]) -> list[str]:
  function decimal_to_binary (line 52) | def decimal_to_binary(no_of_variable: int, minterms: Sequence[float]) ->...
  function is_for_table (line 67) | def is_for_table(string1: str, string2: str, count: int) -> bool:
  function selection (line 81) | def selection(chart: list[list[int]], prime_implicants: list[str]) -> li...
  function prime_implicant_chart (line 122) | def prime_implicant_chart(
  function main (line 139) | def main() -> None:

FILE: boolean_algebra/xnor_gate.py
  function xnor_gate (line 19) | def xnor_gate(input_1: int, input_2: int) -> int:

FILE: boolean_algebra/xor_gate.py
  function xor_gate (line 18) | def xor_gate(input_1: int, input_2: int) -> int:

FILE: cellular_automata/conways_game_of_life.py
  function new_generation (line 26) | def new_generation(cells: list[list[int]]) -> list[list[int]]:
  function generate_images (line 72) | def generate_images(cells: list[list[int]], frames: int) -> list[Image.I...

FILE: cellular_automata/game_of_life.py
  function create_canvas (line 44) | def create_canvas(size: int) -> list[list[bool]]:
  function seed (line 49) | def seed(canvas: list[list[bool]]) -> None:
  function run (line 55) | def run(canvas: list[list[bool]]) -> list[list[bool]]:
  function __judge_point (line 78) | def __judge_point(pt: bool, neighbours: list[list[bool]]) -> bool:

FILE: cellular_automata/langtons_ant.py
  class LangtonsAnt (line 17) | class LangtonsAnt:
    method __init__ (line 28) | def __init__(self, width: int, height: int) -> None:
    method move_ant (line 37) | def move_ant(self, axes: plt.Axes | None, display: bool, _frame: int) ...
    method display (line 86) | def display(self, frames: int = 100_000) -> None:

FILE: cellular_automata/nagel_schrekenberg.py
  function construct_highway (line 31) | def construct_highway(
  function get_distance (line 60) | def get_distance(highway_now: list, car_index: int) -> int:
  function update (line 81) | def update(highway_now: list, probability: float, max_speed: int) -> list:
  function simulate (line 108) | def simulate(

FILE: cellular_automata/one_dimensional.py
  function format_ruleset (line 18) | def format_ruleset(ruleset: int) -> list[int]:
  function new_generation (line 30) | def new_generation(cells: list[list[int]], rule: list[int], time: int) -...
  function generate_image (line 44) | def generate_image(cells: list[list[int]]) -> Image.Image:

FILE: cellular_automata/wa_tor.py
  class Entity (line 38) | class Entity:
    method __init__ (line 51) | def __init__(self, prey: bool, coords: tuple[int, int]) -> None:
    method reset_reproduction_time (line 62) | def reset_reproduction_time(self) -> None:
    method __repr__ (line 77) | def __repr__(self) -> str:
  class WaTor (line 94) | class WaTor:
    method __init__ (line 118) | def __init__(self, width: int, height: int) -> None:
    method set_planet (line 132) | def set_planet(self, planet: list[list[Entity | None]]) -> None:
    method add_entity (line 153) | def add_entity(self, prey: bool) -> None:
    method get_entities (line 173) | def get_entities(self) -> list[Entity]:
    method balance_predators_and_prey (line 183) | def balance_predators_and_prey(self) -> None:
    method get_surrounding_prey (line 215) | def get_surrounding_prey(self, entity: Entity) -> list[Entity]:
    method move_and_reproduce (line 257) | def move_and_reproduce(
    method perform_prey_actions (line 347) | def perform_prey_actions(
    method perform_predator_actions (line 373) | def perform_predator_actions(
    method run (line 431) | def run(self, *, iteration_count: int) -> None:
  function visualise (line 481) | def visualise(wt: WaTor, iter_number: int, *, colour: bool = True) -> None:

FILE: ciphers/a1z26.py
  function encode (line 12) | def encode(plain: str) -> list[int]:
  function decode (line 20) | def decode(encoded: list[int]) -> str:
  function main (line 28) | def main() -> None:

FILE: ciphers/affine_cipher.py
  function check_keys (line 14) | def check_keys(key_a: int, key_b: int, mode: str) -> None:
  function encrypt_message (line 38) | def encrypt_message(key: int, message: str) -> str:
  function decrypt_message (line 56) | def decrypt_message(key: int, message: str) -> str:
  function get_random_key (line 77) | def get_random_key() -> int:
  function main (line 85) | def main() -> None:

FILE: ciphers/atbash.py
  function atbash_slow (line 6) | def atbash_slow(sequence: str) -> str:
  function atbash (line 26) | def atbash(sequence: str) -> str:
  function benchmark (line 41) | def benchmark() -> None:

FILE: ciphers/autokey.py
  function encrypt (line 12) | def encrypt(plaintext: str, key: str) -> str:
  function decrypt (line 77) | def decrypt(ciphertext: str, key: str) -> str:

FILE: ciphers/baconian_cipher.py
  function encode (line 40) | def encode(word: str) -> str:
  function decode (line 62) | def decode(coded: str) -> str:

FILE: ciphers/base16.py
  function base16_encode (line 1) | def base16_encode(data: bytes) -> str:
  function base16_decode (line 18) | def base16_decode(data: str) -> bytes:

FILE: ciphers/base32.py
  function base32_encode (line 10) | def base32_encode(data: bytes) -> bytes:
  function base32_decode (line 26) | def base32_decode(data: bytes) -> bytes:

FILE: ciphers/base64_cipher.py
  function base64_encode (line 4) | def base64_encode(data: bytes) -> bytes:
  function base64_decode (line 64) | def base64_decode(encoded_data: str) -> bytes:

FILE: ciphers/base85.py
  function _base10_to_85 (line 8) | def _base10_to_85(d: int) -> str:
  function _base85_to_10 (line 12) | def _base85_to_10(digits: list) -> int:
  function ascii85_encode (line 16) | def ascii85_encode(data: bytes) -> bytes:
  function ascii85_decode (line 33) | def ascii85_decode(data: bytes) -> bytes:

FILE: ciphers/beaufort_cipher.py
  function generate_key (line 14) | def generate_key(message: str, key: str) -> str:
  function cipher_text (line 33) | def cipher_text(message: str, key_new: str) -> str:
  function original_text (line 52) | def original_text(cipher_text: str, key_new: str) -> str:
  function main (line 69) | def main() -> None:

FILE: ciphers/bifid.py
  class BifidCipher (line 21) | class BifidCipher:
    method __init__ (line 22) | def __init__(self) -> None:
    method letter_to_numbers (line 25) | def letter_to_numbers(self, letter: str) -> np.ndarray:
    method numbers_to_letter (line 40) | def numbers_to_letter(self, index1: int, index2: int) -> str:
    method encode (line 54) | def encode(self, message: str) -> str:
    method decode (line 88) | def decode(self, message: str) -> str:

FILE: ciphers/brute_force_caesar_cipher.py
  function decrypt (line 4) | def decrypt(message: str) -> None:
  function main (line 48) | def main() -> None:

FILE: ciphers/caesar_cipher.py
  function encrypt (line 6) | def encrypt(input_string: str, key: int, alphabet: str | None = None) ->...
  function decrypt (line 91) | def decrypt(input_string: str, key: int, alphabet: str | None = None) ->...
  function brute_force (line 163) | def brute_force(input_string: str, alphabet: str | None = None) -> dict[...

FILE: ciphers/cryptomath_module.py
  function find_mod_inverse (line 4) | def find_mod_inverse(a: int, m: int) -> int:

FILE: ciphers/decrypt_caesar_with_chi_squared.py
  function decrypt_caesar_with_chi_squared (line 5) | def decrypt_caesar_with_chi_squared(

FILE: ciphers/deterministic_miller_rabin.py
  function miller_rabin (line 6) | def miller_rabin(n: int, allow_probable: bool = False) -> bool:
  function test_miller_rabin (line 90) | def test_miller_rabin() -> None:

FILE: ciphers/diffie.py
  function find_primitive (line 4) | def find_primitive(modulus: int) -> int | None:

FILE: ciphers/diffie_hellman.py
  class DiffieHellman (line 182) | class DiffieHellman:
    method __init__ (line 214) | def __init__(self, group: int = 14) -> None:
    method get_private_key (line 222) | def get_private_key(self) -> str:
    method generate_public_key (line 225) | def generate_public_key(self) -> str:
    method is_valid_public_key (line 229) | def is_valid_public_key(self, key: int) -> bool:
    method generate_shared_key (line 236) | def generate_shared_key(self, other_key_str: str) -> str:
    method is_valid_public_key_static (line 244) | def is_valid_public_key_static(remote_public_key_str: int, prime: int)...
    method generate_shared_key_static (line 252) | def generate_shared_key_static(

FILE: ciphers/elgamal_key_generator.py
  function primitive_root (line 16) | def primitive_root(p_val: int) -> int:
  function generate_key (line 27) | def generate_key(key_size: int) -> tuple[tuple[int, int, int, int], tupl...
  function make_key_files (line 40) | def make_key_files(name: str, key_size: int) -> None:
  function main (line 59) | def main() -> None:

FILE: ciphers/enigma_machine2.py
  function _validator (line 74) | def _validator(
  function _plugboard (line 114) | def _plugboard(pbstring: str) -> dict[str, str]:
  function enigma (line 167) | def enigma(

FILE: ciphers/fractionated_morse_cipher.py
  function encode_to_morse (line 79) | def encode_to_morse(plaintext: str) -> str:
  function encrypt_fractionated_morse (line 95) | def encrypt_fractionated_morse(plaintext: str, key: str) -> str:
  function decrypt_fractionated_morse (line 129) | def decrypt_fractionated_morse(ciphertext: str, key: str) -> str:

FILE: ciphers/gronsfeld_cipher.py
  function gronsfeld (line 4) | def gronsfeld(text: str, key: str) -> str:

FILE: ciphers/hill_cipher.py
  class HillCipher (line 46) | class HillCipher:
    method __init__ (line 56) | def __init__(self, encrypt_key: np.ndarray) -> None:
    method replace_letters (line 64) | def replace_letters(self, letter: str) -> int:
    method replace_digits (line 74) | def replace_digits(self, num: int) -> str:
    method check_determinant (line 86) | def check_determinant(self) -> None:
    method process_text (line 104) | def process_text(self, text: str) -> str:
    method encrypt (line 120) | def encrypt(self, text: str) -> str:
    method make_decrypt_key (line 145) | def make_decrypt_key(self) -> np.ndarray:
    method decrypt (line 168) | def decrypt(self, text: str) -> str:
  function main (line 193) | def main() -> None:

FILE: ciphers/mixed_keyword_cypher.py
  function mixed_keyword (line 4) | def mixed_keyword(

FILE: ciphers/mono_alphabetic_ciphers.py
  function translate_message (line 6) | def translate_message(
  function encrypt_message (line 31) | def encrypt_message(key: str, message: str) -> str:
  function decrypt_message (line 39) | def decrypt_message(key: str, message: str) -> str:
  function main (line 47) | def main() -> None:

FILE: ciphers/morse_code.py
  function encrypt (line 25) | def encrypt(message: str) -> str:
  function decrypt (line 35) | def decrypt(message: str) -> str:
  function main (line 43) | def main() -> None:

FILE: ciphers/onepad_cipher.py
  class Onepad (line 4) | class Onepad:
    method encrypt (line 6) | def encrypt(text: str) -> tuple[list[int], list[int]]:
    method decrypt (line 39) | def decrypt(cipher: list[int], key: list[int]) -> str:

FILE: ciphers/permutation_cipher.py
  function generate_valid_block_size (line 14) | def generate_valid_block_size(message_length: int) -> int:
  function generate_permutation_key (line 37) | def generate_permutation_key(block_size: int) -> list[int]:
  function encrypt (line 57) | def encrypt(
  function decrypt (line 94) | def decrypt(encrypted_message: str, key: list[int]) -> str:
  function main (line 124) | def main() -> None:

FILE: ciphers/playfair_cipher.py
  function chunker (line 27) | def chunker(seq: Iterable[str], size: int) -> Generator[tuple[str, ...]]:
  function prepare_input (line 36) | def prepare_input(dirty: str) -> str:
  function generate_table (line 62) | def generate_table(key: str) -> list[str]:
  function encode (line 83) | def encode(plaintext: str, key: str) -> str:
  function decode (line 121) | def decode(ciphertext: str, key: str) -> str:

FILE: ciphers/polybius.py
  class PolybiusCipher (line 20) | class PolybiusCipher:
    method __init__ (line 21) | def __init__(self) -> None:
    method letter_to_numbers (line 24) | def letter_to_numbers(self, letter: str) -> np.ndarray:
    method numbers_to_letter (line 38) | def numbers_to_letter(self, index1: int, index2: int) -> str:
    method encode (line 51) | def encode(self, message: str) -> str:
    method decode (line 74) | def decode(self, message: str) -> str:

FILE: ciphers/porta_cipher.py
  function generate_table (line 31) | def generate_table(key: str) -> list[tuple[str, str]]:
  function encrypt (line 41) | def encrypt(key: str, words: str) -> str:
  function decrypt (line 55) | def decrypt(key: str, words: str) -> str:
  function get_position (line 63) | def get_position(table: tuple[str, str], char: str) -> tuple[int, int]:
  function get_opponent (line 74) | def get_opponent(table: tuple[str, str], char: str) -> str:

FILE: ciphers/rabin_miller.py
  function rabin_miller (line 6) | def rabin_miller(num: int) -> bool:
  function is_prime_low_num (line 28) | def is_prime_low_num(num: int) -> bool:
  function generate_large_prime (line 213) | def generate_large_prime(keysize: int = 1024) -> int:

FILE: ciphers/rail_fence_cipher.py
  function encrypt (line 4) | def encrypt(input_string: str, key: int) -> str:
  function decrypt (line 41) | def decrypt(input_string: str, key: int) -> str:
  function bruteforce (line 87) | def bruteforce(input_string: str) -> dict[int, str]:

FILE: ciphers/rot13.py
  function dencrypt (line 1) | def dencrypt(s: str, n: int = 13) -> str:
  function main (line 23) | def main() -> None:

FILE: ciphers/rsa_cipher.py
  function get_blocks_from_text (line 10) | def get_blocks_from_text(
  function get_text_from_blocks (line 24) | def get_text_from_blocks(
  function encrypt_message (line 39) | def encrypt_message(
  function decrypt_message (line 50) | def decrypt_message(
  function read_key_file (line 63) | def read_key_file(key_filename: str) -> tuple[int, int, int]:
  function encrypt_and_write_to_file (line 70) | def encrypt_and_write_to_file(
  function read_from_file_and_decrypt (line 93) | def read_from_file_and_decrypt(message_filename: str, key_filename: str)...
  function main (line 115) | def main() -> None:

FILE: ciphers/rsa_factorization.py
  function rsafactor (line 19) | def rsafactor(d: int, e: int, n: int) -> list[int]:

FILE: ciphers/rsa_key_generator.py
  function main (line 10) | def main() -> None:
  function generate_key (line 16) | def generate_key(key_size: int) -> tuple[tuple[int, int], tuple[int, int]]:
  function make_key_files (line 43) | def make_key_files(name: str, key_size: int) -> None:

FILE: ciphers/running_key_cipher.py
  function running_key_encrypt (line 6) | def running_key_encrypt(key: str, plaintext: str) -> str:
  function running_key_decrypt (line 29) | def running_key_decrypt(key: str, ciphertext: str) -> str:
  function test_running_key_encrypt (line 52) | def test_running_key_encrypt() -> None:

FILE: ciphers/shuffled_shift_cipher.py
  class ShuffledShiftCipher (line 7) | class ShuffledShiftCipher:
    method __init__ (line 31) | def __init__(self, passcode: str | None = None) -> None:
    method __str__ (line 41) | def __str__(self) -> str:
    method __neg_pos (line 47) | def __neg_pos(self, iterlist: list[int]) -> list[int]:
    method __passcode_creator (line 59) | def __passcode_creator(self) -> list[str]:
    method __make_key_list (line 73) | def __make_key_list(self) -> list[str]:
    method __make_shift_key (line 119) | def __make_shift_key(self) -> int:
    method decrypt (line 127) | def decrypt(self, encoded_message: str) -> str:
    method encrypt (line 149) | def encrypt(self, plaintext: str) -> str:
  function test_end_to_end (line 172) | def test_end_to_end(msg: str = "Hello, this is a modified Caesar cipher"...

FILE: ciphers/simple_keyword_cypher.py
  function remove_duplicates (line 1) | def remove_duplicates(key: str) -> str:
  function create_cipher_map (line 20) | def create_cipher_map(key: str) -> dict[str, str]:
  function encipher (line 46) | def encipher(message: str, cipher_map: dict[str, str]) -> str:
  function decipher (line 60) | def decipher(message: str, cipher_map: dict[str, str]) -> str:
  function main (line 77) | def main() -> None:

FILE: ciphers/simple_substitution_cipher.py
  function main (line 7) | def main() -> None:
  function check_valid_key (line 24) | def check_valid_key(key: str) -> None:
  function encrypt_message (line 34) | def encrypt_message(key: str, message: str) -> str:
  function decrypt_message (line 42) | def decrypt_message(key: str, message: str) -> str:
  function translate_message (line 50) | def translate_message(key: str, message: str, mode: str) -> str:
  function get_random_key (line 71) | def get_random_key() -> str:

FILE: ciphers/transposition_cipher.py
  function main (line 11) | def main() -> None:
  function encrypt_message (line 25) | def encrypt_message(key: int, message: str) -> str:
  function decrypt_message (line 39) | def decrypt_message(key: int, message: str) -> str:

FILE: ciphers/transposition_cipher_encrypt_decrypt_file.py
  function main (line 8) | def main() -> None:

FILE: ciphers/trifid_cipher.py
  function __encrypt_part (line 23) | def __encrypt_part(message_part: str, character_to_number: dict[str, str...
  function __decrypt_part (line 40) | def __decrypt_part(
  function __prepare (line 62) | def __prepare(
  function encrypt_message (line 124) | def encrypt_message(
  function decrypt_message (line 169) | def decrypt_message(

FILE: ciphers/vernam_cipher.py
  function vernam_encrypt (line 1) | def vernam_encrypt(plaintext: str, key: str) -> str:
  function vernam_decrypt (line 15) | def vernam_decrypt(ciphertext: str, key: str) -> str:

FILE: ciphers/vigenere_cipher.py
  function main (line 4) | def main() -> None:
  function encrypt_message (line 20) | def encrypt_message(key: str, message: str) -> str:
  function decrypt_message (line 28) | def decrypt_message(key: str, message: str) -> str:
  function translate_message (line 36) | def translate_message(key: str, message: str, mode: str) -> str:

FILE: ciphers/xor_cipher.py
  class XORCipher (line 23) | class XORCipher:
    method __init__ (line 24) | def __init__(self, key: int = 0):
    method encrypt (line 33) | def encrypt(self, content: str, key: int) -> list[str]:
    method decrypt (line 68) | def decrypt(self, content: str, key: int) -> list[str]:
    method encrypt_string (line 103) | def encrypt_string(self, content: str, key: int = 0) -> str:
    method decrypt_string (line 144) | def decrypt_string(self, content: str, key: int = 0) -> str:
    method encrypt_file (line 185) | def encrypt_file(self, file: str, key: int = 0) -> bool:
    method decrypt_file (line 212) | def decrypt_file(self, file: str, key: int) -> bool:

FILE: computer_vision/flip_augmentation.py
  function main (line 20) | def main() -> None:
  function get_dataset (line 45) | def get_dataset(label_dir: str, img_dir: str) -> tuple[list, list]:
  function update_image_and_anno (line 78) | def update_image_and_anno(
  function random_chars (line 114) | def random_chars(number_char: int = 32) -> str:

FILE: computer_vision/haralick_descriptors.py
  function root_mean_square_error (line 10) | def root_mean_square_error(original: np.ndarray, reference: np.ndarray) ...
  function normalize_image (line 25) | def normalize_image(
  function normalize_array (line 52) | def normalize_array(array: np.ndarray, cap: float = 1) -> np.ndarray:
  function grayscale (line 74) | def grayscale(image: np.ndarray) -> np.ndarray:
  function binarize (line 88) | def binarize(image: np.ndarray, threshold: float = 127.0) -> np.ndarray:
  function transform (line 104) | def transform(
  function opening_filter (line 160) | def opening_filter(image: np.ndarray, kernel: np.ndarray | None = None) ...
  function closing_filter (line 178) | def closing_filter(image: np.ndarray, kernel: np.ndarray | None = None) ...
  function binary_mask (line 195) | def binary_mask(
  function matrix_concurrency (line 222) | def matrix_concurrency(image: np.ndarray, coordinate: tuple[int, int]) -...
  function haralick_descriptors (line 256) | def haralick_descriptors(matrix: np.ndarray) -> list[float]:
  function get_descriptors (line 313) | def get_descriptors(
  function euclidean (line 338) | def euclidean(point_1: np.ndarray, point_2: np.ndarray) -> float:
  function get_distances (line 352) | def get_distances(descriptors: np.ndarray, base: int) -> list[tuple[int,...

FILE: computer_vision/harris_corner.py
  class HarrisCorner (line 10) | class HarrisCorner:
    method __init__ (line 11) | def __init__(self, k: float, window_size: int):
    method __str__ (line 23) | def __str__(self) -> str:
    method detect (line 26) | def detect(self, img_path: str) -> tuple[cv2.Mat, list[list[int]]]:

FILE: computer_vision/horn_schunck.py
  function warp (line 18) | def warp(
  function horn_schunck (line 61) | def horn_schunck(

FILE: computer_vision/intensity_based_segmentation.py
  function segment_image (line 9) | def segment_image(image: np.ndarray, thresholds: list[int]) -> np.ndarray:

FILE: computer_vision/mean_threshold.py
  function mean_threshold (line 9) | def mean_threshold(image: Image) -> Image:

FILE: computer_vision/mosaic_augmentation.py
  function main (line 21) | def main() -> None:
  function get_dataset (line 57) | def get_dataset(label_dir: str, img_dir: str) -> tuple[list, list]:
  function update_image_and_anno (line 87) | def update_image_and_anno(
  function random_chars (line 172) | def random_chars(number_char: int) -> str:

FILE: computer_vision/pooling_functions.py
  function maxpooling (line 8) | def maxpooling(arr: np.ndarray, size: int, stride: int) -> np.ndarray:
  function avgpooling (line 64) | def avgpooling(arr: np.ndarray, size: int, stride: int) -> np.ndarray:

FILE: conversions/astronomical_length_scale_conversion.py
  function length_conversion (line 46) | def length_conversion(value: float, from_type: str, to_type: str) -> float:

FILE: conversions/binary_to_decimal.py
  function bin_to_decimal (line 1) | def bin_to_decimal(bin_string: str) -> int:

FILE: conversions/binary_to_hexadecimal.py
  function bin_to_hexadecimal (line 21) | def bin_to_hexadecimal(binary_str: str) -> str:

FILE: conversions/binary_to_octal.py
  function bin_to_octal (line 21) | def bin_to_octal(bin_string: str) -> str:

FILE: conversions/convert_number_to_words.py
  class NumberingSystem (line 5) | class NumberingSystem(Enum):
    method max_value (line 33) | def max_value(cls, system: str) -> int:
  class NumberWords (line 56) | class NumberWords(Enum):
  function convert_small_number (line 95) | def convert_small_number(num: int) -> str:
  function convert_number (line 137) | def convert_number(

FILE: conversions/decimal_to_any.py
  function decimal_to_any (line 8) | def decimal_to_any(num: int, base: int) -> str:

FILE: conversions/decimal_to_binary.py
  function decimal_to_binary_iterative (line 4) | def decimal_to_binary_iterative(num: int) -> str:
  function decimal_to_binary_recursive_helper (line 55) | def decimal_to_binary_recursive_helper(decimal: int) -> str:
  function decimal_to_binary_recursive (line 74) | def decimal_to_binary_recursive(number: str) -> str:

FILE: conversions/decimal_to_hexadecimal.py
  function decimal_to_hexadecimal (line 24) | def decimal_to_hexadecimal(decimal: float) -> str:

FILE: conversions/decimal_to_octal.py
  function decimal_to_octal (line 9) | def decimal_to_octal(num: int) -> str:
  function main (line 27) | def main() -> None:

FILE: conversions/energy_conversions.py
  function energy_conversion (line 45) | def energy_conversion(from_type: str, to_type: str, value: float) -> float:

FILE: conversions/excel_title_to_column.py
  function excel_title_to_column (line 1) | def excel_title_to_column(column_title: str) -> int:

FILE: conversions/hex_to_bin.py
  function hex_to_bin (line 1) | def hex_to_bin(hex_num: str) -> int:

FILE: conversions/hexadecimal_to_decimal.py
  function hex_to_decimal (line 4) | def hex_to_decimal(hex_string: str) -> int:

FILE: conversions/ipv4_conversion.py
  function ipv4_to_decimal (line 4) | def ipv4_to_decimal(ipv4_address: str) -> int:
  function alt_ipv4_to_decimal (line 41) | def alt_ipv4_to_decimal(ipv4_address: str) -> int:
  function decimal_to_ipv4 (line 51) | def decimal_to_ipv4(decimal_ipv4: int) -> str:

FILE: conversions/length_conversion.py
  class FromTo (line 28) | class FromTo(NamedTuple):
  function length_conversion (line 58) | def length_conversion(value: float, from_type: str, to_type: str) -> float:

FILE: conversions/molecular_chemistry.py
  function molarity_to_normality (line 10) | def molarity_to_normality(nfactor: int, moles: float, volume: float) -> ...
  function moles_to_pressure (line 26) | def moles_to_pressure(volume: float, moles: float, temperature: float) -...
  function moles_to_volume (line 46) | def moles_to_volume(pressure: float, moles: float, temperature: float) -...
  function pressure_and_volume_to_temperature (line 66) | def pressure_and_volume_to_temperature(

FILE: conversions/octal_to_binary.py
  function octal_to_binary (line 11) | def octal_to_binary(octal_number: str) -> str:

FILE: conversions/octal_to_decimal.py
  function oct_to_decimal (line 1) | def oct_to_decimal(oct_string: str) -> int:

FILE: conversions/octal_to_hexadecimal.py
  function octal_to_hex (line 1) | def octal_to_hex(octal: str) -> str:

FILE: conversions/prefix_conversions.py
  class SIUnit (line 10) | class SIUnit(Enum):
  class BinaryUnit (line 33) | class BinaryUnit(Enum):
  function convert_si_prefix (line 44) | def convert_si_prefix(
  function convert_binary_prefix (line 73) | def convert_binary_prefix(

FILE: conversions/prefix_conversions_string.py
  class BinaryUnit (line 21) | class BinaryUnit(Enum):
  class SIUnit (line 33) | class SIUnit(Enum):
    method get_positive (line 56) | def get_positive(cls) -> dict:
    method get_negative (line 71) | def get_negative(cls) -> dict:
  function add_si_prefix (line 87) | def add_si_prefix(value: float) -> str:
  function add_binary_prefix (line 103) | def add_binary_prefix(value: float) -> str:

FILE: conversions/pressure_conversions.py
  class FromTo (line 25) | class FromTo(NamedTuple):
  function pressure_conversion (line 42) | def pressure_conversion(value: float, from_type: str, to_type: str) -> f...

FILE: conversions/rectangular_to_polar.py
  function rectangular_to_polar (line 4) | def rectangular_to_polar(real: float, img: float) -> tuple[float, float]:

FILE: conversions/rgb_cmyk_conversion.py
  function rgb_to_cmyk (line 1) | def rgb_to_cmyk(r_input: int, g_input: int, b_input: int) -> tuple[int, ...

FILE: conversions/rgb_hsv_conversion.py
  function hsv_to_rgb (line 15) | def hsv_to_rgb(hue: float, saturation: float, value: float) -> list[int]:
  function rgb_to_hsv (line 84) | def rgb_to_hsv(red: int, green: int, blue: int) -> list[float]:
  function approximately_equal_hsv (line 142) | def approximately_equal_hsv(hsv_1: list[float], hsv_2: list[float]) -> b...

FILE: conversions/roman_numerals.py
  function roman_to_int (line 18) | def roman_to_int(roman: str) -> int:
  function int_to_roman (line 41) | def int_to_roman(number: int) -> str:

FILE: conversions/speed_conversions.py
  function convert_speed (line 25) | def convert_speed(speed: float, unit_from: str, unit_to: str) -> float:

FILE: conversions/temperature_conversions.py
  function celsius_to_fahrenheit (line 4) | def celsius_to_fahrenheit(celsius: float, ndigits: int = 2) -> float:
  function celsius_to_kelvin (line 32) | def celsius_to_kelvin(celsius: float, ndigits: int = 2) -> float:
  function celsius_to_rankine (line 56) | def celsius_to_rankine(celsius: float, ndigits: int = 2) -> float:
  function fahrenheit_to_celsius (line 80) | def fahrenheit_to_celsius(fahrenheit: float, ndigits: int = 2) -> float:
  function fahrenheit_to_kelvin (line 110) | def fahrenheit_to_kelvin(fahrenheit: float, ndigits: int = 2) -> float:
  function fahrenheit_to_rankine (line 140) | def fahrenheit_to_rankine(fahrenheit: float, ndigits: int = 2) -> float:
  function kelvin_to_celsius (line 170) | def kelvin_to_celsius(kelvin: float, ndigits: int = 2) -> float:
  function kelvin_to_fahrenheit (line 194) | def kelvin_to_fahrenheit(kelvin: float, ndigits: int = 2) -> float:
  function kelvin_to_rankine (line 218) | def kelvin_to_rankine(kelvin: float, ndigits: int = 2) -> float:
  function rankine_to_celsius (line 242) | def rankine_to_celsius(rankine: float, ndigits: int = 2) -> float:
  function rankine_to_fahrenheit (line 266) | def rankine_to_fahrenheit(rankine: float, ndigits: int = 2) -> float:
  function rankine_to_kelvin (line 286) | def rankine_to_kelvin(rankine: float, ndigits: int = 2) -> float:
  function reaumur_to_kelvin (line 306) | def reaumur_to_kelvin(reaumur: float, ndigits: int = 2) -> float:
  function reaumur_to_fahrenheit (line 325) | def reaumur_to_fahrenheit(reaumur: float, ndigits: int = 2) -> float:
  function reaumur_to_celsius (line 344) | def reaumur_to_celsius(reaumur: float, ndigits: int = 2) -> float:
  function reaumur_to_rankine (line 363) | def reaumur_to_rankine(reaumur: float, ndigits: int = 2) -> float:

FILE: conversions/time_conversions.py
  function convert_time (line 25) | def convert_time(time_value: float, unit_from: str, unit_to: str) -> float:

FILE: conversions/volume_conversions.py
  class FromTo (line 24) | class FromTo(NamedTuple):
  function volume_conversion (line 40) | def volume_conversion(value: float, from_type: str, to_type: str) -> float:

FILE: conversions/weight_conversion.py
  function weight_conversion (line 62) | def weight_conversion(from_type: str, to_type: str, value: float) -> float:

FILE: data_compression/burrows_wheeler.py
  class BWTTransformDict (line 19) | class BWTTransformDict(TypedDict):
  function all_rotations (line 24) | def all_rotations(s: str) -> list[str]:
  function bwt_transform (line 54) | def bwt_transform(s: str) -> BWTTransformDict:
  function reverse_bwt (line 93) | def reverse_bwt(bwt_string: str, idx_original_string: int) -> str:

FILE: data_compression/coordinate_compression.py
  class CoordinateCompressor (line 8) | class CoordinateCompressor:
    method __init__ (line 33) | def __init__(self, arr: list[int | float | str]) -> None:
    method compress_coordinates (line 60) | def compress_coordinates(self) -> None:
    method compress (line 82) | def compress(self, original: float | str) -> int:
    method decompress (line 101) | def decompress(self, num: int) -> int | float | str:

FILE: data_compression/huffman.py
  class Letter (line 6) | class Letter:
    method __init__ (line 7) | def __init__(self, letter: str, freq: int):
    method __repr__ (line 12) | def __repr__(self) -> str:
  class TreeNode (line 16) | class TreeNode:
    method __init__ (line 17) | def __init__(self, freq: int, left: Letter | TreeNode, right: Letter |...
  function parse_file (line 23) | def parse_file(file_path: str) -> list[Letter]:
  function build_tree (line 38) | def build_tree(letters: list[Letter]) -> Letter | TreeNode:
  function traverse_tree (line 54) | def traverse_tree(root: Letter | TreeNode, bitstring: str) -> list[Letter]:
  function huffman (line 69) | def huffman(file_path: str) -> None:

FILE: data_compression/lempel_ziv.py
  function read_file_binary (line 11) | def read_file_binary(file_path: str) -> str:
  function add_key_to_lexicon (line 28) | def add_key_to_lexicon(
  function compress_data (line 44) | def compress_data(data_bits: str) -> str:
  function add_file_length (line 74) | def add_file_length(source_path: str, compressed: str) -> str:
  function write_file_binary (line 86) | def write_file_binary(file_path: str, to_write: str) -> None:
  function compress (line 113) | def compress(source_path: str, destination_path: str) -> None:

FILE: data_compression/lempel_ziv_decompress.py
  function read_file_binary (line 10) | def read_file_binary(file_path: str) -> str:
  function decompress_data (line 27) | def decompress_data(data_bits: str) -> str:
  function write_file_binary (line 57) | def write_file_binary(file_path: str, to_write: str) -> None:
  function remove_prefix (line 84) | def remove_prefix(data_bits: str) -> str:
  function compress (line 100) | def compress(source_path: str, destination_path: str) -> None:

FILE: data_compression/lz77.py
  class Token (line 38) | class Token:
    method __repr__ (line 48) | def __repr__(self) -> str:
  class LZ77Compressor (line 59) | class LZ77Compressor:
    method __init__ (line 64) | def __init__(self, window_size: int = 13, lookahead_buffer_size: int =...
    method compress (line 69) | def compress(self, text: str) -> list[Token]:
    method decompress (line 111) | def decompress(self, tokens: list[Token]) -> str:
    method _find_encoding_token (line 144) | def _find_encoding_token(self, text: str, search_buffer: str) -> Token:
    method _match_length_from_index (line 183) | def _match_length_from_index(

FILE: data_compression/peak_signal_to_noise_ratio.py
  function peak_signal_to_noise_ratio (line 17) | def peak_signal_to_noise_ratio(original: float, contrast: float) -> float:
  function main (line 25) | def main() -> None:

FILE: data_compression/run_length_encoding.py
  function run_length_encode (line 4) | def run_length_encode(text: str) -> list:
  function run_length_decode (line 29) | def run_length_decode(encoded: list) -> str:

FILE: data_structures/arrays/equilibrium_index_in_array.py
  function equilibrium_index (line 23) | def equilibrium_index(arr: list[int]) -> int:

FILE: data_structures/arrays/find_triplets_with_0_sum.py
  function find_triplets_with_0_sum (line 4) | def find_triplets_with_0_sum(nums: list[int]) -> list[list[int]]:
  function find_triplets_with_0_sum_hashing (line 27) | def find_triplets_with_0_sum_hashing(arr: list[int]) -> list[list[int]]:

FILE: data_structures/arrays/index_2d_array_in_1d.py
  class Index2DArrayIterator (line 28) | class Index2DArrayIterator:
    method __iter__ (line 31) | def __iter__(self) -> Iterator[int]:
  function index_2d_array_in_1d (line 62) | def index_2d_array_in_1d(array: list[list[int]], index: int) -> int:

FILE: data_structures/arrays/kth_largest_element.py
  function partition (line 8) | def partition(arr: list[int], low: int, high: int) -> int:
  function kth_largest_element (line 44) | def kth_largest_element(arr: list[int], position: int) -> int:

FILE: data_structures/arrays/median_two_array.py
  function find_median_sorted_arrays (line 6) | def find_median_sorted_arrays(nums1: list[int], nums2: list[int]) -> float:

FILE: data_structures/arrays/monotonic_array.py
  function is_monotonic (line 2) | def is_monotonic(nums: list[int]) -> bool:

FILE: data_structures/arrays/pairs_with_given_sum.py
  function pairs_with_sum (line 13) | def pairs_with_sum(arr: list, req_sum: int) -> int:

FILE: data_structures/arrays/permutations.py
  function permute_recursive (line 1) | def permute_recursive(nums: list[int]) -> list[list[int]]:
  function permute_backtrack (line 21) | def permute_backtrack(nums: list[int]) -> list[list[int]]:

FILE: data_structures/arrays/prefix_sum.py
  class PrefixSum (line 10) | class PrefixSum:
    method __init__ (line 11) | def __init__(self, array: list[int]) -> None:
    method get_sum (line 21) | def get_sum(self, start: int, end: int) -> int:
    method contains_sum (line 61) | def contains_sum(self, target_sum: int) -> bool:

FILE: data_structures/arrays/product_sum.py
  function product_sum (line 23) | def product_sum(arr: list[int | list], depth: int) -> int:
  function product_sum_array (line 67) | def product_sum_array(array: list[int | list]) -> int:

FILE: data_structures/arrays/rotate_array.py
  function rotate_array (line 1) | def rotate_array(arr: list[int], steps: int) -> list[int]:

FILE: data_structures/arrays/sparse_table.py
  function build_sparse_table (line 17) | def build_sparse_table(number_list: list[int]) -> list[list[int]]:
  function query (line 61) | def query(sparse_table: list[list[int]], left_bound: int, right_bound: i...

FILE: data_structures/arrays/sudoku_solver.py
  function cross (line 11) | def cross(items_a, items_b):
  function test (line 44) | def test():
  function parse_grid (line 64) | def parse_grid(grid):
  function grid_values (line 77) | def grid_values(grid):
  function assign (line 86) | def assign(values, s, d):
  function eliminate (line 98) | def eliminate(values, s, d):
  function display (line 124) | def display(values):
  function solve (line 141) | def solve(grid):
  function some (line 148) | def some(seq):
  function search (line 156) | def search(values):
  function solve_all (line 169) | def solve_all(grids, name="", showif=0.0):
  function solved (line 196) | def solved(values):
  function from_file (line 207) | def from_file(filename, sep="\n"):
  function random_puzzle (line 213) | def random_puzzle(assignments=17):
  function shuffled (line 229) | def shuffled(seq):

FILE: data_structures/binary_tree/avl_tree.py
  class MyQueue (line 16) | class MyQueue:
    method __init__ (line 17) | def __init__(self) -> None:
    method is_empty (line 22) | def is_empty(self) -> bool:
    method push (line 25) | def push(self, data: Any) -> None:
    method pop (line 29) | def pop(self) -> Any:
    method count (line 34) | def count(self) -> int:
    method print_queue (line 37) | def print_queue(self) -> None:
  class MyNode (line 43) | class MyNode:
    method __init__ (line 44) | def __init__(self, data: Any) -> None:
    method get_data (line 50) | def get_data(self) -> Any:
    method get_left (line 53) | def get_left(self) -> MyNode | None:
    method get_right (line 56) | def get_right(self) -> MyNode | None:
    method get_height (line 59) | def get_height(self) -> int:
    method set_data (line 62) | def set_data(self, data: Any) -> None:
    method set_left (line 65) | def set_left(self, node: MyNode | None) -> None:
    method set_right (line 68) | def set_right(self, node: MyNode | None) -> None:
    method set_height (line 71) | def set_height(self, height: int) -> None:
  function get_height (line 75) | def get_height(node: MyNode | None) -> int:
  function my_max (line 81) | def my_max(a: int, b: int) -> int:
  function right_rotation (line 87) | def right_rotation(node: MyNode) -> MyNode:
  function left_rotation (line 110) | def left_rotation(node: MyNode) -> MyNode:
  function lr_rotation (line 126) | def lr_rotation(node: MyNode) -> MyNode:
  function rl_rotation (line 143) | def rl_rotation(node: MyNode) -> MyNode:
  function insert_node (line 150) | def insert_node(node: MyNode | None, data: Any) -> MyNode | None:
  function get_right_most (line 180) | def get_right_most(root: MyNode) -> Any:
  function get_left_most (line 189) | def get_left_most(root: MyNode) -> Any:
  function del_node (line 198) | def del_node(root: MyNode, data: Any) -> MyNode | None:
  class AVLtree (line 245) | class AVLtree:
    method __init__ (line 279) | def __init__(self) -> None:
    method get_height (line 282) | def get_height(self) -> int:
    method insert (line 285) | def insert(self, data: Any) -> None:
    method del_node (line 289) | def del_node(self, data: Any) -> None:
    method __str__ (line 296) | def __str__(
  function _test (line 332) | def _test() -> None:

FILE: data_structures/binary_tree/basic_binary_tree.py
  class Node (line 8) | class Node:
    method __iter__ (line 13) | def __iter__(self) -> Iterator[int]:
    method __len__ (line 20) | def __len__(self) -> int:
    method is_full (line 23) | def is_full(self) -> bool:
  class BinaryTree (line 32) | class BinaryTree:
    method __iter__ (line 35) | def __iter__(self) -> Iterator[int]:
    method __len__ (line 38) | def __len__(self) -> int:
    method small_tree (line 42) | def small_tree(cls) -> BinaryTree:
    method medium_tree (line 57) | def medium_tree(cls) -> BinaryTree:
    method depth (line 75) | def depth(self) -> int:
    method _depth (line 88) | def _depth(self, node: Node | None) -> int:
    method is_full (line 93) | def is_full(self) -> bool:

FILE: data_structures/binary_tree/binary_search_tree.py
  class Node (line 100) | class Node:
    method __iter__ (line 106) | def __iter__(self) -> Iterator[int]:
    method __repr__ (line 117) | def __repr__(self) -> str:
    method is_right (line 125) | def is_right(self) -> bool:
  class BinarySearchTree (line 130) | class BinarySearchTree:
    method __bool__ (line 133) | def __bool__(self) -> bool:
    method __iter__ (line 136) | def __iter__(self) -> Iterator[int]:
    method __str__ (line 139) | def __str__(self) -> str:
    method __reassign_nodes (line 145) | def __reassign_nodes(self, node: Node, new_children: Node | None) -> N...
    method empty (line 156) | def empty(self) -> bool:
    method __insert (line 170) | def __insert(self, value) -> None:
    method insert (line 195) | def insert(self, *values) -> Self:
    method search (line 200) | def search(self, value) -> Node | None:
    method get_max (line 234) | def get_max(self, node: Node | None = None) -> Node | None:
    method get_min (line 257) | def get_min(self, node: Node | None = None) -> Node | None:
    method remove (line 280) | def remove(self, value: int) -> None:
    method preorder_traverse (line 302) | def preorder_traverse(self, node: Node | None) -> Iterable:
    method traversal_tree (line 308) | def traversal_tree(self, traversal_function=None) -> Any:
    method inorder (line 318) | def inorder(self, arr: list, node: Node | None) -> None:
    method find_kth_smallest (line 326) | def find_kth_smallest(self, k: int, node: Node) -> int:
  function inorder (line 333) | def inorder(curr_node: Node | None) -> list[Node]:
  function postorder (line 343) | def postorder(curr_node: Node | None) -> list[Node]:

FILE: data_structures/binary_tree/binary_search_tree_recursive.py
  class Node (line 19) | class Node:
    method __init__ (line 20) | def __init__(self, label: int, parent: Node | None) -> None:
  class BinarySearchTree (line 27) | class BinarySearchTree:
    method __init__ (line 28) | def __init__(self) -> None:
    method empty (line 31) | def empty(self) -> None:
    method is_empty (line 42) | def is_empty(self) -> bool:
    method put (line 55) | def put(self, label: int) -> None:
    method _put (line 74) | def _put(self, node: Node | None, label: int, parent: Node | None = No...
    method search (line 87) | def search(self, label: int) -> Node:
    method _search (line 104) | def _search(self, node: Node | None, label: int) -> Node:
    method remove (line 115) | def remove(self, label: int) -> None:
    method _reassign_nodes (line 146) | def _reassign_nodes(self, node: Node, new_children: Node | None) -> None:
    method _get_lowest_node (line 158) | def _get_lowest_node(self, node: Node) -> Node:
    method exists (line 167) | def exists(self, label: int) -> bool:
    method get_max_label (line 186) | def get_max_label(self) -> int:
    method get_min_label (line 210) | def get_min_label(self) -> int:
    method inorder_traversal (line 234) | def inorder_traversal(self) -> Iterator[Node]:
    method _inorder_traversal (line 250) | def _inorder_traversal(self, node: Node | None) -> Iterator[Node]:
    method preorder_traversal (line 256) | def preorder_traversal(self) -> Iterator[Node]:
    method _preorder_traversal (line 272) | def _preorder_traversal(self, node: Node | None) -> Iterator[Node]:
  class BinarySearchTreeTest (line 279) | class BinarySearchTreeTest(unittest.TestCase):
    method _get_binary_search_tree (line 281) | def _get_binary_search_tree() -> BinarySearchTree:
    method test_put (line 307) | def test_put(self) -> None:
    method test_search (line 366) | def test_search(self) -> None:
    method test_remove (line 378) | def test_remove(self) -> None:
    method test_remove_2 (line 468) | def test_remove_2(self) -> None:
    method test_empty (line 497) | def test_empty(self) -> None:
    method test_is_empty (line 502) | def test_is_empty(self) -> None:
    method test_exists (line 509) | def test_exists(self) -> None:
    method test_get_max_label (line 515) | def test_get_max_label(self) -> None:
    method test_get_min_label (line 524) | def test_get_min_label(self) -> None:
    method test_inorder_traversal (line 533) | def test_inorder_traversal(self) -> None:
    method test_preorder_traversal (line 539) | def test_preorder_traversal(self) -> None:
  function binary_search_tree_example (line 546) | def binary_search_tree_example() -> None:

FILE: data_structures/binary_tree/binary_tree_mirror.py
  function binary_tree_mirror_dict (line 7) | def binary_tree_mirror_dict(binary_tree_mirror_dictionary: dict, root: i...
  function binary_tree_mirror (line 16) | def binary_tree_mirror(binary_tree: dict, root: int = 1) -> dict:

FILE: data_structures/binary_tree/binary_tree_node_sum.py
  class Node (line 16) | class Node:
    method __init__ (line 21) | def __init__(self, value: int) -> None:
  class BinaryTreeNodeSum (line 27) | class BinaryTreeNodeSum:
    method __init__ (line 58) | def __init__(self, tree: Node) -> None:
    method depth_first_search (line 61) | def depth_first_search(self, node: Node | None) -> int:
    method __iter__ (line 68) | def __iter__(self) -> Iterator[int]:

FILE: data_structures/binary_tree/binary_tree_path_sum.py
  class Node (line 13) | class Node:
    method __init__ (line 18) | def __init__(self, value: int) -> None:
  class BinaryTreePathSum (line 24) | class BinaryTreePathSum:
    method __init__ (line 77) | def __init__(self) -> None:
    method depth_first_search (line 80) | def depth_first_search(self, node: Node | None, path_sum: int) -> None:
    method path_sum (line 92) | def path_sum(self, node: Node | None, target: int | None = None) -> int:

FILE: data_structures/binary_tree/binary_tree_traversals.py
  class Node (line 10) | class Node:
  function make_tree (line 16) | def make_tree() -> Node | None:
  function preorder (line 33) | def preorder(root: Node | None) -> Generator[int]:
  function postorder (line 46) | def postorder(root: Node | None) -> Generator[int]:
  function inorder (line 59) | def inorder(root: Node | None) -> Generator[int]:
  function reverse_inorder (line 72) | def reverse_inorder(root: Node | None) -> Generator[int]:
  function height (line 85) | def height(root: Node | None) -> int:
  function level_order (line 96) | def level_order(root: Node | None) -> Generator[int]:
  function get_nodes_from_left_to_right (line 119) | def get_nodes_from_left_to_right(root: Node | None, level: int) -> Gener...
  function get_nodes_from_right_to_left (line 141) | def get_nodes_from_right_to_left(root: Node | None, level: int) -> Gener...
  function zigzag (line 163) | def zigzag(root: Node | None) -> Generator[int]:
  function main (line 185) | def main() -> None:  # Main function for testing.

FILE: data_structures/binary_tree/diameter_of_binary_tree.py
  class Node (line 12) | class Node:
    method depth (line 17) | def depth(self) -> int:
    method diameter (line 35) | def diameter(self) -> int:

FILE: data_structures/binary_tree/diff_views_of_binary_tree.py
  class TreeNode (line 16) | class TreeNode:
  function make_tree (line 22) | def make_tree() -> TreeNode:
  function binary_tree_right_side_view (line 30) | def binary_tree_right_side_view(root: TreeNode) -> list[int]:
  function binary_tree_left_side_view (line 70) | def binary_tree_left_side_view(root: TreeNode) -> list[int]:
  function binary_tree_top_side_view (line 110) | def binary_tree_top_side_view(root: TreeNode) -> list[int]:
  function binary_tree_bottom_side_view (line 159) | def binary_tree_bottom_side_view(root: TreeNode) -> list[int]:

FILE: data_structures/binary_tree/distribute_coins.py
  class TreeNode (line 47) | class TreeNode:
  class CoinsDistribResult (line 53) | class CoinsDistribResult(NamedTuple):
  function distribute_coins (line 58) | def distribute_coins(root: TreeNode | None) -> int:

FILE: data_structures/binary_tree/fenwick_tree.py
  class FenwickTree (line 4) | class FenwickTree:
    method __init__ (line 11) | def __init__(self, arr: list[int] | None = None, size: int | None = No...
    method init (line 28) | def init(self, arr: list[int]) -> None:
    method get_array (line 53) | def get_array(self) -> list[int]:
    method next_ (line 73) | def next_(index: int) -> int:
    method prev (line 77) | def prev(index: int) -> int:
    method add (line 80) | def add(self, index: int, value: int) -> None:
    method update (line 107) | def update(self, index: int, value: int) -> None:
    method prefix (line 129) | def prefix(self, right: int) -> int:
    method query (line 156) | def query(self, left: int, right: int) -> int:
    method get (line 178) | def get(self, index: int) -> int:
    method rank_query (line 198) | def rank_query(self, value: int) -> int:

FILE: data_structures/binary_tree/flatten_binarytree_to_linkedlist.py
  class TreeNode (line 17) | class TreeNode:
    method __init__ (line 23) | def __init__(self, data: int) -> None:
  function build_tree (line 29) | def build_tree() -> TreeNode:
  function flatten (line 60) | def flatten(root: TreeNode | None) -> None:
  function display_linked_list (line 109) | def display_linked_list(root: TreeNode | None) -> None:

FILE: data_structures/binary_tree/floor_and_ceiling.py
  class Node (line 20) | class Node:
    method __iter__ (line 25) | def __iter__(self) -> Iterator[int]:
    method __len__ (line 32) | def __len__(self) -> int:
  function floor_ceiling (line 36) | def floor_ceiling(root: Node | None, key: int) -> tuple[int | None, int ...

FILE: data_structures/binary_tree/inorder_tree_traversal_2022.py
  class BinaryTreeNode (line 8) | class BinaryTreeNode:
    method __init__ (line 11) | def __init__(self, data: int) -> None:
  function insert (line 17) | def insert(node: BinaryTreeNode | None, new_value: int) -> BinaryTreeNod...
  function inorder (line 46) | def inorder(node: None | BinaryTreeNode) -> list[int]:  # if node is Non...
  function make_tree (line 60) | def make_tree() -> BinaryTreeNode | None:
  function main (line 71) | def main() -> None:

FILE: data_structures/binary_tree/is_sorted.py
  class Node (line 24) | class Node:
    method __iter__ (line 29) | def __iter__(self) -> Iterator[float]:
    method is_sorted (line 48) | def is_sorted(self) -> bool:

FILE: data_structures/binary_tree/is_sum_tree.py
  class Node (line 14) | class Node:
    method __iter__ (line 19) | def __iter__(self) -> Iterator[int]:
    method __len__ (line 34) | def __len__(self) -> int:
    method is_sum_node (line 46) | def is_sum_node(self) -> bool:
  class BinaryTree (line 72) | class BinaryTree:
    method __iter__ (line 75) | def __iter__(self) -> Iterator[int]:
    method __len__ (line 82) | def __len__(self) -> int:
    method __str__ (line 89) | def __str__(self) -> str:
    method is_sum_tree (line 99) | def is_sum_tree(self) -> bool:
    method build_a_tree (line 109) | def build_a_tree(cls) -> BinaryTree:
    method build_a_sum_tree (line 134) | def build_a_sum_tree(cls) -> BinaryTree:

FILE: data_structures/binary_tree/lazy_segment_tree.py
  class SegmentTree (line 6) | class SegmentTree:
    method __init__ (line 7) | def __init__(self, size: int) -> None:
    method left (line 15) | def left(self, idx: int) -> int:
    method right (line 27) | def right(self, idx: int) -> int:
    method build (line 39) | def build(
    method update (line 52) | def update(
    method query (line 89) | def query(
    method __str__ (line 121) | def __str__(self) -> str:

FILE: data_structures/binary_tree/lowest_common_ancestor.py
  function swap (line 9) | def swap(a: int, b: int) -> tuple[int, int]:
  function create_sparse (line 27) | def create_sparse(max_node: int, parent: list[list[int]]) -> list[list[i...
  function lowest_common_ancestor (line 57) | def lowest_common_ancestor(
  function breadth_first_search (line 94) | def breadth_first_search(
  function main (line 139) | def main() -> None:

FILE: data_structures/binary_tree/maximum_fenwick_tree.py
  class MaxFenwickTree (line 1) | class MaxFenwickTree:
    method __init__ (line 39) | def __init__(self, size: int) -> None:
    method get_next (line 54) | def get_next(index: int) -> int:
    method get_prev (line 61) | def get_prev(index: int) -> int:
    method update (line 67) | def update(self, index: int, value: int) -> None:
    method query (line 87) | def query(self, left: int, right: int) -> int:

FILE: data_structures/binary_tree/maximum_sum_bst.py
  class TreeNode (line 11) | class TreeNode:
  function max_sum_bst (line 17) | def max_sum_bst(root: TreeNode | None) -> int:

FILE: data_structures/binary_tree/merge_two_binary_trees.py
  class Node (line 12) | class Node:
    method __init__ (line 17) | def __init__(self, value: int = 0) -> None:
  function merge_two_binary_trees (line 23) | def merge_two_binary_trees(tree1: Node | None, tree2: Node | None) -> No...
  function print_preorder (line 56) | def print_preorder(root: Node | None) -> None:

FILE: data_structures/binary_tree/mirror_binary_tree.py
  class Node (line 14) | class Node:
    method __iter__ (line 23) | def __iter__(self) -> Iterator[int]:
    method __len__ (line 30) | def __len__(self) -> int:
    method mirror (line 33) | def mirror(self) -> Node:
  function make_tree_seven (line 56) | def make_tree_seven() -> Node:
  function make_tree_nine (line 83) | def make_tree_nine() -> Node:
  function main (line 114) | def main() -> None:

FILE: data_structures/binary_tree/non_recursive_segment_tree.py
  class SegmentTree (line 47) | class SegmentTree[T]:
    method __init__ (line 48) | def __init__(self, arr: list[T], fnc: Callable[[T, T], T]) -> None:
    method build (line 67) | def build(self) -> None:
    method update (line 71) | def update(self, p: int, v: T) -> None:
    method query (line 90) | def query(self, left: int, right: int) -> T | None:
  function test_all_segments (line 143) | def test_all_segments() -> None:

FILE: data_structures/binary_tree/number_of_possible_binary_trees.py
  function binomial_coefficient (line 20) | def binomial_coefficient(n: int, k: int) -> int:
  function catalan_number (line 42) | def catalan_number(node_count: int) -> int:
  function factorial (line 59) | def factorial(n: int) -> int:
  function binary_tree_count (line 81) | def binary_tree_count(node_count: int) -> int:

FILE: data_structures/binary_tree/red_black_tree.py
  class RedBlackTree (line 6) | class RedBlackTree:
    method __init__ (line 20) | def __init__(
    method rotate_left (line 43) | def rotate_left(self) -> RedBlackTree:
    method rotate_right (line 65) | def rotate_right(self) -> RedBlackTree:
    method insert (line 87) | def insert(self, label: int) -> RedBlackTree:
    method _insert_repair (line 112) | def _insert_repair(self) -> None:
    method remove (line 150) | def remove(self, label: int) -> RedBlackTree:
    method _remove_repair (line 205) | def _remove_repair(self) -> None:
    method check_color_properties (line 278) | def check_color_properties(self) -> bool:
    method check_coloring (line 311) | def check_coloring(self) -> bool:
    method black_height (line 321) | def black_height(self) -> int | None:
    method __contains__ (line 343) | def __contains__(self, label: int) -> bool:
    method search (line 350) | def search(self, label: int) -> RedBlackTree | None:
    method floor (line 367) | def floor(self, label: int) -> int | None:
    method ceil (line 384) | def ceil(self, label: int) -> int | None:
    method get_max (line 402) | def get_max(self) -> int | None:
    method get_min (line 412) | def get_min(self) -> int | None:
    method grandparent (line 423) | def grandparent(self) -> RedBlackTree | None:
    method sibling (line 431) | def sibling(self) -> RedBlackTree | None:
    method is_left (line 440) | def is_left(self) -> bool:
    method is_right (line 446) | def is_right(self) -> bool:
    method __bool__ (line 452) | def __bool__(self) -> bool:
    method __len__ (line 455) | def __len__(self) -> int:
    method preorder_traverse (line 466) | def preorder_traverse(self) -> Iterator[int | None]:
    method inorder_traverse (line 473) | def inorder_traverse(self) -> Iterator[int | None]:
    method postorder_traverse (line 480) | def postorder_traverse(self) -> Iterator[int | None]:
    method __repr__ (line 487) | def __repr__(self) -> str:
    method __eq__ (line 502) | def __eq__(self, other: object) -> bool:
  function color (line 512) | def color(node: RedBlackTree | None) -> int:
  function test_rotations (line 526) | def test_rotations() -> bool:
  function test_insertion_speed (line 560) | def test_insertion_speed() -> bool:
  function test_insert (line 570) | def test_insert() -> bool:
  function test_insert_and_search (line 591) | def test_insert_and_search() -> bool:
  function test_insert_delete (line 607) | def test_insert_delete() -> bool:
  function test_floor_ceil (line 629) | def test_floor_ceil() -> bool:
  function test_min_max (line 645) | def test_min_max() -> bool:
  function test_tree_traversal (line 657) | def test_tree_traversal() -> bool:
  function test_tree_chaining (line 673) | def test_tree_chaining() -> bool:
  function print_results (line 684) | def print_results(msg: str, passes: bool) -> None:
  function pytests (line 688) | def pytests() -> None:
  function main (line 698) | def main() -> None:

FILE: data_structures/binary_tree/segment_tree.py
  class SegmentTree (line 4) | class SegmentTree:
    method __init__ (line 5) | def __init__(self, a):
    method left (line 14) | def left(self, idx):
    method right (line 26) | def right(self, idx):
    method build (line 38) | def build(self, idx, left, right):
    method update (line 47) | def update(self, a, b, val):
    method update_recursive (line 59) | def update_recursive(self, idx, left, right, a, b, val):
    method query (line 74) | def query(self, a, b):
    method query_recursive (line 86) | def query_recursive(self, idx, left, right, a, b):
    method show_data (line 99) | def show_data(self):

FILE: data_structures/binary_tree/segment_tree_other.py
  class SegmentTreeNode (line 11) | class SegmentTreeNode:
    method __init__ (line 12) | def __init__(self, start, end, val, left=None, right=None):
    method __repr__ (line 20) | def __repr__(self):
  class SegmentTree (line 24) | class SegmentTree:
    method __init__ (line 130) | def __init__(self, collection: Sequence, function):
    method update (line 136) | def update(self, i, val):
    method query_range (line 149) | def query_range(self, i, j):
    method _build_tree (line 168) | def _build_tree(self, start, end):
    method _update_tree (line 176) | def _update_tree(self, node, i, val):
    method _query_range (line 186) | def _query_range(self, node, i, j):
    method traverse (line 204) | def traverse(self):

FILE: data_structures/binary_tree/serialize_deserialize_binary_tree.py
  class TreeNode (line 8) | class TreeNode:
    method __post_init__ (line 22) | def __post_init__(self):
    method __iter__ (line 26) | def __iter__(self) -> Iterator[TreeNode]:
    method __len__ (line 42) | def __len__(self) -> int:
    method __repr__ (line 56) | def __repr__(self) -> str:
    method five_tree (line 73) | def five_tree(cls) -> TreeNode:
  function deserialize (line 86) | def deserialize(data: str) -> TreeNode | None:

FILE: data_structures/binary_tree/symmetric_tree.py
  class Node (line 14) | class Node:
  function make_symmetric_tree (line 38) | def make_symmetric_tree() -> Node:
  function make_asymmetric_tree (line 71) | def make_asymmetric_tree() -> Node:
  function is_symmetric_tree (line 104) | def is_symmetric_tree(tree: Node) -> bool:
  function is_mirror (line 125) | def is_mirror(left: Node | None, right: Node | None) -> bool:

FILE: data_structures/binary_tree/treap.py
  class Node (line 6) | class Node:
    method __init__ (line 12) | def __init__(self, value: int | None = None):
    method __repr__ (line 18) | def __repr__(self) -> str:
    method __str__ (line 28) | def __str__(self) -> str:
  function split (line 35) | def split(root: Node | None, value: int) -> tuple[Node | None, Node | No...
  function merge (line 61) | def merge(left: Node | None, right: Node | None) -> Node | None:
  function insert (line 83) | def insert(root: Node | None, value: int) -> Node | None:
  function erase (line 96) | def erase(root: Node | None, value: int) -> Node | None:
  function inorder (line 109) | def inorder(root: Node | None) -> None:
  function interact_treap (line 121) | def interact_treap(root: Node | None, args: str) -> Node | None:
  function main (line 158) | def main() -> None:

FILE: data_structures/binary_tree/wavelet_tree.py
  class Node (line 16) | class Node:
    method __init__ (line 17) | def __init__(self, length: int) -> None:
    method __repr__ (line 24) | def __repr__(self) -> str:
  function build_tree (line 35) | def build_tree(arr: list[int]) -> Node | None:
  function rank_till_index (line 70) | def rank_till_index(node: Node | None, num: int, index: int) -> int:
  function rank (line 100) | def rank(node: Node | None, num: int, start: int, end: int) -> int:
  function quantile (line 121) | def quantile(node: Node | None, index: int, start: int, end: int) -> int:
  function range_counting (line 161) | def range_counting(

FILE: data_structures/disjoint_set/alternate_disjoint_set.py
  class DisjointSet (line 7) | class DisjointSet:
    method __init__ (line 8) | def __init__(self, set_counts: list) -> None:
    method merge (line 19) | def merge(self, src: int, dst: int) -> bool:
    method get_parent (line 54) | def get_parent(self, disj_set: int) -> int:

FILE: data_structures/disjoint_set/disjoint_set.py
  class Node (line 7) | class Node:
    method __init__ (line 8) | def __init__(self, data: int) -> None:
  function make_set (line 14) | def make_set(x: Node) -> None:
  function union_set (line 24) | def union_set(x: Node, y: Node) -> None:
  function find_set (line 42) | def find_set(x: Node) -> Node:
  function find_python_set (line 51) | def find_python_set(node: Node) -> set:
  function test_disjoint_set (line 63) | def test_disjoint_set() -> None:

FILE: data_structures/hashing/bloom_filter.py
  class Bloom (line 67) | class Bloom:
    method __init__ (line 68) | def __init__(self, size: int = 8) -> None:
    method add (line 72) | def add(self, value: str) -> None:
    method exists (line 76) | def exists(self, value: str) -> bool:
    method __contains__ (line 80) | def __contains__(self, other: str) -> bool:
    method format_bin (line 83) | def format_bin(self, bitarray: int) -> str:
    method bitstring (line 88) | def bitstring(self) -> str:
    method hash_ (line 91) | def hash_(self, value: str) -> int:
    method format_hash (line 100) | def format_hash(self, value: str) -> str:
    method estimated_error_rate (line 104) | def estimated_error_rate(self) -> float:

FILE: data_structures/hashing/double_hash.py
  class DoubleHash (line 19) | class DoubleHash(HashTable):
    method __init__ (line 24) | def __init__(self, *args, **kwargs):
    method __hash_function_2 (line 27) | def __hash_function_2(self, value, data):
    method __hash_double_function (line 35) | def __hash_double_function(self, key, data, increment):
    method _collision_resolution (line 38) | def _collision_resolution(self, key, data=None):

FILE: data_structures/hashing/hash_map.py
  class _Item (line 20) | class _Item[KEY, VAL]:
  class _DeletedItem (line 25) | class _DeletedItem(_Item):
    method __init__ (line 26) | def __init__(self) -> None:
    method __bool__ (line 29) | def __bool__(self) -> bool:
  class HashMap (line 36) | class HashMap(MutableMapping[KEY, VAL]):
    method __init__ (line 41) | def __init__(
    method _get_bucket_index (line 50) | def _get_bucket_index(self, key: KEY) -> int:
    method _get_next_ind (line 53) | def _get_next_ind(self, ind: int) -> int:
    method _try_set (line 69) | def _try_set(self, ind: int, key: KEY, val: VAL) -> bool:
    method _is_full (line 90) | def _is_full(self) -> bool:
    method _is_sparse (line 107) | def _is_sparse(self) -> bool:
    method _resize (line 114) | def _resize(self, new_size: int) -> None:
    method _size_up (line 122) | def _size_up(self) -> None:
    method _size_down (line 125) | def _size_down(self) -> None:
    method _iterate_buckets (line 128) | def _iterate_buckets(self, key: KEY) -> Iterator[int]:
    method _add_item (line 134) | def _add_item(self, key: KEY, val: VAL) -> None:
    method __setitem__ (line 177) | def __setitem__(self, key: KEY, val: VAL) -> None:
    method __delitem__ (line 206) | def __delitem__(self, key: KEY) -> None:
    method __getitem__ (line 267) | def __getitem__(self, key: KEY) -> VAL:
    method __len__ (line 297) | def __len__(self) -> int:
    method __iter__ (line 314) | def __iter__(self) -> Iterator[KEY]:
    method __repr__ (line 317) | def __repr__(self) -> str:

FILE: data_structures/hashing/hash_table.py
  class HashTable (line 7) | class HashTable:
    method __init__ (line 12) | def __init__(
    method keys (line 25) | def keys(self):
    method balanced_factor (line 51) | def balanced_factor(self):
    method hash_function (line 56) | def hash_function(self, key):
    method _step_by_step (line 83) | def _step_by_step(self, step_ord):
    method bulk_insert (line 88) | def bulk_insert(self, values):
    method _set_value (line 133) | def _set_value(self, key, data):
    method _collision_resolution (line 179) | def _collision_resolution(self, key, data=None):
    method rehashing (line 239) | def rehashing(self):
    method insert_data (line 247) | def insert_data(self, data):

FILE: data_structures/hashing/hash_table_with_linked_list.py
  class HashTableWithLinkedList (line 6) | class HashTableWithLinkedList(HashTable):
    method __init__ (line 7) | def __init__(self, *args, **kwargs):
    method _set_value (line 10) | def _set_value(self, key, data):
    method balanced_factor (line 15) | def balanced_factor(self):
    method _collision_resolution (line 22) | def _collision_resolution(self, key, data=None):

FILE: data_structures/hashing/number_theory/prime_numbers.py
  function is_prime (line 9) | def is_prime(number: int) -> bool:
  function next_prime (line 50) | def next_prime(value, factor=1, **kwargs):

FILE: data_structures/hashing/quadratic_probing.py
  class QuadraticProbing (line 6) | class QuadraticProbing(HashTable):
    method __init__ (line 11) | def __init__(self, *args, **kwargs):
    method _collision_resolution (line 14) | def _collision_resolution(self, key, data=None):  # noqa: ARG002

FILE: data_structures/hashing/tests/test_hash_map.py
  function _get (line 8) | def _get(k):
  function _set (line 12) | def _set(k, v):
  function _del (line 16) | def _del(k):
  function _run_operation (line 20) | def _run_operation(obj, fun, *args):
  function test_hash_map_is_the_same_as_dict (line 77) | def test_hash_map_is_the_same_as_dict(operations):
  function test_no_new_methods_was_added_to_api (line 90) | def test_no_new_methods_was_added_to_api():

FILE: data_structures/heap/binomial_heap.py
  class Node (line 7) | class Node:
    method __init__ (line 15) | def __init__(self, val):
    method merge_trees (line 23) | def merge_trees(self, other):
  class BinomialHeap (line 48) | class BinomialHeap:
    method __init__ (line 126) | def __init__(self, bottom_root=None, min_node=None, heap_size=0):
    method merge_heaps (line 131) | def merge_heaps(self, other):
    method insert (line 206) | def insert(self, val):
    method peek (line 247) | def peek(self):
    method is_empty (line 253) | def is_empty(self):
    method delete_min (line 256) | def delete_min(self):
    method pre_order (line 359) | def pre_order(self):
    method __traversal (line 374) | def __traversal(self, curr_node, preorder, level=0):
    method __str__ (line 385) | def __str__(self):

FILE: data_structures/heap/heap.py
  class Comparable (line 8) | class Comparable(Protocol):
    method __lt__ (line 10) | def __lt__(self: T, other: T) -> bool:
    method __gt__ (line 14) | def __gt__(self: T, other: T) -> bool:
    method __eq__ (line 18) | def __eq__(self: T, other: object) -> bool:
  class Heap (line 25) | class Heap[T: Comparable]:
    method __init__ (line 48) | def __init__(self) -> None:
    method __repr__ (line 52) | def __repr__(self) -> str:
    method parent_index (line 55) | def parent_index(self, child_idx: int) -> int | None:
    method left_child_idx (line 91) | def left_child_idx(self, parent_idx: int) -> int | None:
    method right_child_idx (line 101) | def right_child_idx(self, parent_idx: int) -> int | None:
    method max_heapify (line 111) | def max_heapify(self, index: int) -> None:
    method build_max_heap (line 134) | def build_max_heap(self, collection: Iterable[T]) -> None:
    method extract_max (line 165) | def extract_max(self) -> T:
    method insert (line 196) | def insert(self, value: T) -> None:
    method heap_sort (line 232) | def heap_sort(self) -> None:

FILE: data_structures/heap/heap_generic.py
  class Heap (line 4) | class Heap:
    method __init__ (line 10) | def __init__(self, key: Callable | None = None) -> None:
    method _parent (line 21) | def _parent(self, i: int) -> int | None:
    method _left (line 25) | def _left(self, i: int) -> int | None:
    method _right (line 30) | def _right(self, i: int) -> int | None:
    method _swap (line 35) | def _swap(self, i: int, j: int) -> None:
    method _cmp (line 45) | def _cmp(self, i: int, j: int) -> bool:
    method _get_valid_parent (line 49) | def _get_valid_parent(self, i: int) -> int:
    method _heapify_up (line 65) | def _heapify_up(self, index: int) -> None:
    method _heapify_down (line 72) | def _heapify_down(self, index: int) -> None:
    method update_item (line 79) | def update_item(self, item: int, item_value: int) -> None:
    method delete_item (line 90) | def delete_item(self, item: int) -> None:
    method insert_item (line 105) | def insert_item(self, item: int, item_value: int) -> None:
    method get_top (line 116) | def get_top(self) -> tuple | None:
    method extract_top (line 120) | def extract_top(self) -> tuple | None:
  function test_heap (line 131) | def test_heap() -> None:

FILE: data_structures/heap/max_heap.py
  class BinaryHeap (line 1) | class BinaryHeap:
    method __init__ (line 19) | def __init__(self):
    method __swap_up (line 23) | def __swap_up(self, i: int) -> None:
    method insert (line 32) | def insert(self, value: int) -> None:
    method __swap_down (line 38) | def __swap_down(self, i: int) -> None:
    method pop (line 53) | def pop(self) -> int:
    method get_list (line 63) | def get_list(self):
    method __len__ (line 66) | def __len__(self):

FILE: data_structures/heap/min_heap.py
  class Node (line 5) | class Node:
    method __init__ (line 6) | def __init__(self, name, val):
    method __str__ (line 10) | def __str__(self):
    method __lt__ (line 13) | def __lt__(self, other):
  class MinHeap (line 17) | class MinHeap:
    method __init__ (line 34) | def __init__(self, array):
    method __getitem__ (line 39) | def __getitem__(self, key):
    method get_parent_idx (line 42) | def get_parent_idx(self, idx):
    method get_left_child_idx (line 45) | def get_left_child_idx(self, idx):
    method get_right_child_idx (line 48) | def get_right_child_idx(self, idx):
    method get_value (line 51) | def get_value(self, key):
    method build_heap (line 54) | def build_heap(self, array):
    method sift_down (line 67) | def sift_down(self, idx, array):
    method sift_up (line 91) | def sift_up(self, idx):
    method peek (line 102) | def peek(self):
    method remove (line 105) | def remove(self):
    method insert (line 117) | def insert(self, node):
    method is_empty (line 123) | def is_empty(self):
    method decrease_key (line 126) | def decrease_key(self, node, new_value):

FILE: data_structures/heap/randomized_heap.py
  class RandomizedHeapNode (line 12) | class RandomizedHeapNode[T: bool]:
    method __init__ (line 18) | def __init__(self, value: T) -> None:
    method value (line 24) | def value(self) -> T:
    method merge (line 38) | def merge(
  class RandomizedHeap (line 76) | class RandomizedHeap[T: bool]:
    method __init__ (line 99) | def __init__(self, data: Iterable[T] | None = ()) -> None:
    method insert (line 111) | def insert(self, value: T) -> None:
    method pop (line 125) | def pop(self) -> T | None:
    method top (line 153) | def top(self) -> T:
    method clear (line 175) | def clear(self) -> None:
    method to_sorted_list (line 188) | def to_sorted_list(self) -> list[Any]:
    method __bool__ (line 202) | def __bool__(self) -> bool:

FILE: data_structures/heap/skew_heap.py
  class SkewNode (line 11) | class SkewNode[T: bool]:
    method __init__ (line 17) | def __init__(self, value: T) -> None:
    method value (line 23) | def value(self) -> T:
    method merge (line 59) | def merge(
  class SkewHeap (line 90) | class SkewHeap[T: bool]:
    method __init__ (line 114) | def __init__(self, data: Iterable[T] | None = ()) -> None:
    method __bool__ (line 125) | def __bool__(self) -> bool:
    method __iter__ (line 141) | def __iter__(self) -> Iterator[T]:
    method insert (line 159) | def insert(self, value: T) -> None:
    method pop (line 173) | def pop(self) -> T | None:
    method top (line 198) | def top(self) -> T:
    method clear (line 220) | def clear(self) -> None:

FILE: data_structures/kd_tree/build_kdtree.py
  function build_kdtree (line 12) | def build_kdtree(points: list[list[float]], depth: int = 0) -> KDNode | ...

FILE: data_structures/kd_tree/example/example_usage.py
  function main (line 16) | def main() -> None:

FILE: data_structures/kd_tree/example/hypercube_points.py
  function hypercube_points (line 12) | def hypercube_points(

FILE: data_structures/kd_tree/kd_node.py
  class KDNode (line 12) | class KDNode:
    method __init__ (line 22) | def __init__(

FILE: data_structures/kd_tree/nearest_neighbour_search.py
  function nearest_neighbour_search (line 12) | def nearest_neighbour_search(

FILE: data_structures/kd_tree/tests/test_kdtree.py
  function test_build_kdtree (line 26) | def test_build_kdtree(num_points, cube_size, num_dimensions, depth, expe...
  function test_nearest_neighbour_search (line 61) | def test_nearest_neighbour_search():
  function test_edge_cases (line 88) | def test_edge_cases():

FILE: data_structures/linked_list/__init__.py
  class Node (line 14) | class Node:
    method __init__ (line 15) | def __init__(self, item: Any, next: Any) -> None:  # noqa: A002
  class LinkedList (line 20) | class LinkedList:
    method __init__ (line 21) | def __init__(self) -> None:
    method add (line 25) | def add(self, item: Any, position: int = 0) -> None:
    method remove (line 77) | def remove(self) -> Any:
    method is_empty (line 89) | def is_empty(self) -> bool:
    method __str__ (line 92) | def __str__(self) -> str:
    method __len__ (line 115) | def __len__(self) -> int:

FILE: data_structures/linked_list/circular_linked_list.py
  class Node (line 9) | class Node:
  class CircularLinkedList (line 15) | class CircularLinkedList:
    method __iter__ (line 19) | def __iter__(self) -> Iterator[Any]:
    method __len__ (line 32) | def __len__(self) -> int:
    method __repr__ (line 38) | def __repr__(self) -> str:
    method insert_tail (line 46) | def insert_tail(self, data: Any) -> None:
    method insert_head (line 52) | def insert_head(self, data: Any) -> None:
    method insert_nth (line 58) | def insert_nth(self, index: int, data: Any) -> None:
    method delete_front (line 89) | def delete_front(self) -> Any:
    method delete_tail (line 97) | def delete_tail(self) -> Any:
    method delete_nth (line 107) | def delete_nth(self, index: int = 0) -> Any:
    method is_empty (line 142) | def is_empty(self) -> bool:
  function test_circular_linked_list (line 151) | def test_circular_linked_list() -> None:

FILE: data_structures/linked_list/deque_doubly.py
  class _DoublyLinkedBase (line 11) | class _DoublyLinkedBase:
    class _Node (line 14) | class _Node:
      method __init__ (line 17) | def __init__(self, link_p, element, link_n):
      method has_next_and_prev (line 22) | def has_next_and_prev(self):
    method __init__ (line 27) | def __init__(self):
    method __len__ (line 34) | def __len__(self):
    method is_empty (line 37) | def is_empty(self):
    method _insert (line 40) | def _insert(self, predecessor, e, successor):
    method _delete (line 49) | def _delete(self, node):
  class LinkedDeque (line 62) | class LinkedDeque(_DoublyLinkedBase):
    method first (line 63) | def first(self):
    method last (line 75) | def last(self):
    method add_first (line 89) | def add_first(self, element):
    method add_last (line 96) | def add_last(self, element):
    method remove_first (line 105) | def remove_first(self):
    method remove_last (line 125) | def remove_last(self):

FILE: data_structures/linked_list/doubly_linked_list.py
  class Node (line 6) | class Node:
    method __init__ (line 7) | def __init__(self, data):
    method __str__ (line 12) | def __str__(self):
  class DoublyLinkedList (line 16) | class DoublyLinkedList:
    method __init__ (line 17) | def __init__(self):
    method __iter__ (line 21) | def __iter__(self):
    method __str__ (line 35) | def __str__(self):
    method __len__ (line 46) | def __len__(self):
    method insert_at_head (line 56) | def insert_at_head(self, data):
    method insert_at_tail (line 59) | def insert_at_tail(self, data):
    method insert_at_nth (line 62) | def insert_at_nth(self, index: int, data):
    method delete_head (line 108) | def delete_head(self):
    method delete_tail (line 111) | def delete_tail(self):
    method delete_at_nth (line 114) | def delete_at_nth(self, index: int):
    method delete (line 159) | def delete(self, data) -> str:
    method is_empty (line 179) | def is_empty(self):
  function test_doubly_linked_list (line 191) | def test_doubly_linked_list() -> None:

FILE: data_structures/linked_list/doubly_linked_list_two.py
  class Node (line 19) | class Node[DataType]:
    method __str__ (line 24) | def __str__(self) -> str:
  class LinkedListIterator (line 28) | class LinkedListIterator:
    method __init__ (line 29) | def __init__(self, head):
    method __iter__ (line 32) | def __iter__(self):
    method __next__ (line 35) | def __next__(self):
  class LinkedList (line 45) | class LinkedList:
    method __str__ (line 49) | def __str__(self):
    method __contains__ (line 57) | def __contains__(self, value: DataType):
    method __iter__ (line 65) | def __iter__(self):
    method get_head_data (line 68) | def get_head_data(self):
    method get_tail_data (line 73) | def get_tail_data(self):
    method set_head (line 78) | def set_head(self, node: Node) -> None:
    method set_tail (line 85) | def set_tail(self, node: Node) -> None:
    method insert (line 92) | def insert(self, value: DataType) -> None:
    method insert_before_node (line 99) | def insert_before_node(self, node: Node, node_to_insert: Node) -> None:
    method insert_after_node (line 110) | def insert_after_node(self, node: Node, node_to_insert: Node) -> None:
    method insert_at_position (line 121) | def insert_at_position(self, position: int, value: DataType) -> None:
    method get_node (line 133) | def get_node(self, item: DataType) -> Node:
    method delete_value (line 141) | def delete_value(self, value):
    method remove_node_pointers (line 152) | def remove_node_pointers(node: Node) -> None:
    method is_empty (line 162) | def is_empty(self):
  function create_linked_list (line 166) | def create_linked_list() -> None:

FILE: data_structures/linked_list/floyds_cycle_detection.py
  class Node (line 19) | class Node:
  class LinkedList (line 29) | class LinkedList:
    method __iter__ (line 36) | def __iter__(self) -> Iterator:
    method add_node (line 61) | def add_node(self, data: Any) -> None:
    method detect_cycle (line 89) | def detect_cycle(self) -> bool:

FILE: data_structures/linked_list/from_sequence.py
  class Node (line 7) | class Node:
    method __init__ (line 8) | def __init__(self, data=None):
    method __repr__ (line 12) | def __repr__(self):
  function make_linked_list (line 23) | def make_linked_list(elements_list: list | tuple) -> Node:

FILE: data_structures/linked_list/has_loop.py
  class ContainsLoopError (line 6) | class ContainsLoopError(Exception):
  class Node (line 10) | class Node:
    method __init__ (line 11) | def __init__(self, data: Any) -> None:
    method __iter__ (line 15) | def __iter__(self):
    method has_loop (line 26) | def has_loop(self) -> bool:

FILE: data_structures/linked_list/is_palindrome.py
  class ListNode (line 7) | class ListNode:
  function is_palindrome (line 12) | def is_palindrome(head: ListNode | None) -> bool:
  function is_palindrome_stack (line 68) | def is_palindrome_stack(head: ListNode | None) -> bool:
  function is_palindrome_dict (line 124) | def is_palindrome_dict(head: ListNode | None) -> bool:

FILE: data_structures/linked_list/merge_two_lists.py
  class Node (line 15) | class Node:
  class SortedLinkedList (line 20) | class SortedLinkedList:
    method __init__ (line 21) | def __init__(self, ints: Iterable[int]) -> None:
    method __iter__ (line 26) | def __iter__(self) -> Iterator[int]:
    method __len__ (line 38) | def __len__(self) -> int:
    method __str__ (line 50) | def __str__(self) -> str:
  function merge_lists (line 62) | def merge_lists(

FILE: data_structures/linked_list/middle_element_of_linked_list.py
  class Node (line 4) | class Node:
    method __init__ (line 5) | def __init__(self, data: int) -> None:
  class LinkedList (line 10) | class LinkedList:
    method __init__ (line 11) | def __init__(self):
    method push (line 14) | def push(self, new_data: int) -> int:
    method middle_element (line 20) | def middle_element(self) -> int | None:

FILE: data_structures/linked_list/print_reverse.py
  class Node (line 8) | class Node:
  class LinkedList (line 13) | class LinkedList:
    method __init__ (line 18) | def __init__(self) -> None:
    method __iter__ (line 27) | def __iter__(self) -> Iterator[int]:
    method __repr__ (line 40) | def __repr__(self) -> str:
    method append (line 54) | def append(self, data: int) -> None:
    method extend (line 71) | def extend(self, items: Iterable[int]) -> None:
  function make_linked_list (line 88) | def make_linked_list(elements_list: Iterable[int]) -> LinkedList:
  function in_reverse (line 110) | def in_reverse(linked_list: LinkedList) -> str:

FILE: data_structures/linked_list/reverse_k_group.py
  class Node (line 8) | class Node:
  class LinkedList (line 13) | class LinkedList:
    method __init__ (line 14) | def __init__(self, ints: Iterable[int]) -> None:
    method __iter__ (line 19) | def __iter__(self) -> Iterator[int]:
    method __len__ (line 33) | def __len__(self) -> int:
    method __str__ (line 45) | def __str__(self) -> str:
    method append (line 54) | def append(self, data: int) -> None:
    method reverse_k_nodes (line 76) | def reverse_k_nodes(self, group_size: int) -> None:

FILE: data_structures/linked_list/rotate_to_the_right.py
  class Node (line 7) | class Node:
  function print_linked_list (line 12) | def print_linked_list(head: Node | None) -> None:
  function insert_node (line 40) | def insert_node(head: Node | None, data: int) -> Node:
  function rotate_to_the_right (line 70) | def rotate_to_the_right(head: Node, places: int) -> Node:

FILE: data_structures/linked_list/singly_linked_list.py
  class Node (line 9) | class Node:
    method __repr__ (line 25) | def __repr__(self) -> str:
  class LinkedList (line 40) | class LinkedList:
    method __init__ (line 41) | def __init__(self):
    method __iter__ (line 50) | def __iter__(self) -> Iterator[Any]:
    method __len__ (line 69) | def __len__(self) -> int:
    method __repr__ (line 90) | def __repr__(self) -> str:
    method __getitem__ (line 108) | def __getitem__(self, index: int) -> Any:
    method __setitem__ (line 133) | def __setitem__(self, index: int, data: Any) -> None:
    method insert_tail (line 160) | def insert_tail(self, data: Any) -> None:
    method insert_head (line 176) | def insert_head(self, data: Any) -> None:
    method insert_nth (line 192) | def insert_nth(self, index: int, data: Any) -> None:
    method print_list (line 223) | def print_list(self) -> None:  # print every node data
    method delete_head (line 235) | def delete_head(self) -> Any:
    method delete_tail (line 262) | def delete_tail(self) -> Any:  # delete from tail
    method delete_nth (line 289) | def delete_nth(self, index: int = 0) -> Any:
    method is_empty (line 325) | def is_empty(self) -> bool:
    method reverse (line 337) | def reverse(self) -> None:
  function test_singly_linked_list (line 366) | def test_singly_linked_list() -> None:
  function test_singly_linked_list_2 (line 411) | def test_singly_linked_list_2() -> None:
  function main (line 494) | def main():

FILE: data_structures/linked_list/skip_list.py
  class Node (line 16) | class Node[KT, VT]:
    method __init__ (line 17) | def __init__(self, key: KT | str = "root", value: VT | None = None):
    method __repr__ (line 22) | def __repr__(self) -> str:
    method level (line 34) | def level(self) -> int:
  class SkipList (line 52) | class SkipList[KT, VT]:
    method __init__ (line 53) | def __init__(self, p: float = 0.5, max_level: int = 16):
    method __str__ (line 59) | def __str__(self) -> str:
    method __iter__ (line 109) | def __iter__(self):
    method random_level (line 116) | def random_level(self) -> int:
    method _locate_node (line 128) | def _locate_node(self, key) -> tuple[Node[KT, VT] | None, list[Node[KT...
    method delete (line 163) | def delete(self, key: KT):
    method insert (line 189) | def insert(self, key: KT, value: VT):
    method find (line 226) | def find(self, key: VT) -> VT | None:
  function test_insert (line 249) | def test_insert():
  function test_insert_overrides_existing_value (line 269) | def test_insert_overrides_existing_value():
  function test_searching_empty_list_returns_none (line 297) | def test_searching_empty_list_returns_none():
  function test_search (line 302) | def test_search():
  function test_deleting_item_from_empty_list_do_nothing (line 318) | def test_deleting_item_from_empty_list_do_nothing():
  function test_deleted_items_are_not_founded_by_find_method (line 325) | def test_deleted_items_are_not_founded_by_find_method():
  function test_delete_removes_only_given_key (line 340) | def test_delete_removes_only_given_key():
  function test_delete_doesnt_leave_dead_nodes (line 373) | def test_delete_doesnt_leave_dead_nodes():
  function test_iter_always_yields_sorted_values (line 391) | def test_iter_always_yields_sorted_values():
  function pytests (line 408) | def pytests():
  function main (line 426) | def main():

FILE: data_structures/linked_list/swap_nodes.py
  class Node (line 9) | class Node:
  class LinkedList (line 15) | class LinkedList:
    method __iter__ (line 18) | def __iter__(self) -> Iterator:
    method __len__ (line 32) | def __len__(self) -> int:
    method push (line 43) | def push(self, new_data: Any) -> None:
    method swap_nodes (line 67) | def swap_nodes(self, node_data_1: Any, node_data_2: Any) -> None:

FILE: data_structures/queues/circular_queue.py
  class CircularQueue (line 4) | class CircularQueue:
    method __init__ (line 7) | def __init__(self, n: int):
    method __len__ (line 14) | def __len__(self) -> int:
    method is_empty (line 28) | def is_empty(self) -> bool:
    method first (line 39) | def first(self):
    method enqueue (line 50) | def enqueue(self, data):
    method dequeue (line 81) | def dequeue(self):

FILE: data_structures/queues/circular_queue_linked_list.py
  class CircularQueueLinkedList (line 9) | class CircularQueueLinkedList:
    method __init__ (line 22) | def __init__(self, initial_capacity: int = 6) -> None:
    method create_linked_list (line 27) | def create_linked_list(self, initial_capacity: int) -> None:
    method is_empty (line 40) | def is_empty(self) -> bool:
    method first (line 61) | def first(self) -> Any | None:
    method enqueue (line 86) | def enqueue(self, data: Any) -> None:
    method dequeue (line 111) | def dequeue(self) -> Any:
    method check_can_perform_operation (line 142) | def check_can_perform_operation(self) -> None:
    method check_is_full (line 146) | def check_is_full(self) -> None:
  class Node (line 151) | class Node:
    method __init__ (line 152) | def __init__(self) -> None:

FILE: data_structures/queues/double_ended_queue.py
  class Deque (line 12) | class Deque:
    class _Node (line 39) | class _Node:
    class _Iterator (line 49) | class _Iterator:
      method __init__ (line 60) | def __init__(self, cur: Deque._Node | None) -> None:
      method __iter__ (line 63) | def __iter__(self) -> Deque._Iterator:
      method __next__ (line 70) | def __next__(self) -> Any:
    method __init__ (line 89) | def __init__(self, iterable: Iterable[Any] | None = None) -> None:
    method append (line 99) | def append(self, val: Any) -> None:
    method appendleft (line 141) | def appendleft(self, val: Any) -> None:
    method extend (line 183) | def extend(self, iterable: Iterable[Any]) -> None:
    method extendleft (line 212) | def extendleft(self, iterable: Iterable[Any]) -> None:
    method pop (line 241) | def pop(self) -> Any:
    method popleft (line 290) | def popleft(self) -> Any:
    method is_empty (line 336) | def is_empty(self) -> bool:
    method __len__ (line 353) | def __len__(self) -> int:
    method __eq__ (line 375) | def __eq__(self, other: object) -> bool:
    method __iter__ (line 419) | def __iter__(self) -> Deque._Iterator:
    method __repr__ (line 439) | def __repr__(self) -> str:

FILE: data_structures/queues/linked_queue.py
  class Node (line 9) | class Node:
    method __init__ (line 10) | def __init__(self, data: Any) -> None:
    method __str__ (line 14) | def __str__(self) -> str:
  class LinkedQueue (line 18) | class LinkedQueue:
    method __init__ (line 45) | def __init__(self) -> None:
    method __iter__ (line 49) | def __iter__(self) -> Iterator[Any]:
    method __len__ (line 55) | def __len__(self) -> int:
    method __str__ (line 70) | def __str__(self) -> str:
    method is_empty (line 83) | def is_empty(self) -> bool:
    method put (line 95) | def put(self, item: Any) -> None:
    method get (line 115) | def get(self) -> Any:
    method clear (line 139) | def clear(self) -> None:

FILE: data_structures/queues/priority_queue_using_list.py
  class OverFlowError (line 7) | class OverFlowError(Exception):
  class UnderFlowError (line 11) | class UnderFlowError(Exception):
  class FixedPriorityQueue (line 15) | class FixedPriorityQueue:
    method __init__ (line 69) | def __init__(self):
    method enqueue (line 76) | def enqueue(self, priority: int, data: int) -> None:
    method dequeue (line 89) | def dequeue(self) -> int:
    method __str__ (line 99) | def __str__(self) -> str:
  class ElementPriorityQueue (line 103) | class ElementPriorityQueue:
    method __init__ (line 149) | def __init__(self):
    method enqueue (line 152) | def enqueue(self, data: int) -> None:
    method dequeue (line 161) | def dequeue(self) -> int:
    method __str__ (line 173) | def __str__(self) -> str:
  function fixed_priority_queue (line 180) | def fixed_priority_queue():
  function element_priority_queue (line 205) | def element_priority_queue():

FILE: data_structures/queues/queue_by_list.py
  class QueueByList (line 6) | class QueueByList[T]:
    method __init__ (line 7) | def __init__(self, iterable: Iterable[T] | None = None) -> None:
    method __len__ (line 18) | def __len__(self) -> int:
    method __repr__ (line 40) | def __repr__(self) -> str:
    method put (line 58) | def put(self, item: T) -> None:
    method get (line 72) | def get(self) -> T:
    method rotate (line 98) | def rotate(self, rotation: int) -> None:
    method get_front (line 118) | def get_front(self) -> T:

FILE: data_structures/queues/queue_by_two_stacks.py
  class QueueByTwoStacks (line 6) | class QueueByTwoStacks[T]:
    method __init__ (line 7) | def __init__(self, iterable: Iterable[T] | None = None) -> None:
    method __len__ (line 19) | def __len__(self) -> int:
    method __repr__ (line 42) | def __repr__(self) -> str:
    method put (line 59) | def put(self, item: T) -> None:
    method get (line 74) | def get(self) -> T:

FILE: data_structures/queues/queue_on_pseudo_stack.py
  class Queue (line 6) | class Queue:
    method __init__ (line 7) | def __init__(self):
    method __str__ (line 11) | def __str__(self):
    method put (line 19) | def put(self, item: Any) -> None:
    method get (line 28) | def get(self) -> Any:
    method rotate (line 40) | def rotate(self, rotation: int) -> None:
    method front (line 50) | def front(self) -> Any:
    method size (line 58) | def size(self) -> int:

FILE: data_structures/stacks/balanced_parentheses.py
  function balanced_parentheses (line 4) | def balanced_parentheses(parentheses: str) -> bool:

FILE: data_structures/stacks/dijkstras_two_stack_algorithm.py
  function dijkstras_two_stack_algorithm (line 40) | def dijkstras_two_stack_algorithm(equation: str) -> int:

FILE: data_structures/stacks/infix_to_postfix_conversion.py
  function precedence (line 28) | def precedence(char: str) -> int:
  function associativity (line 37) | def associativity(char: str) -> Literal["LR", "RL"]:
  function infix_to_postfix (line 45) | def infix_to_postfix(expression_str: str) -> str:

FILE: data_structures/stacks/infix_to_prefix_conversion.py
  function infix_2_postfix (line 18) | def infix_2_postfix(infix: str) -> str:
  function infix_2_prefix (line 127) | def infix_2_prefix(infix: str) -> str:

FILE: data_structures/stacks/largest_rectangle_histogram.py
  function largest_rectangle_area (line 1) | def largest_rectangle_area(heights: list[int]) -> int:

FILE: data_structures/stacks/lexicographical_numbers.py
  function lexical_order (line 4) | def lexical_order(max_number: int) -> Iterator[int]:

FILE: data_structures/stacks/next_greater_element.py
  function next_greatest_element_slow (line 7) | def next_greatest_element_slow(arr: list[float]) -> list[float]:
  function next_greatest_element_fast (line 40) | def next_greatest_element_fast(arr: list[float]) -> list[float]:
  function next_greatest_element (line 71) | def next_greatest_element(arr: list[float]) -> list[float]:

FILE: data_structures/stacks/postfix_evaluation.py
  function parse_token (line 40) | def parse_token(token: str | float) -> float | str:
  function evaluate (line 64) | def evaluate(post_fix: list[str], verbose: bool = False) -> float:

FILE: data_structures/stacks/prefix_evaluation.py
  function is_operand (line 14) | def is_operand(c):
  function evaluate (line 26) | def evaluate(expression):
  function evaluate_recursive (line 58) | def evaluate_recursive(expression: list[str]):

FILE: data_structures/stacks/stack.py
  class StackOverflowError (line 8) | class StackOverflowError(BaseException):
  class StackUnderflowError (line 12) | class StackUnderflowError(BaseException):
  class Stack (line 16) | class Stack[T]:
    method __init__ (line 25) | def __init__(self, limit: int = 10):
    method __bool__ (line 29) | def __bool__(self) -> bool:
    method __str__ (line 32) | def __str__(self) -> str:
    method push (line 35) | def push(self, data: T) -> None:
    method pop (line 57) | def pop(self) -> T:
    method peek (line 76) | def peek(self) -> T:
    method is_empty (line 95) | def is_empty(self) -> bool:
    method is_full (line 110) | def is_full(self) -> bool:
    method size (line 123) | def size(self) -> int:
    method __contains__ (line 144) | def __contains__(self, item: T) -> bool:
  function test_stack (line 161) | def test_stack() -> None:

FILE: data_structures/stacks/stack_using_two_queues.py
  class StackWithQueues (line 8) | class StackWithQueues:
    method push (line 37) | def push(self, item: int) -> None:
    method pop (line 43) | def pop(self) -> int:
    method peek (line 46) | def peek(self) -> int | None:

FILE: data_structures/stacks/stack_with_doubly_linked_list.py
  class Node (line 11) | class Node[T]:
    method __init__ (line 12) | def __init__(self, data: T):
  class Stack (line 18) | class Stack[T]:
    method __init__ (line 44) | def __init__(self) -> None:
    method push (line 47) | def push(self, data: T) -> None:
    method pop (line 58) | def pop(self) -> T | None:
    method top (line 70) | def top(self) -> T | None:
    method __len__ (line 74) | def __len__(self) -> int:
    method is_empty (line 82) | def is_empty(self) -> bool:
    method print_stack (line 85) | def print_stack(self) -> None:

FILE: data_structures/stacks/stack_with_singly_linked_list.py
  class Node (line 11) | class Node[T]:
    method __init__ (line 12) | def __init__(self, data: T):
    method __str__ (line 16) | def __str__(self) -> str:
  class LinkedStack (line 20) | class LinkedStack[T]:
    method __init__ (line 50) | def __init__(self) -> None:
    method __iter__ (line 53) | def __iter__(self) -> Iterator[T]:
    method __str__ (line 59) | def __str__(self) -> str:
    method __len__ (line 70) | def __len__(self) -> int:
    method is_empty (line 83) | def is_empty(self) -> bool:
    method push (line 94) | def push(self, item: T) -> None:
    method pop (line 108) | def pop(self) -> T:
    method peek (line 132) | def peek(self) -> T:
    method clear (line 147) | def clear(self) -> None:

FILE: data_structures/stacks/stock_span_problem.py
  function calculate_span (line 11) | def calculate_span(price: list[int]) -> list[int]:
  function print_array (line 61) | def print_array(arr, n):

FILE: data_structures/suffix_tree/example/example_usage.py
  function main (line 12) | def main() -> None:

FILE: data_structures/suffix_tree/suffix_tree.py
  class SuffixTree (line 12) | class SuffixTree:
    method __init__ (line 13) | def __init__(self, text: str) -> None:
    method build_suffix_tree (line 24) | def build_suffix_tree(self) -> None:
    method _add_suffix (line 34) | def _add_suffix(self, suffix: str, index: int) -> None:
    method search (line 51) | def search(self, pattern: str) -> bool:

FILE: data_structures/suffix_tree/suffix_tree_node.py
  class SuffixTreeNode (line 12) | class SuffixTreeNode:
    method __init__ (line 13) | def __init__(

FILE: data_structures/suffix_tree/tests/test_suffix_tree.py
  class TestSuffixTree (line 14) | class TestSuffixTree(unittest.TestCase):
    method setUp (line 15) | def setUp(self) -> None:
    method test_search_existing_patterns (line 20) | def test_search_existing_patterns(self) -> None:
    method test_search_non_existing_patterns (line 29) | def test_search_non_existing_patterns(self) -> None:
    method test_search_empty_pattern (line 38) | def test_search_empty_pattern(self) -> None:
    method test_search_full_text (line 42) | def test_search_full_text(self) -> None:
    method test_search_substrings (line 48) | def test_search_substrings(self) -> None:

FILE: data_structures/trie/radix_tree.py
  class RadixNode (line 8) | class RadixNode:
    method __init__ (line 9) | def __init__(self, prefix: str = "", is_leaf: bool = False) -> None:
    method match (line 18) | def match(self, word: str) -> tuple[str, str, str]:
    method insert_many (line 39) | def insert_many(self, words: list[str]) -> None:
    method insert (line 50) | def insert(self, word: str) -> None:
    method find (line 102) | def find(self, word: str) -> bool:
    method delete (line 131) | def delete(self, word: str) -> bool:
    method print_tree (line 181) | def print_tree(self, height: int = 0) -> None:
  function test_trie (line 194) | def test_trie() -> bool:
  function pytests (line 211) | def pytests() -> None:
  function main (line 215) | def main() -> None:

FILE: data_structures/trie/trie.py
  class TrieNode (line 9) | class TrieNode:
    method __init__ (line 10) | def __init__(self) -> None:
    method insert_many (line 14) | def insert_many(self, words: list[str]) -> None:
    method insert (line 23) | def insert(self, word: str) -> None:
    method find (line 36) | def find(self, word: str) -> bool:
    method delete (line 49) | def delete(self, word: str) -> None:
  function print_words (line 78) | def print_words(node: TrieNode, word: str) -> None:
  function test_trie (line 92) | def test_trie() -> bool:
  function print_results (line 111) | def print_results(msg: str, passes: bool) -> None:
  function pytests (line 115) | def pytests() -> None:
  function main (line 119) | def main() -> None:

FILE: digital_image_processing/change_brightness.py
  function change_brightness (line 4) | def change_brightness(img: Image, level: float) -> Image:

FILE: digital_image_processing/change_contrast.py
  function change_contrast (line 14) | def change_contrast(img: Image, level: int) -> Image:

FILE: digital_image_processing/convert_to_negative.py
  function convert_to_negative (line 8) | def convert_to_negative(img):

FILE: digital_image_processing/dithering/burkes.py
  class Burkes (line 9) | class Burkes:
    method __init__ (line 19) | def __init__(self, input_img, threshold: int):
    method get_greyscale (line 40) | def get_greyscale(cls, blue: int, green: int, red: int) -> float:
    method process (line 56) | def process(self) -> None:

FILE: digital_image_processing/edge_detection/canny.py
  function gen_gaussian_kernel (line 10) | def gen_gaussian_kernel(k_size, sigma):
  function suppress_non_maximum (line 21) | def suppress_non_maximum(image_shape, gradient_direction, sobel_grad):
  function detect_high_low_threshold (line 73) | def detect_high_low_threshold(
  function track_edge (line 94) | def track_edge(image_shape, destination, weak, strong):
  function canny (line 119) | def canny(image, threshold_low=15, threshold_high=30, weak=128, strong=2...

FILE: digital_image_processing/filters/bilateral_filter.py
  function vec_gaussian (line 20) | def vec_gaussian(img: np.ndarray, variance: float) -> np.ndarray:
  function get_slice (line 27) | def get_slice(img: np.ndarray, x: int, y: int, kernel_size: int) -> np.n...
  function get_gauss_kernel (line 32) | def get_gauss_kernel(kernel_size: int, spatial_variance: float) -> np.nd...
  function bilateral_filter (line 43) | def bilateral_filter(
  function parse_args (line 64) | def parse_args(args: list) -> tuple:

FILE: digital_image_processing/filters/convolve.py
  function im2col (line 8) | def im2col(image, block_size):
  function img_convolve (line 23) | def img_convolve(image, filter_kernel):

FILE: digital_image_processing/filters/gabor_filter.py
  function gabor_filter_kernel (line 7) | def gabor_filter_kernel(

FILE: digital_image_processing/filters/gaussian_filter.py
  function gen_gaussian_kernel (line 11) | def gen_gaussian_kernel(k_size, sigma):
  function gaussian_filter (line 18) | def gaussian_filter(image, k_size, sigma):

FILE: digital_image_processing/filters/laplacian_filter.py
  function my_laplacian (line 20) | def my_laplacian(src: np.ndarray, ksize: int) -> np.ndarray:

FILE: digital_image_processing/filters/local_binary_pattern.py
  function get_neighbors_pixel (line 5) | def get_neighbors_pixel(
  function local_binary_value (line 26) | def local_binary_value(image: np.ndarray, x_coordinate: int, y_coordinat...

FILE: digital_image_processing/filters/median_filter.py
  function median_filter (line 9) | def median_filter(gray_img, mask=3):

FILE: digital_image_processing/filters/sobel_filter.py
  function sobel_filter (line 10) | def sobel_filter(image):

FILE: digital_image_processing/histogram_equalization/histogram_stretch.py
  class ConstantStretch (line 15) | class ConstantStretch:
    method __init__ (line 16) | def __init__(self):
    method stretch (line 27) | def stretch(self, input_image):
    method plot_histogram (line 49) | def plot_histogram(self):
    method show_image (line 52) | def show_image(self):

FILE: digital_image_processing/index_calculation.py
  class IndexCalculation (line 11) | class IndexCalculation:
    method __init__ (line 107) | def __init__(self, red=None, green=None, blue=None, red_edge=None, nir...
    method set_matricies (line 110) | def set_matricies(self, red=None, green=None, blue=None, red_edge=None...
    method calculation (line 123) | def calculation(
    method arv12 (line 180) | def arv12(self):
    method ccci (line 189) | def ccci(self):
    method cvi (line 199) | def cvi(self):
    method gli (line 207) | def gli(self):
    method ndvi (line 217) | def ndvi(self):
    method bndvi (line 226) | def bndvi(self):
    method red_edge_ndvi (line 235) | def red_edge_ndvi(self):
    method gndvi (line 243) | def gndvi(self):
    method gbndvi (line 251) | def gbndvi(self):
    method grndvi (line 261) | def grndvi(self):
    method rbndvi (line 271) | def rbndvi(self):
    method pndvi (line 279) | def pndvi(self):
    method atsavi (line 289) | def atsavi(self, x=0.08, a=1.22, b=0.03):
    method bwdrvi (line 300) | def bwdrvi(self):
    method ci_green (line 308) | def ci_green(self):
    method ci_rededge (line 316) | def ci_rededge(self):
    method ci (line 324) | def ci(self):
    method ctvi (line 332) | def ctvi(self):
    method gdvi (line 341) | def gdvi(self):
    method evi (line 349) | def evi(self):
    method gemi (line 359) | def gemi(self):
    method gosavi (line 370) | def gosavi(self, y=0.16):
    method gsavi (line 379) | def gsavi(self, n=0.5):
    method hue (line 388) | def hue(self):
    method ivi (line 398) | def ivi(self, a=None, b=None):
    method ipvi (line 408) | def ipvi(self):
    method i (line 416) | def i(self):
    method rvi (line 424) | def rvi(self):
    method mrvi (line 432) | def mrvi(self):
    method m_savi (line 440) | def m_savi(self):
    method norm_g (line 451) | def norm_g(self):
    method norm_nir (line 459) | def norm_nir(self):
    method norm_r (line 467) | def norm_r(self):
    method ngrdi (line 475) | def ngrdi(self):
    method ri (line 485) | def ri(self):
    method s (line 493) | def s(self):
    method _if (line 503) | def _if(self):
    method dvi (line 511) | def dvi(self):
    method tvi (line 520) | def tvi(self):
    method ndre (line 528) | def ndre(self):

FILE: digital_image_processing/morphological_operations/dilation_operation.py
  function rgb_to_gray (line 7) | def rgb_to_gray(rgb: np.ndarray) -> np.ndarray:
  function gray_to_binary (line 23) | def gray_to_binary(gray: np.ndarray) -> np.ndarray:
  function dilation (line 40) | def dilation(image: np.ndarray, kernel: np.ndarray) -> np.ndarray:

FILE: digital_image_processing/morphological_operations/erosion_operation.py
  function rgb_to_gray (line 7) | def rgb_to_gray(rgb: np.ndarray) -> np.ndarray:
  function gray_to_binary (line 24) | def gray_to_binary(gray: np.ndarray) -> np.ndarray:
  function erosion (line 42) | def erosion(image: np.ndarray, kernel: np.ndarray) -> np.ndarray:

FILE: digital_image_processing/resize/resize.py
  class NearestNeighbour (line 7) | class NearestNeighbour:
    method __init__ (line 13) | def __init__(self, img, dst_width: int, dst_height: int):
    method process (line 30) | def process(self):
    method get_x (line 35) | def get_x(self, x: int) -> int:
    method get_y (line 48) | def get_y(self, y: int) -> int:

FILE: digital_image_processing/rotation/rotation.py
  function get_rotation (line 8) | def get_rotation(

FILE: digital_image_processing/sepia.py
  function make_sepia (line 8) | def make_sepia(img, factor: int):

FILE: digital_image_processing/test_digital_image_processing.py
  function test_convert_to_negative (line 27) | def test_convert_to_negative():
  function test_change_contrast (line 34) | def test_change_contrast():
  function test_gen_gaussian_kernel (line 43) | def test_gen_gaussian_kernel():
  function test_canny (line 50) | def test_canny():
  function test_gen_gaussian_kernel_filter (line 60) | def test_gen_gaussian_kernel_filter():
  function test_convolve_filter (line 64) | def test_convolve_filter():
  function test_median_filter (line 71) | def test_median_filter():
  function test_sobel_filter (line 75) | def test_sobel_filter():
  function test_sepia (line 81) | def test_sepia():
  function test_burkes (line 86) | def test_burkes(file_path: str = "digital_image_processing/image_data/le...
  function test_nearest_neighbour (line 92) | def test_nearest_neighbour(
  function test_local_binary_pattern (line 100) | def test_local_binary_pattern():

FILE: divide_and_conquer/closest_pair_of_points.py
  function euclidean_distance_sqr (line 23) | def euclidean_distance_sqr(point1, point2):
  function column_based_sort (line 31) | def column_based_sort(array, column=0):
  function dis_between_closest_pair (line 39) | def dis_between_closest_pair(points, points_counts, min_dis=float("inf")):
  function dis_between_closest_in_strip (line 61) | def dis_between_closest_in_strip(points, points_counts, min_dis=float("i...
  function closest_pair_of_points_sqr (line 82) | def closest_pair_of_points_sqr(points_sorted_on_x, points_sorted_on_y, p...
  function closest_pair_of_points (line 125) | def closest_pair_of_points(points, points_counts):

FILE: divide_and_conquer/convex_hull.py
  class Point (line 21) | class Point:
    method __init__ (line 48) | def __init__(self, x, y):
    method __eq__ (line 51) | def __eq__(self, other):
    method __ne__ (line 54) | def __ne__(self, other):
    method __gt__ (line 57) | def __gt__(self, other):
    method __lt__ (line 64) | def __lt__(self, other):
    method __ge__ (line 67) | def __ge__(self, other):
    method __le__ (line 74) | def __le__(self, other):
    method __repr__ (line 81) | def __repr__(self):
    method __hash__ (line 84) | def __hash__(self):
  function _construct_points (line 88) | def _construct_points(
  function _validate_input (line 135) | def _validate_input(points: list[Point] | list[list[float]]) -> list[Poi...
  function _det (line 188) | def _det(a: Point, b: Point, c: Point) -> float:
  function convex_hull_bf (line 223) | def convex_hull_bf(points: list[Point]) -> list[Point]:
  function convex_hull_recursive (line 295) | def convex_hull_recursive(points: list[Point]) -> list[Point]:
  function _construct_hull (line 365) | def _construct_hull(
  function convex_hull_melkman (line 409) | def convex_hull_melkman(points: list[Point]) -> list[Point]:
  function main (line 480) | def main():

FILE: divide_and_conquer/heaps_algorithm.py
  function heaps (line 10) | def heaps(arr: list) -> list:

FILE: divide_and_conquer/heaps_algorithm_iterative.py
  function heaps (line 10) | def heaps(arr: list) -> list:

FILE: divide_and_conquer/inversions.py
  function count_inversions_bf (line 12) | def count_inversions_bf(arr):
  function count_inversions_recursive (line 43) | def count_inversions_recursive(arr):
  function _count_cross_inversions (line 77) | def _count_cross_inversions(p, q):
  function main (line 121) | def main():

FILE: divide_and_conquer/kth_order_statistic.py
  function random_pivot (line 17) | def random_pivot(lst):
  function kth_number (line 26) | def kth_number(lst: list[int], k: int) -> int:

FILE: divide_and_conquer/max_difference_pair.py
  function max_difference (line 1) | def max_difference(a: list[int]) -> tuple[int, int]:

FILE: divide_and_conquer/max_subarray.py
  function max_subarray (line 19) | def max_subarray(
  function max_cross_sum (line 64) | def max_cross_sum(
  function time_max_subarray (line 87) | def time_max_subarray(input_size: int) -> float:
  function plot_runtimes (line 95) | def plot_runtimes() -> None:

FILE: divide_and_conquer/mergesort.py
  function merge (line 4) | def merge(left_half: list, right_half: list) -> list:
  function merge_sort (line 60) | def merge_sort(array: list) -> list:

FILE: divide_and_conquer/peak.py
  function peak (line 14) | def peak(lst: list[int]) -> int:

FILE: divide_and_conquer/power.py
  function actual_power (line 1) | def actual_power(a: int, b: int) -> int:
  function power (line 30) | def power(a: int, b: int) -> float:

FILE: divide_and_conquer/strassen_matrix_multiplication.py
  function default_matrix_multiplication (line 6) | def default_matrix_multiplication(a: list, b: list) -> list:
  function matrix_addition (line 19) | def matrix_addition(matrix_a: list, matrix_b: list):
  function matrix_subtraction (line 26) | def matrix_subtraction(matrix_a: list, matrix_b: list):
  function split_matrix (line 33) | def split_matrix(a: list) -> tuple[list, list, list, list]:
  function matrix_dimensions (line 66) | def matrix_dimensions(matrix: list) -> tuple[int, int]:
  function print_matrix (line 70) | def print_matrix(matrix: list) -> None:
  function actual_strassen (line 74) | def actual_strassen(matrix_a: list, matrix_b: list) -> list:
  function strassen (line 107) | def strassen(matrix1: list, matrix2: list) -> list:

FILE: dynamic_programming/abbreviation.py
  function abbr (line 15) | def abbr(a: str, b: str) -> bool:

FILE: dynamic_programming/all_construct.py
  function all_construct (line 9) | def all_construct(target: str, word_bank: list[str] | None = None) -> li...

FILE: dynamic_programming/bitmask.py
  class AssignmentUsingBitmask (line 15) | class AssignmentUsingBitmask:
    method __init__ (line 16) | def __init__(self, task_performed, total):
    method count_ways_until (line 31) | def count_ways_until(self, mask, task_no):
    method count_no_of_ways (line 64) | def count_no_of_ways(self, task_performed):

FILE: dynamic_programming/catalan_numbers.py
  function catalan_numbers (line 30) | def catalan_numbers(upper_limit: int) -> "list[int]":

FILE: dynamic_programming/climbing_stairs.py
  function climb_stairs (line 4) | def climb_stairs(number_of_steps: int) -> int:

FILE: dynamic_programming/combination_sum_iv.py
  function combination_sum_iv (line 26) | def combination_sum_iv(array: list[int], target: int) -> int:
  function combination_sum_iv_dp_array (line 45) | def combination_sum_iv_dp_array(array: list[int], target: int) -> int:
  function combination_sum_iv_bottom_up (line 75) | def combination_sum_iv_bottom_up(n: int, array: list[int], target: int) ...

FILE: dynamic_programming/edit_distance.py
  class EditDistance (line 14) | class EditDistance:
    method __init__ (line 21) | def __init__(self):
    method __min_dist_top_down_dp (line 26) | def __min_dist_top_down_dp(self, m: int, n: int) -> int:
    method min_dist_top_down (line 44) | def min_dist_top_down(self, word1: str, word2: str) -> int:
    method min_dist_bottom_up (line 59) | def min_dist_bottom_up(self, word1: str, word2: str) -> int:

FILE: dynamic_programming/factorial.py
  function factorial (line 7) | def factorial(num: int) -> int:

FILE: dynamic_programming/fast_fibonacci.py
  function fibonacci (line 13) | def fibonacci(n: int) -> int:
  function _fib (line 25) | def _fib(n: int) -> tuple[int, int]:

FILE: dynamic_programming/fibonacci.py
  class Fibonacci (line 7) | class Fibonacci:
    method __init__ (line 8) | def __init__(self) -> None:
    method get (line 11) | def get(self, index: int) -> list:
  function main (line 27) | def main() -> None:

FILE: dynamic_programming/fizz_buzz.py
  function fizz_buzz (line 4) | def fizz_buzz(number: int, iterations: int) -> str:

FILE: dynamic_programming/floyd_warshall.py
  class Graph (line 4) | class Graph:
    method __init__ (line 5) | def __init__(self, n=0):  # a graph with Node 0,1,...,N-1
    method add_edge (line 14) | def add_edge(self, u, v, w):
    method floyd_warshall (line 26) | def floyd_warshall(self):
    method show_min (line 45) | def show_min(self, u, v):

FILE: dynamic_programming/integer_partition.py
  function partition (line 11) | def partition(m: int) -> int:

FILE: dynamic_programming/iterating_through_submasks.py
  function list_of_submasks (line 12) | def list_of_submasks(mask: int) -> list[int]:

FILE: dynamic_programming/k_means_clustering_tensorflow.py
  function tf_k_means_cluster (line 7) | def tf_k_means_cluster(vectors, noofclusters):

FILE: dynamic_programming/knapsack.py
  function mf_knapsack (line 10) | def mf_knapsack(i, wt, val, j):
  function knapsack (line 29) | def knapsack(w, wt, val, n):
  function knapsack_with_example_solution (line 42) | def knapsack_with_example_solution(w: int, wt: list, val: list):
  function _construct_solution (line 103) | def _construct_solution(dp: list, wt: list, i: int, j: int, optimal_set:...

FILE: dynamic_programming/largest_divisible_subset.py
  function largest_divisible_subset (line 4) | def largest_divisible_subset(items: list[int]) -> list[int]:

FILE: dynamic_programming/longest_common_subsequence.py
  function longest_common_subsequence (line 9) | def longest_common_subsequence(x: str, y: str):

FILE: dynamic_programming/longest_common_substring.py
  function longest_common_substring (line 13) | def longest_common_substring(text1: str, text2: str) -> str:

FILE: dynamic_programming/longest_increasing_subsequence.py
  function longest_subsequence (line 19) | def longest_subsequence(array: list[int]) -> list[int]:  # This function...

FILE: dynamic_programming/longest_increasing_subsequence_iterative.py
  function longest_subsequence (line 21) | def longest_subsequence(array: list[int]) -> list[int]:

FILE: dynamic_programming/longest_increasing_subsequence_o_nlogn.py
  function ceil_index (line 10) | def ceil_index(v, left, right, key):
  function longest_increasing_subsequence_length (line 20) | def longest_increasing_subsequence_length(v: list[int]) -> int:

FILE: dynamic_programming/longest_palindromic_subsequence.py
  function longest_palindromic_subsequence (line 11) | def longest_palindromic_subsequence(input_string: str) -> int:

FILE: dynamic_programming/matrix_chain_multiplication.py
  function matrix_chain_multiply (line 54) | def matrix_chain_multiply(arr: list[int]) -> int:
  function matrix_chain_order (line 99) | def matrix_chain_order(dims: list[int]) -> int:
  function elapsed_time (line 131) | def elapsed_time(msg: str) -> Iterator:

FILE: dynamic_programming/matrix_chain_order.py
  function matrix_chain_order (line 13) | def matrix_chain_order(array: list[int]) -> tuple[list[list[int]], list[...
  function print_optimal_solution (line 37) | def print_optimal_solution(optimal_solution: list[list[int]], i: int, j:...
  function main (line 51) | def main():

FILE: dynamic_programming/max_non_adjacent_sum.py
  function maximum_non_adjacent_sum (line 6) | def maximum_non_adjacent_sum(nums: list[int]) -> int:

FILE: dynamic_programming/max_product_subarray.py
  function max_product_subarray (line 1) | def max_product_subarray(numbers: list[int]) -> int:

FILE: dynamic_programming/max_subarray_sum.py
  function max_subarray_sum (line 16) | def max_subarray_sum(

FILE: dynamic_programming/min_distance_up_bottom.py
  function min_distance_up_bottom (line 14) | def min_distance_up_bottom(word1: str, word2: str) -> int:

FILE: dynamic_programming/minimum_coin_change.py
  function dp_count (line 10) | def dp_count(s, n):

FILE: dynamic_programming/minimum_cost_path.py
  function minimum_cost_path (line 6) | def minimum_cost_path(matrix: list[list[int]]) -> int:

FILE: dynamic_programming/minimum_partition.py
  function find_min (line 6) | def find_min(numbers: list[int]) -> int:

FILE: dynamic_programming/minimum_size_subarray_sum.py
  function minimum_subarray_sum (line 4) | def minimum_subarray_sum(target: int, numbers: list[int]) -> int:

FILE: dynamic_programming/minimum_squares_to_represent_a_number.py
  function minimum_squares_to_represent_a_number (line 5) | def minimum_squares_to_represent_a_number(number: int) -> int:

FILE: dynamic_programming/minimum_steps_to_one.py
  function min_steps_to_one (line 30) | def min_steps_to_one(number: int) -> int:

FILE: dynamic_programming/minimum_tickets_cost.py
  function mincost_tickets (line 28) | def mincost_tickets(days: list[int], costs: list[int]) -> int:

FILE: dynamic_programming/narcissistic_number.py
  function find_narcissistic_numbers (line 27) | def find_narcissistic_numbers(limit: int) -> list[int]:

FILE: dynamic_programming/optimal_binary_search_tree.py
  class Node (line 23) | class Node:
    method __init__ (line 26) | def __init__(self, key, freq):
    method __str__ (line 30) | def __str__(self):
  function print_binary_search_tree (line 38) | def print_binary_search_tree(root, key, i, j, parent, is_left):
  function find_optimal_binary_search_tree (line 68) | def find_optimal_binary_search_tree(nodes):
  function main (line 137) | def main():

FILE: dynamic_programming/palindrome_partitioning.py
  function find_minimum_partitions (line 12) | def find_minimum_partitions(string: str) -> int:

FILE: dynamic_programming/range_sum_query.py
  function prefix_sum (line 64) | def prefix_sum(array: list[int], queries: list[tuple[int, int]]) -> list...

FILE: dynamic_programming/regex_match.py
  function recursive_match (line 13) | def recursive_match(text: str, pattern: str) -> bool:
  function dp_match (line 52) | def dp_match(text: str, pattern: str) -> bool:

FILE: dynamic_programming/rod_cutting.py
  function naive_cut_rod_recursive (line 14) | def naive_cut_rod_recursive(n: int, prices: list):
  function top_down_cut_rod (line 56) | def top_down_cut_rod(n: int, prices: list):
  function _top_down_cut_rod_recursive (line 94) | def _top_down_cut_rod_recursive(n: int, prices: list, max_rev: list):
  function bottom_up_cut_rod (line 133) | def bottom_up_cut_rod(n: int, prices: list):
  function _enforce_args (line 177) | def _enforce_args(n: int, prices: list):
  function main (line 200) | def main():

FILE: dynamic_programming/smith_waterman.py
  function score_function (line 12) | def score_function(
  function smith_waterman (line 39) | def smith_waterman(
  function traceback (line 129) | def traceback(score: list[list[int]], query: str, subject: str) -> str:

FILE: dynamic_programming/subset_generation.py
  function subset_combinations (line 1) | def subset_combinations(elements: list[int], n: int) -> list:

FILE: dynamic_programming/sum_of_subset.py
  function is_sum_subset (line 1) | def is_sum_subset(arr: list[int], required_sum: int) -> bool:

FILE: dynamic_programming/trapped_water.py
  function trapped_rainwater (line 16) | def trapped_rainwater(heights: tuple[int, ...]) -> int:

FILE: dynamic_programming/tribonacci.py
  function tribonacci (line 4) | def tribonacci(num: int) -> list[int]:

FILE: dynamic_programming/viterbi.py
  function viterbi (line 4) | def viterbi(
  function _validation (line 179) | def _validation(
  function _validate_not_empty (line 217) | def _validate_not_empty(
  function _validate_lists (line 248) | def _validate_lists(observations_space: Any, states_space: Any) -> None:
  function _validate_list (line 264) | def _validate_list(_object: Any, var_name: str) -> None:
  function _validate_dicts (line 286) | def _validate_dicts(
  function _validate_nested_dict (line 315) | def _validate_nested_dict(_object: Any, var_name: str) -> None:
  function _validate_dict (line 340) | def _validate_dict(

FILE: dynamic_programming/wildcard_matching.py
  function is_match (line 19) | def is_match(string: str, pattern: str) -> bool:

FILE: dynamic_programming/word_break.py
  function word_break (line 27) | def word_break(string: str, words: list[str]) -> bool:

FILE: electronics/apparent_power.py
  function apparent_power (line 5) | def apparent_power(

FILE: electronics/builtin_voltage.py
  function builtin_voltage (line 8) | def builtin_voltage(

FILE: electronics/capacitor_equivalence.py
  function capacitor_parallel (line 6) | def capacitor_parallel(capacitors: list[float]) -> float:
  function capacitor_series (line 26) | def capacitor_series(capacitors: list[float]) -> float:

FILE: electronics/carrier_concentration.py
  function carrier_concentration (line 8) | def carrier_concentration(

FILE: electronics/charging_capacitor.py
  function charging_capacitor (line 21) | def charging_capacitor(

FILE: electronics/charging_inductor.py
  function charging_inductor (line 32) | def charging_inductor(

FILE: electronics/circular_convolution.py
  class CircularConvolution (line 21) | class CircularConvolution:
    method __init__ (line 26) | def __init__(self) -> None:
    method circular_convolution (line 34) | def circular_convolution(self) -> list[float]:

FILE: electronics/coulombs_law.py
  function couloumbs_law (line 8) | def couloumbs_law(

FILE: electronics/electric_conductivity.py
  function electric_conductivity (line 6) | def electric_conductivity(

FILE: electronics/electric_power.py
  class Result (line 7) | class Result(NamedTuple):
  function electric_power (line 12) | def electric_power(voltage: float, current: float, power: float) -> tuple:

FILE: electronics/electrical_impedance.py
  function electrical_impedance (line 12) | def electrical_impedance(

FILE: electronics/ic_555_timer.py
  function astable_frequency (line 26) | def astable_frequency(
  function astable_duty_cycle (line 50) | def astable_duty_cycle(resistance_1: float, resistance_2: float) -> float:

FILE: electronics/ind_reactance.py
  function ind_reactance (line 7) | def ind_reactance(

FILE: electronics/ohms_law.py
  function ohms_law (line 5) | def ohms_law(voltage: float, current: float, resistance: float) -> dict[...

FILE: electronics/real_and_reactive_power.py
  function real_power (line 4) | def real_power(apparent_power: float, power_factor: float) -> float:
  function reactive_power (line 25) | def reactive_power(apparent_power: float, power_factor: float) -> float:

FILE: electronics/resistor_color_code.py
  function get_significant_digits (line 138) | def get_significant_digits(colors: list) -> str:
  function get_multiplier (line 161) | def get_multiplier(color: str) -> float:
  function get_tolerance (line 181) | def get_tolerance(color: str) -> float:
  function get_temperature_coeffecient (line 201) | def get_temperature_coeffecient(color: str) -> int:
  function get_band_type_count (line 221) | def get_band_type_count(total_number_of_bands: int, type_of_band: str) -...
  function check_validity (line 260) | def check_validity(number_of_bands: int, colors: list) -> bool:
  function calculate_resistance (line 295) | def calculate_resistance(number_of_bands: int, color_code_list: list) ->...

FILE: electronics/resistor_equivalence.py
  function resistor_parallel (line 6) | def resistor_parallel(resistors: list[float]) -> float:
  function resistor_series (line 31) | def resistor_series(resistors: list[float]) -> float:

FILE: electronics/resonant_frequency.py
  function resonant_frequency (line 16) | def resonant_frequency(inductance: float, capacitance: float) -> tuple:

FILE: electronics/wheatstone_bridge.py
  function wheatstone_solver (line 5) | def wheatstone_solver(

FILE: file_transfer/receive_file.py
  function main (line 4) | def main():

FILE: file_transfer/send_file.py
  function send_file (line 1) | def send_file(filename: str = "mytext.txt", testing: bool = False) -> None:

FILE: file_transfer/tests/test_send_file.py
  function test_send_file_running_as_expected (line 8) | def test_send_file_running_as_expected(file, sock):

FILE: financial/equated_monthly_installments.py
  function equated_monthly_installments (line 11) | def equated_monthly_installments(

FILE: financial/exponential_moving_average.py
  function exponential_moving_average (line 15) | def exponential_moving_average(

FILE: financial/interest.py
  function simple_interest (line 6) | def simple_interest(
  function compound_interest (line 42) | def compound_interest(
  function apr_interest (line 80) | def apr_interest(

FILE: financial/present_value.py
  function present_value (line 12) | def present_value(discount_rate: float, cash_flows: list[float]) -> float:

FILE: financial/price_plus_tax.py
  function price_plus_tax (line 6) | def price_plus_tax(price: float, tax_rate: float) -> float:

FILE: financial/simple_moving_average.py
  function simple_moving_average (line 13) | def simple_moving_average(

FILE: financial/straight_line_depreciation.py
  function straight_line_depreciation (line 32) | def straight_line_depreciation(

FILE: financial/time_and_half_pay.py
  function pay (line 6) | def pay(hours_worked: float, pay_rate: float, hours: float = 40) -> float:

FILE: fractals/julia_sets.py
  function eval_exponential (line 40) | def eval_exponential(c_parameter: complex, z_values: np.ndarray) -> np.n...
  function eval_quadratic_polynomial (line 53) | def eval_quadratic_polynomial(c_parameter: complex, z_values: np.ndarray...
  function prepare_grid (line 67) | def prepare_grid(window_size: float, nb_pixels: int) -> np.ndarray:
  function iterate_function (line 85) | def iterate_function(
  function show_results (line 127) | def show_results(
  function ignore_overflow_warnings (line 148) | def ignore_overflow_warnings() -> None:

FILE: fractals/koch_snowflake.py
  function iterate (line 38) | def iterate(initial_vectors: list[np.ndarray], steps: int) -> list[np.nd...
  function iteration_step (line 53) | def iteration_step(vectors: list[np.ndarray]) -> list[np.ndarray]:
  function rotate (line 77) | def rotate(vector: np.ndarray, angle_in_degrees: float) -> np.ndarray:
  function plot (line 92) | def plot(vectors: list[np.ndarray]) -> None:

FILE: fractals/mandelbrot.py
  function get_distance (line 23) | def get_distance(x: float, y: float, max_step: int) -> float:
  function get_black_and_white_rgb (line 50) | def get_black_and_white_rgb(distance: float) -> tuple:
  function get_color_coded_rgb (line 68) | def get_color_coded_rgb(distance: float) -> tuple:
  function get_image (line 86) | def get_image(

FILE: fractals/sierpinski_triangle.py
  function get_mid (line 30) | def get_mid(p1: tuple[float, float], p2: tuple[float, float]) -> tuple[f...
  function triangle (line 48) | def triangle(

FILE: fractals/vicsek.py
  function draw_cross (line 18) | def draw_cross(x: float, y: float, length: float):
  function draw_fractal_recursive (line 37) | def draw_fractal_recursive(x: float, y: float, length: float, depth: flo...
  function set_color (line 53) | def set_color(rgb: str):
  function draw_vicsek_fractal (line 57) | def draw_vicsek_fractal(x: float, y: float, length: float, depth: float,...
  function main (line 69) | def main():

FILE: fuzzy_logic/fuzzy_operations.py
  class FuzzySet (line 16) | class FuzzySet:
    method __str__ (line 68) | def __str__(self) -> str:
    method complement (line 77) | def complement(self) -> FuzzySet:
    method intersection (line 93) | def intersection(self, other) -> FuzzySet:
    method membership (line 112) | def membership(self, x: float) -> float:
    method union (line 141) | def union(self, other) -> FuzzySet:
    method plot (line 159) | def plot(self):

FILE: genetic_algorithm/basic_string.py
  function evaluate (line 24) | def evaluate(item: str, main_target: str) -> tuple[str, float]:
  function crossover (line 35) | def crossover(parent_1: str, parent_2: str) -> tuple[str, str]:
  function mutate (line 48) | def mutate(child: str, genes: list[str]) -> str:
  function select (line 62) | def select(
  function basic (line 97) | def basic(target: str, genes: list[str], debug: bool = True) -> tuple[in...

FILE: geodesy/haversine_distance.py
  function haversine_distance (line 8) | def haversine_distance(lat1: float, lon1: float, lat2: float, lon2: floa...

FILE: geodesy/lamberts_ellipsoidal_distance.py
  function lamberts_ellipsoidal_distance (line 10) | def lamberts_ellipsoidal_distance(

FILE: geometry/geometry.py
  class Angle (line 12) | class Angle:
    method __post_init__ (line 32) | def __post_init__(self) -> None:
  class Side (line 38) | class Side:
    method __post_init__ (line 69) | def __post_init__(self) -> None:
  class Ellipse (line 79) | class Ellipse:
    method area (line 95) | def area(self) -> float:
    method perimeter (line 103) | def perimeter(self) -> float:
  class Circle (line 111) | class Circle(Ellipse):
    method __init__ (line 127) | def __init__(self, radius: float) -> None:
    method __repr__ (line 131) | def __repr__(self) -> str:
    method diameter (line 135) | def diameter(self) -> float:
    method max_parts (line 142) | def max_parts(self, num_cuts: float) -> float:
  class Polygon (line 171) | class Polygon:
    method add_side (line 194) | def add_side(self, side: Side) -> Self:
    method get_side (line 202) | def get_side(self, index: int) -> Side:
    method set_side (line 213) | def set_side(self, index: int, side: Side) -> Self:
  class Rectangle (line 226) | class Rectangle(Polygon):
    method __init__ (line 241) | def __init__(self, short_side_length: float, long_side_length: float) ...
    method post_init (line 247) | def post_init(self) -> None:
    method perimeter (line 258) | def perimeter(self) -> float:
    method area (line 261) | def area(self) -> float:
  class Square (line 266) | class Square(Rectangle):
    method __init__ (line 277) | def __init__(self, side_length: float) -> None:
    method perimeter (line 280) | def perimeter(self) -> float:
    method area (line 283) | def area(self) -> float:

FILE: geometry/graham_scan.py
  class Point (line 28) | class Point:
    method __init__ (line 41) | def __init__(self, x_coordinate: float, y_coordinate: float) -> None:
    method __eq__ (line 52) | def __eq__(self, other: object) -> bool:
    method __lt__ (line 65) | def __lt__(self, other: Point) -> bool:
    method euclidean_distance (line 80) | def euclidean_distance(self, other: Point) -> float:
    method consecutive_orientation (line 91) | def consecutive_orientation(self, point_a: Point, point_b: Point) -> f...
  function graham_scan (line 113) | def graham_scan(points: Sequence[Point]) -> list[Point]:

FILE: geometry/jarvis_march.py
  class Point (line 25) | class Point:
    method __init__ (line 28) | def __init__(self, x_coordinate: float, y_coordinate: float) -> None:
    method __eq__ (line 32) | def __eq__(self, other: object) -> bool:
    method __repr__ (line 37) | def __repr__(self) -> str:
    method __hash__ (line 40) | def __hash__(self) -> int:
  function _cross_product (line 44) | def _cross_product(origin: Point, point_a: Point, point_b: Point) -> float:
  function _is_point_on_segment (line 58) | def _is_point_on_segment(p1: Point, p2: Point, point: Point) -> bool:
  function _find_leftmost_point (line 72) | def _find_leftmost_point(points: list[Point]) -> int:
  function _find_next_hull_point (line 83) | def _find_next_hull_point(points: list[Point], current_idx: int) -> int:
  function _is_valid_polygon (line 100) | def _is_valid_polygon(hull: list[Point]) -> bool:
  function _add_point_to_hull (line 111) | def _add_point_to_hull(hull: list[Point], point: Point) -> None:
  function jarvis_march (line 120) | def jarvis_march(points: list[Point]) -> list[Point]:

FILE: geometry/tests/test_graham_scan.py
  function test_empty_points (line 8) | def test_empty_points() -> None:
  function test_single_point (line 13) | def test_single_point() -> None:
  function test_two_points (line 18) | def test_two_points() -> None:
  function test_duplicate_points (line 23) | def test_duplicate_points() -> None:
  function test_collinear_points (line 30) | def test_collinear_points() -> None:
  function test_triangle (line 42) | def test_triangle() -> None:
  function test_rectangle (line 56) | def test_rectangle() -> None:
  function test_triangle_with_interior_points (line 69) | def test_triangle_with_interior_points() -> None:
  function test_rectangle_with_interior_points (line 94) | def test_rectangle_with_interior_points() -> None:
  function test_star_shape (line 121) | def test_star_shape() -> None:
  function test_rectangle_with_collinear_points (line 152) | def test_rectangle_with_collinear_points() -> None:
  function test_point_equality (line 178) | def test_point_equality() -> None:
  function test_point_comparison (line 188) | def test_point_comparison() -> None:
  function test_euclidean_distance (line 199) | def test_euclidean_distance() -> None:
  function test_consecutive_orientation (line 207) | def test_consecutive_orientation() -> None:
  function test_large_hull (line 220) | def test_large_hull() -> None:
  function test_random_order (line 246) | def test_random_order() -> None:

FILE: geometry/tests/test_jarvis_march.py
  class TestPoint (line 8) | class TestPoint:
    method test_point_creation (line 11) | def test_point_creation(self) -> None:
    method test_point_equality (line 17) | def test_point_equality(self) -> None:
    method test_point_repr (line 25) | def test_point_repr(self) -> None:
    method test_point_hash (line 30) | def test_point_hash(self) -> None:
  class TestJarvisMarch (line 37) | class TestJarvisMarch:
    method test_triangle (line 40) | def test_triangle(self) -> None:
    method test_collinear_points (line 47) | def test_collinear_points(self) -> None:
    method test_rectangle_with_interior_point (line 53) | def test_rectangle_with_interior_point(self) -> None:
    method test_star_shape (line 62) | def test_star_shape(self) -> None:
    method test_empty_list (line 77) | def test_empty_list(self) -> None:
    method test_single_point (line 81) | def test_single_point(self) -> None:
    method test_two_points (line 85) | def test_two_points(self) -> None:
    method test_square (line 89) | def test_square(self) -> None:
    method test_duplicate_points (line 97) | def test_duplicate_points(self) -> None:
    method test_pentagon (line 104) | def test_pentagon(self) -> None:

FILE: graphics/bezier_curve.py
  class BezierCurve (line 8) | class BezierCurve:
    method __init__ (line 15) | def __init__(self, list_of_points: list[tuple[float, float]]):
    method basis_function (line 25) | def basis_function(self, t: float) -> list[float]:
    method bezier_curve_function (line 49) | def bezier_curve_function(self, t: float) -> tuple[float, float]:
    method plot_curve (line 75) | def plot_curve(self, step_size: float = 0.01):

FILE: graphics/butterfly_pattern.py
  function butterfly_pattern (line 1) | def butterfly_pattern(n: int) -> str:

FILE: graphics/digital_differential_analyzer_line.py
  function digital_differential_analyzer_line (line 4) | def digital_differential_analyzer_line(

FILE: graphics/vector3_for_2d_rendering.py
  function convert_to_2d (line 13) | def convert_to_2d(
  function rotate (line 38) | def rotate(

FILE: graphs/a_star.py
  function search (line 12) | def search(

FILE: graphs/ant_colony_optimization_algorithms.py
  function main (line 29) | def main(
  function distance (line 102) | def distance(city1: list[int], city2: list[int]) -> float:
  function pheromone_update (line 115) | def pheromone_update(
  function city_select (line 168) | def city_select(

FILE: graphs/articulation_points.py
  function compute_ap (line 2) | def compute_ap(graph):

FILE: graphs/basic_graphs.py
  function _input (line 4) | def _input(message):
  function initialize_unweighted_directed_graph (line 8) | def initialize_unweighted_directed_graph(
  function initialize_unweighted_undirected_graph (line 21) | def initialize_unweighted_undirected_graph(
  function initialize_weighted_undirected_graph (line 35) | def initialize_weighted_undirected_graph(
  function dfs (line 79) | def dfs(g, s):
  function bfs (line 114) | def bfs(g, s):
  function dijk (line 149) | def dijk(g, s):
  function topo (line 189) | def topo(g, ind=None, q=None):
  function adjm (line 219) | def adjm():
  function floy (line 259) | def floy(a_and_n):
  function prim (line 284) | def prim(g, s):
  function edglist (line 313) | def edglist():
  function krusk (line 350) | def krusk(e_and_n):
  function find_isolated_nodes (line 374) | def find_isolated_nodes(graph):

FILE: graphs/bellman_ford.py
  function print_distance (line 4) | def print_distance(distance: list[float], src):
  function check_negative_cycle (line 10) | def check_negative_cycle(
  function bellman_ford (line 20) | def bellman_ford(

FILE: graphs/bi_directional_dijkstra.py
  function pass_and_relaxation (line 19) | def pass_and_relaxation(
  function bidirectional_dij (line 47) | def bidirectional_dij(

FILE: graphs/bidirectional_a_star.py
  class Node (line 28) | class Node:
    method __init__ (line 44) | def __init__(
    method calculate_heuristic (line 63) | def calculate_heuristic(self) -> float:
    method __lt__ (line 74) | def __lt__(self, other: Node) -> bool:
  class AStar (line 78) | class AStar:
    method __init__ (line 94) | def __init__(self, start: TPosition, goal: TPosition):
    method search (line 103) | def search(self) -> list[TPosition]:
    method get_successors (line 132) | def get_successors(self, parent: Node) -> list[Node]:
    method retrace_path (line 158) | def retrace_path(self, node: Node | None) -> list[TPosition]:
  class BidirectionalAStar (line 171) | class BidirectionalAStar:
    method __init__ (line 184) | def __init__(self, start: TPosition, goal: TPosition) -> None:
    method search (line 189) | def search(self) -> list[TPosition]:
    method retrace_bidirectional_path (line 232) | def retrace_bidirectional_path(

FILE: graphs/bidirectional_breadth_first_search.py
  class Node (line 24) | class Node:
    method __init__ (line 25) | def __init__(
  class BreadthFirstSearch (line 36) | class BreadthFirstSearch:
    method __init__ (line 55) | def __init__(self, start: tuple[int, int], goal: tuple[int, int]):
    method search (line 62) | def search(self) -> Path | None:
    method get_successors (line 79) | def get_successors(self, parent: Node) -> list[Node]:
    method retrace_path (line 98) | def retrace_path(self, node: Node | None) -> Path:
  class BidirectionalBreadthFirstSearch (line 111) | class BidirectionalBreadthFirstSearch:
    method __init__ (line 125) | def __init__(self, start, goal):
    method search (line 130) | def search(self) -> Path | None:
    method retrace_bidirectional_path (line 157) | def retrace_bidirectional_path(self, fwd_node: Node, bwd_node: Node) -...

FILE: graphs/bidirectional_search.py
  function expand_search (line 17) | def expand_search(
  function construct_path (line 41) | def construct_path(current: int | None, parents: dict[int, int | None]) ...
  function bidirectional_search (line 49) | def bidirectional_search(
  function main (line 151) | def main() -> None:

FILE: graphs/boruvka.py
  class Graph (line 33) | class Graph:
    method __init__ (line 34) | def __init__(self, num_of_nodes: int) -> None:
    method add_edge (line 49) | def add_edge(self, u_node: int, v_node: int, weight: int) -> None:
    method find_component (line 54) | def find_component(self, u_node: int) -> int:
    method set_component (line 61) | def set_component(self, u_node: int) -> None:
    method union (line 68) | def union(self, component_size: list[int], u_node: int, v_node: int) -...
    method boruvka (line 83) | def boruvka(self) -> None:
  function test_vector (line 141) | def test_vector() -> None:

FILE: graphs/breadth_first_search.py
  class Graph (line 10) | class Graph:
    method __init__ (line 11) | def __init__(self) -> None:
    method print_graph (line 14) | def print_graph(self) -> None:
    method add_edge (line 26) | def add_edge(self, from_vertex: int, to_vertex: int) -> None:
    method bfs (line 40) | def bfs(self, start_vertex: int) -> set[int]:

FILE: graphs/breadth_first_search_2.py
  function breadth_first_search (line 32) | def breadth_first_search(graph: dict, start: str) -> list[str]:
  function breadth_first_search_with_deque (line 53) | def breadth_first_search_with_deque(graph: dict, start: str) -> list[str]:
  function benchmark_function (line 73) | def benchmark_function(name: str) -> None:

FILE: graphs/breadth_first_search_shortest_path.py
  class Graph (line 18) | class Graph:
    method __init__ (line 19) | def __init__(self, graph: dict[str, list[str]], source_vertex: str) ->...
    method breath_first_search (line 29) | def breath_first_search(self) -> None:
    method shortest_path (line 49) | def shortest_path(self, target_vertex: str) -> str:

FILE: graphs/breadth_first_search_shortest_path_2.py
  function bfs_shortest_path (line 21) | def bfs_shortest_path(graph: dict, start, goal) -> list[str]:
  function bfs_shortest_path_distance (line 72) | def bfs_shortest_path_distance(graph: dict, start, target) -> int:

FILE: graphs/breadth_first_search_zero_one_shortest_path.py
  class Edge (line 15) | class Edge:
  class AdjacencyList (line 22) | class AdjacencyList:
    method __init__ (line 25) | def __init__(self, size: int):
    method __getitem__ (line 29) | def __getitem__(self, vertex: int) -> Iterator[Edge]:
    method size (line 34) | def size(self):
    method add_edge (line 37) | def add_edge(self, from_vertex: int, to_vertex: int, weight: int):
    method get_shortest_path (line 63) | def get_shortest_path(self, start_vertex: int, finish_vertex: int) -> ...

FILE: graphs/check_bipatrite.py
  function is_bipartite_dfs (line 4) | def is_bipartite_dfs(graph: dict[int, list[int]]) -> bool:
  function is_bipartite_bfs (line 84) | def is_bipartite_bfs(graph: dict[int, list[int]]) -> bool:

FILE: graphs/check_cycle.py
  function check_cycle (line 6) | def check_cycle(graph: dict) -> bool:
  function depth_first_search (line 24) | def depth_first_search(graph: dict, vertex: int, visited: set, rec_stk: ...

FILE: graphs/connected_components.py
  function dfs (line 13) | def dfs(graph: dict, vert: int, visited: list) -> list:
  function connected_components (line 33) | def connected_components(graph: dict) -> list:

FILE: graphs/deep_clone_graph.py
  class Node (line 17) | class Node:
    method __post_init__ (line 21) | def __post_init__(self) -> None:
    method __hash__ (line 28) | def __hash__(self) -> int:
  function clone_graph (line 36) | def clone_graph(node: Node | None) -> Node | None:

FILE: graphs/depth_first_search.py
  function depth_first_search (line 6) | def depth_first_search(graph: dict, start: str) -> set[str]:

FILE: graphs/depth_first_search_2.py
  class Graph (line 6) | class Graph:
    method __init__ (line 7) | def __init__(self):
    method print_graph (line 11) | def print_graph(self) -> None:
    method add_edge (line 35) | def add_edge(self, from_vertex: int, to_vertex: int) -> None:
    method dfs (line 57) | def dfs(self) -> None:
    method dfs_recursive (line 81) | def dfs_recursive(self, start_vertex: int, visited: list) -> None:

FILE: graphs/dijkstra.py
  function dijkstra (line 37) | def dijkstra(graph, start, end):

FILE: graphs/dijkstra_2.py
  function print_dist (line 1) | def print_dist(dist, v):
  function min_dist (line 11) | def min_dist(mdist, vset, v):
  function dijkstra (line 21) | def dijkstra(graph, v, src):

FILE: graphs/dijkstra_algorithm.py
  class PriorityQueue (line 11) | class PriorityQueue:
    method __init__ (line 13) | def __init__(self):
    method is_empty (line 30) | def is_empty(self):
    method min_heapify (line 44) | def min_heapify(self, idx):
    method insert (line 87) | def insert(self, tup):
    method extract_min (line 108) | def extract_min(self):
    method left (line 130) | def left(self, i):
    method right (line 143) | def right(self, i):
    method par (line 156) | def par(self, i):
    method swap (line 171) | def swap(self, i, j):
    method decrease_key (line 192) | def decrease_key(self, tup, new_d):
  class Graph (line 213) | class Graph:
    method __init__ (line 214) | def __init__(self, num):
    method add_edge (line 235) | def add_edge(self, u, v, w):
    method show_graph (line 258) | def show_graph(self):
    method dijkstra (line 277) | def dijkstra(self, src):
    method show_distances (line 380) | def show_distances(self, src):
    method show_path (line 394) | def show_path(self, src, dest):

FILE: graphs/dijkstra_alternate.py
  class Graph (line 4) | class Graph:
    method __init__ (line 5) | def __init__(self, vertices: int) -> None:
    method print_solution (line 18) | def print_solution(self, distances_from_source: list[int]) -> None:
    method minimum_distance (line 27) | def minimum_distance(
    method dijkstra (line 49) | def dijkstra(self, source: int) -> None:

FILE: graphs/dijkstra_binary_grid.py
  function dijkstra (line 14) | def dijkstra(

FILE: graphs/dinic.py
  class Dinic (line 4) | class Dinic:
    method __init__ (line 5) | def __init__(self, n):
    method add_edge (line 17) | def add_edge(self, a, b, c, rcap=0):
    method depth_first_search (line 22) | def depth_first_search(self, vertex, sink, flow):
    method max_flow (line 38) | def max_flow(self, source, sink):

FILE: graphs/directed_and_undirected_weighted_graph.py
  class DirectedGraph (line 9) | class DirectedGraph:
    method __init__ (line 10) | def __init__(self):
    method add_pair (line 16) | def add_pair(self, u, v, w=1):
    method all_nodes (line 25) | def all_nodes(self):
    method remove_pair (line 29) | def remove_pair(self, u, v):
    method dfs (line 36) | def dfs(self, s=-2, d=-1):
    method fill_graph_randomly (line 76) | def fill_graph_randomly(self, c=-1):
    method bfs (line 86) | def bfs(self, s=-2):
    method in_degree (line 102) | def in_degree(self, u):
    method out_degree (line 110) | def out_degree(self, u):
    method topological_sort (line 113) | def topological_sort(self, s=-2):
    method cycle_nodes (line 146) | def cycle_nodes(self):
    method has_cycle (line 199) | def has_cycle(self):
    method dfs_time (line 251) | def dfs_time(self, s=-2, e=-1):
    method bfs_time (line 257) | def bfs_time(self, s=-2):
  class Graph (line 264) | class Graph:
    method __init__ (line 265) | def __init__(self):
    method add_pair (line 271) | def add_pair(self, u, v, w=1):
    method remove_pair (line 290) | def remove_pair(self, u, v):
    method dfs (line 302) | def dfs(self, s=-2, d=-1):
    method fill_graph_randomly (line 342) | def fill_graph_randomly(self, c=-1):
    method bfs (line 352) | def bfs(self, s=-2):
    method degree (line 368) | def degree(self, u):
    method cycle_nodes (line 371) | def cycle_nodes(self):
    method has_cycle (line 424) | def has_cycle(self):
    method all_nodes (line 476) | def all_nodes(self):
    method dfs_time (line 479) | def dfs_time(self, s=-2, e=-1):
    method bfs_time (line 485) | def bfs_time(self, s=-2):

FILE: graphs/edmonds_karp_multiple_source_and_sink.py
  class FlowNetwork (line 1) | class FlowNetwork:
    method __init__ (line 2) | def __init__(self, graph, sources, sinks):
    method _normalize_graph (line 12) | def _normalize_graph(self, sources, sinks):
    method find_maximum_flow (line 47) | def find_maximum_flow(self):
    method set_maximum_flow_algorithm (line 56) | def set_maximum_flow_algorithm(self, algorithm):
  class FlowNetworkAlgorithmExecutor (line 60) | class FlowNetworkAlgorithmExecutor:
    method __init__ (line 61) | def __init__(self, flow_network):
    method execute (line 71) | def execute(self):
    method _algorithm (line 77) | def _algorithm(self):
  class MaximumFlowAlgorithmExecutor (line 81) | class MaximumFlowAlgorithmExecutor(FlowNetworkAlgorithmExecutor):
    method __init__ (line 82) | def __init__(self, flow_network):
    method get_maximum_flow (line 87) | def get_maximum_flow(self):
  class PushRelabelExecutor (line 94) | class PushRelabelExecutor(MaximumFlowAlgorithmExecutor):
    method __init__ (line 95) | def __init__(self, flow_network):
    method _algorithm (line 103) | def _algorithm(self):
    method process_vertex (line 135) | def process_vertex(self, vertex_index):
    method push (line 149) | def push(self, from_index, to_index):
    method relabel (line 159) | def relabel(self, vertex_index):

FILE: graphs/eulerian_path_and_circuit_for_undirected_graph.py
  function dfs (line 9) | def dfs(u, graph, visited_edge, path=None):
  function check_circuit_or_path (line 19) | def check_circuit_or_path(graph, max_node):
  function check_euler (line 35) | def check_euler(graph, max_node):
  function main (line 52) | def main():

FILE: graphs/even_tree.py
  function dfs (line 20) | def dfs(start: int) -> int:
  function even_tree (line 33) | def even_tree():

FILE: graphs/finding_bridges.py
  function __get_demo_graph (line 13) | def __get_demo_graph(index):
  function compute_bridges (line 60) | def compute_bridges(graph: dict[int, list[int]]) -> list[tuple[int, int]]:

FILE: graphs/frequent_pattern_graph_miner.py
  function get_distinct_edge (line 27) | def get_distinct_edge(edge_array):
  function get_bitcode (line 40) | def get_bitcode(edge_array, distinct_edge):
  function get_frequency_table (line 53) | def get_frequency_table(edge_array):
  function get_nodes (line 74) | def get_nodes(frequency_table):
  function get_cluster (line 88) | def get_cluster(nodes):
  function get_support (line 99) | def get_support(cluster):
  function print_all (line 113) | def print_all() -> None:
  function create_edge (line 130) | def create_edge(nodes, graph, cluster, c1):
  function construct_graph (line 154) | def construct_graph(cluster, nodes):
  function my_dfs (line 172) | def my_dfs(graph, start, end, path=None):
  function find_freq_subgraph_given_support (line 184) | def find_freq_subgraph_given_support(s, cluster, graph):
  function freq_subgraphs_edge_list (line 193) | def freq_subgraphs_edge_list(paths):
  function preprocess (line 209) | def preprocess(edge_array):

FILE: graphs/g_topological_sort.py
  function print_stack (line 21) | def print_stack(stack, clothes):
  function depth_first_search (line 29) | def depth_first_search(u, visited, graph):
  function topological_sort (line 38) | def topological_sort(graph, visited):

FILE: graphs/gale_shapley_bigraph.py
  function stable_matching (line 4) | def stable_matching(

FILE: graphs/graph_adjacency_list.py
  class GraphAdjacencyList (line 31) | class GraphAdjacencyList[T]:
    method __init__ (line 32) | def __init__(
    method add_vertex (line 60) | def add_vertex(self, vertex: T) -> None:
    method add_edge (line 79) | def add_edge(self, source_vertex: T, destination_vertex: T) -> None:
    method remove_vertex (line 107) | def remove_vertex(self, vertex: T) -> None:
    method remove_edge (line 132) | def remove_edge(self, source_vertex: T, destination_vertex: T) -> None:
    method contains_vertex (line 159) | def contains_vertex(self, vertex: T) -> bool:
    method contains_edge (line 165) | def contains_edge(self, source_vertex: T, destination_vertex: T) -> bool:
    method clear_graph (line 183) | def clear_graph(self) -> None:
    method __repr__ (line 189) | def __repr__(self) -> str:
  class TestGraphAdjacencyList (line 193) | class TestGraphAdjacencyList(unittest.TestCase):
    method __assert_graph_edge_exists_check (line 194) | def __assert_graph_edge_exists_check(
    method __assert_graph_edge_does_not_exist_check (line 204) | def __assert_graph_edge_does_not_exist_check(
    method __assert_graph_vertex_exists_check (line 214) | def __assert_graph_vertex_exists_check(
    method __assert_graph_vertex_does_not_exist_check (line 223) | def __assert_graph_vertex_does_not_exist_check(
    method __generate_random_edges (line 232) | def __generate_random_edges(
    method __generate_graphs (line 251) | def __generate_graphs(
    method test_init_check (line 278) | def test_init_check(self) -> None:
    method test_contains_vertex (line 299) | def test_contains_vertex(self) -> None:
    method test_add_vertices (line 315) | def test_add_vertices(self) -> None:
    method test_remove_vertices (line 339) | def test_remove_vertices(self) -> None:
    method test_add_and_remove_vertices_repeatedly (line 363) | def test_add_and_remove_vertices_repeatedly(self) -> None:
    method test_contains_edge (line 400) | def test_contains_edge(self) -> None:
    method test_add_edge (line 434) | def test_add_edge(self) -> None:
    method test_remove_edge (line 455) | def test_remove_edge(self) -> None:
    method test_add_and_remove_edges_repeatedly (line 475) | def test_add_and_remove_edges_repeatedly(self) -> None:
    method test_add_vertex_exception_check (line 509) | def test_add_vertex_exception_check(self) -> None:
    method test_remove_vertex_exception_check (line 523) | def test_remove_vertex_exception_check(self) -> None:
    method test_add_edge_exception_check (line 538) | def test_add_edge_exception_check(self) -> None:
    method test_remove_edge_exception_check (line 552) | def test_remove_edge_exception_check(self) -> None:
    method test_contains_edge_exception_check (line 576) | def test_contains_edge_exception_check(self) -> None:

FILE: graphs/graph_adjacency_matrix.py
  class GraphAdjacencyMatrix (line 31) | class GraphAdjacencyMatrix[T]:
    method __init__ (line 32) | def __init__(
    method add_edge (line 61) | def add_edge(self, source_vertex: T, destination_vertex: T) -> None:
    method remove_edge (line 90) | def remove_edge(self, source_vertex: T, destination_vertex: T) -> None:
    method add_vertex (line 118) | def add_vertex(self, vertex: T) -> None:
    method remove_vertex (line 135) | def remove_vertex(self, vertex: T) -> None:
    method contains_vertex (line 165) | def contains_vertex(self, vertex: T) -> bool:
    method contains_edge (line 171) | def contains_edge(self, source_vertex: T, destination_vertex: T) -> bool:
    method clear_graph (line 191) | def clear_graph(self) -> None:
    method __repr__ (line 198) | def __repr__(self) -> str:
  class TestGraphMatrix (line 204) | class TestGraphMatrix(unittest.TestCase):
    method __assert_graph_edge_exists_check (line 205) | def __assert_graph_edge_exists_check(
    method __assert_graph_edge_does_not_exist_check (line 215) | def __assert_graph_edge_does_not_exist_check(
    method __assert_graph_vertex_exists_check (line 225) | def __assert_graph_vertex_exists_check(
    method __assert_graph_vertex_does_not_exist_check (line 234) | def __assert_graph_vertex_does_not_exist_check(
    method __generate_random_edges (line 243) | def __generate_random_edges(
    method __generate_graphs (line 262) | def __generate_graphs(
    method test_init_check (line 289) | def test_init_check(self) -> None:
    method test_contains_vertex (line 311) | def test_contains_vertex(self) -> None:
    method test_add_vertices (line 327) | def test_add_vertices(self) -> None:
    method test_remove_vertices (line 351) | def test_remove_vertices(self) -> None:
    method test_add_and_remove_vertices_repeatedly (line 375) | def test_add_and_remove_vertices_repeatedly(self) -> None:
    method test_contains_edge (line 412) | def test_contains_edge(self) -> None:
    method test_add_edge (line 446) | def test_add_edge(self) -> None:
    method test_remove_edge (line 467) | def test_remove_edge(self) -> None:
    method test_add_and_remove_edges_repeatedly (line 487) | def test_add_and_remove_edges_repeatedly(self) -> None:
    method test_add_vertex_exception_check (line 521) | def test_add_vertex_exception_check(self) -> None:
    method test_remove_vertex_exception_check (line 535) | def test_remove_vertex_exception_check(self) -> None:
    method test_add_edge_exception_check (line 550) | def test_add_edge_exception_check(self) -> None:
    method test_remove_edge_exception_check (line 564) | def test_remove_edge_exception_check(self) -> None:
    method test_contains_edge_exception_check (line 588) | def test_contains_edge_exception_check(self) -> None:

FILE: graphs/graph_list.py
  class GraphAdjacencyList (line 14) | class GraphAdjacencyList[T]:
    method __init__ (line 75) | def __init__(self, directed: bool = True) -> None:
    method add_edge (line 84) | def add_edge(
    method __repr__ (line 149) | def __repr__(self) -> str:

FILE: graphs/graphs_floyd_warshall.py
  function _print_dist (line 8) | def _print_dist(dist, v):
  function floyd_warshall (line 19) | def floyd_warshall(graph, v):

FILE: graphs/greedy_best_first.py
  class Node (line 40) | class Node:
    method __init__ (line 56) | def __init__(
    method calculate_heuristic (line 74) | def calculate_heuristic(self) -> float:
    method __lt__ (line 83) | def __lt__(self, other) -> bool:
    method __eq__ (line 86) | def __eq__(self, other) -> bool:
  class GreedyBestFirst (line 90) | class GreedyBestFirst:
    method __init__ (line 107) | def __init__(
    method search (line 119) | def search(self) -> Path | None:
    method get_successors (line 147) | def get_successors(self, parent: Node) -> list[Node]:
    method retrace_path (line 168) | def retrace_path(self, node: Node | None) -> Path:

FILE: graphs/greedy_min_vertex_cover.py
  function greedy_min_vertex_cover (line 12) | def greedy_min_vertex_cover(graph: dict) -> set[int]:

FILE: graphs/kahns_algorithm_long.py
  function longest_distance (line 2) | def longest_distance(graph):

FILE: graphs/kahns_algorithm_topo.py
  function topological_sort (line 1) | def topological_sort(graph: dict[int, list[int]]) -> list[int] | None:

FILE: graphs/karger.py
  function partition_graph (line 25) | def partition_graph(graph: dict[str, list[str]]) -> set[tuple[str, str]]:

FILE: graphs/lanczos_eigenvectors.py
  function validate_adjacency_list (line 32) | def validate_adjacency_list(graph: list[list[int | None]]) -> None:
  function lanczos_iteration (line 71) | def lanczos_iteration(
  function multiply_matrix_vector (line 133) | def multiply_matrix_vector(
  function find_lanczos_eigenvectors (line 165) | def find_lanczos_eigenvectors(
  function main (line 196) | def main() -> None:

FILE: graphs/markov_chain.py
  class MarkovChainGraphUndirectedUnweighted (line 7) | class MarkovChainGraphUndirectedUnweighted:
    method __init__ (line 12) | def __init__(self):
    method add_node (line 15) | def add_node(self, node: str) -> None:
    method add_transition_probability (line 18) | def add_transition_probability(
    method get_nodes (line 27) | def get_nodes(self) -> list[str]:
    method transition (line 30) | def transition(self, node: str) -> str:
  function get_transitions (line 41) | def get_transitions(

FILE: graphs/matching_min_vertex_cover.py
  function matching_min_vertex_cover (line 11) | def matching_min_vertex_cover(graph: dict) -> set:
  function get_edges (line 39) | def get_edges(graph: dict) -> set:

FILE: graphs/minimum_path_sum.py
  function min_path_sum (line 1) | def min_path_sum(grid: list) -> int:
  function fill_row (line 47) | def fill_row(current_row: list, row_above: list) -> list:

FILE: graphs/minimum_spanning_tree_boruvka.py
  class Graph (line 1) | class Graph:
    method __init__ (line 6) | def __init__(self):
    method add_vertex (line 11) | def add_vertex(self, vertex):
    method add_edge (line 20) | def add_edge(self, head, tail, weight):
    method distinct_weight (line 35) | def distinct_weight(self):
    method __str__ (line 57) | def __str__(self):
    method get_edges (line 68) | def get_edges(self):
    method get_vertices (line 78) | def get_vertices(self):
    method build (line 85) | def build(vertices=None, edges=None):
    class UnionFind (line 101) | class UnionFind:
      method __init__ (line 106) | def __init__(self):
      method __len__ (line 110) | def __len__(self):
      method make_set (line 113) | def make_set(self, item):
      method find (line 121) | def find(self, item):
      method union (line 128) | def union(self, item1, item2):
    method boruvka_mst (line 150) | def boruvka_mst(graph):

FILE: graphs/minimum_spanning_tree_kruskal.py
  function kruskal (line 1) | def kruskal(

FILE: graphs/minimum_spanning_tree_kruskal2.py
  class DisjointSetTreeNode (line 8) | class DisjointSetTreeNode[T]:
    method __init__ (line 10) | def __init__(self, data: T) -> None:
  class DisjointSetTree (line 16) | class DisjointSetTree[T]:
    method __init__ (line 18) | def __init__(self) -> None:
    method make_set (line 22) | def make_set(self, data: T) -> None:
    method find_set (line 26) | def find_set(self, data: T) -> DisjointSetTreeNode[T]:
    method link (line 33) | def link(
    method union (line 44) | def union(self, data1: T, data2: T) -> None:
  class GraphUndirectedWeighted (line 49) | class GraphUndirectedWeighted[T]:
    method __init__ (line 50) | def __init__(self) -> None:
    method add_node (line 54) | def add_node(self, node: T) -> None:
    method add_edge (line 59) | def add_edge(self, node1: T, node2: T, weight: int) -> None:
    method kruskal (line 66) | def kruskal(self) -> GraphUndirectedWeighted[T]:

FILE: graphs/minimum_spanning_tree_prims.py
  class Heap (line 5) | class Heap:
    method __init__ (line 6) | def __init__(self):
    method get_position (line 9) | def get_position(self, vertex):
    method set_position (line 12) | def set_position(self, vertex, pos):
    method top_to_bottom (line 15) | def top_to_bottom(self, heap, start, size, positions):
    method bottom_to_top (line 42) | def bottom_to_top(self, val, index, heap, position):
    method heapify (line 63) | def heapify(self, heap, positions):
    method delete_minimum (line 68) | def delete_minimum(self, heap, positions):
  function prisms_algorithm (line 75) | def prisms_algorithm(adjacency_list):

FILE: graphs/minimum_spanning_tree_prims2.py
  function get_parent_position (line 18) | def get_parent_position(position: int) -> int:
  function get_child_left_position (line 30) | def get_child_left_position(position: int) -> int:
  function get_child_right_position (line 40) | def get_child_right_position(position: int) -> int:
  class MinPriorityQueue (line 50) | class MinPriorityQueue[T]:
    method __init__ (line 86) | def __init__(self) -> None:
    method __len__ (line 91) | def __len__(self) -> int:
    method __repr__ (line 94) | def __repr__(self) -> str:
    method is_empty (line 97) | def is_empty(self) -> bool:
    method push (line 101) | def push(self, elem: T, weight: int) -> None:
    method extract_min (line 108) | def extract_min(self) -> T:
    method update_key (line 120) | def update_key(self, elem: T, weight: int) -> None:
    method _bubble_up (line 134) | def _bubble_up(self, elem: T) -> None:
    method _bubble_down (line 148) | def _bubble_down(self, elem: T) -> None:
    method _swap_nodes (line 175) | def _swap_nodes(self, node1_pos: int, node2_pos: int) -> None:
  class GraphUndirectedWeighted (line 187) | class GraphUndirectedWeighted[T]:
    method __init__ (line 196) | def __init__(self) -> None:
    method __repr__ (line 200) | def __repr__(self) -> str:
    method __len__ (line 203) | def __len__(self) -> int:
    method add_node (line 206) | def add_node(self, node: T) -> None:
    method add_edge (line 212) | def add_edge(self, node1: T, node2: T, weight: int) -> None:
  function prims_algo (line 220) | def prims_algo[T](

FILE: graphs/multi_heuristic_astar.py
  class PriorityQueue (line 9) | class PriorityQueue:
    method __init__ (line 10) | def __init__(self):
    method minkey (line 14) | def minkey(self):
    method empty (line 20) | def empty(self):
    method put (line 23) | def put(self, item, priority):
    method remove_element (line 39) | def remove_element(self, item):
    method top_show (line 50) | def top_show(self):
    method get (line 53) | def get(self):
  function consistent_heuristic (line 59) | def consistent_heuristic(p: TPos, goal: TPos):
  function heuristic_2 (line 66) | def heuristic_2(p: TPos, goal: TPos):
  function heuristic_1 (line 71) | def heuristic_1(p: TPos, goal: TPos):
  function key (line 76) | def key(start: TPos, i: int, goal: TPos, g_function: dict[TPos, float]):
  function do_something (line 81) | def do_something(back_pointer, goal, start):
  function valid (line 123) | def valid(p: TPos):
  function expand_state (line 129) | def expand_state(
  function make_common_ground (line 172) | def make_common_ground():
  function multi_a_star (line 236) | def multi_a_star(start: TPos, goal: TPos, n_heuristic: int):

FILE: graphs/page_rank.py
  class Node (line 18) | class Node:
    method __init__ (line 19) | def __init__(self, name):
    method add_inbound (line 24) | def add_inbound(self, node):
    method add_outbound (line 27) | def add_outbound(self, node):
    method __repr__ (line 30) | def __repr__(self):
  function page_rank (line 34) | def page_rank(nodes, limit=3, d=0.85):
  function main (line 52) | def main():

FILE: graphs/prim.py
  class Vertex (line 13) | class Vertex:
    method __init__ (line 16) | def __init__(self, id_):
    method __lt__ (line 30) | def __lt__(self, other):
    method __repr__ (line 34) | def __repr__(self):
    method add_neighbor (line 38) | def add_neighbor(self, vertex):
    method add_edge (line 42) | def add_edge(self, vertex, weight):
  function connect (line 47) | def connect(graph, a, b, edge):
  function prim (line 56) | def prim(graph: list, root: Vertex) -> list:
  function prim_heap (line 86) | def prim_heap(graph: list, root: Vertex) -> Iterator[tuple]:
  function test_vector (line 118) | def test_vector() -> None:

FILE: graphs/random_graph_generator.py
  function random_graph (line 12) | def random_graph(
  function complete_graph (line 50) | def complete_graph(vertices_number: int) -> dict:

FILE: graphs/scc_kosaraju.py
  function dfs (line 4) | def dfs(u):
  function dfs2 (line 14) | def dfs2(u):
  function kosaraju (line 24) | def kosaraju():

FILE: graphs/strongly_connected_components.py
  function topology_sort (line 13) | def topology_sort(
  function find_components (line 37) | def find_components(
  function strongly_connected_components (line 59) | def strongly_connected_components(graph: dict[int, list[int]]) -> list[l...

FILE: graphs/tarjans_scc.py
  function tarjan (line 4) | def tarjan(g: list[list[int]]) -> list[list[int]]:
  function create_graph (line 83) | def create_graph(n: int, edges: list[tuple[int, int]]) -> list[list[int]]:

FILE: graphs/tests/test_min_spanning_tree_kruskal.py
  function test_kruskal_successful_result (line 4) | def test_kruskal_successful_result():

FILE: graphs/tests/test_min_spanning_tree_prim.py
  function test_prim_successful_result (line 6) | def test_prim_successful_result():

FILE: greedy_methods/best_time_to_buy_and_sell_stock.py
  function max_profit (line 18) | def max_profit(prices: list[int]) -> int:

FILE: greedy_methods/fractional_cover_problem.py
  class Item (line 8) | class Item:
    method ratio (line 13) | def ratio(self) -> float:
  function fractional_cover (line 33) | def fractional_cover(items: list[Item], capacity: int) -> float:

FILE: greedy_methods/fractional_knapsack.py
  function frac_knapsack (line 5) | def frac_knapsack(vl, wt, w, n):

FILE: greedy_methods/fractional_knapsack_2.py
  function fractional_knapsack (line 8) | def fractional_knapsack(

FILE: greedy_methods/gas_station.py
  class GasStation (line 31) | class GasStation:
  function get_gas_stations (line 36) | def get_gas_stations(
  function can_complete_journey (line 62) | def can_complete_journey(gas_stations: tuple[GasStation, ...]) -> int:

FILE: greedy_methods/minimum_coin_change.py
  function find_minimum_change (line 44) | def find_minimum_change(denominations: list[int], value: str) -> list[int]:

FILE: greedy_methods/minimum_waiting_time.py
  function minimum_waiting_time (line 16) | def minimum_waiting_time(queries: list[int]) -> int:

FILE: greedy_methods/optimal_merge_pattern.py
  function optimal_merge_pattern (line 23) | def optimal_merge_pattern(files: list) -> float:

FILE: greedy_methods/smallest_range.py
  function smallest_range (line 10) | def smallest_range(nums: list[list[int]]) -> list[int]:

FILE: hashes/adler32.py
  function adler32 (line 14) | def adler32(plain_text: str) -> int:

FILE: hashes/chaos_machine.py
  function push (line 16) | def push(seed):
  function pull (line 42) | def pull():
  function reset (line 75) | def reset():

FILE: hashes/djb2.py
  function djb2 (line 21) | def djb2(s: str) -> int:

FILE: hashes/elf.py
  function elf_hash (line 1) | def elf_hash(data: str) -> int:

FILE: hashes/enigma_machine.py
  function rotator (line 10) | def rotator():
  function engine (line 30) | def engine(input_character):

FILE: hashes/fletcher16.py
  function fletcher16 (line 13) | def fletcher16(text: str) -> int:

FILE: hashes/hamming_code.py
  function text_to_bits (line 52) | def text_to_bits(text, encoding="utf-8", errors="surrogatepass"):
  function text_from_bits (line 61) | def text_from_bits(bits, encoding="utf-8", errors="surrogatepass"):
  function emitter_converter (line 71) | def emitter_converter(size_par, data):
  function receptor_converter (line 150) | def receptor_converter(size_par, data):

FILE: hashes/luhn.py
  function is_luhn (line 6) | def is_luhn(string: str) -> bool:

FILE: hashes/md5.py
  function to_little_endian (line 18) | def to_little_endian(string_32: bytes) -> bytes:
  function reformat_hex (line 46) | def reformat_hex(i: int) -> bytes:
  function preprocess (line 90) | def preprocess(message: bytes) -> bytes:
  function get_block_words (line 134) | def get_block_words(bit_string: bytes) -> Generator[list[int]]:
  function not_32 (line 190) | def not_32(i: int) -> int:
  function sum_32 (line 228) | def sum_32(a: int, b: int) -> int:
  function left_rotate_32 (line 253) | def left_rotate_32(i: int, shift: int) -> int:
  function md5_me (line 297) | def md5_me(message: bytes) -> bytes:

FILE: hashes/sdbm.py
  function sdbm (line 22) | def sdbm(plain_text: str) -> int:

FILE: hashes/sha1.py
  class SHA1Hash (line 34) | class SHA1Hash:
    method __init__ (line 41) | def __init__(self, data):
    method rotate (line 53) | def rotate(n, b):
    method padding (line 61) | def padding(self):
    method split_blocks (line 69) | def split_blocks(self):
    method expand_block (line 78) | def expand_block(self, block):
    method final_hash (line 88) | def final_hash(self):
  function test_sha1_hash (line 133) | def test_sha1_hash():
  function main (line 138) | def main():

FILE: hashes/sha256.py
  class SHA256 (line 23) | class SHA256:
    method __init__ (line 34) | def __init__(self, data: bytes) -> None:
    method preprocessing (line 121) | def preprocessing(data: bytes) -> bytes:
    method final_hash (line 126) | def final_hash(self) -> None:
    method ror (line 190) | def ror(self, value: int, rotations: int) -> int:
  class SHA256HashTest (line 197) | class SHA256HashTest(unittest.TestCase):
    method test_match_hashes (line 202) | def test_match_hashes(self) -> None:
  function main (line 209) | def main() -> None:

FILE: knapsack/greedy_knapsack.py
  function calc_profit (line 20) | def calc_profit(profit: list, weight: list, max_weight: int) -> int:

FILE: knapsack/knapsack.py
  function knapsack (line 10) | def knapsack(

FILE: knapsack/recursive_approach_knapsack.py
  function knapsack (line 20) | def knapsack(

FILE: knapsack/tests/test_greedy_knapsack.py
  class TestClass (line 8) | class TestClass(unittest.TestCase):
    method test_sorted (line 13) | def test_sorted(self):
    method test_negative_max_weight (line 23) | def test_negative_max_weight(self):
    method test_negative_profit_value (line 33) | def test_negative_profit_value(self):
    method test_negative_weight_value (line 43) | def test_negative_weight_value(self):
    method test_null_max_weight (line 53) | def test_null_max_weight(self):
    method test_unequal_list_length (line 63) | def test_unequal_list_length(self):

FILE: knapsack/tests/test_knapsack.py
  class Test (line 15) | class Test(unittest.TestCase):
    method test_base_case (line 16) | def test_base_case(self):
    method test_easy_case (line 31) | def test_easy_case(self):
    method test_knapsack (line 41) | def test_knapsack(self):
    method test_knapsack_repetition (line 51) | def test_knapsack_repetition(self):

FILE: linear_algebra/gaussian_elimination.py
  function retroactive_resolution (line 11) | def retroactive_resolution(
  function gaussian_elimination (line 46) | def gaussian_elimination(

FILE: linear_algebra/jacobi_iteration_method.py
  function jacobi_iteration_method (line 13) | def jacobi_iteration_method(
  function strictly_diagonally_dominant (line 169) | def strictly_diagonally_dominant(table: NDArray[float64]) -> bool:

FILE: linear_algebra/lu_decomposition.py
  function lower_upper_decomposition (line 25) | def lower_upper_decomposition(table: np.ndarray) -> tuple[np.ndarray, np...

FILE: linear_algebra/matrix_inversion.py
  function invert_matrix (line 4) | def invert_matrix(matrix: list[list[float]]) -> list[list[float]]:

FILE: linear_algebra/src/conjugate_gradient.py
  function _is_matrix_spd (line 12) | def _is_matrix_spd(matrix: np.ndarray) -> bool:
  function _create_spd_matrix (line 48) | def _create_spd_matrix(dimension: int) -> Any:
  function conjugate_gradient (line 71) | def conjugate_gradient(
  function test_conjugate_gradient (line 154) | def test_conjugate_gradient() -> None:

FILE: linear_algebra/src/gaussian_elimination_pivoting.py
  function solve_linear_system (line 4) | def solve_linear_system(matrix: np.ndarray) -> np.ndarray:

FILE: linear_algebra/src/lib.py
  class Vector (line 30) | class Vector:
    method __init__ (line 51) | def __init__(self, components: Collection[float] | None = None) -> None:
    method __len__ (line 60) | def __len__(self) -> int:
    method __str__ (line 66) | def __str__(self) -> str:
    method __add__ (line 72) | def __add__(self, other: Vector) -> Vector:
    method __sub__ (line 85) | def __sub__(self, other: Vector) -> Vector:
    method __eq__ (line 98) | def __eq__(self, other: object) -> bool:
    method __mul__ (line 109) | def __mul__(self, other: float) -> Vector: ...
    method __mul__ (line 112) | def __mul__(self, other: Vector) -> float: ...
    method __mul__ (line 114) | def __mul__(self, other: float | Vector) -> float | Vector:
    method copy (line 129) | def copy(self) -> Vector:
    method component (line 135) | def component(self, i: int) -> float:
    method change_component (line 145) | def change_component(self, pos: int, value: float) -> None:
    method euclidean_length (line 155) | def euclidean_length(self) -> float:
    method angle (line 175) | def angle(self, other: Vector, deg: bool = False) -> float:
  function zero_vector (line 196) | def zero_vector(dimension: int) -> Vector:
  function unit_basis_vector (line 205) | def unit_basis_vector(dimension: int, pos: int) -> Vector:
  function axpy (line 218) | def axpy(scalar: float, x: Vector, y: Vector) -> Vector:
  function random_vector (line 231) | def random_vector(n: int, a: int, b: int) -> Vector:
  class Matrix (line 243) | class Matrix:
    method __init__ (line 265) | def __init__(self, matrix: list[list[float]], w: int, h: int) -> None:
    method __str__ (line 273) | def __str__(self) -> str:
    method __add__ (line 287) | def __add__(self, other: Matrix) -> Matrix:
    method __sub__ (line 303) | def __sub__(self, other: Matrix) -> Matrix:
    method __mul__ (line 320) | def __mul__(self, other: float) -> Matrix: ...
    method __mul__ (line 323) | def __mul__(self, other: Vector) -> Vector: ...
    method __mul__ (line 325) | def __mul__(self, other: float | Vector) -> Vector | Matrix:
    method height (line 353) | def height(self) -> int:
    method width (line 359) | def width(self) -> int:
    method component (line 365) | def component(self, x: int, y: int) -> float:
    method change_component (line 374) | def change_component(self, x: int, y: int, value: float) -> None:
    method minor (line 383) | def minor(self, x: int, y: int) -> float:
    method cofactor (line 394) | def cofactor(self, x: int, y: int) -> float:
    method determinant (line 405) | def determinant(self) -> float:
  function square_zero_matrix (line 427) | def square_zero_matrix(n: int) -> Matrix:
  function random_matrix (line 435) | def random_matrix(width: int, height: int, a: int, b: int) -> Matrix:

FILE: linear_algebra/src/polynom_for_points.py
  function points_to_polynomial (line 1) | def points_to_polynomial(coordinates: list[list[int]]) -> str:

FILE: linear_algebra/src/power_iteration.py
  function power_iteration (line 4) | def power_iteration(
  function test_power_iteration (line 84) | def test_power_iteration() -> None:

FILE: linear_algebra/src/rank_of_matrix.py
  function rank_of_matrix (line 8) | def rank_of_matrix(matrix: list[list[int | float]]) -> int:

FILE: linear_algebra/src/rayleigh_quotient.py
  function is_hermitian (line 10) | def is_hermitian(matrix: np.ndarray) -> bool:
  function rayleigh_quotient (line 30) | def rayleigh_quotient(a: np.ndarray, v: np.ndarray) -> Any:
  function tests (line 54) | def tests() -> None:

FILE: linear_algebra/src/schur_complement.py
  function schur_complement (line 7) | def schur_complement(
  class TestSchurComplement (line 61) | class TestSchurComplement(unittest.TestCase):
    method test_schur_complement (line 62) | def test_schur_complement(self) -> None:
    method test_improper_a_b_dimensions (line 77) | def test_improper_a_b_dimensions(self) -> None:
    method test_improper_b_c_dimensions (line 85) | def test_improper_b_c_dimensions(self) -> None:

FILE: linear_algebra/src/test_linear_algebra.py
  class Test (line 24) | class Test(unittest.TestCase):
    method test_component (line 25) | def test_component(self) -> None:
    method test_str (line 34) | def test_str(self) -> None:
    method test_size (line 41) | def test_size(self) -> None:
    method test_euclidean_length (line 48) | def test_euclidean_length(self) -> None:
    method test_add (line 61) | def test_add(self) -> None:
    method test_sub (line 71) | def test_sub(self) -> None:
    method test_mul (line 81) | def test_mul(self) -> None:
    method test_zero_vector (line 91) | def test_zero_vector(self) -> None:
    method test_unit_basis_vector (line 97) | def test_unit_basis_vector(self) -> None:
    method test_axpy (line 103) | def test_axpy(self) -> None:
    method test_copy (line 111) | def test_copy(self) -> None:
    method test_change_component (line 119) | def test_change_component(self) -> None:
    method test_str_matrix (line 128) | def test_str_matrix(self) -> None:
    method test_minor (line 135) | def test_minor(self) -> None:
    method test_cofactor (line 145) | def test_cofactor(self) -> None:
    method test_determinant (line 155) | def test_determinant(self) -> None:
    method test__mul__matrix (line 162) | def test__mul__matrix(self) -> None:
    method test_change_component_matrix (line 171) | def test_change_component_matrix(self) -> None:
    method test_component_matrix (line 179) | def test_component_matrix(self) -> None:
    method test__add__matrix (line 186) | def test__add__matrix(self) -> None:
    method test__sub__matrix (line 194) | def test__sub__matrix(self) -> None:
    method test_square_zero_matrix (line 202) | def test_square_zero_matrix(self) -> None:

FILE: linear_algebra/src/transformations_2d.py
  function scaling (line 20) | def scaling(scaling_factor: float) -> list[list[float]]:
  function rotation (line 29) | def rotation(angle: float) -> list[list[float]]:
  function projection (line 39) | def projection(angle: float) -> list[list[float]]:
  function reflection (line 50) | def reflection(angle: float) -> list[list[float]]:

FILE: linear_programming/simplex.py
  class Tableau (line 21) | class Tableau:
    method __init__ (line 43) | def __init__(
    method generate_col_titles (line 86) | def generate_col_titles(self) -> list[str]:
    method find_pivot (line 108) | def find_pivot(self) -> tuple[Any, Any]:
    method pivot (line 149) | def pivot(self, row_idx: int, col_idx: int) -> np.ndarray:
    method change_stage (line 173) | def change_stage(self) -> np.ndarray:
    method run_simplex (line 210) | def run_simplex(self) -> dict[Any, Any]:
    method interpret_tableau (line 307) | def interpret_tableau(self) -> dict[str, float]:

FILE: machine_learning/apriori_algorithm.py
  function load_data (line 18) | def load_data() -> list[list[str]]:
  function prune (line 28) | def prune(itemset: list, candidates: list, length: int) -> list:
  function apriori (line 65) | def apriori(data: list[list[str]], min_support: int) -> list[tuple[list[...

FILE: machine_learning/astar.py
  class Cell (line 19) | class Cell:
    method __init__ (line 27) | def __init__(self):
    method __eq__ (line 39) | def __eq__(self, cell):
    method showcell (line 42) | def showcell(self):
  class Gridworld (line 46) | class Gridworld:
    method __init__ (line 53) | def __init__(self, world_size=(5, 5)):
    method show (line 58) | def show(self):
    method get_neighbours (line 61) | def get_neighbours(self, cell):
  function astar (line 89) | def astar(world, start, goal):

FILE: machine_learning/automatic_differentiation.py
  class OpType (line 21) | class OpType(Enum):
  class Variable (line 35) | class Variable:
    method __init__ (line 51) | def __init__(self, value: Any) -> None:
    method __repr__ (line 59) | def __repr__(self) -> str:
    method to_ndarray (line 62) | def to_ndarray(self) -> np.ndarray:
    method __add__ (line 65) | def __add__(self, other: Variable) -> Variable:
    method __sub__ (line 74) | def __sub__(self, other: Variable) -> Variable:
    method __mul__ (line 83) | def __mul__(self, other: Variable) -> Variable:
    method __truediv__ (line 92) | def __truediv__(self, other: Variable) -> Variable:
    method __matmul__ (line 101) | def __matmul__(self, other: Variable) -> Variable:
    method __pow__ (line 110) | def __pow__(self, power: int) -> Variable:
    method add_param_to (line 124) | def add_param_to(self, param_to: Operation) -> None:
    method add_result_of (line 127) | def add_result_of(self, result_of: Operation) -> None:
  class Operation (line 131) | class Operation:
    method __init__ (line 138) | def __init__(
    method add_params (line 146) | def add_params(self, params: list[Variable]) -> None:
    method add_output (line 149) | def add_output(self, output: Variable) -> None:
    method __eq__ (line 152) | def __eq__(self, value) -> bool:
  class GradientTracker (line 156) | class GradientTracker:
    method __new__ (line 196) | def __new__(cls) -> Self:
    method __init__ (line 206) | def __init__(self) -> None:
    method __enter__ (line 209) | def __enter__(self) -> Self:
    method __exit__ (line 213) | def __exit__(
    method append (line 221) | def append(
    method gradient (line 247) | def gradient(self, target: Variable, source: Variable) -> np.ndarray |...
    method derivative (line 281) | def derivative(self, param: Variable, operation: Operation) -> np.ndar...

FILE: machine_learning/data_transformations.py
  fun
Condensed preview — 1489 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (9,379K chars).
[
  {
    "path": ".devcontainer/Dockerfile",
    "chars": 372,
    "preview": "# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/README.md\nARG VARIANT=3.13-bookworm\nF"
  },
  {
    "path": ".devcontainer/README.md",
    "chars": 1194,
    "preview": "# Development Container\n\nThis is **Devcontainer** configuration to provide a consistent development environment for all "
  },
  {
    "path": ".devcontainer/devcontainer.json",
    "chars": 1454,
    "preview": "{\n\t\"name\": \"Python 3\",\n\t\"build\": {\n\t\t\"dockerfile\": \"Dockerfile\",\n\t\t\"context\": \"..\",\n\t\t\"args\": {\n\t\t\t// Update 'VARIANT' t"
  },
  {
    "path": ".devcontainer/post_install",
    "chars": 1010,
    "preview": "#!/usr/bin/env bash\n\necho \"Begin post-installation steps...\"\n\nset -e\n\necho \"Installing pre-commit hooks...\"\npre-commit i"
  },
  {
    "path": ".gitattributes",
    "chars": 12,
    "preview": "* text=auto\n"
  },
  {
    "path": ".github/CODEOWNERS",
    "chars": 956,
    "preview": "# This is a comment.\n# Each line is a file pattern followed by one or more owners.\n\n# More details are here: https://hel"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.yml",
    "chars": 1589,
    "preview": "name: Bug report\ndescription: Create a bug report to help us address errors in the repository\nlabels: [bug]\nbody:\n  - ty"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 188,
    "preview": "blank_issues_enabled: false\ncontact_links:\n  - name: Discord community\n    url: https://discord.gg/c7MnfGFGa6\n    about:"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.yml",
    "chars": 715,
    "preview": "name: Feature request\ndescription: Suggest features, propose improvements, discuss new ideas.\nlabels: [enhancement]\nbody"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/other.yml",
    "chars": 543,
    "preview": "name: Other\ndescription: Use this for any other issues. PLEASE do not create blank issues\nlabels: [\"awaiting triage\"]\nbo"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 295,
    "preview": "# Keep GitHub Actions up to date with Dependabot...\n# https://docs.github.com/en/code-security/dependabot/working-with-d"
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 1473,
    "preview": "### Describe your change:\n\n\n\n* [ ] Add an algorithm?\n* [ ] Fix a bug or typo in an existing algorithm?\n* [ ] Add or chan"
  },
  {
    "path": ".github/stale.yml",
    "chars": 2547,
    "preview": "# Configuration for probot-stale - https://github.com/probot/stale\n\n# Number of days of inactivity before an Issue or Pu"
  },
  {
    "path": ".github/workflows/build.yml",
    "chars": 1461,
    "preview": "name: \"build\"\n\non:\n  pull_request:\n  schedule:\n    - cron: \"0 0 * * *\" # Run everyday\n\njobs:\n  build:\n    runs-on: ubunt"
  },
  {
    "path": ".github/workflows/devcontainer_ci.yml",
    "chars": 320,
    "preview": "name: Test DevContainer Build\n\non:\n  push:\n    paths:\n      - \".devcontainer/**\"\n  pull_request:\n    paths:\n      - \".de"
  },
  {
    "path": ".github/workflows/directory_writer.yml",
    "chars": 961,
    "preview": "# The objective of this GitHub Action is to update the DIRECTORY.md file (if needed)\n# when doing a git push\nname: direc"
  },
  {
    "path": ".github/workflows/project_euler.yml",
    "chars": 1845,
    "preview": "on:\n  pull_request:\n    # Run only if a file is changed within the project_euler directory and related files\n    paths:\n"
  },
  {
    "path": ".github/workflows/ruff.yml",
    "chars": 295,
    "preview": "# https://beta.ruff.rs\nname: ruff\non:\n  push:\n    branches:\n      - master\n  pull_request:\n    branches:\n      - master\n"
  },
  {
    "path": ".github/workflows/sphinx.yml",
    "chars": 1746,
    "preview": "name: sphinx\n\non:\n  # Triggers the workflow on push or pull request events but only for the \"master\" branch\n  push:\n    "
  },
  {
    "path": ".gitignore",
    "chars": 1239,
    "preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
  },
  {
    "path": ".gitpod.yml",
    "chars": 52,
    "preview": "tasks:\n  - init: pip3 install -r ./requirements.txt\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "chars": 1543,
    "preview": "ci:\n  autoupdate_schedule: monthly\n\nrepos:\n  - repo: https://github.com/pre-commit/pre-commit-hooks\n    rev: v6.0.0\n    "
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 11429,
    "preview": "# Contributing guidelines\n\n## Before contributing\n\nWelcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Py"
  },
  {
    "path": "DIRECTORY.md",
    "chars": 70341,
    "preview": "\n## Audio Filters\n  * [Butterworth Filter](audio_filters/butterworth_filter.py)\n  * [Iir Filter](audio_filters/iir_filte"
  },
  {
    "path": "LICENSE.md",
    "chars": 1095,
    "preview": "## MIT License\n\nCopyright (c) 2016-2022 TheAlgorithms and contributors\n\nPermission is hereby granted, free of charge, to"
  },
  {
    "path": "README.md",
    "chars": 2792,
    "preview": "<div align=\"center\">\n<!-- Title: -->\n  <a href=\"https://github.com/TheAlgorithms/\">\n    <img src=\"https://raw.githubuser"
  },
  {
    "path": "audio_filters/README.md",
    "chars": 415,
    "preview": "# Audio Filter\n\nAudio filters work on the frequency of an audio signal to attenuate unwanted frequency and amplify wante"
  },
  {
    "path": "audio_filters/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "audio_filters/butterworth_filter.py",
    "chars": 5989,
    "preview": "from math import cos, sin, sqrt, tau\n\nfrom audio_filters.iir_filter import IIRFilter\n\n\"\"\"\nCreate 2nd-order IIR filters w"
  },
  {
    "path": "audio_filters/equal_loudness_filter.py.broken.txt",
    "chars": 2210,
    "preview": "from json import loads\nfrom pathlib import Path\n\nimport numpy as np\nfrom yulewalker import yulewalk\n\nfrom audio_filters."
  },
  {
    "path": "audio_filters/iir_filter.py",
    "chars": 3271,
    "preview": "from __future__ import annotations\n\n\nclass IIRFilter:\n    r\"\"\"\n    N-Order IIR filter\n    Assumes working with float sam"
  },
  {
    "path": "audio_filters/loudness_curve.json",
    "chars": 812,
    "preview": "{\n  \"_comment\": \"The following is a representative average of the Equal Loudness Contours as measured by Robinson and Da"
  },
  {
    "path": "audio_filters/show_response.py",
    "chars": 2477,
    "preview": "from __future__ import annotations\n\nfrom abc import abstractmethod\nfrom math import pi\nfrom typing import Protocol\n\nimpo"
  },
  {
    "path": "backtracking/README.md",
    "chars": 374,
    "preview": "# Backtracking\n\nBacktracking is a way to speed up the search process by removing candidates when they can't be the solut"
  },
  {
    "path": "backtracking/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "backtracking/all_combinations.py",
    "chars": 3481,
    "preview": "\"\"\"\nIn this problem, we want to determine all possible combinations of k\nnumbers out of 1 ... n. We use backtracking to "
  },
  {
    "path": "backtracking/all_permutations.py",
    "chars": 2512,
    "preview": "\"\"\"\nIn this problem, we want to determine all possible permutations\nof the given sequence. We use backtracking to solve "
  },
  {
    "path": "backtracking/all_subsequences.py",
    "chars": 2211,
    "preview": "\"\"\"\nIn this problem, we want to determine all possible subsequences\nof the given sequence. We use backtracking to solve "
  },
  {
    "path": "backtracking/coloring.py",
    "chars": 3450,
    "preview": "\"\"\"\nGraph Coloring also called \"m coloring problem\"\nconsists of coloring a given graph with at most m colors\nsuch that n"
  },
  {
    "path": "backtracking/combination_sum.py",
    "chars": 2270,
    "preview": "\"\"\"\nIn the Combination Sum problem, we are given a list consisting of distinct integers.\nWe need to find all the combina"
  },
  {
    "path": "backtracking/crossword_puzzle_solver.py",
    "chars": 3690,
    "preview": "# https://www.geeksforgeeks.org/solve-crossword-puzzle/\n\n\ndef is_valid(\n    puzzle: list[list[str]], word: str, row: int"
  },
  {
    "path": "backtracking/generate_parentheses.py",
    "chars": 2438,
    "preview": "\"\"\"\nauthor: Aayush Soni\nGiven n pairs of parentheses, write a function to generate all\ncombinations of well-formed paren"
  },
  {
    "path": "backtracking/generate_parentheses_iterative.py",
    "chars": 2164,
    "preview": "def generate_parentheses_iterative(length: int) -> list[str]:\n    \"\"\"\n    Generate all valid combinations of parentheses"
  },
  {
    "path": "backtracking/hamiltonian_cycle.py",
    "chars": 5835,
    "preview": "\"\"\"\nA Hamiltonian cycle (Hamiltonian circuit) is a graph cycle\nthrough a graph that visits each node exactly once.\nDeter"
  },
  {
    "path": "backtracking/knight_tour.py",
    "chars": 2451,
    "preview": "# Knight Tour Intro: https://www.youtube.com/watch?v=ab_dY3dZFHM\n\nfrom __future__ import annotations\n\n\ndef get_valid_pos"
  },
  {
    "path": "backtracking/match_word_pattern.py",
    "chars": 1806,
    "preview": "def match_word_pattern(pattern: str, input_string: str) -> bool:\n    \"\"\"\n    Determine if a given pattern matches a stri"
  },
  {
    "path": "backtracking/minimax.py",
    "chars": 3057,
    "preview": "\"\"\"\nMinimax helps to achieve maximum score in a game by checking all possible moves\ndepth is current depth in game tree."
  },
  {
    "path": "backtracking/n_queens.py",
    "chars": 3293,
    "preview": "\"\"\"\n\nThe nqueens problem is of placing N queens on a N * N\nchess board such that no queen can attack any other queens pl"
  },
  {
    "path": "backtracking/n_queens_math.py",
    "chars": 4927,
    "preview": "r\"\"\"\nProblem:\n\nThe n queens problem is: placing N queens on a N * N chess board such that no queen\ncan attack any other "
  },
  {
    "path": "backtracking/power_sum.py",
    "chars": 2624,
    "preview": "\"\"\"\nProblem source: https://www.hackerrank.com/challenges/the-power-sum/problem\nFind the number of ways that a given int"
  },
  {
    "path": "backtracking/rat_in_maze.py",
    "chars": 6563,
    "preview": "from __future__ import annotations\n\n\ndef solve_maze(\n    maze: list[list[int]],\n    source_row: int,\n    source_column: "
  },
  {
    "path": "backtracking/sudoku.py",
    "chars": 3958,
    "preview": "\"\"\"\nGiven a partially filled 9x9 2D array, the objective is to fill a 9x9\nsquare grid with digits numbered 1 to 9, so th"
  },
  {
    "path": "backtracking/sum_of_subsets.py",
    "chars": 2208,
    "preview": "\"\"\"\nThe sum-of-subsets problem states that a set of non-negative integers, and a\nvalue M, determine all possible subsets"
  },
  {
    "path": "backtracking/word_break.py",
    "chars": 2146,
    "preview": "\"\"\"\nWord Break Problem is a well-known problem in computer science.\nGiven a string and a dictionary of words, the task i"
  },
  {
    "path": "backtracking/word_ladder.py",
    "chars": 3728,
    "preview": "\"\"\"\nWord Ladder is a classic problem in computer science.\nThe problem is to transform a start word into an end word\nby c"
  },
  {
    "path": "backtracking/word_search.py",
    "chars": 4426,
    "preview": "\"\"\"\nAuthor  : Alexander Pantyukhin\nDate    : November 24, 2022\n\nTask:\nGiven an m x n grid of characters board and a stri"
  },
  {
    "path": "bit_manipulation/README.md",
    "chars": 722,
    "preview": "# Bit manipulation\n\nBit manipulation is the act of manipulating bits to detect errors (hamming code), encrypts and decry"
  },
  {
    "path": "bit_manipulation/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "bit_manipulation/binary_and_operator.py",
    "chars": 1410,
    "preview": "# https://www.tutorialspoint.com/python3/bitwise_operators_example.htm\n\n\ndef binary_and(a: int, b: int) -> str:\n    \"\"\"\n"
  },
  {
    "path": "bit_manipulation/binary_coded_decimal.py",
    "chars": 705,
    "preview": "def binary_coded_decimal(number: int) -> str:\n    \"\"\"\n    Find binary coded decimal (bcd) of integer base 10.\n    Each d"
  },
  {
    "path": "bit_manipulation/binary_count_setbits.py",
    "chars": 1110,
    "preview": "def binary_count_setbits(a: int) -> int:\n    \"\"\"\n    Take in 1 integer, return a number that is\n    the number of 1's in"
  },
  {
    "path": "bit_manipulation/binary_count_trailing_zeros.py",
    "chars": 1234,
    "preview": "from math import log2\n\n\ndef binary_count_trailing_zeros(a: int) -> int:\n    \"\"\"\n    Take in 1 integer, return a number t"
  },
  {
    "path": "bit_manipulation/binary_or_operator.py",
    "chars": 1462,
    "preview": "# https://www.tutorialspoint.com/python3/bitwise_operators_example.htm\r\n\r\n\r\ndef binary_or(a: int, b: int) -> str:\r\n    \""
  },
  {
    "path": "bit_manipulation/binary_shifts.py",
    "chars": 3403,
    "preview": "# Information on binary shifts:\n# https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types\n# "
  },
  {
    "path": "bit_manipulation/binary_twos_complement.py",
    "chars": 1121,
    "preview": "# Information on 2's complement: https://en.wikipedia.org/wiki/Two%27s_complement\n\n\ndef twos_complement(number: int) -> "
  },
  {
    "path": "bit_manipulation/binary_xor_operator.py",
    "chars": 1450,
    "preview": "# https://www.tutorialspoint.com/python3/bitwise_operators_example.htm\n\n\ndef binary_xor(a: int, b: int) -> str:\n    \"\"\"\n"
  },
  {
    "path": "bit_manipulation/bitwise_addition_recursive.py",
    "chars": 1594,
    "preview": "\"\"\"\nCalculates the sum of two non-negative integers using bitwise operators\nWikipedia explanation: https://en.wikipedia."
  },
  {
    "path": "bit_manipulation/count_1s_brian_kernighan_method.py",
    "chars": 1286,
    "preview": "def get_1s_count(number: int) -> int:\n    \"\"\"\n    Count the number of set bits in a 32 bit integer using Brian Kernighan"
  },
  {
    "path": "bit_manipulation/count_number_of_one_bits.py",
    "chars": 2832,
    "preview": "from timeit import timeit\n\n\ndef get_set_bits_count_using_brian_kernighans_algorithm(number: int) -> int:\n    \"\"\"\n    Cou"
  },
  {
    "path": "bit_manipulation/excess_3_code.py",
    "chars": 628,
    "preview": "def excess_3_code(number: int) -> str:\n    \"\"\"\n    Find excess-3 code of integer base 10.\n    Add 3 to all digits in a d"
  },
  {
    "path": "bit_manipulation/find_previous_power_of_two.py",
    "chars": 967,
    "preview": "def find_previous_power_of_two(number: int) -> int:\n    \"\"\"\n    Find the largest power of two that is less than or equal"
  },
  {
    "path": "bit_manipulation/find_unique_number.py",
    "chars": 998,
    "preview": "def find_unique_number(arr: list[int]) -> int:\n    \"\"\"\n    Given a list of integers where every element appears twice ex"
  },
  {
    "path": "bit_manipulation/gray_code_sequence.py",
    "chars": 2444,
    "preview": "def gray_code(bit_count: int) -> list:\n    \"\"\"\n    Takes in an integer n and returns a n-bit\n    gray code sequence\n    "
  },
  {
    "path": "bit_manipulation/highest_set_bit.py",
    "chars": 850,
    "preview": "def get_highest_set_bit_position(number: int) -> int:\n    \"\"\"\n    Returns position of the highest set bit of a number.\n "
  },
  {
    "path": "bit_manipulation/index_of_rightmost_set_bit.py",
    "chars": 1483,
    "preview": "# Reference: https://www.geeksforgeeks.org/position-of-rightmost-set-bit/\n\n\ndef get_index_of_rightmost_set_bit(number: i"
  },
  {
    "path": "bit_manipulation/is_even.py",
    "chars": 834,
    "preview": "def is_even(number: int) -> bool:\n    \"\"\"\n    return true if the input integer is even\n    Explanation: Lets take a look"
  },
  {
    "path": "bit_manipulation/is_power_of_two.py",
    "chars": 1310,
    "preview": "\"\"\"\nAuthor  : Alexander Pantyukhin\nDate    : November 1, 2022\n\nTask:\nGiven a positive int number. Return True if this nu"
  },
  {
    "path": "bit_manipulation/largest_pow_of_two_le_num.py",
    "chars": 1332,
    "preview": "\"\"\"\nAuthor  : Naman Sharma\nDate    : October 2, 2023\n\nTask:\nTo Find the largest power of 2 less than or equal to a given"
  },
  {
    "path": "bit_manipulation/missing_number.py",
    "chars": 881,
    "preview": "def find_missing_number(nums: list[int]) -> int:\n    \"\"\"\n    Finds the missing number in a list of consecutive integers."
  },
  {
    "path": "bit_manipulation/numbers_different_signs.py",
    "chars": 856,
    "preview": "\"\"\"\nAuthor  : Alexander Pantyukhin\nDate    : November 30, 2022\n\nTask:\nGiven two int numbers. Return True these numbers h"
  },
  {
    "path": "bit_manipulation/power_of_4.py",
    "chars": 1493,
    "preview": "\"\"\"\n\nTask:\nGiven a positive int number. Return True if this number is power of 4\nor False otherwise.\n\nImplementation not"
  },
  {
    "path": "bit_manipulation/reverse_bits.py",
    "chars": 2328,
    "preview": "def get_reverse_bit_string(number: int) -> str:\n    \"\"\"\n    Return the reverse bit string of a 32 bit integer\n\n    >>> g"
  },
  {
    "path": "bit_manipulation/single_bit_manipulation_operations.py",
    "chars": 2304,
    "preview": "#!/usr/bin/env python3\n\n\"\"\"Provide the functionality to manipulate a single bit.\"\"\"\n\n\ndef set_bit(number: int, position:"
  },
  {
    "path": "bit_manipulation/swap_all_odd_and_even_bits.py",
    "chars": 1893,
    "preview": "def show_bits(before: int, after: int) -> str:\n    \"\"\"\n    >>> print(show_bits(0, 0xFFFF))\n        0: 00000000\n    65535"
  },
  {
    "path": "blockchain/README.md",
    "chars": 3718,
    "preview": "# Blockchain\n\nA Blockchain is a type of **distributed ledger** technology (DLT) that consists of a growing list of recor"
  },
  {
    "path": "blockchain/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "blockchain/diophantine_equation.py",
    "chars": 2741,
    "preview": "from __future__ import annotations\n\nfrom maths.greatest_common_divisor import greatest_common_divisor\n\n\ndef diophantine("
  },
  {
    "path": "boolean_algebra/README.md",
    "chars": 264,
    "preview": "# Boolean Algebra\n\nBoolean algebra is used to do arithmetic with bits of values True (1) or False (0).\nThere are three b"
  },
  {
    "path": "boolean_algebra/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "boolean_algebra/and_gate.py",
    "chars": 1089,
    "preview": "\"\"\"\nAn AND Gate is a logic gate in boolean algebra which results to 1 (True) if all the\ninputs are 1 (True), and 0 (Fals"
  },
  {
    "path": "boolean_algebra/imply_gate.py",
    "chars": 2462,
    "preview": "\"\"\"\nAn IMPLY Gate is a logic gate in boolean algebra which results to 1 if\neither input 1 is 0, or if input 1 is 1, then"
  },
  {
    "path": "boolean_algebra/karnaugh_map_simplification.py",
    "chars": 1369,
    "preview": "\"\"\"\nhttps://en.wikipedia.org/wiki/Karnaugh_map\nhttps://www.allaboutcircuits.com/technical-articles/karnaugh-map-boolean-"
  },
  {
    "path": "boolean_algebra/multiplexer.py",
    "chars": 1224,
    "preview": "def mux(input0: int, input1: int, select: int) -> int:\n    \"\"\"\n    Implement a 2-to-1 Multiplexer.\n\n    :param input0: T"
  },
  {
    "path": "boolean_algebra/nand_gate.py",
    "chars": 952,
    "preview": "\"\"\"\r\nA NAND Gate is a logic gate in boolean algebra which results to 0 (False) if both\r\nthe inputs are 1, and 1 (True) o"
  },
  {
    "path": "boolean_algebra/nimply_gate.py",
    "chars": 965,
    "preview": "\"\"\"\nAn NIMPLY Gate is a logic gate in boolean algebra which results to 0 if\neither input 1 is 0, or if input 1 is 1, the"
  },
  {
    "path": "boolean_algebra/nor_gate.py",
    "chars": 1724,
    "preview": "\"\"\"\nA NOR Gate is a logic gate in boolean algebra which results in false(0) if any of the\ninputs is 1, and True(1) if al"
  },
  {
    "path": "boolean_algebra/not_gate.py",
    "chars": 706,
    "preview": "\"\"\"\r\nA NOT Gate is a logic gate in boolean algebra which results to 0 (False) if the\r\ninput is high, and 1 (True) if the"
  },
  {
    "path": "boolean_algebra/or_gate.py",
    "chars": 887,
    "preview": "\"\"\"\r\nAn OR Gate is a logic gate in boolean algebra which results to 0 (False) if both the\r\ninputs are 0, and 1 (True) ot"
  },
  {
    "path": "boolean_algebra/quine_mc_cluskey.py",
    "chars": 4276,
    "preview": "from __future__ import annotations\n\nfrom collections.abc import Sequence\nfrom typing import Literal\n\n\ndef compare_string"
  },
  {
    "path": "boolean_algebra/xnor_gate.py",
    "chars": 966,
    "preview": "\"\"\"\r\nA XNOR Gate is a logic gate in boolean algebra which results to 0 (False) if both the\r\ninputs are different, and 1 "
  },
  {
    "path": "boolean_algebra/xor_gate.py",
    "chars": 887,
    "preview": "\"\"\"\nA XOR Gate is a logic gate in boolean algebra which results to 1 (True) if only one of\nthe two inputs is 1, and 0 (F"
  },
  {
    "path": "cellular_automata/README.md",
    "chars": 441,
    "preview": "# Cellular Automata\n\nCellular automata are a way to simulate the behavior of \"life\", no matter if it is a robot or cell."
  },
  {
    "path": "cellular_automata/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "cellular_automata/conways_game_of_life.py",
    "chars": 3163,
    "preview": "\"\"\"\nConway's Game of Life implemented in Python.\nhttps://en.wikipedia.org/wiki/Conway%27s_Game_of_Life\n\"\"\"\n\nfrom __futur"
  },
  {
    "path": "cellular_automata/game_of_life.py",
    "chars": 3027,
    "preview": "\"\"\"Conway's Game Of Life, Author Anurag Kumar(mailto:anuragkumarak95@gmail.com)\n\nRequirements:\n  - numpy\n  - random\n  - "
  },
  {
    "path": "cellular_automata/langtons_ant.py",
    "chars": 3430,
    "preview": "\"\"\"\nLangton's ant\n\n@ https://en.wikipedia.org/wiki/Langton%27s_ant\n@ https://upload.wikimedia.org/wikipedia/commons/0/09"
  },
  {
    "path": "cellular_automata/nagel_schrekenberg.py",
    "chars": 5175,
    "preview": "\"\"\"\nSimulate the evolution of a highway with only one road that is a loop.\nThe highway is divided in cells, each cell ca"
  },
  {
    "path": "cellular_automata/one_dimensional.py",
    "chars": 2368,
    "preview": "\"\"\"\nReturn an image of 16 generations of one-dimensional cellular automata based on a given\nruleset number\nhttps://mathw"
  },
  {
    "path": "cellular_automata/wa_tor.py",
    "chars": 20556,
    "preview": "\"\"\"\nWa-Tor algorithm (1984)\n\n| @ https://en.wikipedia.org/wiki/Wa-Tor\n| @ https://beltoforion.de/en/wator/\n| @ https://b"
  },
  {
    "path": "ciphers/README.md",
    "chars": 303,
    "preview": "# Ciphers\n\nCiphers are used to protect data from people that are not allowed to have it. They are everywhere on the inte"
  },
  {
    "path": "ciphers/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "ciphers/a1z26.py",
    "chars": 742,
    "preview": "\"\"\"\nConvert a string of characters to a sequence of numbers\ncorresponding to the character's position in the alphabet.\n\n"
  },
  {
    "path": "ciphers/affine_cipher.py",
    "chars": 3457,
    "preview": "import random\nimport sys\n\nfrom maths.greatest_common_divisor import gcd_by_iterative\n\nfrom . import cryptomath_module as"
  },
  {
    "path": "ciphers/atbash.py",
    "chars": 1448,
    "preview": "\"\"\"https://en.wikipedia.org/wiki/Atbash\"\"\"\n\nimport string\n\n\ndef atbash_slow(sequence: str) -> str:\n    \"\"\"\n    >>> atbas"
  },
  {
    "path": "ciphers/autokey.py",
    "chars": 4750,
    "preview": "\"\"\"\nhttps://en.wikipedia.org/wiki/Autokey_cipher\n\nAn autokey cipher (also known as the autoclave cipher) is a cipher tha"
  },
  {
    "path": "ciphers/baconian_cipher.py",
    "chars": 2136,
    "preview": "\"\"\"\nProgram to encode and decode Baconian or Bacon's Cipher\nWikipedia reference : https://en.wikipedia.org/wiki/Bacon%27"
  },
  {
    "path": "ciphers/base16.py",
    "chars": 2318,
    "preview": "def base16_encode(data: bytes) -> str:\n    \"\"\"\n    Encodes the given bytes into base16.\n\n    >>> base16_encode(b'Hello W"
  },
  {
    "path": "ciphers/base32.py",
    "chars": 1426,
    "preview": "\"\"\"\nBase32 encoding and decoding\n\nhttps://en.wikipedia.org/wiki/Base32\n\"\"\"\n\nB32_CHARSET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234"
  },
  {
    "path": "ciphers/base64_cipher.py",
    "chars": 5036,
    "preview": "B64_CHARSET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"\n\n\ndef base64_encode(data: bytes) -> byt"
  },
  {
    "path": "ciphers/base85.py",
    "chars": 1867,
    "preview": "\"\"\"\nBase85 (Ascii85) encoding and decoding\n\nhttps://en.wikipedia.org/wiki/Ascii85\n\"\"\"\n\n\ndef _base10_to_85(d: int) -> str"
  },
  {
    "path": "ciphers/beaufort_cipher.py",
    "chars": 1940,
    "preview": "\"\"\"\nAuthor: Mohit Radadiya\n\"\"\"\n\nfrom string import ascii_uppercase\n\ndict1 = {char: i for i, char in enumerate(ascii_uppe"
  },
  {
    "path": "ciphers/bifid.py",
    "chars": 3584,
    "preview": "#!/usr/bin/env python3\n\n\"\"\"\nThe Bifid Cipher uses a Polybius Square to encipher a message in a way that\nmakes it fairly "
  },
  {
    "path": "ciphers/brute_force_caesar_cipher.py",
    "chars": 1962,
    "preview": "import string\n\n\ndef decrypt(message: str) -> None:\n    \"\"\"\n    >>> decrypt('TMDETUX PMDVU')\n    Decryption using Key #0:"
  },
  {
    "path": "ciphers/caesar_cipher.py",
    "chars": 7956,
    "preview": "from __future__ import annotations\n\nfrom string import ascii_letters\n\n\ndef encrypt(input_string: str, key: int, alphabet"
  },
  {
    "path": "ciphers/cryptomath_module.py",
    "chars": 432,
    "preview": "from maths.greatest_common_divisor import gcd_by_iterative\n\n\ndef find_mod_inverse(a: int, m: int) -> int:\n    if gcd_by_"
  },
  {
    "path": "ciphers/decrypt_caesar_with_chi_squared.py",
    "chars": 9535,
    "preview": "#!/usr/bin/env python3\nfrom __future__ import annotations\n\n\ndef decrypt_caesar_with_chi_squared(\n    ciphertext: str,\n  "
  },
  {
    "path": "ciphers/deterministic_miller_rabin.py",
    "chars": 4182,
    "preview": "\"\"\"Created by Nathan Damon, @bizzfitch on github\n>>> test_miller_rabin()\n\"\"\"\n\n\ndef miller_rabin(n: int, allow_probable: "
  },
  {
    "path": "ciphers/diffie.py",
    "chars": 1584,
    "preview": "from __future__ import annotations\r\n\r\n\r\ndef find_primitive(modulus: int) -> int | None:\r\n    \"\"\"\r\n    Find a primitive r"
  },
  {
    "path": "ciphers/diffie_hellman.py",
    "chars": 12147,
    "preview": "from binascii import hexlify\nfrom hashlib import sha256\nfrom os import urandom\n\n# RFC 3526 - More Modular Exponential (M"
  },
  {
    "path": "ciphers/elgamal_key_generator.py",
    "chars": 2168,
    "preview": "import os\nimport random\nimport sys\n\nfrom . import cryptomath_module as cryptomath\nfrom . import rabin_miller\n\nmin_primit"
  },
  {
    "path": "ciphers/enigma_machine2.py",
    "chars": 8933,
    "preview": "\"\"\"\n| Wikipedia: https://en.wikipedia.org/wiki/Enigma_machine\n| Video explanation: https://youtu.be/QwQVMqfoB2E\n| Also c"
  },
  {
    "path": "ciphers/fractionated_morse_cipher.py",
    "chars": 4003,
    "preview": "\"\"\"\nPython program for the Fractionated Morse Cipher.\n\nThe Fractionated Morse cipher first converts the plaintext to Mor"
  },
  {
    "path": "ciphers/gronsfeld_cipher.py",
    "chars": 1199,
    "preview": "from string import ascii_uppercase\n\n\ndef gronsfeld(text: str, key: str) -> str:\n    \"\"\"\n    Encrypt plaintext with the G"
  },
  {
    "path": "ciphers/hill_cipher.py",
    "chars": 7301,
    "preview": "\"\"\"\n\nHill Cipher:\nThe 'HillCipher' class below implements the Hill Cipher algorithm which uses\nmodern linear algebra tec"
  },
  {
    "path": "ciphers/mixed_keyword_cypher.py",
    "chars": 2556,
    "preview": "from string import ascii_uppercase\n\n\ndef mixed_keyword(\n    keyword: str, plaintext: str, verbose: bool = False, alphabe"
  },
  {
    "path": "ciphers/mono_alphabetic_ciphers.py",
    "chars": 1772,
    "preview": "from typing import Literal\n\nLETTERS = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\n\ndef translate_message(\n    key: str, message: str, "
  },
  {
    "path": "ciphers/morse_code.py",
    "chars": 1713,
    "preview": "#!/usr/bin/env python3\n\n\"\"\"\nPython program to translate to and from Morse code.\n\nhttps://en.wikipedia.org/wiki/Morse_cod"
  },
  {
    "path": "ciphers/onepad_cipher.py",
    "chars": 1855,
    "preview": "import random\n\n\nclass Onepad:\n    @staticmethod\n    def encrypt(text: str) -> tuple[list[int], list[int]]:\n        \"\"\"\n "
  },
  {
    "path": "ciphers/permutation_cipher.py",
    "chars": 4058,
    "preview": "\"\"\"\nThe permutation cipher, also called the transposition cipher, is a simple encryption\ntechnique that rearranges the c"
  },
  {
    "path": "ciphers/playfair_cipher.py",
    "chars": 4506,
    "preview": "\"\"\"\nhttps://en.wikipedia.org/wiki/Playfair_cipher#Description\n\nThe Playfair cipher was developed by Charles Wheatstone i"
  },
  {
    "path": "ciphers/polybius.py",
    "chars": 3084,
    "preview": "#!/usr/bin/env python3\n\n\"\"\"\nA Polybius Square is a table that allows someone to translate letters into numbers.\n\nhttps:/"
  },
  {
    "path": "ciphers/porta_cipher.py",
    "chars": 3152,
    "preview": "alphabet = {\n    \"A\": (\"ABCDEFGHIJKLM\", \"NOPQRSTUVWXYZ\"),\n    \"B\": (\"ABCDEFGHIJKLM\", \"NOPQRSTUVWXYZ\"),\n    \"C\": (\"ABCDEF"
  },
  {
    "path": "ciphers/prehistoric_men.txt",
    "chars": 336976,
    "preview": "The Project Gutenberg eBook, Prehistoric Men, by Robert J. (Robert John)\nBraidwood, Illustrated by Susan T. Richert\n\n\nTh"
  },
  {
    "path": "ciphers/rabin_miller.py",
    "chars": 3291,
    "preview": "# Primality Testing with the Rabin-Miller Algorithm\n\nimport random\n\n\ndef rabin_miller(num: int) -> bool:\n    s = num - 1"
  },
  {
    "path": "ciphers/rail_fence_cipher.py",
    "chars": 3162,
    "preview": "\"\"\"https://en.wikipedia.org/wiki/Rail_fence_cipher\"\"\"\r\n\r\n\r\ndef encrypt(input_string: str, key: int) -> str:\r\n    \"\"\"\r\n  "
  },
  {
    "path": "ciphers/rot13.py",
    "chars": 841,
    "preview": "def dencrypt(s: str, n: int = 13) -> str:\n    \"\"\"\n    https://en.wikipedia.org/wiki/ROT13\n\n    >>> msg = \"My secret bank"
  },
  {
    "path": "ciphers/rsa_cipher.py",
    "chars": 4873,
    "preview": "import os\nimport sys\n\nfrom . import rsa_key_generator as rkg\n\nDEFAULT_BLOCK_SIZE = 128\nBYTE_SIZE = 256\n\n\ndef get_blocks_"
  },
  {
    "path": "ciphers/rsa_factorization.py",
    "chars": 1696,
    "preview": "\"\"\"\r\nAn RSA prime factor algorithm.\r\n\r\nThe program can efficiently factor RSA prime number given the private key d and\r\n"
  },
  {
    "path": "ciphers/rsa_key_generator.py",
    "chars": 1919,
    "preview": "import os\nimport random\nimport sys\n\nfrom maths.greatest_common_divisor import gcd_by_iterative\n\nfrom . import cryptomath"
  },
  {
    "path": "ciphers/running_key_cipher.py",
    "chars": 2023,
    "preview": "\"\"\"\nhttps://en.wikipedia.org/wiki/Running_key_cipher\n\"\"\"\n\n\ndef running_key_encrypt(key: str, plaintext: str) -> str:\n   "
  },
  {
    "path": "ciphers/shuffled_shift_cipher.py",
    "chars": 6738,
    "preview": "from __future__ import annotations\n\nimport random\nimport string\n\n\nclass ShuffledShiftCipher:\n    \"\"\"\n    This algorithm "
  },
  {
    "path": "ciphers/simple_keyword_cypher.py",
    "chars": 2845,
    "preview": "def remove_duplicates(key: str) -> str:\n    \"\"\"\n    Removes duplicate alphabetic characters in a keyword (letter is igno"
  },
  {
    "path": "ciphers/simple_substitution_cipher.py",
    "chars": 1869,
    "preview": "import random\nimport sys\n\nLETTERS = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\n\ndef main() -> None:\n    message = input(\"Enter messag"
  },
  {
    "path": "ciphers/transposition_cipher.py",
    "chars": 1815,
    "preview": "import math\n\n\"\"\"\nIn cryptography, the TRANSPOSITION cipher is a method of encryption where the\npositions of plaintext ar"
  },
  {
    "path": "ciphers/transposition_cipher_encrypt_decrypt_file.py",
    "chars": 1166,
    "preview": "import os\nimport sys\nimport time\n\nfrom . import transposition_cipher as trans_cipher\n\n\ndef main() -> None:\n    input_fil"
  },
  {
    "path": "ciphers/trifid_cipher.py",
    "chars": 7022,
    "preview": "\"\"\"\r\nThe trifid cipher uses a table to fractionate each plaintext letter into a trigram,\r\nmixes the constituents of the "
  },
  {
    "path": "ciphers/vernam_cipher.py",
    "chars": 1077,
    "preview": "def vernam_encrypt(plaintext: str, key: str) -> str:\n    \"\"\"\n    >>> vernam_encrypt(\"HELLO\",\"KEY\")\n    'RIJVS'\n    \"\"\"\n "
  },
  {
    "path": "ciphers/vigenere_cipher.py",
    "chars": 1781,
    "preview": "LETTERS = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\n\ndef main() -> None:\n    message = input(\"Enter message: \")\n    key = input(\"Ent"
  },
  {
    "path": "ciphers/xor_cipher.py",
    "chars": 6928,
    "preview": "\"\"\"\nauthor: Christian Bender\ndate: 21.12.2017\nclass: XORCipher\n\nThis class implements the XOR-cipher algorithm and provi"
  },
  {
    "path": "computer_vision/README.md",
    "chars": 798,
    "preview": "# Computer Vision\n\nComputer vision is a field of computer science that works on enabling computers to see, identify and "
  },
  {
    "path": "computer_vision/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "computer_vision/cnn_classification.py",
    "chars": 3181,
    "preview": "\"\"\"\nConvolutional Neural Network\n\nObjective : To train a CNN model detect if TB is present in Lung X-ray or not.\n\nResour"
  },
  {
    "path": "computer_vision/flip_augmentation.py",
    "chars": 4324,
    "preview": "import glob\nimport os\nimport random\nfrom string import ascii_lowercase, digits\n\nimport cv2\n\n\"\"\"\nFlip image and bounding "
  },
  {
    "path": "computer_vision/haralick_descriptors.py",
    "chars": 15383,
    "preview": "\"\"\"\nhttps://en.wikipedia.org/wiki/Image_texture\nhttps://en.wikipedia.org/wiki/Co-occurrence_matrix#Application_to_image_"
  },
  {
    "path": "computer_vision/harris_corner.py",
    "chars": 2209,
    "preview": "import cv2\nimport numpy as np\n\n\"\"\"\nHarris Corner Detector\nhttps://en.wikipedia.org/wiki/Harris_Corner_Detector\n\"\"\"\n\n\ncla"
  },
  {
    "path": "computer_vision/horn_schunck.py",
    "chars": 4293,
    "preview": "\"\"\"\nThe Horn-Schunck method estimates the optical flow for every single pixel of\na sequence of images.\nIt works by assum"
  },
  {
    "path": "computer_vision/intensity_based_segmentation.py",
    "chars": 1767,
    "preview": "# Source: \"https://www.ijcse.com/docs/IJCSE11-02-03-117.pdf\"\r\n\r\n# Importing necessary libraries\r\nimport matplotlib.pyplo"
  },
  {
    "path": "computer_vision/mean_threshold.py",
    "chars": 734,
    "preview": "from PIL import Image\n\n\"\"\"\nMean thresholding algorithm for image processing\nhttps://en.wikipedia.org/wiki/Thresholding_("
  },
  {
    "path": "computer_vision/mosaic_augmentation.py",
    "chars": 7068,
    "preview": "\"\"\"Source: https://github.com/jason9075/opencv-mosaic-data-aug\"\"\"\n\nimport glob\nimport os\nimport random\nfrom string impor"
  },
  {
    "path": "computer_vision/pooling_functions.py",
    "chars": 4348,
    "preview": "# Source : https://computersciencewiki.org/index.php/Max-pooling_/_Pooling\n# Importing the libraries\nimport numpy as np\n"
  },
  {
    "path": "conversions/README.md",
    "chars": 295,
    "preview": "# Conversion\n\nConversion programs convert a type of data, a number from a numerical base or unit into one of another typ"
  },
  {
    "path": "conversions/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "conversions/astronomical_length_scale_conversion.py",
    "chars": 3045,
    "preview": "\"\"\"\nConversion of length units.\nAvailable Units:\nMetre, Kilometre, Megametre, Gigametre,\nTerametre, Petametre, Exametre,"
  },
  {
    "path": "conversions/binary_to_decimal.py",
    "chars": 1277,
    "preview": "def bin_to_decimal(bin_string: str) -> int:\n    \"\"\"\n    Convert a binary value to its decimal equivalent\n\n    >>> bin_to"
  },
  {
    "path": "conversions/binary_to_hexadecimal.py",
    "chars": 1700,
    "preview": "BITS_TO_HEX = {\n    \"0000\": \"0\",\n    \"0001\": \"1\",\n    \"0010\": \"2\",\n    \"0011\": \"3\",\n    \"0100\": \"4\",\n    \"0101\": \"5\",\n  "
  },
  {
    "path": "conversions/binary_to_octal.py",
    "chars": 1196,
    "preview": "\"\"\"\nThe function below will convert any binary string to the octal equivalent.\n\n>>> bin_to_octal(\"1111\")\n'17'\n\n>>> bin_t"
  },
  {
    "path": "conversions/convert_number_to_words.py",
    "chars": 5690,
    "preview": "from enum import Enum\nfrom typing import Literal\n\n\nclass NumberingSystem(Enum):\n    SHORT = (\n        (15, \"quadrillion\""
  },
  {
    "path": "conversions/decimal_to_any.py",
    "chars": 3184,
    "preview": "\"\"\"Convert a positive Decimal Number to Any Other Representation\"\"\"\n\nfrom string import ascii_uppercase\n\nALPHABET_VALUES"
  },
  {
    "path": "conversions/decimal_to_binary.py",
    "chars": 3328,
    "preview": "\"\"\"Convert a Decimal Number to a Binary Number.\"\"\"\n\n\ndef decimal_to_binary_iterative(num: int) -> str:\n    \"\"\"\n    Conve"
  },
  {
    "path": "conversions/decimal_to_hexadecimal.py",
    "chars": 1960,
    "preview": "\"\"\"Convert Base 10 (Decimal) Values to Hexadecimal Representations\"\"\"\n\n# set decimal value for each hexadecimal digit\nva"
  },
  {
    "path": "conversions/decimal_to_octal.py",
    "chars": 1211,
    "preview": "\"\"\"Convert a Decimal Number to an Octal Number.\"\"\"\n\nimport math\n\n# Modified from:\n# https://github.com/TheAlgorithms/Jav"
  },
  {
    "path": "conversions/energy_conversions.py",
    "chars": 4292,
    "preview": "\"\"\"\nConversion of energy units.\n\nAvailable units: joule, kilojoule, megajoule, gigajoule,\\\n      wattsecond, watthour, k"
  },
  {
    "path": "conversions/excel_title_to_column.py",
    "chars": 711,
    "preview": "def excel_title_to_column(column_title: str) -> int:\n    \"\"\"\n    Given a string column_title that represents\n    the col"
  },
  {
    "path": "conversions/hex_to_bin.py",
    "chars": 1500,
    "preview": "def hex_to_bin(hex_num: str) -> int:\n    \"\"\"\n    Convert a hexadecimal value to its binary equivalent\n    #https://stack"
  },
  {
    "path": "conversions/hexadecimal_to_decimal.py",
    "chars": 1521,
    "preview": "hex_table = {hex(i)[2:]: i for i in range(16)}  # Use [:2] to strip off the leading '0x'\n\n\ndef hex_to_decimal(hex_string"
  },
  {
    "path": "conversions/ipv4_conversion.py",
    "chars": 2241,
    "preview": "# https://www.geeksforgeeks.org/convert-ip-address-to-integer-and-vice-versa/\n\n\ndef ipv4_to_decimal(ipv4_address: str) -"
  },
  {
    "path": "conversions/length_conversion.py",
    "chars": 4151,
    "preview": "\"\"\"\r\nConversion of length units.\r\nAvailable Units:- Metre,Kilometre,Feet,Inch,Centimeter,Yard,Foot,Mile,Millimeter\r\n\r\nUS"
  },
  {
    "path": "conversions/molecular_chemistry.py",
    "chars": 2685,
    "preview": "\"\"\"\nFunctions useful for doing molecular chemistry:\n* molarity_to_normality\n* moles_to_pressure\n* moles_to_volume\n* pres"
  },
  {
    "path": "conversions/octal_to_binary.py",
    "chars": 1438,
    "preview": "\"\"\"\n* Author: Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)\n* Description: Convert a Octal number to Bi"
  },
  {
    "path": "conversions/octal_to_decimal.py",
    "chars": 2408,
    "preview": "def oct_to_decimal(oct_string: str) -> int:\n    \"\"\"\n    Convert a octal value to its decimal equivalent\n\n    >>> oct_to_"
  },
  {
    "path": "conversions/octal_to_hexadecimal.py",
    "chars": 1626,
    "preview": "def octal_to_hex(octal: str) -> str:\n    \"\"\"\n    Convert an Octal number to Hexadecimal number.\n    For more information"
  },
  {
    "path": "conversions/prefix_conversions.py",
    "chars": 2468,
    "preview": "\"\"\"\nConvert International System of Units (SI) and Binary prefixes\n\"\"\"\n\nfrom __future__ import annotations\n\nfrom enum im"
  },
  {
    "path": "conversions/prefix_conversions_string.py",
    "chars": 3181,
    "preview": "\"\"\"\n* Author: Manuel Di Lullo (https://github.com/manueldilullo)\n* Description: Convert a number to use the correct SI o"
  },
  {
    "path": "conversions/pressure_conversions.py",
    "chars": 2980,
    "preview": "\"\"\"\r\nConversion of pressure units.\r\nAvailable Units:- Pascal,Bar,Kilopascal,Megapascal,psi(pound per square inch),\r\ninHg"
  },
  {
    "path": "conversions/rectangular_to_polar.py",
    "chars": 768,
    "preview": "import math\n\n\ndef rectangular_to_polar(real: float, img: float) -> tuple[float, float]:\n    \"\"\"\n    https://en.wikipedia"
  },
  {
    "path": "conversions/rgb_cmyk_conversion.py",
    "chars": 2073,
    "preview": "def rgb_to_cmyk(r_input: int, g_input: int, b_input: int) -> tuple[int, int, int, int]:\r\n    \"\"\"\r\n    Simple RGB to CMYK"
  },
  {
    "path": "conversions/rgb_hsv_conversion.py",
    "chars": 5789,
    "preview": "\"\"\"\nThe RGB color model is an additive color model in which red, green, and blue light\nare added together in various way"
  },
  {
    "path": "conversions/roman_numerals.py",
    "chars": 1703,
    "preview": "ROMAN = [\r\n    (1000, \"M\"),\r\n    (900, \"CM\"),\r\n    (500, \"D\"),\r\n    (400, \"CD\"),\r\n    (100, \"C\"),\r\n    (90, \"XC\"),\r\n    "
  },
  {
    "path": "conversions/speed_conversions.py",
    "chars": 1770,
    "preview": "\"\"\"\nConvert speed units\n\nhttps://en.wikipedia.org/wiki/Kilometres_per_hour\nhttps://en.wikipedia.org/wiki/Miles_per_hour\n"
  },
  {
    "path": "conversions/temperature_conversions.py",
    "chars": 11615,
    "preview": "\"\"\"Convert between different units of temperature\"\"\"\n\n\ndef celsius_to_fahrenheit(celsius: float, ndigits: int = 2) -> fl"
  }
]

// ... and 1289 more files (download for full content)

About this extraction

This page contains the full source code of the TheAlgorithms/Python GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1489 files (8.4 MB), approximately 2.3M tokens, and a symbol index with 4127 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!