From c6f9dd094d79d4dfb64fcb78994ee2ad2ff75991 Mon Sep 17 00:00:00 2001 From: aymanpopje <76626896+aymanpopje@users.noreply.github.com> Date: Thu, 13 Jun 2024 13:42:11 +0200 Subject: [PATCH 01/27] Added README.md template (see section 3.6 in Assignemnt 1), Renamed the original README.md to README_original.md (Required by Assignemnt 1). --- README.md | 491 +++++++-------------------------------------- README_original.md | 424 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 491 insertions(+), 424 deletions(-) create mode 100644 README_original.md diff --git a/README.md b/README.md index 65caeb5ca..fd8293229 100644 --- a/README.md +++ b/README.md @@ -1,424 +1,67 @@ -[![PyPI version](https://badge.fury.io/py/algorithms.svg)](https://badge.fury.io/py/algorithms) -[![Open Source Helpers](https://www.codetriage.com/keon/algorithms/badges/users.svg)](https://www.codetriage.com/keon/algorithms) -[![Build Status](https://travis-ci.org/keon/algorithms.svg?branch=master)](https://travis-ci.org/keon/algorithms) -[![Coverage Status](https://coveralls.io/repos/github/keon/algorithms/badge.svg?branch=master)](https://coveralls.io/github/keon/algorithms?branch=master) - -

- -Pythonic Data Structures and Algorithms -========================================= - -Minimal and clean example implementations of data structures and algorithms in Python 3. - -## Contributing -Thanks for your interest in contributing! There are many ways to contribute to this project. [Get started here](CONTRIBUTING.md) - -## Tests - -### Use unittest -For running all tests write down: - - $ python3 -m unittest discover tests - -For running some specific tests you can do this as following (Ex: sort): - - $ python3 -m unittest tests.test_sort - -### Use pytest -For running all tests write down: - - $ python3 -m pytest tests - -## Install -If you want to use the API algorithms in your code, it is as simple as: - - $ pip3 install algorithms - -You can test by creating a python file: (Ex: use `merge_sort` in `sort`) - -```python3 -from algorithms.sort import merge_sort - -if __name__ == "__main__": - my_list = [1, 8, 3, 5, 6] - my_list = merge_sort(my_list) - print(my_list) -``` - -## Uninstall -If you want to uninstall algorithms, it is as simple as: - - $ pip3 uninstall -y algorithms - -## List of Implementations - -- [arrays](algorithms/arrays) - - [delete_nth](algorithms/arrays/delete_nth.py) - - [flatten](algorithms/arrays/flatten.py) - - [garage](algorithms/arrays/garage.py) - - [josephus_problem](algorithms/arrays/josephus.py) - - [limit](algorithms/arrays/limit.py) - - [longest_non_repeat](algorithms/arrays/longest_non_repeat.py/) - - [max_ones_index](algorithms/arrays/max_ones_index.py) - - [merge_intervals](algorithms/arrays/merge_intervals.py) - - [missing_ranges](algorithms/arrays/missing_ranges.py) - - [plus_one](algorithms/arrays/plus_one.py) - - [remove_duplicates](algorithms/arrays/remove_duplicates.py) - - [rotate](algorithms/arrays/rotate.py) - - [summarize_ranges](algorithms/arrays/summarize_ranges.py) - - [three_sum](algorithms/arrays/three_sum.py) - - [trimmean](algorithms/arrays/trimmean.py) - - [top_1](algorithms/arrays/top_1.py) - - [two_sum](algorithms/arrays/two_sum.py) - - [move_zeros](algorithms/arrays/move_zeros.py) - - [n_sum](algorithms/arrays/n_sum.py) -- [greedy](algorithms/greedy/) - - [max_contiguous_subsequence_sum](algorithms/greedy/max_contiguous_subsequence_sum.py) -- [automata](algorithms/automata) - - [DFA](algorithms/automata/dfa.py) -- [backtrack](algorithms/backtrack) - - [general_solution.md](algorithms/backtrack/) - - [add_operators](algorithms/backtrack/add_operators.py) - - [anagram](algorithms/backtrack/anagram.py) - - [array_sum_combinations](algorithms/backtrack/array_sum_combinations.py) - - [combination_sum](algorithms/backtrack/combination_sum.py) - - [factor_combinations](algorithms/backtrack/factor_combinations.py) - - [generate_abbreviations](algorithms/backtrack/generate_abbreviations.py) - - [generate_parenthesis](algorithms/backtrack/generate_parenthesis.py) - - [letter_combination](algorithms/backtrack/letter_combination.py) - - [palindrome_partitioning](algorithms/backtrack/palindrome_partitioning.py) - - [pattern_match](algorithms/backtrack/pattern_match.py) - - [permute](algorithms/backtrack/permute.py) - - [permute_unique](algorithms/backtrack/permute_unique.py) - - [subsets](algorithms/backtrack/subsets.py) - - [subsets_unique](algorithms/backtrack/subsets_unique.py) -- [bfs](algorithms/bfs) - - [maze_search](algorithms/bfs/maze_search.py) - - [shortest_distance_from_all_buildings](algorithms/bfs/shortest_distance_from_all_buildings.py) - - [word_ladder](algorithms/bfs/word_ladder.py) -- [bit](algorithms/bit) - - [add_bitwise_operator](algorithms/bit/add_bitwise_operator.py) - - [bit_operation](algorithms/bit/bit_operation.py) - - [bytes_int_conversion](algorithms/bit/bytes_int_conversion.py) - - [count_flips_to_convert](algorithms/bit/count_flips_to_convert.py) - - [count_ones](algorithms/bit/count_ones.py) - - [find_difference](algorithms/bit/find_difference.py) - - [find_missing_number](algorithms/bit/find_missing_number.py) - - [flip_bit_longest_sequence](algorithms/bit/flip_bit_longest_sequence.py) - - [power_of_two](algorithms/bit/power_of_two.py) - - [reverse_bits](algorithms/bit/reverse_bits.py) - - [single_number](algorithms/bit/single_number.py) - - [single_number2](algorithms/bit/single_number2.py) - - [single_number3](algorithms/bit/single_number3.py) - - [subsets](algorithms/bit/subsets.py) - - [swap_pair](algorithms/bit/swap_pair.py) - - [has_alternative_bit](algorithms/bit/has_alternative_bit.py) - - [insert_bit](algorithms/bit/insert_bit.py) - - [remove_bit](algorithms/bit/remove_bit.py) - - [binary_gap](algorithms/bit/binary_gap.py) -- [compression](algorithms/compression) - - [huffman_coding](algorithms/compression/huffman_coding.py) - - [rle_compression](algorithms/compression/rle_compression.py) - - [elias](algorithms/compression/elias.py) -- [dfs](algorithms/dfs) - - [all_factors](algorithms/dfs/all_factors.py) - - [count_islands](algorithms/dfs/count_islands.py) - - [pacific_atlantic](algorithms/dfs/pacific_atlantic.py) - - [sudoku_solver](algorithms/dfs/sudoku_solver.py) - - [walls_and_gates](algorithms/dfs/walls_and_gates.py) -- [distribution](algorithms/distribution) - - [histogram](algorithms/distribution/histogram.py) -- [dp](algorithms/dp) - - [buy_sell_stock](algorithms/dp/buy_sell_stock.py) - - [climbing_stairs](algorithms/dp/climbing_stairs.py) - - [coin_change](algorithms/dp/coin_change.py) - - [combination_sum](algorithms/dp/combination_sum.py) - - [egg_drop](algorithms/dp/egg_drop.py) - - [house_robber](algorithms/dp/house_robber.py) - - [int_divide](algorithms/dp/int_divide.py) - - [job_scheduling](algorithms/dp/job_scheduling.py) - - [knapsack](algorithms/dp/knapsack.py) - - [longest_increasing](algorithms/dp/longest_increasing.py) - - [matrix_chain_order](algorithms/dp/matrix_chain_order.py) - - [max_product_subarray](algorithms/dp/max_product_subarray.py) - - [max_subarray](algorithms/dp/max_subarray.py) - - [min_cost_path](algorithms/dp/min_cost_path.py) - - [num_decodings](algorithms/dp/num_decodings.py) - - [regex_matching](algorithms/dp/regex_matching.py) - - [rod_cut](algorithms/dp/rod_cut.py) - - [word_break](algorithms/dp/word_break.py) - - [fibonacci](algorithms/dp/fib.py) - - [hosoya triangle](algorithms/dp/hosoya_triangle.py) - - [K-Factor_strings](algorithms/dp/k_factor.py) - - [planting_trees](algorithms/dp/planting_trees.py) -- [graph](algorithms/graph) - - [check_bipartite](algorithms/graph/check_bipartite.py) - - [strongly_connected](algorithms/graph/check_digraph_strongly_connected.py) - - [clone_graph](algorithms/graph/clone_graph.py) - - [cycle_detection](algorithms/graph/cycle_detection.py) - - [find_all_cliques](algorithms/graph/find_all_cliques.py) - - [find_path](algorithms/graph/find_path.py) - - [graph](algorithms/graph/graph.py) - - [dijkstra](algorithms/graph/dijkstra.py) - - [markov_chain](algorithms/graph/markov_chain.py) - - [minimum_spanning_tree](algorithms/graph/minimum_spanning_tree.py) - - [satisfiability](algorithms/graph/satisfiability.py) - - [minimum_spanning_tree_prims](algorithms/graph/prims_minimum_spanning.py) - - [tarjan](algorithms/graph/tarjan.py) - - [traversal](algorithms/graph/traversal.py) - - [maximum_flow](algorithms/graph/maximum_flow.py) - - [maximum_flow_bfs](algorithms/graph/maximum_flow_bfs.py) - - [maximum_flow_dfs](algorithms/graph/maximum_flow_dfs.py) - - [all_pairs_shortest_path](algorithms/graph/all_pairs_shortest_path.py) - - [bellman_ford](algorithms/graph/bellman_ford.py) - - [Count Connected Components](algorithms/graph/count_connected_number_of_component.py) -- [heap](algorithms/heap) - - [merge_sorted_k_lists](algorithms/heap/merge_sorted_k_lists.py) - - [skyline](algorithms/heap/skyline.py) - - [sliding_window_max](algorithms/heap/sliding_window_max.py) - - [binary_heap](algorithms/heap/binary_heap.py) - - [k_closest_points](algorithms/heap/k_closest_points.py) -- [linkedlist](algorithms/linkedlist) - - [add_two_numbers](algorithms/linkedlist/add_two_numbers.py) - - [copy_random_pointer](algorithms/linkedlist/copy_random_pointer.py) - - [delete_node](algorithms/linkedlist/delete_node.py) - - [first_cyclic_node](algorithms/linkedlist/first_cyclic_node.py) - - [is_cyclic](algorithms/linkedlist/is_cyclic.py) - - [is_palindrome](algorithms/linkedlist/is_palindrome.py) - - [kth_to_last](algorithms/linkedlist/kth_to_last.py) - - [linkedlist](algorithms/linkedlist/linkedlist.py) - - [remove_duplicates](algorithms/linkedlist/remove_duplicates.py) - - [reverse](algorithms/linkedlist/reverse.py) - - [rotate_list](algorithms/linkedlist/rotate_list.py) - - [swap_in_pairs](algorithms/linkedlist/swap_in_pairs.py) - - [is_sorted](algorithms/linkedlist/is_sorted.py) - - [remove_range](algorithms/linkedlist/remove_range.py) -- [map](algorithms/map) - - [hashtable](algorithms/map/hashtable.py) - - [separate_chaining_hashtable](algorithms/map/separate_chaining_hashtable.py) - - [longest_common_subsequence](algorithms/map/longest_common_subsequence.py) - - [longest_palindromic_subsequence](algorithms/map/longest_palindromic_subsequence.py) - - [randomized_set](algorithms/map/randomized_set.py) - - [valid_sudoku](algorithms/map/valid_sudoku.py) - - [word_pattern](algorithms/map/word_pattern.py) - - [is_isomorphic](algorithms/map/is_isomorphic.py) - - [is_anagram](algorithms/map/is_anagram.py) -- [maths](algorithms/maths) - - [base_conversion](algorithms/maths/base_conversion.py) - - [chinese_remainder_theorem](algorithms/maths/chinese_remainder_theorem.py) - - [combination](algorithms/maths/combination.py) - - [cosine_similarity](algorithms/maths/cosine_similarity.py) - - [decimal_to_binary_ip](algorithms/maths/decimal_to_binary_ip.py) - - [diffie_hellman_key_exchange](algorithms/maths/diffie_hellman_key_exchange.py) - - [euler_totient](algorithms/maths/euler_totient.py) - - [extended_gcd](algorithms/maths/extended_gcd.py) - - [factorial](algorithms/maths/factorial.py) - - [find_order](algorithms/maths/find_order_simple.py) - - [find_primitive_root](algorithms/maths/find_primitive_root_simple.py) - - [gcd/lcm](algorithms/maths/gcd.py) - - [generate_strobogrammtic](algorithms/maths/generate_strobogrammtic.py) - - [hailstone](algorithms/maths/hailstone.py) - - [is_strobogrammatic](algorithms/maths/is_strobogrammatic.py) - - [krishnamurthy_number](algorithms/maths/krishnamurthy_number.py) - - [magic_number](algorithms/maths/magic_number.py) - - [modular_exponential](algorithms/maths/modular_exponential.py) - - [modular_inverse](algorithms/maths/modular_inverse.py) - - [next_bigger](algorithms/maths/next_bigger.py) - - [next_perfect_square](algorithms/maths/next_perfect_square.py) - - [nth_digit](algorithms/maths/nth_digit.py) - - [num_perfect_squares](algorithms/maths/num_perfect_squares.py) - - [polynomial](algorithms/maths/polynomial.py) - - [power](algorithms/maths/power.py) - - [prime_check](algorithms/maths/prime_check.py) - - [primes_sieve_of_eratosthenes](algorithms/maths/primes_sieve_of_eratosthenes.py) - - [pythagoras](algorithms/maths/pythagoras.py) - - [rabin_miller](algorithms/maths/rabin_miller.py) - - [recursive_binomial_coefficient](algorithms/maths/recursive_binomial_coefficient.py) - - [rsa](algorithms/maths/rsa.py) - - [sqrt_precision_factor](algorithms/maths/sqrt_precision_factor.py) - - [summing_digits](algorithms/maths/summing_digits.py) - - [symmetry_group_cycle_index](algorithms/maths/symmetry_group_cycle_index.py) -- [matrix](algorithms/matrix) - - [sudoku_validator](algorithms/matrix/sudoku_validator.py) - - [bomb_enemy](algorithms/matrix/bomb_enemy.py) - - [copy_transform](algorithms/matrix/copy_transform.py) - - [count_paths](algorithms/matrix/count_paths.py) - - [matrix_exponentiation](algorithms/matrix/matrix_exponentiation.py) - - [matrix_inversion](algorithms/matrix/matrix_inversion.py) - - [matrix_multiplication](algorithms/matrix/multiply.py) - - [rotate_image](algorithms/matrix/rotate_image.py) - - [search_in_sorted_matrix](algorithms/matrix/search_in_sorted_matrix.py) - - [sparse_dot_vector](algorithms/matrix/sparse_dot_vector.py) - - [sparse_mul](algorithms/matrix/sparse_mul.py) - - [spiral_traversal](algorithms/matrix/spiral_traversal.py) - - [crout_matrix_decomposition](algorithms/matrix/crout_matrix_decomposition.py) - - [cholesky_matrix_decomposition](algorithms/matrix/cholesky_matrix_decomposition.py) - - [sum_sub_squares](algorithms/matrix/sum_sub_squares.py) - - [sort_matrix_diagonally](algorithms/matrix/sort_matrix_diagonally.py) -- [queues](algorithms/queues) - - [max_sliding_window](algorithms/queues/max_sliding_window.py) - - [moving_average](algorithms/queues/moving_average.py) - - [queue](algorithms/queues/queue.py) - - [reconstruct_queue](algorithms/queues/reconstruct_queue.py) - - [zigzagiterator](algorithms/queues/zigzagiterator.py) -- [search](algorithms/search) - - [binary_search](algorithms/search/binary_search.py) - - [first_occurrence](algorithms/search/first_occurrence.py) - - [last_occurrence](algorithms/search/last_occurrence.py) - - [linear_search](algorithms/search/linear_search.py) - - [search_insert](algorithms/search/search_insert.py) - - [two_sum](algorithms/search/two_sum.py) - - [search_range](algorithms/search/search_range.py) - - [find_min_rotate](algorithms/search/find_min_rotate.py) - - [search_rotate](algorithms/search/search_rotate.py) - - [jump_search](algorithms/search/jump_search.py) - - [next_greatest_letter](algorithms/search/next_greatest_letter.py) - - [interpolation_search](algorithms/search/interpolation_search.py) -- [set](algorithms/set) - - [randomized_set](algorithms/set/randomized_set.py) - - [set_covering](algorithms/set/set_covering.py) - - [find_keyboard_row](algorithms/set/find_keyboard_row.py) -- [sort](algorithms/sort) - - [bitonic_sort](algorithms/sort/bitonic_sort.py) - - [bogo_sort](algorithms/sort/bogo_sort.py) - - [bubble_sort](algorithms/sort/bubble_sort.py) - - [bucket_sort](algorithms/sort/bucket_sort.py) - - [cocktail_shaker_sort](algorithms/sort/cocktail_shaker_sort.py) - - [comb_sort](algorithms/sort/comb_sort.py) - - [counting_sort](algorithms/sort/counting_sort.py) - - [cycle_sort](algorithms/sort/cycle_sort.py) - - [exchange_sort](algorithms/sort/exchange_sort.py) - - [gnome_sort](algorithms/sort/gnome_sort.py) - - [heap_sort](algorithms/sort/heap_sort.py) - - [insertion_sort](algorithms/sort/insertion_sort.py) - - [meeting_rooms](algorithms/sort/meeting_rooms.py) - - [merge_sort](algorithms/sort/merge_sort.py) - - [pancake_sort](algorithms/sort/pancake_sort.py) - - [pigeonhole_sort](algorithms/sort/pigeonhole_sort.py) - - [quick_sort](algorithms/sort/quick_sort.py) - - [radix_sort](algorithms/sort/radix_sort.py) - - [selection_sort](algorithms/sort/selection_sort.py) - - [shell_sort](algorithms/sort/shell_sort.py) - - [sort_colors](algorithms/sort/sort_colors.py) - - [stooge_sort](algorithms/sort/stooge_sort.py) - - [top_sort](algorithms/sort/top_sort.py) - - [wiggle_sort](algorithms/sort/wiggle_sort.py) -- [stack](algorithms/stack) - - [longest_abs_path](algorithms/stack/longest_abs_path.py) - - [simplify_path](algorithms/stack/simplify_path.py) - - [stack](algorithms/stack/stack.py) - - [valid_parenthesis](algorithms/stack/valid_parenthesis.py) - - [stutter](algorithms/stack/stutter.py) - - [switch_pairs](algorithms/stack/switch_pairs.py) - - [is_consecutive](algorithms/stack/is_consecutive.py) - - [remove_min](algorithms/stack/remove_min.py) - - [is_sorted](algorithms/stack/is_sorted.py) -- [streaming](algorithms/streaming) - - [1-sparse-recovery](algorithms/streaming/one_sparse_recovery.py) - - [misra-gries](algorithms/streaming/misra_gries.py) -- [strings](algorithms/strings) - - [fizzbuzz](algorithms/strings/fizzbuzz.py) - - [delete_reoccurring](algorithms/strings/delete_reoccurring.py) - - [strip_url_params](algorithms/strings/strip_url_params.py) - - [validate_coordinates](algorithms/strings/validate_coordinates.py) - - [domain_extractor](algorithms/strings/domain_extractor.py) - - [merge_string_checker](algorithms/strings/merge_string_checker.py) - - [add_binary](algorithms/strings/add_binary.py) - - [breaking_bad](algorithms/strings/breaking_bad.py) - - [decode_string](algorithms/strings/decode_string.py) - - [encode_decode](algorithms/strings/encode_decode.py) - - [group_anagrams](algorithms/strings/group_anagrams.py) - - [int_to_roman](algorithms/strings/int_to_roman.py) - - [is_palindrome](algorithms/strings/is_palindrome.py) - - [license_number](algorithms/strings/license_number.py) - - [make_sentence](algorithms/strings/make_sentence.py) - - [multiply_strings](algorithms/strings/multiply_strings.py) - - [one_edit_distance](algorithms/strings/one_edit_distance.py) - - [rabin_karp](algorithms/strings/rabin_karp.py) - - [reverse_string](algorithms/strings/reverse_string.py) - - [reverse_vowel](algorithms/strings/reverse_vowel.py) - - [reverse_words](algorithms/strings/reverse_words.py) - - [roman_to_int](algorithms/strings/roman_to_int.py) - - [word_squares](algorithms/strings/word_squares.py) - - [unique_morse](algorithms/strings/unique_morse.py) - - [judge_circle](algorithms/strings/judge_circle.py) - - [strong_password](algorithms/strings/strong_password.py) - - [caesar_cipher](algorithms/strings/caesar_cipher.py) - - [check_pangram](algorithms/strings/check_pangram.py) - - [contain_string](algorithms/strings/contain_string.py) - - [count_binary_substring](algorithms/strings/count_binary_substring.py) - - [repeat_string](algorithms/strings/repeat_string.py) - - [min_distance](algorithms/strings/min_distance.py) - - [longest_common_prefix](algorithms/strings/longest_common_prefix.py) - - [rotate](algorithms/strings/rotate.py) - - [first_unique_char](algorithms/strings/first_unique_char.py) - - [repeat_substring](algorithms/strings/repeat_substring.py) - - [atbash_cipher](algorithms/strings/atbash_cipher.py) - - [longest_palindromic_substring](algorithms/strings/longest_palindromic_substring.py) - - [knuth_morris_pratt](algorithms/strings/knuth_morris_pratt.py) - - [panagram](algorithms/strings/panagram.py) -- [tree](algorithms/tree) - - [bst](algorithms/tree/bst) - - [array_to_bst](algorithms/tree/bst/array_to_bst.py) - - [bst_closest_value](algorithms/tree/bst/bst_closest_value.py) - - [BSTIterator](algorithms/tree/bst/BSTIterator.py) - - [delete_node](algorithms/tree/bst/delete_node.py) - - [is_bst](algorithms/tree/bst/is_bst.py) - - [kth_smallest](algorithms/tree/bst/kth_smallest.py) - - [lowest_common_ancestor](algorithms/tree/bst/lowest_common_ancestor.py) - - [predecessor](algorithms/tree/bst/predecessor.py) - - [serialize_deserialize](algorithms/tree/bst/serialize_deserialize.py) - - [successor](algorithms/tree/bst/successor.py) - - [unique_bst](algorithms/tree/bst/unique_bst.py) - - [depth_sum](algorithms/tree/bst/depth_sum.py) - - [count_left_node](algorithms/tree/bst/count_left_node.py) - - [num_empty](algorithms/tree/bst/num_empty.py) - - [height](algorithms/tree/bst/height.py) - - [fenwick_tree](algorithms/tree/fenwick_tree/fenwick_tree.py) - - [red_black_tree](algorithms/tree/red_black_tree) - - [red_black_tree](algorithms/tree/red_black_tree/red_black_tree.py) - - [segment_tree](algorithms/tree/segment_tree) - - [segment_tree](algorithms/tree/segment_tree/segment_tree.py) - - [iterative_segment_tree](algorithms/tree/segment_tree/iterative_segment_tree.py) - - [traversal](algorithms/tree/traversal) - - [inorder](algorithms/tree/traversal/inorder.py) - - [level_order](algorithms/tree/traversal/level_order.py) - - [postorder](algorithms/tree/traversal/postorder.py) - - [preorder](algorithms/tree/traversal/preorder.py) - - [zigzag](algorithms/tree/traversal/zigzag.py) - - [trie](algorithms/tree/trie) - - [add_and_search](algorithms/tree/trie/add_and_search.py) - - [trie](algorithms/tree/trie/trie.py) - - [b_tree](algorithms/tree/b_tree.py) - - [binary_tree_paths](algorithms/tree/binary_tree_paths.py) - - [bin_tree_to_list](algorithms/tree/bin_tree_to_list.py) - - [construct_tree_preorder_postorder](algorithms/tree/construct_tree_postorder_preorder.py) - - [deepest_left](algorithms/tree/deepest_left.py) - - [invert_tree](algorithms/tree/invert_tree.py) - - [is_balanced](algorithms/tree/is_balanced.py) - - [is_subtree](algorithms/tree/is_subtree.py) - - [is_symmetric](algorithms/tree/is_symmetric.py) - - [longest_consecutive](algorithms/tree/longest_consecutive.py) - - [lowest_common_ancestor](algorithms/tree/lowest_common_ancestor.py) - - [max_height](algorithms/tree/max_height.py) - - [max_path_sum](algorithms/tree/max_path_sum.py) - - [min_height](algorithms/tree/min_height.py) - - [path_sum](algorithms/tree/path_sum.py) - - [path_sum2](algorithms/tree/path_sum2.py) - - [pretty_print](algorithms/tree/pretty_print.py) - - [same_tree](algorithms/tree/same_tree.py) - - [tree](algorithms/tree/tree.py) -- [unix](algorithms/unix) - - [path](algorithms/unix/path/) - - [join_with_slash](algorithms/unix/path/join_with_slash.py) - - [full_path](algorithms/unix/path/full_path.py) - - [split](algorithms/unix/path/split.py) - - [simplify_path](algorithms/unix/path/simplify_path.py) -- [unionfind](algorithms/unionfind) - - [count_islands](algorithms/unionfind/count_islands.py) - - -## Contributors - -Thanks to [all the contributors](https://github.com/keon/algorithms/graphs/contributors) -who helped in building the repo. +# Report for Assignment 1 + +## Project chosen + +Name: + +URL: + +Number of lines of code and the tool used to count it: + +Programming language: + +## Coverage measurement + +### Existing tool + + + + + +### Your own coverage tool + + + + + + + + + + + + + + + +## Coverage improvement + +### Individual tests + + + + + + + + + + + + + + + + + + + +### Overall + + + + + +## Statement of individual contributions + + diff --git a/README_original.md b/README_original.md new file mode 100644 index 000000000..25bf3bc03 --- /dev/null +++ b/README_original.md @@ -0,0 +1,424 @@ +[![PyPI version](https://badge.fury.io/py/algorithms.svg)](https://badge.fury.io/py/algorithms) +[![Open Source Helpers](https://www.codetriage.com/keon/algorithms/badges/users.svg)](https://www.codetriage.com/keon/algorithms) +[![Build Status](https://travis-ci.org/keon/algorithms.svg?branch=master)](https://travis-ci.org/keon/algorithms) +[![Coverage Status](https://coveralls.io/repos/github/keon/algorithms/badge.svg?branch=master)](https://coveralls.io/github/keon/algorithms?branch=master) + +

+ +Pythonic Data Structures and Algorithms +========================================= + +Minimal and clean example implementations of data structures and algorithms in Python 3. + +## Contributing +Thanks for your interest in contributing! There are many ways to contribute to this project. [Get started here](CONTRIBUTING.md) + +## Tests + +### Use unittest +For running all tests write down: + + $ python3 -m unittest discover tests + +For running some specific tests you can do this as following (Ex: sort): + + $ python3 -m unittest tests.test_sort + +### Use pytest +For running all tests write down: + + $ python3 -m pytest tests + +## Install +If you want to use the API algorithms in your code, it is as simple as: + + $ pip3 install algorithms + +You can test by creating a python file: (Ex: use `merge_sort` in `sort`) + +```python3 +from algorithms.sort import merge_sort + +if __name__ == "__main__": + my_list = [1, 8, 3, 5, 6] + my_list = merge_sort(my_list) + print(my_list) +``` + +## Uninstall +If you want to uninstall algorithms, it is as simple as: + + $ pip3 uninstall -y algorithms + +## List of Implementations + +- [arrays](algorithms/arrays) + - [delete_nth](algorithms/arrays/delete_nth.py) + - [flatten](algorithms/arrays/flatten.py) + - [garage](algorithms/arrays/garage.py) + - [josephus_problem](algorithms/arrays/josephus.py) + - [limit](algorithms/arrays/limit.py) + - [longest_non_repeat](algorithms/arrays/longest_non_repeat.py/) + - [max_ones_index](algorithms/arrays/max_ones_index.py) + - [merge_intervals](algorithms/arrays/merge_intervals.py) + - [missing_ranges](algorithms/arrays/missing_ranges.py) + - [plus_one](algorithms/arrays/plus_one.py) + - [remove_duplicates](algorithms/arrays/remove_duplicates.py) + - [rotate](algorithms/arrays/rotate.py) + - [summarize_ranges](algorithms/arrays/summarize_ranges.py) + - [three_sum](algorithms/arrays/three_sum.py) + - [trimmean](algorithms/arrays/trimmean.py) + - [top_1](algorithms/arrays/top_1.py) + - [two_sum](algorithms/arrays/two_sum.py) + - [move_zeros](algorithms/arrays/move_zeros.py) + - [n_sum](algorithms/arrays/n_sum.py) +- [greedy](algorithms/greedy/) + - [max_contiguous_subsequence_sum](algorithms/greedy/max_contiguous_subsequence_sum.py) +- [automata](algorithms/automata) + - [DFA](algorithms/automata/dfa.py) +- [backtrack](algorithms/backtrack) + - [general_solution.md](algorithms/backtrack/) + - [add_operators](algorithms/backtrack/add_operators.py) + - [anagram](algorithms/backtrack/anagram.py) + - [array_sum_combinations](algorithms/backtrack/array_sum_combinations.py) + - [combination_sum](algorithms/backtrack/combination_sum.py) + - [factor_combinations](algorithms/backtrack/factor_combinations.py) + - [generate_abbreviations](algorithms/backtrack/generate_abbreviations.py) + - [generate_parenthesis](algorithms/backtrack/generate_parenthesis.py) + - [letter_combination](algorithms/backtrack/letter_combination.py) + - [palindrome_partitioning](algorithms/backtrack/palindrome_partitioning.py) + - [pattern_match](algorithms/backtrack/pattern_match.py) + - [permute](algorithms/backtrack/permute.py) + - [permute_unique](algorithms/backtrack/permute_unique.py) + - [subsets](algorithms/backtrack/subsets.py) + - [subsets_unique](algorithms/backtrack/subsets_unique.py) +- [bfs](algorithms/bfs) + - [maze_search](algorithms/bfs/maze_search.py) + - [shortest_distance_from_all_buildings](algorithms/bfs/shortest_distance_from_all_buildings.py) + - [word_ladder](algorithms/bfs/word_ladder.py) +- [bit](algorithms/bit) + - [add_bitwise_operator](algorithms/bit/add_bitwise_operator.py) + - [bit_operation](algorithms/bit/bit_operation.py) + - [bytes_int_conversion](algorithms/bit/bytes_int_conversion.py) + - [count_flips_to_convert](algorithms/bit/count_flips_to_convert.py) + - [count_ones](algorithms/bit/count_ones.py) + - [find_difference](algorithms/bit/find_difference.py) + - [find_missing_number](algorithms/bit/find_missing_number.py) + - [flip_bit_longest_sequence](algorithms/bit/flip_bit_longest_sequence.py) + - [power_of_two](algorithms/bit/power_of_two.py) + - [reverse_bits](algorithms/bit/reverse_bits.py) + - [single_number](algorithms/bit/single_number.py) + - [single_number2](algorithms/bit/single_number2.py) + - [single_number3](algorithms/bit/single_number3.py) + - [subsets](algorithms/bit/subsets.py) + - [swap_pair](algorithms/bit/swap_pair.py) + - [has_alternative_bit](algorithms/bit/has_alternative_bit.py) + - [insert_bit](algorithms/bit/insert_bit.py) + - [remove_bit](algorithms/bit/remove_bit.py) + - [binary_gap](algorithms/bit/binary_gap.py) +- [compression](algorithms/compression) + - [huffman_coding](algorithms/compression/huffman_coding.py) + - [rle_compression](algorithms/compression/rle_compression.py) + - [elias](algorithms/compression/elias.py) +- [dfs](algorithms/dfs) + - [all_factors](algorithms/dfs/all_factors.py) + - [count_islands](algorithms/dfs/count_islands.py) + - [pacific_atlantic](algorithms/dfs/pacific_atlantic.py) + - [sudoku_solver](algorithms/dfs/sudoku_solver.py) + - [walls_and_gates](algorithms/dfs/walls_and_gates.py) +- [distribution](algorithms/distribution) + - [histogram](algorithms/distribution/histogram.py) +- [dp](algorithms/dp) + - [buy_sell_stock](algorithms/dp/buy_sell_stock.py) + - [climbing_stairs](algorithms/dp/climbing_stairs.py) + - [coin_change](algorithms/dp/coin_change.py) + - [combination_sum](algorithms/dp/combination_sum.py) + - [egg_drop](algorithms/dp/egg_drop.py) + - [house_robber](algorithms/dp/house_robber.py) + - [int_divide](algorithms/dp/int_divide.py) + - [job_scheduling](algorithms/dp/job_scheduling.py) + - [knapsack](algorithms/dp/knapsack.py) + - [longest_increasing](algorithms/dp/longest_increasing.py) + - [matrix_chain_order](algorithms/dp/matrix_chain_order.py) + - [max_product_subarray](algorithms/dp/max_product_subarray.py) + - [max_subarray](algorithms/dp/max_subarray.py) + - [min_cost_path](algorithms/dp/min_cost_path.py) + - [num_decodings](algorithms/dp/num_decodings.py) + - [regex_matching](algorithms/dp/regex_matching.py) + - [rod_cut](algorithms/dp/rod_cut.py) + - [word_break](algorithms/dp/word_break.py) + - [fibonacci](algorithms/dp/fib.py) + - [hosoya triangle](algorithms/dp/hosoya_triangle.py) + - [K-Factor_strings](algorithms/dp/k_factor.py) + - [planting_trees](algorithms/dp/planting_trees.py) +- [graph](algorithms/graph) + - [check_bipartite](algorithms/graph/check_bipartite.py) + - [strongly_connected](algorithms/graph/check_digraph_strongly_connected.py) + - [clone_graph](algorithms/graph/clone_graph.py) + - [cycle_detection](algorithms/graph/cycle_detection.py) + - [find_all_cliques](algorithms/graph/find_all_cliques.py) + - [find_path](algorithms/graph/find_path.py) + - [graph](algorithms/graph/graph.py) + - [dijkstra](algorithms/graph/dijkstra.py) + - [markov_chain](algorithms/graph/markov_chain.py) + - [minimum_spanning_tree](algorithms/graph/minimum_spanning_tree.py) + - [satisfiability](algorithms/graph/satisfiability.py) + - [minimum_spanning_tree_prims](algorithms/graph/prims_minimum_spanning.py) + - [tarjan](algorithms/graph/tarjan.py) + - [traversal](algorithms/graph/traversal.py) + - [maximum_flow](algorithms/graph/maximum_flow.py) + - [maximum_flow_bfs](algorithms/graph/maximum_flow_bfs.py) + - [maximum_flow_dfs](algorithms/graph/maximum_flow_dfs.py) + - [all_pairs_shortest_path](algorithms/graph/all_pairs_shortest_path.py) + - [bellman_ford](algorithms/graph/bellman_ford.py) + - [Count Connected Components](algorithms/graph/count_connected_number_of_component.py) +- [heap](algorithms/heap) + - [merge_sorted_k_lists](algorithms/heap/merge_sorted_k_lists.py) + - [skyline](algorithms/heap/skyline.py) + - [sliding_window_max](algorithms/heap/sliding_window_max.py) + - [binary_heap](algorithms/heap/binary_heap.py) + - [k_closest_points](algorithms/heap/k_closest_points.py) +- [linkedlist](algorithms/linkedlist) + - [add_two_numbers](algorithms/linkedlist/add_two_numbers.py) + - [copy_random_pointer](algorithms/linkedlist/copy_random_pointer.py) + - [delete_node](algorithms/linkedlist/delete_node.py) + - [first_cyclic_node](algorithms/linkedlist/first_cyclic_node.py) + - [is_cyclic](algorithms/linkedlist/is_cyclic.py) + - [is_palindrome](algorithms/linkedlist/is_palindrome.py) + - [kth_to_last](algorithms/linkedlist/kth_to_last.py) + - [linkedlist](algorithms/linkedlist/linkedlist.py) + - [remove_duplicates](algorithms/linkedlist/remove_duplicates.py) + - [reverse](algorithms/linkedlist/reverse.py) + - [rotate_list](algorithms/linkedlist/rotate_list.py) + - [swap_in_pairs](algorithms/linkedlist/swap_in_pairs.py) + - [is_sorted](algorithms/linkedlist/is_sorted.py) + - [remove_range](algorithms/linkedlist/remove_range.py) +- [map](algorithms/map) + - [hashtable](algorithms/map/hashtable.py) + - [separate_chaining_hashtable](algorithms/map/separate_chaining_hashtable.py) + - [longest_common_subsequence](algorithms/map/longest_common_subsequence.py) + - [longest_palindromic_subsequence](algorithms/map/longest_palindromic_subsequence.py) + - [randomized_set](algorithms/map/randomized_set.py) + - [valid_sudoku](algorithms/map/valid_sudoku.py) + - [word_pattern](algorithms/map/word_pattern.py) + - [is_isomorphic](algorithms/map/is_isomorphic.py) + - [is_anagram](algorithms/map/is_anagram.py) +- [maths](algorithms/maths) + - [base_conversion](algorithms/maths/base_conversion.py) + - [chinese_remainder_theorem](algorithms/maths/chinese_remainder_theorem.py) + - [combination](algorithms/maths/combination.py) + - [cosine_similarity](algorithms/maths/cosine_similarity.py) + - [decimal_to_binary_ip](algorithms/maths/decimal_to_binary_ip.py) + - [diffie_hellman_key_exchange](algorithms/maths/diffie_hellman_key_exchange.py) + - [euler_totient](algorithms/maths/euler_totient.py) + - [extended_gcd](algorithms/maths/extended_gcd.py) + - [factorial](algorithms/maths/factorial.py) + - [find_order](algorithms/maths/find_order_simple.py) + - [find_primitive_root](algorithms/maths/find_primitive_root_simple.py) + - [gcd/lcm](algorithms/maths/gcd.py) + - [generate_strobogrammtic](algorithms/maths/generate_strobogrammtic.py) + - [hailstone](algorithms/maths/hailstone.py) + - [is_strobogrammatic](algorithms/maths/is_strobogrammatic.py) + - [krishnamurthy_number](algorithms/maths/krishnamurthy_number.py) + - [magic_number](algorithms/maths/magic_number.py) + - [modular_exponential](algorithms/maths/modular_exponential.py) + - [modular_inverse](algorithms/maths/modular_inverse.py) + - [next_bigger](algorithms/maths/next_bigger.py) + - [next_perfect_square](algorithms/maths/next_perfect_square.py) + - [nth_digit](algorithms/maths/nth_digit.py) + - [num_perfect_squares](algorithms/maths/num_perfect_squares.py) + - [polynomial](algorithms/maths/polynomial.py) + - [power](algorithms/maths/power.py) + - [prime_check](algorithms/maths/prime_check.py) + - [primes_sieve_of_eratosthenes](algorithms/maths/primes_sieve_of_eratosthenes.py) + - [pythagoras](algorithms/maths/pythagoras.py) + - [rabin_miller](algorithms/maths/rabin_miller.py) + - [recursive_binomial_coefficient](algorithms/maths/recursive_binomial_coefficient.py) + - [rsa](algorithms/maths/rsa.py) + - [sqrt_precision_factor](algorithms/maths/sqrt_precision_factor.py) + - [summing_digits](algorithms/maths/summing_digits.py) + - [symmetry_group_cycle_index](algorithms/maths/symmetry_group_cycle_index.py) +- [matrix](algorithms/matrix) + - [sudoku_validator](algorithms/matrix/sudoku_validator.py) + - [bomb_enemy](algorithms/matrix/bomb_enemy.py) + - [copy_transform](algorithms/matrix/copy_transform.py) + - [count_paths](algorithms/matrix/count_paths.py) + - [matrix_exponentiation](algorithms/matrix/matrix_exponentiation.py) + - [matrix_inversion](algorithms/matrix/matrix_inversion.py) + - [matrix_multiplication](algorithms/matrix/multiply.py) + - [rotate_image](algorithms/matrix/rotate_image.py) + - [search_in_sorted_matrix](algorithms/matrix/search_in_sorted_matrix.py) + - [sparse_dot_vector](algorithms/matrix/sparse_dot_vector.py) + - [sparse_mul](algorithms/matrix/sparse_mul.py) + - [spiral_traversal](algorithms/matrix/spiral_traversal.py) + - [crout_matrix_decomposition](algorithms/matrix/crout_matrix_decomposition.py) + - [cholesky_matrix_decomposition](algorithms/matrix/cholesky_matrix_decomposition.py) + - [sum_sub_squares](algorithms/matrix/sum_sub_squares.py) + - [sort_matrix_diagonally](algorithms/matrix/sort_matrix_diagonally.py) +- [queues](algorithms/queues) + - [max_sliding_window](algorithms/queues/max_sliding_window.py) + - [moving_average](algorithms/queues/moving_average.py) + - [queue](algorithms/queues/queue.py) + - [reconstruct_queue](algorithms/queues/reconstruct_queue.py) + - [zigzagiterator](algorithms/queues/zigzagiterator.py) +- [search](algorithms/search) + - [binary_search](algorithms/search/binary_search.py) + - [first_occurrence](algorithms/search/first_occurrence.py) + - [last_occurrence](algorithms/search/last_occurrence.py) + - [linear_search](algorithms/search/linear_search.py) + - [search_insert](algorithms/search/search_insert.py) + - [two_sum](algorithms/search/two_sum.py) + - [search_range](algorithms/search/search_range.py) + - [find_min_rotate](algorithms/search/find_min_rotate.py) + - [search_rotate](algorithms/search/search_rotate.py) + - [jump_search](algorithms/search/jump_search.py) + - [next_greatest_letter](algorithms/search/next_greatest_letter.py) + - [interpolation_search](algorithms/search/interpolation_search.py) +- [set](algorithms/set) + - [randomized_set](algorithms/set/randomized_set.py) + - [set_covering](algorithms/set/set_covering.py) + - [find_keyboard_row](algorithms/set/find_keyboard_row.py) +- [sort](algorithms/sort) + - [bitonic_sort](algorithms/sort/bitonic_sort.py) + - [bogo_sort](algorithms/sort/bogo_sort.py) + - [bubble_sort](algorithms/sort/bubble_sort.py) + - [bucket_sort](algorithms/sort/bucket_sort.py) + - [cocktail_shaker_sort](algorithms/sort/cocktail_shaker_sort.py) + - [comb_sort](algorithms/sort/comb_sort.py) + - [counting_sort](algorithms/sort/counting_sort.py) + - [cycle_sort](algorithms/sort/cycle_sort.py) + - [exchange_sort](algorithms/sort/exchange_sort.py) + - [gnome_sort](algorithms/sort/gnome_sort.py) + - [heap_sort](algorithms/sort/heap_sort.py) + - [insertion_sort](algorithms/sort/insertion_sort.py) + - [meeting_rooms](algorithms/sort/meeting_rooms.py) + - [merge_sort](algorithms/sort/merge_sort.py) + - [pancake_sort](algorithms/sort/pancake_sort.py) + - [pigeonhole_sort](algorithms/sort/pigeonhole_sort.py) + - [quick_sort](algorithms/sort/quick_sort.py) + - [radix_sort](algorithms/sort/radix_sort.py) + - [selection_sort](algorithms/sort/selection_sort.py) + - [shell_sort](algorithms/sort/shell_sort.py) + - [sort_colors](algorithms/sort/sort_colors.py) + - [stooge_sort](algorithms/sort/stooge_sort.py) + - [top_sort](algorithms/sort/top_sort.py) + - [wiggle_sort](algorithms/sort/wiggle_sort.py) +- [stack](algorithms/stack) + - [longest_abs_path](algorithms/stack/longest_abs_path.py) + - [simplify_path](algorithms/stack/simplify_path.py) + - [stack](algorithms/stack/stack.py) + - [valid_parenthesis](algorithms/stack/valid_parenthesis.py) + - [stutter](algorithms/stack/stutter.py) + - [switch_pairs](algorithms/stack/switch_pairs.py) + - [is_consecutive](algorithms/stack/is_consecutive.py) + - [remove_min](algorithms/stack/remove_min.py) + - [is_sorted](algorithms/stack/is_sorted.py) +- [streaming](algorithms/streaming) + - [1-sparse-recovery](algorithms/streaming/one_sparse_recovery.py) + - [misra-gries](algorithms/streaming/misra_gries.py) +- [strings](algorithms/strings) + - [fizzbuzz](algorithms/strings/fizzbuzz.py) + - [delete_reoccurring](algorithms/strings/delete_reoccurring.py) + - [strip_url_params](algorithms/strings/strip_url_params.py) + - [validate_coordinates](algorithms/strings/validate_coordinates.py) + - [domain_extractor](algorithms/strings/domain_extractor.py) + - [merge_string_checker](algorithms/strings/merge_string_checker.py) + - [add_binary](algorithms/strings/add_binary.py) + - [breaking_bad](algorithms/strings/breaking_bad.py) + - [decode_string](algorithms/strings/decode_string.py) + - [encode_decode](algorithms/strings/encode_decode.py) + - [group_anagrams](algorithms/strings/group_anagrams.py) + - [int_to_roman](algorithms/strings/int_to_roman.py) + - [is_palindrome](algorithms/strings/is_palindrome.py) + - [license_number](algorithms/strings/license_number.py) + - [make_sentence](algorithms/strings/make_sentence.py) + - [multiply_strings](algorithms/strings/multiply_strings.py) + - [one_edit_distance](algorithms/strings/one_edit_distance.py) + - [rabin_karp](algorithms/strings/rabin_karp.py) + - [reverse_string](algorithms/strings/reverse_string.py) + - [reverse_vowel](algorithms/strings/reverse_vowel.py) + - [reverse_words](algorithms/strings/reverse_words.py) + - [roman_to_int](algorithms/strings/roman_to_int.py) + - [word_squares](algorithms/strings/word_squares.py) + - [unique_morse](algorithms/strings/unique_morse.py) + - [judge_circle](algorithms/strings/judge_circle.py) + - [strong_password](algorithms/strings/strong_password.py) + - [caesar_cipher](algorithms/strings/caesar_cipher.py) + - [check_pangram](algorithms/strings/check_pangram.py) + - [contain_string](algorithms/strings/contain_string.py) + - [count_binary_substring](algorithms/strings/count_binary_substring.py) + - [repeat_string](algorithms/strings/repeat_string.py) + - [min_distance](algorithms/strings/min_distance.py) + - [longest_common_prefix](algorithms/strings/longest_common_prefix.py) + - [rotate](algorithms/strings/rotate.py) + - [first_unique_char](algorithms/strings/first_unique_char.py) + - [repeat_substring](algorithms/strings/repeat_substring.py) + - [atbash_cipher](algorithms/strings/atbash_cipher.py) + - [longest_palindromic_substring](algorithms/strings/longest_palindromic_substring.py) + - [knuth_morris_pratt](algorithms/strings/knuth_morris_pratt.py) + - [panagram](algorithms/strings/panagram.py) +- [tree](algorithms/tree) + - [bst](algorithms/tree/bst) + - [array_to_bst](algorithms/tree/bst/array_to_bst.py) + - [bst_closest_value](algorithms/tree/bst/bst_closest_value.py) + - [BSTIterator](algorithms/tree/bst/BSTIterator.py) + - [delete_node](algorithms/tree/bst/delete_node.py) + - [is_bst](algorithms/tree/bst/is_bst.py) + - [kth_smallest](algorithms/tree/bst/kth_smallest.py) + - [lowest_common_ancestor](algorithms/tree/bst/lowest_common_ancestor.py) + - [predecessor](algorithms/tree/bst/predecessor.py) + - [serialize_deserialize](algorithms/tree/bst/serialize_deserialize.py) + - [successor](algorithms/tree/bst/successor.py) + - [unique_bst](algorithms/tree/bst/unique_bst.py) + - [depth_sum](algorithms/tree/bst/depth_sum.py) + - [count_left_node](algorithms/tree/bst/count_left_node.py) + - [num_empty](algorithms/tree/bst/num_empty.py) + - [height](algorithms/tree/bst/height.py) + - [fenwick_tree](algorithms/tree/fenwick_tree/fenwick_tree.py) + - [red_black_tree](algorithms/tree/red_black_tree) + - [red_black_tree](algorithms/tree/red_black_tree/red_black_tree.py) + - [segment_tree](algorithms/tree/segment_tree) + - [segment_tree](algorithms/tree/segment_tree/segment_tree.py) + - [iterative_segment_tree](algorithms/tree/segment_tree/iterative_segment_tree.py) + - [traversal](algorithms/tree/traversal) + - [inorder](algorithms/tree/traversal/inorder.py) + - [level_order](algorithms/tree/traversal/level_order.py) + - [postorder](algorithms/tree/traversal/postorder.py) + - [preorder](algorithms/tree/traversal/preorder.py) + - [zigzag](algorithms/tree/traversal/zigzag.py) + - [trie](algorithms/tree/trie) + - [add_and_search](algorithms/tree/trie/add_and_search.py) + - [trie](algorithms/tree/trie/trie.py) + - [b_tree](algorithms/tree/b_tree.py) + - [binary_tree_paths](algorithms/tree/binary_tree_paths.py) + - [bin_tree_to_list](algorithms/tree/bin_tree_to_list.py) + - [construct_tree_preorder_postorder](algorithms/tree/construct_tree_postorder_preorder.py) + - [deepest_left](algorithms/tree/deepest_left.py) + - [invert_tree](algorithms/tree/invert_tree.py) + - [is_balanced](algorithms/tree/is_balanced.py) + - [is_subtree](algorithms/tree/is_subtree.py) + - [is_symmetric](algorithms/tree/is_symmetric.py) + - [longest_consecutive](algorithms/tree/longest_consecutive.py) + - [lowest_common_ancestor](algorithms/tree/lowest_common_ancestor.py) + - [max_height](algorithms/tree/max_height.py) + - [max_path_sum](algorithms/tree/max_path_sum.py) + - [min_height](algorithms/tree/min_height.py) + - [path_sum](algorithms/tree/path_sum.py) + - [path_sum2](algorithms/tree/path_sum2.py) + - [pretty_print](algorithms/tree/pretty_print.py) + - [same_tree](algorithms/tree/same_tree.py) + - [tree](algorithms/tree/tree.py) +- [unix](algorithms/unix) + - [path](algorithms/unix/path/) + - [join_with_slash](algorithms/unix/path/join_with_slash.py) + - [full_path](algorithms/unix/path/full_path.py) + - [split](algorithms/unix/path/split.py) + - [simplify_path](algorithms/unix/path/simplify_path.py) +- [unionfind](algorithms/unionfind) + - [count_islands](algorithms/unionfind/count_islands.py) + + +## Contributors + +Thanks to [all the contributors](https://github.com/keon/algorithms/graphs/contributors) +who helped in building the repo. From bbce1bde5f8c3481469da796f8e910752e4e2f10 Mon Sep 17 00:00:00 2001 From: aymanpopje Date: Thu, 13 Jun 2024 13:53:27 +0200 Subject: [PATCH 02/27] Added missing comma in "test_array.py" --- tests/test_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_array.py b/tests/test_array.py index f1ad11693..b73ecb17b 100644 --- a/tests/test_array.py +++ b/tests/test_array.py @@ -9,7 +9,7 @@ missing_ranges, move_zeros, plus_one_v1, plus_one_v2, plus_one_v3, - remove_duplicates + remove_duplicates, rotate_v1, rotate_v2, rotate_v3, summarize_ranges, three_sum, From a2036f5c55c4e88773cc8835afff30068d157a9a Mon Sep 17 00:00:00 2001 From: aymanpopje Date: Fri, 14 Jun 2024 12:00:55 +0200 Subject: [PATCH 03/27] Created script for measuring doing tests and measuring branch coverage. (branch-coverage.py. Requires coverage.py is installed) Made test scripts not count towards branch coverage --- .coveragerc | 1 + branch-coverage.py | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 branch-coverage.py diff --git a/.coveragerc b/.coveragerc index a5f7fcee8..c42e2db7a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,6 @@ [report] omit = + */tests/* */python?.?/* */site-packages/nose/* *__init__* diff --git a/branch-coverage.py b/branch-coverage.py new file mode 100644 index 000000000..04ab54c8f --- /dev/null +++ b/branch-coverage.py @@ -0,0 +1,4 @@ +import subprocess + +subprocess.run(["coverage", "run", "--branch", "-m", "pytest", "tests"]) +subprocess.run(["coverage", "report"]) \ No newline at end of file From fcec603cc18fda4af5530a1b251f864eaa4b6123 Mon Sep 17 00:00:00 2001 From: almuthana Date: Fri, 14 Jun 2024 20:14:54 +0200 Subject: [PATCH 04/27] add --- algorithms/maths/euler_totient.py | 22 +++++++++++++++++++ algorithms/strings/count_binary_substring.py | 23 ++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/algorithms/maths/euler_totient.py b/algorithms/maths/euler_totient.py index f29d382ff..ed5d873c5 100644 --- a/algorithms/maths/euler_totient.py +++ b/algorithms/maths/euler_totient.py @@ -4,15 +4,37 @@ which are coprime to n. (Two numbers are coprime if their greatest common divisor (GCD) equals 1). """ +branch_coverage = { + "check_1": False, # if branch for x > 0 + "check_2": False, # else branch + "check_2": False, + "check_2": False, +} def euler_totient(n): """Euler's totient function or Phi function. Time Complexity: O(sqrt(n)).""" result = n for i in range(2, int(n ** 0.5) + 1): + branch_coverage["check_1"] = True if n % i == 0: + branch_coverage["check_2"] = True while n % i == 0: + branch_coverage["check_3"] = True n //= i result -= result // i if n > 1: + branch_coverage["check_4"] = True result -= result // n return result + +def print_coverage(): + total = len(branch_coverage) + reached = sum(branch_coverage.values()) + coverage_percentage = (reached / total) * 100 + for branch, hit in branch_coverage.items(): + print(f"{branch} was {'hit' if hit else 'not hit'}") + print(f"coverage_percentage: {coverage_percentage}%") + + +result = euler_totient(21) +print_coverage() \ No newline at end of file diff --git a/algorithms/strings/count_binary_substring.py b/algorithms/strings/count_binary_substring.py index bd775ee53..b766d12c9 100644 --- a/algorithms/strings/count_binary_substring.py +++ b/algorithms/strings/count_binary_substring.py @@ -18,16 +18,39 @@ Explanation: There are 4 substrings: "10", "01", "10", "01" that have equal number of consecutive 1's and 0's. Reference: https://leetcode.com/problems/count-binary-substrings/description/ """ +branch_coverage = { + "check_5": False, + "check_6": False, + "check_7": False, +} + def count_binary_substring(s): + global branch_coverage cur = 1 pre = 0 count = 0 for i in range(1, len(s)): + branch_coverage["check_5"] = True if s[i] != s[i - 1]: + branch_coverage["check_6"] = True count = count + min(pre, cur) pre = cur cur = 1 else: + branch_coverage["check_7"] = True cur = cur + 1 count = count + min(pre, cur) return count + + +def print_coverage(): + total = len(branch_coverage) + reached_branches = sum(branch_coverage.values()) + percentage = (reached_branches / total) * 100 + for branch, hit in branch_coverage.items(): + print(f"{branch} was {'hit' if hit else 'not hit'}") + print(f"total Coverage: {percentage}%") + +count = count_binary_substring("01100110") + +print_coverage() From 57b66879c6ae0f82712c55528f540dfdb3c3ddd3 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 14:09:35 +0200 Subject: [PATCH 05/27] add --- algorithms/dp/word_break.py | 30 +++++++++++++++++++++++---- algorithms/sort/stooge_sort.py | 38 +++++++++++++++++++++++++++------- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/algorithms/dp/word_break.py b/algorithms/dp/word_break.py index f520456b0..0cae1b189 100644 --- a/algorithms/dp/word_break.py +++ b/algorithms/dp/word_break.py @@ -17,6 +17,14 @@ """ +# TC: O(N^2) SC: O(N) +branch_coverage = { + "check_1": False, + "check_2": False, + "check_3": False, + "check_4": False, + +} # TC: O(N^2) SC: O(N) def word_break(word, word_dict): """ @@ -27,15 +35,29 @@ def word_break(word, word_dict): dp_array = [False] * (len(word)+1) dp_array[0] = True for i in range(1, len(word)+1): + branch_coverage["check_1"] = True for j in range(0, i): + branch_coverage["check_2"] = True if dp_array[j] and word[j:i] in word_dict: + branch_coverage["check_3"] = True dp_array[i] = True break + branch_coverage["check_4"] = True return dp_array[-1] -if __name__ == "__main__": - STR = "keonkim" - dic = ["keon", "kim"] +def print_coverage(): + total = len(branch_coverage) + reached = sum(branch_coverage.values()) + coverage_percentage = (reached / total) * 100 + for branch, hit in branch_coverage.items(): + print(f"{branch} was {'hit' if hit else 'not hit'}") + print(f"coverage_percentage: {coverage_percentage}%") + + +result = word_break("keonkim", {"keon", "kim"}) +print_coverage() + + + - print(word_break(str, dic)) diff --git a/algorithms/sort/stooge_sort.py b/algorithms/sort/stooge_sort.py index 42f8b3bd4..b8419cef8 100644 --- a/algorithms/sort/stooge_sort.py +++ b/algorithms/sort/stooge_sort.py @@ -6,15 +6,22 @@ ''' - +branch_coverage = { + "check_1": False, # if branch for x > 0 + "check_2": False, # else branch + "check_3": False, + "check_4": False, +} def stoogesort(arr, l, h): if l >= h: + branch_coverage["check_1"] = True return # If first element is smaller # than last, swap them if arr[l]>arr[h]: + branch_coverage["check_2"] = True t = arr[l] arr[l] = arr[h] arr[h] = t @@ -22,6 +29,7 @@ def stoogesort(arr, l, h): # If there are more than 2 elements in # the array if h-l + 1 > 2: + branch_coverage["check_3"] = True t = (int)((h-l + 1)/3) # Recursively sort first 2 / 3 elements @@ -33,11 +41,27 @@ def stoogesort(arr, l, h): # Recursively sort first 2 / 3 elements # again to confirm stoogesort(arr, l, (h-t)) + + branch_coverage["check_4"] = True + +def print_coverage(): + total = len(branch_coverage) + reached = sum(branch_coverage.values()) + coverage_percentage = (reached / total) * 100 + for branch, hit in branch_coverage.items(): + print(f"{branch} was {'hit' if hit else 'not hit'}") + print(f"coverage_percentage: {coverage_percentage}%") + +arr1 = [10, -1, 2, 3, 0] +arr2 = [] +result = stoogesort(arr1, 0, len(arr1) - 1) +result = stoogesort(arr1, 0, len(arr2) - 1) +print_coverage() -if __name__ == "__main__": - array = [1,3,64,5,7,8] - n = len(array) - stoogesort(array, 0, n-1) - for i in range(0, n): - print(array[i], end = ' ') +# if __name__ == "__main__": +# array = [1,3,64,5,7,8] +# n = len(array) +# stoogesort(array, 0, n-1) +# for i in range(0, n): +# print(array[i], end = ' ') From 157de36fd4c373b67cd03e3b3713be9ba5cf0d97 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 14:34:08 +0200 Subject: [PATCH 06/27] add --- tests/test_dp.py | 13 ++++++++++++- tests/test_sort.py | 25 +++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/tests/test_dp.py b/tests/test_dp.py index e92800a11..e1f2ab8cd 100644 --- a/tests/test_dp.py +++ b/tests/test_dp.py @@ -14,7 +14,8 @@ longest_increasing_subsequence_optimized, longest_increasing_subsequence_optimized2, int_divide,find_k_factor, - planting_trees, regex_matching + planting_trees, regex_matching, + word_break, ) @@ -258,6 +259,16 @@ def test_symbol_2(self): p = "ab*" self.assertTrue(regex_matching.is_match(s, p)) +class TestWordBreak(unittest.TestCase): + """Test for interpolation_search and word_break""" + + def test_word_break(self): + self.assertTrue(word_break("keonkim", {"keon", "kim"})) + self.assertTrue(word_break("leetcode", {"leet", "code"})) + self.assertFalse(word_break("catsandog", {"cats", "dog", "sand", "and", "cat"})) + self.assertTrue(word_break("applepenapple", {"apple", "pen"})) + self.assertFalse(word_break("pineapplepenapple", {"apple", "pen"})) + self.assertTrue(word_break("aaaaaaa", {"aaaa", "aaa"})) if __name__ == '__main__': unittest.main() diff --git a/tests/test_sort.py b/tests/test_sort.py index c80290fdf..3627bb7cd 100644 --- a/tests/test_sort.py +++ b/tests/test_sort.py @@ -17,7 +17,8 @@ radix_sort, gnome_sort, cocktail_shaker_sort, - top_sort, top_sort_recursive + top_sort, top_sort_recursive, + ) import unittest @@ -124,7 +125,27 @@ def test_topsort(self): self.assertTrue(res.index('g') < res.index('e')) res = top_sort(self.depGraph) self.assertTrue(res.index('g') < res.index('e')) - +class TestStoog(unittest.TestCase): + def test_stoogesort(self): + arr1 = [1, 3, 64, 5, 7, 8] + stoogesort(arr1, 0, len(arr1) - 1) + self.assertEqual(arr1, [1, 3, 5, 7, 8, 64]) + + arr2 = [5, 4, 3, 2, 1] + stoogesort(arr2, 0, len(arr2) - 1) + self.assertEqual(arr2, [1, 2, 3, 4, 5]) + + arr3 = [1, 2, 3, 4, 5] + stoogesort(arr3, 0, len(arr3) - 1) + self.assertEqual(arr3, [1, 2, 3, 4, 5]) + + arr4 = [10, -1, 2, 3, 0] + stoogesort(arr4, 0, len(arr4) - 1) + self.assertEqual(arr4, [-1, 0, 2, 3, 10]) + + arr5 = [] + stoogesort(arr5, 0, len(arr5) - 1) + self.assertEqual(arr5, []) if __name__ == "__main__": unittest.main() From 386ed52ba2edf4185491cbf3caa505b183721a5c Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 14:36:06 +0200 Subject: [PATCH 07/27] add --- tests/test_sort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_sort.py b/tests/test_sort.py index 3627bb7cd..10113348e 100644 --- a/tests/test_sort.py +++ b/tests/test_sort.py @@ -18,7 +18,7 @@ gnome_sort, cocktail_shaker_sort, top_sort, top_sort_recursive, - + stoogesort ) import unittest From 0f4d2d944cfb779f4345d98c05c3da411e0b68d1 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 16:40:14 +0200 Subject: [PATCH 08/27] add --- README.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fd8293229..be1bd88b1 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,13 @@ Name: URL: -Number of lines of code and the tool used to count it: - Programming language: ## Coverage measurement ### Existing tool - + @@ -24,6 +22,62 @@ Programming language: +Almuthana Almustafa + + + +stoogsort in stoog_sort.py + + + +link to commit in test files: +https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97 + +link to commit in founction: +https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 + + + +result: + +![alt text](ts.png) + +existing tool result before: + +![alt text](ss2.png) + +existing tool result after: + +![alt text](ss.png) + + + + +word_break in word_break.py + + + +link to commit in test files: +https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97 + +link to commit in founction: +https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 + + +result: + +![alt text](ts.png) + +existing tool result before: + +![alt text](wk1.png) + +existing tool result after: + +![alt text](wk2.png) + + + @@ -65,3 +119,5 @@ Programming language: ## Statement of individual contributions + +Almuthana Almustafa make the stoogsort and word_break functions. From b0de551da7f1ab870430823339d1acb523c5dda4 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 16:43:07 +0200 Subject: [PATCH 09/27] add --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index be1bd88b1..bfa9f8273 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Name: URL: +Number of lines of code and the tool used to count it: + Programming language: ## Coverage measurement From 4b6a7b943393714f28ac159263bf9cf5796623b3 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 16:44:52 +0200 Subject: [PATCH 10/27] add --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bfa9f8273..a82c57bc7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Name: URL: -Number of lines of code and the tool used to count it: +Number of lines of code and the tool used to count it: Programming language: From d823b9c6a2226673b968b805b15785863536ea61 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 16:45:46 +0200 Subject: [PATCH 11/27] add --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a82c57bc7..6aa23cc0b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Name: URL: -Number of lines of code and the tool used to count it: + Programming language: @@ -14,7 +14,7 @@ Programming language: ### Existing tool - + From fab5c24ffffda63ac71b3fee7370feccaff15a29 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 16:46:33 +0200 Subject: [PATCH 12/27] add --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6aa23cc0b..cec491c7f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Name: URL: - +Number of lines of code and the tool used to count it: Programming language: @@ -14,7 +14,7 @@ Programming language: ### Existing tool - + From dbb131c8426dedad18d9ddebacfa35dfd5b588be Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 16:48:18 +0200 Subject: [PATCH 13/27] add --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cec491c7f..30aa3da72 100644 --- a/README.md +++ b/README.md @@ -122,4 +122,4 @@ existing tool result after: -Almuthana Almustafa make the stoogsort and word_break functions. + From c8c757573a8669847fee7fba9676012c5c69bdc8 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 16:50:34 +0200 Subject: [PATCH 14/27] added --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 30aa3da72..96e69e642 100644 --- a/README.md +++ b/README.md @@ -122,4 +122,6 @@ existing tool result after: +Abdullah -> increased the coverage for two functions. +Almuthana Almustafa -> increased the coverage for two functions. From 6bab0cd7a3be8810a999c74f1804331b7f3c08b1 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 16:51:41 +0200 Subject: [PATCH 15/27] added --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 96e69e642..8e0238f26 100644 --- a/README.md +++ b/README.md @@ -124,4 +124,3 @@ existing tool result after: Abdullah -> increased the coverage for two functions. -Almuthana Almustafa -> increased the coverage for two functions. From d7d2780b4a2fa3af377cd5ae3f6bec0906ea862f Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 18:46:10 +0200 Subject: [PATCH 16/27] add --- README.md | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 245 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8e0238f26..c8068c929 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,24 @@ ## Project chosen -Name: +Name: algorithms -URL: +URL: (https://github.com/keon/algorithms) -Number of lines of code and the tool used to count it: +Number of lines of code and the tool used to count it: 18023(18 KLOC), counted using lizard -Programming language: +Programming language: Python ## Coverage measurement ### Existing tool - +We have used coverage.py to measure the cover of our chosen project. After installing all tools and dependencies, we have +run the tool by typing coverage run --branch -m pytest tests. Afterwards, we use coverage report to generate the report. Later, Ayman has written a scrip to run the commands in a single script, and to also skip the test files, which don't need to be tested. + +In order to not put in 8 large images, I will insert the final screenshot, with the total branch coverage: +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/f1cd3fab-b00c-4cd0-89d0-6452e7ed1a63) - ### Your own coverage tool @@ -90,6 +93,75 @@ existing tool result after: +#### Ayman Errahmouni + +##### Function 1: simplify_path_v2 + +[Link the commit](https://github.com/CatalinAnt/algorithms-SEP-95/pull/2/commits/22ee6fa1df4785596c603af61a725c558973eb0b) + +Screenshot of branch measurement (66%):
+![image](image-7.png) + +##### Function 2: insertion_sort + +[Link to commit](https://github.com/CatalinAnt/algorithms-SEP-95/pull/2/commits/5dae7f28036f89b7f6ff673639a922dd714aff3e) + +Screenshot of branch measurement (0%, was untested):
+![alt text](image-8.png) + +#### Catalin Antonescu + +##### Function 1: strong_password + +Link to commit: +[https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7) + +Screenshot of branch measurement: +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/e718a47f-5ea0-412c-b250-25a193412164) + +##### Function 2: rotate_image + +Link to commit:(same as for the first one) +[https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7) + +Screenshot of branch measurement: +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e) + +#### Abdullah Abdelkhalik + + +pythagoras + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 + +![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/0df1fa2b-2185-4b9f-ae65-5d969edb009b) + + +first_unique_char + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658 + +![first_unique_char_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10d7c45c-398e-4408-8f11-6771f51fa95c) + + +#### Abdullah Abdelkhalik + + +pythagoras + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 + +![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/0df1fa2b-2185-4b9f-ae65-5d969edb009b) + + +first_unique_char + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658 + +![first_unique_char_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10d7c45c-398e-4408-8f11-6771f51fa95c) + + + ## Coverage improvement ### Individual tests @@ -112,15 +184,182 @@ existing tool result after: +## Ayman Errahmouni + +#### + +An enhanced existing test + +Old coverage:
+![old coverage result (24%)](image-2.png) + +Diff (LHS = new code, RHS = old code):
+![LHS: new code, RHS: old code](image.png) + +New coverage:
+![new coverage result (100%)](image-1.png) + +The coverage was improved because certain cases that could happen in file paths (e.g. the "." directory, empty path) were not tested for. +By added additional tests that use such cases, the coverage improved. + +The test was also faulty on windows (i guess linux was assumed), so i added support for that in the test. (It now passes on Windows 10 too) + +#### + +An new test. (before, `insertion_sort` was not present in any test) + +Diff (LHS: new code, RHS: old code):
+(New test)
+![LHS: new code, RHS: old code](image-5.png)
+(Changes in imports)
+![LHS: new code, RHS: old code](image-6.png) + +Old coverage:
+![Old coverage result (4%)](image-3.png) + +New coverage:
+![alt text](image-4.png) + + + +## Catalin Antonescu + +Test 1: + +In test_string: + +Link to commit: + +[https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7) + +Old coverage: + +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/5ea3487d-f024-45e6-a1e7-e6d9d1d953b7) +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/e718a47f-5ea0-412c-b250-25a193412164) + +New coverage: + +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/1d179cc4-1179-40e2-b344-5e904e899647) +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/c8173a47-bcc9-4b6a-9a91-c70b5a8b002f) + +For strong_password there was a 26% coverage improvement with the existing tool and 40% with manual measurement tool. + + +Test 2: + +In test_matrix: + +[https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7) + +Old coverage: + +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e) +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/a97a2bd6-c69e-4435-a8e2-bbdefc429bd1) + + +New coverage: + +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/7cc337eb-5684-40b3-aedd-dc2b7180b7f3) +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/2143adff-e0aa-4113-858a-0c92ec288d20) + For rotate_image, thre was a 33% coverage improvement with the existing tool and 25% with manual tool. + + +## Abdullah Abdelkhalik + +test_maths + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/60832d9c672efd586848077cc41a52630d34371b + +![pythagoras_before](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/cf57112b-1aef-4a10-a41f-bd4b797e2012) + +![pythagoras_after](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/1aa45c17-46fc-49d3-944a-03c2276d1be6) + +the coverage is improved by 28%, the code only hit one of the five branches and cover only one of the three cases of the pythagoras theory. I added the other two cases, i could have a fourth case where none of the cases is present. + +test_strings + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 + +![first_unique_char_before](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/9910ec69-73b0-4c87-afc8-abc01f65a423) + +![first_unique_char_after](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10859fac-776c-4a48-8a1c-9531afcbfa9b) + +The coverage is improved by 13%, the code only hit three out of five branches and only set up two examples. I added a case where there is no unique letter. + + +Almuthana Almustafa + +stoogsort in stoog_sort.py + +[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3) + +result: + +![alt text](ts.png) + +word_break in word_break.py + +link to commit in founction: +[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 ) + +result: + +![alt text](ts.png) + +Almuthana Almustafa + +stoogsort function + +link to commit in test files: +[Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) + +existing tool result before: + +![alt text](ss2.png) + +existing tool result after: + +![alt text](ss.png) + +The coverage increased by 89%, largely attributable to the implementation of new tests. + +word_break function + +[Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) + +existing tool result before: + +![alt text](wk1.png) + +existing tool result after: + +![alt text](wk2.png) + +The coverage improved by 86% due to the creation of new tests. + ### Overall +Old overall coverage: +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/f1cd3fab-b00c-4cd0-89d0-6452e7ed1a63) +New overall coverage: + +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/a53729ff-a4f1-42ce-9fe9-ff0813952658) + +Due to the large size of the project, the percentage only went up by one percent. ## Statement of individual contributions Abdullah -> increased the coverage for two functions. +Almuthana Almustafa -> Instrumentation was added to two functions, and test cases were created for them to improve coverage. + + + + + + From 50cfaff2442a7e9ba3cf87cd290186d6c1dc2d4c Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 18:50:55 +0200 Subject: [PATCH 17/27] add --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c8068c929..3fe74a081 100644 --- a/README.md +++ b/README.md @@ -302,7 +302,7 @@ word_break in word_break.py link to commit in founction: [Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 ) -result: +result: ![alt text](ts.png) From 39e7967dcb5c4e2c06dc0180b3007747ac069366 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 18:57:20 +0200 Subject: [PATCH 18/27] ad --- README.md | 76 ++++--------------------------------------------------- 1 file changed, 5 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 3fe74a081..a61e4c8f8 100644 --- a/README.md +++ b/README.md @@ -23,76 +23,6 @@ In order to not put in 8 large images, I will insert the final screenshot, with ### Your own coverage tool - - - - -Almuthana Almustafa - - - -stoogsort in stoog_sort.py - - - -link to commit in test files: -https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97 - -link to commit in founction: -https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 - - - -result: - -![alt text](ts.png) - -existing tool result before: - -![alt text](ss2.png) - -existing tool result after: - -![alt text](ss.png) - - - - -word_break in word_break.py - - - -link to commit in test files: -https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97 - -link to commit in founction: -https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 - - -result: - -![alt text](ts.png) - -existing tool result before: - -![alt text](wk1.png) - -existing tool result after: - -![alt text](wk2.png) - - - - - - - - - - - - - #### Ayman Errahmouni ##### Function 1: simplify_path_v2 @@ -287,7 +217,7 @@ https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e748 The coverage is improved by 13%, the code only hit three out of five branches and only set up two examples. I added a case where there is no unique letter. -Almuthana Almustafa +## Almuthana Almustafa stoogsort in stoog_sort.py @@ -308,6 +238,8 @@ result: Almuthana Almustafa +Test 1: + stoogsort function link to commit in test files: @@ -323,6 +255,8 @@ existing tool result after: The coverage increased by 89%, largely attributable to the implementation of new tests. +Test 2: + word_break function [Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) From 206364842842b8074b1f7169539eaef8de9f1e9e Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 20:23:48 +0200 Subject: [PATCH 19/27] images added --- README.md | 54 +++++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index a61e4c8f8..3f1d2aa1f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Screenshot of branch measurement (0%, was untested):
#### Catalin Antonescu ##### Function 1: strong_password - + Link to commit: [https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7) @@ -91,6 +91,24 @@ https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4 ![first_unique_char_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10d7c45c-398e-4408-8f11-6771f51fa95c) +#### Almuthana Almustafa + +##### Function 1: stoogsort in stoog_sort.py + +[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3) + +result: + +![alt text](result_image-2.png) + +##### Function 2: word_break in word_break.py + +link to commit in founction: +[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 ) + +result: + +![alt text](result_image-2.png) ## Coverage improvement @@ -216,58 +234,36 @@ https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e748 The coverage is improved by 13%, the code only hit three out of five branches and only set up two examples. I added a case where there is no unique letter. - ## Almuthana Almustafa -stoogsort in stoog_sort.py +### Test 1: stoogsort -[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3) - -result: - -![alt text](ts.png) - -word_break in word_break.py - -link to commit in founction: -[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 ) -result: - -![alt text](ts.png) - -Almuthana Almustafa - -Test 1: - -stoogsort function link to commit in test files: [Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) existing tool result before: -![alt text](ss2.png) +![alt text](stoog_sort_image1.png) existing tool result after: -![alt text](ss.png) +![alt text](stoog_sort_image2.png) The coverage increased by 89%, largely attributable to the implementation of new tests. -Test 2: - -word_break function +### Test 2: word_break [Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) existing tool result before: -![alt text](wk1.png) +![alt text](word_break_image1.png) existing tool result after: -![alt text](wk2.png) +![alt text](word_break_image2.png) The coverage improved by 86% due to the creation of new tests. From 60118df8a07a42a5c97a63ff296589be5ff17bd2 Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 20:50:36 +0200 Subject: [PATCH 20/27] image added --- result_image-2.png | Bin 0 -> 3692 bytes stoog_sort_image1.png | Bin 0 -> 2572 bytes stoog_sort_image2.png | Bin 0 -> 2542 bytes word_break_image1.png | Bin 0 -> 2681 bytes word_break_image2.png | Bin 0 -> 2827 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 result_image-2.png create mode 100644 stoog_sort_image1.png create mode 100644 stoog_sort_image2.png create mode 100644 word_break_image1.png create mode 100644 word_break_image2.png diff --git a/result_image-2.png b/result_image-2.png new file mode 100644 index 0000000000000000000000000000000000000000..1106174d2b46b2daa2e05e9be34a7967dd24a55a GIT binary patch literal 3692 zcmai1c{r4P+rDjMnaDb}u@%{gjHR-Tb*zPyeP1di4GCGZlPps-7?m-MJe08|TRlV= z6v`lqj3rC9v5$B3em%$Wec$mO?;rPlU)OQ`?%#b~=XIXv@w-zlSedZ139$hHz>Y9A zv;hD*Sz3IP1w^|?5N4)m4?3ic2^^^GgU-_uMn8Q^eE@j%5WMffM9W!knK~c=fIIl; zqMPs)y9)pubO=LzySuJSg^HmIC9hio!IxpUN{~zF zF)`r&`(gK6Fc@q*!jA$bg-MWvs}XF6la3Wgn|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Mo|(=;-FN5yy{>nQNgW7Ib85FQ06#-YD!BncHuHy2d0lpNn(GRo+32*czl*nUQaYa$sU>{(P6UpIJrfuXm^(Za`wAb26Su=}vsoj<6C&di2SQOoyAz_DnqvYj~_E^`)j?3;wmS zOva=?WI1#>T%k8ILR_^}qf^;a`+KK4E5>*yjv3w4$K;=@NuGdtQZT&gT`KAiMH@Kt z((>uy-TVaW(w7XFOV>#Fe4Sm;$G6Voyr;L~WVQmmC$wH*_qUkZ(@7le%a?91JI74^ fK4<*Rc_6ll_p0yf^lYU4Ap!^^E5k~-d)&VO8W`OB literal 0 HcmV?d00001 diff --git a/stoog_sort_image1.png b/stoog_sort_image1.png new file mode 100644 index 0000000000000000000000000000000000000000..98f6c7c6dd483367cacf83333b7949c79a12372e GIT binary patch literal 2572 zcmV+n3iI`eP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&386_uK~#8N?VT-m z@=6fL=UyFCQ}NVcFm-4Q9{^KVjltERIcN;7290|R9{_{K)nITnm>T@OGy9VFkPTT% z0{`DRoVH=RnSIIb%1Yg*gSYD#_c)lCWITF}T`szQIdy7+&+VB}xi zOn?h$qs#yR00000w1z%SSCQ?N)VoKt;A^XCJ!|au4a)6|-iJdP@@IW8*II#}3cnWp zL6?Hlj{YvqgE@nh;y?{>p4b|%ozeyWq1^@s6T14o5wW8eh!?f4fJuNhr zm0h71SEKUZ(9_H(rDac-`&=E}Ax?dxVYtX#kf!?-5FNjjzP! z`<&I*#bHq11EW{!(24e&7MW&klow=P^BSJy!@@)REXnHc4c%7sdHF|P;TOsC4Ta&B8_I^J(@!eC_## zQ*p|dXQI;&?PXD6$eQ@>lWJ~GD*V5PQaUORP;3hu*z%pf=L$PoaA$tr(fmEfGS1{< ziRULPEc{TY>q6>YGFT3u)wS<8zE_y=z}L;7k-pC|lU`N|%V{^KcfO%ccjSD( z=rtyj{a)XvOZ)kTo+k3WmNk?sao>`1C6G=uq27`6`A83gF8S1}!@XnuB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J-IW!1vRYHcaHimH@#%Q literal 0 HcmV?d00001 From 7c2276a4b8b8f15c1c85bbc48e530f47292c46cf Mon Sep 17 00:00:00 2001 From: almuthana Date: Wed, 26 Jun 2024 20:57:57 +0200 Subject: [PATCH 21/27] ad --- README.md | 2 +- algorithms/dp/word_break.py | 16 ++++++++-------- result_image_2.png | Bin 0 -> 3558 bytes 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 result_image_2.png diff --git a/README.md b/README.md index 3f1d2aa1f..a601d0d45 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ link to commit in founction: result: -![alt text](result_image-2.png) +![alt text](result_image_2.png) ## Coverage improvement diff --git a/algorithms/dp/word_break.py b/algorithms/dp/word_break.py index 0cae1b189..2ef9fd03b 100644 --- a/algorithms/dp/word_break.py +++ b/algorithms/dp/word_break.py @@ -19,10 +19,10 @@ # TC: O(N^2) SC: O(N) branch_coverage = { - "check_1": False, - "check_2": False, - "check_3": False, - "check_4": False, + "check_5": False, + "check_6": False, + "check_7": False, + "check_8": False, } # TC: O(N^2) SC: O(N) @@ -35,14 +35,14 @@ def word_break(word, word_dict): dp_array = [False] * (len(word)+1) dp_array[0] = True for i in range(1, len(word)+1): - branch_coverage["check_1"] = True + branch_coverage["check_5"] = True for j in range(0, i): - branch_coverage["check_2"] = True + branch_coverage["check_6"] = True if dp_array[j] and word[j:i] in word_dict: - branch_coverage["check_3"] = True + branch_coverage["check_7"] = True dp_array[i] = True break - branch_coverage["check_4"] = True + branch_coverage["check_8"] = True return dp_array[-1] diff --git a/result_image_2.png b/result_image_2.png new file mode 100644 index 0000000000000000000000000000000000000000..3cc6c81909a2becc5e8c00adac17c794d161bc38 GIT binary patch literal 3558 zcmb`KcT`i`wud(m6o`Z>pwgrrHPQqH4OPI<3{??BN2EwKAu%*TM51(%V$KP@UNn&o z2}Mx^0)hfkL_k^~fFMn3m?O1M<|rt`7heN#K1~PL|IdXl#!H073NO z%Qk*j>H#ZKsEMJz?E|MDL@0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%6zyhTwYKCXLegc0 z15Z&^;g4@+`|U$Qb?&!3E1g>&=-FkJu4^S|>i4!uk6N1YoO>Hem1Id8q$ph=IP}Te zHP@Sp&wd-nHx2tZewtS5@Tb`%oKQT2)Lc4G=JMS0U-anpC_?RN)U>5wUEKm_Q&Pq% z8lC3`rQ8yO=D(&}iX70+au?%e&ih5%@$mpzCISPIXj@nOf@%+gBZsHY^#-Y>|Cs&RujSB{`0U;l zx>#PB^FU#NpW}A+gp`@zgf<6C4(#mmRV$8QIUD-MS$V8qidIIX0+e zoxPc>+DKU}BXT&LtB6=3u0Vq{Fa0{LdD$z@Nkz|Qc3}s-d?NAozgnEHUR@vJE>@`# q9~Jpd{kxvOaJ}vd01{U>9$uCIbgxQ&?Go$X3@|Z57?Q5KJo+Dx`k?** literal 0 HcmV?d00001 From 2017fe397ae674bb39f03002db3b5ef9cb244c2c Mon Sep 17 00:00:00 2001 From: almuthana Date: Thu, 27 Jun 2024 10:09:46 +0200 Subject: [PATCH 22/27] updated --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a601d0d45..b7cb85220 100644 --- a/README.md +++ b/README.md @@ -285,8 +285,10 @@ Due to the large size of the project, the percentage only went up by one percent Abdullah -> increased the coverage for two functions. + Almuthana Almustafa -> Instrumentation was added to two functions, and test cases were created for them to improve coverage. +Cataline -> Instrumentation was added to two functions, and the tests for these functions were enhanced. From 98cc754db258757a6e779f9953f5e13da2db59b8 Mon Sep 17 00:00:00 2001 From: almuthana Date: Thu, 27 Jun 2024 19:39:56 +0200 Subject: [PATCH 23/27] readme update --- README.md | 129 ++++++++++++++++++++++---------------------------- SS_befor1.png | Bin 0 -> 3483 bytes WB_befor1.png | Bin 0 -> 3688 bytes 3 files changed, 57 insertions(+), 72 deletions(-) create mode 100644 SS_befor1.png create mode 100644 WB_befor1.png diff --git a/README.md b/README.md index b7cb85220..73ec34ab3 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ We have used coverage.py to measure the cover of our chosen project. After insta run the tool by typing coverage run --branch -m pytest tests. Afterwards, we use coverage report to generate the report. Later, Ayman has written a scrip to run the commands in a single script, and to also skip the test files, which don't need to be tested. In order to not put in 8 large images, I will insert the final screenshot, with the total branch coverage: -![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/f1cd3fab-b00c-4cd0-89d0-6452e7ed1a63) +![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/f1cd3fab-b00c-4cd0-89d0-6452e7ed1a63) ### Your own coverage tool @@ -29,15 +29,15 @@ In order to not put in 8 large images, I will insert the final screenshot, with [Link the commit](https://github.com/CatalinAnt/algorithms-SEP-95/pull/2/commits/22ee6fa1df4785596c603af61a725c558973eb0b) -Screenshot of branch measurement (66%):
+Screenshot of branch measurement:
![image](image-7.png) ##### Function 2: insertion_sort [Link to commit](https://github.com/CatalinAnt/algorithms-SEP-95/pull/2/commits/5dae7f28036f89b7f6ff673639a922dd714aff3e) -Screenshot of branch measurement (0%, was untested):
-![alt text](image-8.png) +Screenshot of branch measurement:
+![alt text](image-12.png) #### Catalin Antonescu @@ -57,58 +57,38 @@ Link to commit:(same as for the first one) Screenshot of branch measurement: ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e) -#### Abdullah Abdelkhalik - +#### Almuthana Almustafa -pythagoras +##### Function 1: stoogsort in stoog_sort.py -https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 +[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3) -![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/0df1fa2b-2185-4b9f-ae65-5d969edb009b) +result: +![alt text](SS_befor1.png) -first_unique_char +##### Function 2: word_break in word_break.py -https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658 +link to commit in founction: +[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 ) -![first_unique_char_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10d7c45c-398e-4408-8f11-6771f51fa95c) +result: +![alt text](WB_befor1.png) #### Abdullah Abdelkhalik - -pythagoras +##### Function 2: pythagoras https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 -![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/0df1fa2b-2185-4b9f-ae65-5d969edb009b) - +![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/c61bff67-be7e-4bd2-b892-0a0f2dada1f3) -first_unique_char +##### Function 2: first_unique_char https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658 -![first_unique_char_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10d7c45c-398e-4408-8f11-6771f51fa95c) - - -#### Almuthana Almustafa - -##### Function 1: stoogsort in stoog_sort.py - -[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3) - -result: - -![alt text](result_image-2.png) - -##### Function 2: word_break in word_break.py - -link to commit in founction: -[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 ) - -result: - -![alt text](result_image_2.png) +![first_unique_char_hits (2)](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/8c1b704e-cadb-4f54-aea7-795005348538) ## Coverage improvement @@ -132,9 +112,9 @@ result: -## Ayman Errahmouni +#### Ayman Errahmouni -#### +##### An enhanced existing test @@ -143,6 +123,7 @@ Old coverage:
Diff (LHS = new code, RHS = old code):
![LHS: new code, RHS: old code](image.png) +![alt text](image-9.png) New coverage:
![new coverage result (100%)](image-1.png) @@ -152,7 +133,7 @@ By added additional tests that use such cases, the coverage improved. The test was also faulty on windows (i guess linux was assumed), so i added support for that in the test. (It now passes on Windows 10 too) -#### +##### An new test. (before, `insertion_sort` was not present in any test) @@ -161,6 +142,8 @@ Diff (LHS: new code, RHS: old code):
![LHS: new code, RHS: old code](image-5.png)
(Changes in imports)
![LHS: new code, RHS: old code](image-6.png) +(Instrumentation)
+![alt text](image-8.png) Old coverage:
![Old coverage result (4%)](image-3.png) @@ -170,7 +153,7 @@ New coverage:
-## Catalin Antonescu +#### Catalin Antonescu Test 1: @@ -192,7 +175,6 @@ New coverage: For strong_password there was a 26% coverage improvement with the existing tool and 40% with manual measurement tool. - Test 2: In test_matrix: @@ -204,41 +186,15 @@ Old coverage: ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e) ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/a97a2bd6-c69e-4435-a8e2-bbdefc429bd1) - New coverage: ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/7cc337eb-5684-40b3-aedd-dc2b7180b7f3) ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/2143adff-e0aa-4113-858a-0c92ec288d20) For rotate_image, thre was a 33% coverage improvement with the existing tool and 25% with manual tool. - -## Abdullah Abdelkhalik - -test_maths - -https://github.com/CatalinAnt/algorithms-SEP-95/commit/60832d9c672efd586848077cc41a52630d34371b - -![pythagoras_before](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/cf57112b-1aef-4a10-a41f-bd4b797e2012) - -![pythagoras_after](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/1aa45c17-46fc-49d3-944a-03c2276d1be6) - -the coverage is improved by 28%, the code only hit one of the five branches and cover only one of the three cases of the pythagoras theory. I added the other two cases, i could have a fourth case where none of the cases is present. - -test_strings - -https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 - -![first_unique_char_before](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/9910ec69-73b0-4c87-afc8-abc01f65a423) - -![first_unique_char_after](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10859fac-776c-4a48-8a1c-9531afcbfa9b) - -The coverage is improved by 13%, the code only hit three out of five branches and only set up two examples. I added a case where there is no unique letter. - -## Almuthana Almustafa - -### Test 1: stoogsort - +#### Almuthana Almustafa +##### Test 1: stoogsort link to commit in test files: [Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) @@ -251,9 +207,11 @@ existing tool result after: ![alt text](stoog_sort_image2.png) +![alt text](result_image-2.png) + The coverage increased by 89%, largely attributable to the implementation of new tests. -### Test 2: word_break +##### Test 2: word_break [Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) @@ -265,8 +223,34 @@ existing tool result after: ![alt text](word_break_image2.png) +![alt text](result_image_2.png) + The coverage improved by 86% due to the creation of new tests. +#### Abdullah Abdelkhalik + +#### Improvements + +test_maths + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/60832d9c672efd586848077cc41a52630d34371b + +![pythagoras_before](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/cf57112b-1aef-4a10-a41f-bd4b797e2012) + +![pythagoras_after](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/1aa45c17-46fc-49d3-944a-03c2276d1be6) + +the coverage is improved by 28%, the code only hit one of the five branches and cover only one of the three cases of the pythagoras theory. I added the other two cases, i could have a fourth case where none of the cases is present. + +test_strings + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 + +![first_unique_char_before](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/9910ec69-73b0-4c87-afc8-abc01f65a423) + +![first_unique_char_after](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10859fac-776c-4a48-8a1c-9531afcbfa9b) + +The coverage is improved by 13%, the code only hit three out of five branches and only set up two examples. I added a case where there is no unique letter. + ### Overall @@ -295,3 +279,4 @@ Cataline -> Instrumentation was added to two functions, and the tests for these + diff --git a/SS_befor1.png b/SS_befor1.png new file mode 100644 index 0000000000000000000000000000000000000000..c37497dd17c428ecefb78d6e87f4ff2be2dc0fff GIT binary patch literal 3483 zcmbW4XHZk?7KVceDv>VIZRkM=y{dq8fk+9FB1jQ}Afbj{qzVB0z7hHqSqI^^{spX04~4NV3>Bk z8bp7SjDe1(S&-dI4k%FkI~Q^(d)vU!u)Ri@nLDoY4`XM$E{y8fZ#5u`ke#pf*kj;R zkYeWM<>r2=URW$GKjpg;#V_^!u(V@5OJ=L7zQjxVWPkTZ#EBjt62Diz&kNw-lyL{# zIE!S}h^drY?%6yiiSbg9UkiP<(}@V{-)wI@=VDY+EgM{r@_Qr5V}a#sJZlDj)2FpbKXyfVsf-7=}SM+XnRI3m1{AWz9%KOFMh1hY%KZ5ngHG6#d6PLq?B%GqbtZVa{K z)El;&3uiDIEqh-oro(rtKP;3Rzdyc@F2pfk5UHE$Um^f`TK@8cY1LF;Y?uG3PcFsG z*+z(d3)bBq%H5C~_sMKtXs(tjo*@#yWIH|{K3kRaVr=(E3L+UF7 zR7ra|NhM^{;tmq^hjx^E{9<4C<$C_iG+5g)|JVU0 zM+r^xRkx^;**%{-O=H$KB@y1!WAZ^Y`@cpv+}?a^kX2Y{C(|taHurj`93C>mGNlW* z4&iO4{<0(@L{ekXxT_Pl8tG{3A4nI30HlH(8p+~k3Y(aT3uT&&qZ6&MDvK$ zt4cy|pk&$RA4oU^ba`$e_0-(v+t|ludr)6V4Js`>L4L+|+xVW&kM9?}aLx6TlUpw- z`m8EWSH^nNZ}K5dChJTO zVs>tx|5AWCw|Unjq{Ez4uDNA0!XLG#&-#QU66Y8AW_?d8kjG=jT6K(b)hx8XfIuya zcj1KJZ`zw3n~9&Y-QOfB(Tx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pJax1ZEYhv3~YO5!`zCLI#{hqj-eD6C(#ks~VX|dO@ z#-~y`xiYbUA@lY|Xkot4xYac7p1>kVp-iA^(EE2k_fTxNSx?KV@ZMABoA-pq6m1C0 zc7eAo2Fp_4cky(MD6yL9L{h|AP}8 z!YURfCEY$+$^wt&wsg%*0x%S|zDle#Fgf20E#ySYr241tb{@caEvv>|Z;RrAX~xy! zlHmi)`IndAZAFJvvM9)7R>P=vWBFr1P^%!?|Ek6C|>wHm4ukf21xN*jDb=%ZU8?x>{QM{bA;h(!~i2 z5r$v*)XBBlgKLV*kl+0;VBad#(kw3bOd@Qp-W_>mymh@@9Jtknpq&H^@sSla&sEV< zcQ&R93bCtHcv(4Y?xC-hzr#S;$@8TUy+aNzHgy8OY4x>1t}JzzkYS#ajEHUGRR8Px z0~5&}Gilv7RCitXWvekZ$K**?z|Lj?OR;Zrsy@OH()xKtVsW+01kWr;c`yY8cDUJ{+j`E?8lktX>siL04A zC4y`_hfBA{=^thTXiyxsSn9(JC9qvS(?3?h((oLaQ%SmjpRccX?8{EL+5=jho9>AF zda3E%%A7@9Z^OC#(0W?$Z_ATtl%b$(QmzG$LTR2~8rEk^`h_#_K~4ux?$)?Rv!PYG zcpMfl#b(VzqP`s<%Y|lP`l7Zok&tD>EW$vJb-l~VF(7tjuK|shT!odW)s-swu`fBx zwRjPes<$xGILG1eXC1UoBVTPUsAXUKOhZ6$rC@$F&m}I*aaGsysKU1yPU2)IaqH~U zDN}Yt6HB6s?X2zKV|!M_fSajibi_4Rm8#`2tXtcF zKk5+crWbopCA*u)tQcg+8!-Ge?(f^mT)B5WZEaNEfv$)+r+o4biu`o%*H8UisbugZ z(qqRIDEf=y@it9;ObIwIJk()YcSe@5v7Z^(S(m=C#>>I$s}c>e`Q49KkJ*`H*!IsWjL*}5r~n4K#yVwMPow`09>Khg literal 0 HcmV?d00001 diff --git a/WB_befor1.png b/WB_befor1.png new file mode 100644 index 0000000000000000000000000000000000000000..1b63096c7f5f2bb44a9e0380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yf{8q=5Qew^2ib(|anebcn%vY3lb(dk zqcTYa{r95*0^*8jbNtDpY~lPX`Rvk|_j`>7~* z-yPKJ3nf`S80&_8(@6nadF`$b?Mp!pnW)oMWshYuexHb(VLK<#l*e;eRM%8L&UsCn zs9`VcCj0f3@f6g^lHOZ`x*6!Y!*0-K)m54;R(=m!v@MqKdn{%TRQOSN7B^`1HTvCd zl?CBK&t3i=r+Y5TO$t|U+@^P!3MF~!Z~48a{Xv$?&DL7OkB{`qM0w)Ksnm`FF@G#E zSMH->$^p37n^=D-(ORUuGGtAyQ})@oLhSR{`TN9Z>hbQ0@6cnXpMB{3$UC+tycvm) z{;pg^XV>*&vc_fJ$*Y0MzOgpC5*l4zwu$~u6pQ3S;r}G;3`2n;`^}r)95|n5C&GUr<(aiug0XG%D{k z=RvcVL3=t;)aG;NN0HInM9thpadp1FeDA8eH>@R55U z`hzqfVf>-;u^I3AU}VMq((H(&C|gW05`H@N_h%NP7o*9I!7Nsc^epMODKzW<8PsmH zQ9Zrq6szuIA76d}R$Q@RAYX4+$v$qn!bSF@W6SSxZO!29f4q8?kcH1fU_GpG(UTo@I;jxh7-6+ms zFM1x9mB+BIHGj1#m6d|f-nipEOSUp zFYCvI<jA$}Cl=sp_Z>|!)X8*N(2fI;u zm%Lj^PN}H$0y%4{mO^A$XjCNxqH?nH6u{Um$)C)J`P{0J(Eh7 zE7mn$pUzm~RE`u26`*KDc;hI7DX&UUauMYdWB|*r12^ZbHLR>-OM9vPtWergsPKxo zZ&X9OO)xPkmY Date: Thu, 27 Jun 2024 19:45:55 +0200 Subject: [PATCH 24/27] update --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 73ec34ab3..ab163184f 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,6 @@ result: ##### Function 2: word_break in word_break.py -link to commit in founction: [Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 ) result: From 87d3ac6672bee1d5ac0e82da2311df46a7cce5fd Mon Sep 17 00:00:00 2001 From: almuthana Date: Thu, 27 Jun 2024 19:52:50 +0200 Subject: [PATCH 25/27] add --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab163184f..d663206f5 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Link to commit:(same as for the first one) Screenshot of branch measurement: ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e) -#### Almuthana Almustafa +#### Almuthana Almustafa ##### Function 1: stoogsort in stoog_sort.py From a111b488298a739b8e55eb04e35ae2548fa35e3c Mon Sep 17 00:00:00 2001 From: almuthana Date: Thu, 27 Jun 2024 19:57:58 +0200 Subject: [PATCH 26/27] add --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d663206f5..29b1dd8a7 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ In order to not put in 8 large images, I will insert the final screenshot, with #### Ayman Errahmouni + ##### Function 1: simplify_path_v2 [Link the commit](https://github.com/CatalinAnt/algorithms-SEP-95/pull/2/commits/22ee6fa1df4785596c603af61a725c558973eb0b) @@ -75,7 +76,8 @@ result: ![alt text](WB_befor1.png) -#### Abdullah Abdelkhalik + +#### Abdullah Abdelkhalik ##### Function 2: pythagoras From fe43c21d6deb97ce9f492fed1c372b6f6f9bb468 Mon Sep 17 00:00:00 2001 From: almuthana Date: Thu, 27 Jun 2024 22:17:12 +0200 Subject: [PATCH 27/27] add --- README.md | 123 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 71 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 29b1dd8a7..6535120fc 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,13 @@ We have used coverage.py to measure the cover of our chosen project. After insta run the tool by typing coverage run --branch -m pytest tests. Afterwards, we use coverage report to generate the report. Later, Ayman has written a scrip to run the commands in a single script, and to also skip the test files, which don't need to be tested. In order to not put in 8 large images, I will insert the final screenshot, with the total branch coverage: - ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/f1cd3fab-b00c-4cd0-89d0-6452e7ed1a63) + ### Your own coverage tool #### Ayman Errahmouni - ##### Function 1: simplify_path_v2 [Link the commit](https://github.com/CatalinAnt/algorithms-SEP-95/pull/2/commits/22ee6fa1df4785596c603af61a725c558973eb0b) @@ -58,7 +57,7 @@ Link to commit:(same as for the first one) Screenshot of branch measurement: ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e) -#### Almuthana Almustafa +#### Almuthana Almustafa ##### Function 1: stoogsort in stoog_sort.py @@ -66,56 +65,24 @@ Screenshot of branch measurement: result: -![alt text](SS_befor1.png) +![alt text](result_image-2.png) ##### Function 2: word_break in word_break.py +link to commit in founction: [Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 ) result: -![alt text](WB_befor1.png) - - -#### Abdullah Abdelkhalik - -##### Function 2: pythagoras - -https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 - -![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/c61bff67-be7e-4bd2-b892-0a0f2dada1f3) - -##### Function 2: first_unique_char - -https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658 - -![first_unique_char_hits (2)](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/8c1b704e-cadb-4f54-aea7-795005348538) +![alt text](result_image_2.png) ## Coverage improvement ### Individual tests - +## Ayman Errahmouni - - - - - - - - - - - - - - - - -#### Ayman Errahmouni - -##### +#### An enhanced existing test @@ -134,7 +101,7 @@ By added additional tests that use such cases, the coverage improved. The test was also faulty on windows (i guess linux was assumed), so i added support for that in the test. (It now passes on Windows 10 too) -##### +#### An new test. (before, `insertion_sort` was not present in any test) @@ -154,7 +121,7 @@ New coverage:
-#### Catalin Antonescu +## Catalin Antonescu Test 1: @@ -187,15 +154,18 @@ Old coverage: ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e) ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/a97a2bd6-c69e-4435-a8e2-bbdefc429bd1) + New coverage: ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/7cc337eb-5684-40b3-aedd-dc2b7180b7f3) ![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/2143adff-e0aa-4113-858a-0c92ec288d20) For rotate_image, thre was a 33% coverage improvement with the existing tool and 25% with manual tool. -#### Almuthana Almustafa +## Almuthana Almustafa + +### Test 1: stoogsort + -##### Test 1: stoogsort link to commit in test files: [Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) @@ -208,11 +178,9 @@ existing tool result after: ![alt text](stoog_sort_image2.png) -![alt text](result_image-2.png) - The coverage increased by 89%, largely attributable to the implementation of new tests. -##### Test 2: word_break +### Test 2: word_break [Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97) @@ -224,13 +192,54 @@ existing tool result after: ![alt text](word_break_image2.png) -![alt text](result_image_2.png) - The coverage improved by 86% due to the creation of new tests. + + + + + + + + + + + + + + + + + + + + + + + #### Abdullah Abdelkhalik -#### Improvements + +pythagoras + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303 + +![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/c61bff67-be7e-4bd2-b892-0a0f2dada1f3) + + + + +first_unique_char + +https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658 + +![first_unique_char_hits (2)](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/8c1b704e-cadb-4f54-aea7-795005348538) + + + + + +## Improvements test_maths @@ -252,6 +261,18 @@ https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e748 The coverage is improved by 13%, the code only hit three out of five branches and only set up two examples. I added a case where there is no unique letter. + + + + + + + + + + + + ### Overall @@ -279,5 +300,3 @@ Cataline -> Instrumentation was added to two functions, and the tests for these - -