Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upupdate logo path #382
update logo path #382
Conversation
Pull Request Test Coverage Report for Build 697
|
* simplefied the calculation of the mid. * Add stutter.py to stack * Add switch_pairs.py to stack * Add is_consecutive.py to stack * Add remove_min.py to stack * Add is_sorted to stack * Added a test suite and change the division operator from / to //. * added a class-framework and a toString() method. At the end of the file a simple test case. * renamed the methods * added a simple tes case , main() method * added test suite (unittest) * changed style * Add unittest to sort * Implement binary heap * changed xrange to range * fixed merge_sort.py * fixed insertion_sort.py. * fixed selection_sort.py * Create merge_string_checker.py * Update README.md * Create merge_string_checker.py PR changes. * Update merge_string_checker.py * Update merge_string_checker.py * Implement bst tree * Update first_occurance.py The earlier code fails to output the right index for following input: (Note that the first value '1' is repeated) array = [1, 1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 6, 6, 6] firstOccurance(array, 1) * Update bst.py Removing redundant checks moving root is None check in recur_search/recur_size. Similar change could be done in recur_insert. ```python def insert(self,data): self.root = self.recur_insert(self.root, data) def recur_insert(self, root, data): if root is None: return Node(data) if root.data == data: return # Do Nothing elif data < root.data: root.left = self.recur_insert(root.left, data) else: root.right = self.recur_insert(root.right, data) ``` * Update first_occurance.py Incorporated review comments for keon#206 * Update first_occurance.py Address Keon Review comments. * Update first_occurance.py Fixing the infinite loop. It is good idea to keep the following loop condition always in binary search and incorporating additional conditions if required within the while lo <= hi: loop instead of writing multiple variants as https://leetcode.com/articles/introduction-to-binary-search/ lo, hi = 0, len(array) - 1 * Add depth_sum to bst * Add count_left_node.py to bst * Fix typo example in bst * Add num_empty.py to bst * Add height.py to bst * Update first_occurance.py Update the calculation of mid to the following instead of doing mid = lo + (hi-lo)//2 as python does not have overflow issues unlike other langauges c, c++, java,... mid = (lo+hi)//2 * typo in josephus * moving tests and PEPE 8 fixes in flatten.py * created test_array.py for all unittests in array/ module * add .travis.yml for Travis CI config * update README for pytest (now we can run tests by command pytest) * some refactor * add requirements.txt * add .cache to .gitignore * Update Maintainers List add @SaadBenn and @danghai * Delete lastfailed * fixing errors and some refactoring * fixed all errors :) * Add domain_extractor.py * Update README.md * Add sudoku_validator.py * Update README.md Add sudoku_validator to the content table. * Fix missing close parentheses * Add status badges of built to README * Test maths (keon#220) * added test suite for base_conversion.py * added test suite for extended_gcd.py * improved the code of the gcd-function * added test suite for gcd.py * fixed a bug in the function strobogrammaticInRange(...) * removed the print * added test suite for generate_strobogrammatic.py * added variables for the lengths * added test suite for is_strobogrammatic.py * renamed the function find_next_square(...) * added test suite for the file next_perfect_square.py * test for the file primes_sieve_of_eratosthenes.py * test for the file prime_test.py * test for the file pythagoras.py * test for the file rabin_miller.py * added a docstring * fixed my assert * added test for the file rsa.py * added random.seed() in genprime(k) * fixed rsa encryption * fixed rsa.py * Separate test case for sort (keon#222) * Add test_sort.py and separate test for bubble sort * Separate test for comb_sort * Add separate test for counting_sort * Separate test for heap_sort * Separate test for insertion_sort * Separate test for merge_sort * Separate test for quick_sort * Separate test for selection_sort * remove unused import * removed unused import * update information in CONTRIBUTING.md * added some informations * added a sentence * added seed in maths/rsa.py and pep8 fixes in test_maths.py * Update rabin_miller.py * Separate test for bit (keon#230) * Add test_bit to bit * Separate test for add_bitwise_operator * Separate test for count_ones * Separate test for find_missing_number * Separate test for power_of_two * Separate test for reverse_bits * Separate test for single_number * Separate test for single_number2 * Separate test for subsets * Refactor Tarjan (keon#231) * Place tarjan's graph helpers at graph.py for reuse * Transforms tarjan algorithm into class * Add tarjan's examples as test cases * Comment out testing lines * rewrote math.rsa test and commented it out * added a new test. * comment out * removed import math * Add strings/strip_url_params file. (keon#232) * Add strip_url_params function. The function removes duplicate query strings based off of an optional argument passed to the function. * Fix indentation error in strip_url_params.py * Import urlparse library in strip_url_param * Update README.md by adding strip_url_params.py * added the changes I requested on the review. - refactored names of urllib - add separate testcase for all 3 algorithms - renamed algorithms * Add name's collaborators to CONTRIBUTING.md * Separate test for linkedlist * Add merge_two_list to linkedlist * Add separate test for is_palindrome * Add algorithm that tests knowledge of strings (keon#234) * Add a function that validates latitude and longitude. * Update README.md by adding validate_coordinates.py * Fix indentation error * Fix indentation errors and follow PEP8 * Add import statement for unittest * Fix function names * Add delete_reocurring_characters * Update README.md by adding delete_reoccuring_char * Add PR review changes * Separate test for search, and add some problem (keon#233) * Separate test for search * Add search_insert to search * Add two_sum to search * Add search_range to search * Add binary search recursion to search * Add find_min_rotate to search * Add search_rotate to search * Add problem search to README.md * Add SeparateChainingHashTable implementation (keon#236) * Add SeparateChainingHashTable implementation * Optimize the SeparateChainingHashTable code * Update Readme docs * Add is_palindrome variations (keon#238) * Add variations to is_palindrome.py * Move all test into a separate test folder (keon#239) * Move all test into tests folder * Add unittest in travis * Add the way testing to README * Add __init__ for each folder test * Add pytest to README and travis * move test_search to tests * move test_array to tests * Avl tree implementation * Add a function that sanitizes the string in is_palindrome.py * fix the error in is_palindrome (keon#249) * fix the error in is_palindrome * Import string module * add import string * move tests for maths -> tests/test_maths.py (keon#248) * naming convention fixes in many files (keon#250) * Fix test Fixed keon#247 * Add heap and stack to test (keon#245) * Add test_stack io tests * Add test_heap to test * Add init file to graph module * Move graph tests to correct folder * Add comparison magic methods for Node objects * Sort each SCC for standardization * Tests for the module strings (keon#255) * changed line with // operator * added test for add_binary.py * changed formatting * added test for file breaking_bad.py * added test for the file decode_string.py * added test suite for the file delete_reoccurring.py * changed formatting * added test suite for the file domain_extractor.py * renamed the functions of the file domain_extractor.py * added test suite for encode_decode.py * removed the surrounding class. * added test suite for the file group_anagrams.py * added a new line * added test suite for the file int_to_roman.py * added test suite for the file is_palindrome.py * added a test suite for the file license_number.py * added a test suite for the file make_sentence.py * changed the description * added test suite for the file merge_string_checker.py * added test suite for the file multiply_strings.py * added test for one_edit_distance.py * added test for the file rabin_karp.py * added test suite for the file reverse_string.py * added test for the file reverse_vowel.py * added test for reverse_words * added test for roman_to_int.py * added a test for the file strip_urls_params.py * remove inline test * added test for validate_coordinates.py * added test for the file word_squares.py * Add some bit manipulation (keon#253) * Add bit_operation to bit * Add swap_pair to bit * Add find_difference to bit * Add has_alternative_bit to bit * add another method for has_alternative_bit() * test for another method * corrected typo in spelling * Add insertion to bit * Add remove_bit to bit * Add fizzbuzz.py in strings folder * Add fizzbuzz.py to README.md The algorithm is in strings folder of the repo. * add single_number3: find two elements that appear only once (keon#260) * add single_number3: find two elements that appear only once * update README.md - add single_number3 * update single number 3 * Add coverall to algorithms (keon#261) * Add coverall to Algorithms * Add .coverage to gitignore * Fix prime_test in tests.math * Add coveral badge to README * Change the prime_test to prime_check * added fibonacci * added print * Update quick_sort.py Correct the best case time complexity * Delete temporary.md (keon#267) * Add test_queue to tests (keon#262) * typo fix (keon#269) * Python packaging locally (keon#268) * Python packaging locally * Add check install and uninstall package to Travis * Add priority queue implementation using lists * Fix minor typo in README * add Dijkstra's and OrderedStack (keon#270) * Dijkstra's single source shortest path algorithm * Update dij.py provided test case * Create orderedStack.py Stack that is always sorted in order highest to lowest. Can be applied in e-mail/messages application to display latest messages at the top. * Update and rename dij.py to dijkstra.py * Update orderedStack.py Made suggested changes * Update orderedStack.py * Modify the orderedStack and add unittest * Update dijkstra.py * Update dijkstra.py * Update dijkstra.py * Update dijkstra.py * Update dijkstra.py * Update dijkstra.py corrected indentation * Update ordered_stack.py Forgot to remove return statement from push function. I needed it in one of my programs. Removed. Removed redundant brackets * Update test_stack.py * Update test_stack.py * Update priority_queue.py (keon#273) * Update priority_queue.py - refactor `insert` and `delete` -> `push` and `pop`. Because `pop` seems more natural while returning the deleted item (rather than `delete`) - `push` now takes data and priority(optional), and constructs a `PriorityQueueNode` inside the method for inserting. This simplifies the usage. - used `collections.deque()` for O(1) popleft operation. - add `__repr__` method. * Add unittest for PriorityQueue * update readme for chinese students (keon#276) * update readme * update .gitgnore * Update README_CN.md * Update README_CN.md * Update README.md * added a iterative version * changed the README.md * added a precondition with assert * added a german redame and changed the main-readme * changed something * Add is_rotated.py (keon#281) * Add tests for is_rotated * Add is_rotated.py * Conforms to PEP8 * Add empty string test to is_rotated * Updated summing_digits to not override a built-in python function (keon#283) * Update bst.py (keon#284) * update quicksort (keon#285) * add doc string * when input array type is np.array, output array type is the same rather than list * wrap the sorting function * modified the code according to the pep8 specification * use // instead of int() * add extra 2 argument to pass test * delete two arguments of quick sort and reformat test_sort.py * fix a small bug in quick_sort * reorganize arrays * reorganize linkedlist * reorganize backtrack * reorganize bfs * reorganize dfs * reorganize dp * reorganize graph * reorganize heap * reorganize map * reorganize maths * reorganize matrix * reorganize queue * reorganize search * reorganize set * reorganize sort * reorganize stack * reorganize strings * reorganize bit * reorganize tree * reorganize other files * README.md: Update python packaging following reorganize * Created README and CONTRIBUTING files in Japanese (keon#289) * Create CONTRIBUTING_JP.md * Create README_JP.md * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_JP.md * README.md: Update the link after reorganization * README_CN.md: Update the link after reorganization * README_GE.md: Update the link after reorganization * added bucket_sort.py & shell_sort.py (keon#296) * Create bucket_sort.py * Create shell_sort.py * Update test_sort.py * Update __init__.py * add some bit problems (keon#294) * add arrays/max_ones_index * add 2 algorithms to algorithms/bit * update all READMEs * Update README for bucket and shell sort (keon#298) * Update README.md * Update README_JP.md * Update README_JP.md * Update README_GE.md * Update README_CN.md * FIX README.md to correct link for the Arrays / Josephus Problem (keon#299) * Corrected link to Arrays/Josephus Problems (keon#300) * Update README_JP.md * Update README_CN.md * Update README_GE.md * Create README_KR.md file that is korean translation of README.md (keon#297) * Create README_KR.md * Added link to Korean README file in other README files (keon#302) * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Created combination.py in maths (keon#304) * Create combination.py * Update __init__.py * Update test_maths.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Created radix_sort.py in algorithms/sort (keon#303) * Create radix_sort.py * Update test_sort.py * Update __init__.py * Update radix_sort.py * Update radix_sort.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Zhengli0817 patch 1 - update topsort.py (keon#295) * Update bst.py * Update topsort.py The original algo is wrong because it is using BFS, it should use DFS instead. A counter-example is provided below: depGraph = { "a" : [ "b" ], "b" : [ "c" ], "c" : [ 'e'], 'e' : [ 'g' ], "d" : [ ], "f" : ["e" , "d"], "g" : [ ] } given = [ "b", "c", "a", "d", "e", "f", "g" ] The output of ret_dep_graph() is: ['e', 'g', 'c', 'b', 'a', 'd', 'f'] Clearly, 'g' has to be done before 'e'. * Update topsort.py * Update topsort.py The original algo in topsort.py is wrong because it is using BFS, it should use DFS instead. A counter-example is provided below: depGraph = { "a" : [ "b" ], "b" : [ "c" ], "c" : [ 'e'], 'e' : [ 'g' ], "d" : [ ], "f" : ["e" , "d"], "g" : [ ] } given = [ "b", "c", "a", "d", "e", "f", "g" ] The output of ret_dep_graph() is: ['e', 'g', 'c', 'b', 'a', 'd', 'f'] Clearly, 'g' has to be done before 'e'. * Update topsort.py * Create __init__.py * Update __init__.py * Update __init__.py * Create test_topsort.py * Update topsort.py * Update test_topsort.py * Update __init__.py * Update and rename topsort.py to top_sort.py * Update top_sort.py * Update __init__.py * Update test_topsort.py * Created CONTRIBUTING_KR.md in Korean (keon#290) * Update CONTRIBUTING_KR.md * Create linear_search.py in algorithms/search (keon#305) * Create linear_search.py * Update linear_search.py * Update linear_search.py * Update README.md * Update README.md * Update test_search.py * Update __init__.py * Created jump_seach in algorithms/seach (keon#301) * Add files via upload * Update __init__.py * Update test_search.py * Create README_KR.md * Update README_KR.md * Update jump_search.py * Update jump_search.py * Update test_search.py * Update jump_search.py * Update README_KR.md update jump search * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Added link to linear search in all README files (keon#307) * Update README_CN.md Added linear_search.py * Update README_GE.md * Update README_JP.md * Update README_KR.md * Created factorial.py in algorithms/maths (keon#309) * Create factorial.py * Update __init__.py * Update test_maths.py * Update test_maths.py I added TestFactorial, also modified TestCombination comment. * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_maths.py * Update factorial.py * Created bogo_sort.py in algorithms/sort (keon#308) * Create bogo_sort.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_sort.py * Update __init__.py * Update test_sort.py * Update test_sort.py * Update bogo_sort.py * Update bogo_sort.py * Fixed links in README files (keon#312) * Update README_CN.md * Update README.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Add documentation template (keon#314) * add docs template * add logo * create documentation template * Added link to OS Helpers, Build Status, and Coverage Status in README files. (keon#316) * Update README_CN.md * Update README_JP.md * Update README_KR.md * Created PULL_REQUEST_TEMPLATE.md (keon#311) * Create PULL_REQUEST_TEMPLATE.md * review change * Create cocktail_shaker_sort and add test case (keon#310) * Create cocktail_shaker_sort.py * Update __init__.py * Update test_sort.py * Update test_sort.py * Update README.md * Update README_CN.md * Update README_CN.md * Update README.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * add to python package index (keon#320) * Created gnome sort in sort algorithm (keon#313) * Create gnome_sort.py * Update __init__.py * Update test_sort.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update gnome_sort.py * clean up backtrack and move tests to test_backtest (keon#306) * clean up backtrack and add tests * fix typos in backtrack * add type of desc. as markdown (keon#324) fixes keon#322 * Create bitonic_sort.py in /algorithms/sort/ and update test_sort, __init__ and all README files (keon#317) * Create bitonic_sort.py * Update __init__.py * Update test_sort.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update bitonic_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Update test_sort.py * Update test_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Added simulation in bubble sort (keon#327) * Update bubble_sort.py * Update bubble_sort.py * Update bubble_sort.py * Update bubble_sort.py * logo update in all READMEs (keon#329) * add logo in README_CN * Update README_GE.md * Update README_JP.md * Update README_KR.md * WIP: Fix some issues in Travis and add more python env (keon#323) * Requirements.txt: Add requirements dependency for algorithms * Update cache in travis * Switch to use tox and add more env in python for testing * Add MANIFEST.in file * fix travis issue (#1) * Add TODO to PriorityQueue * Update tree.md (keon#332) * add PyPI badge to READMEs (keon#334) * add PyPI badge to READMEs * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Created pancake_sort.py in algorithms/sorts (keon#336) * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_sort.py * Create pancake_sort.py * Update __init__.py * Created cycle_sort.py in algorithms/sort (keon#338) * Create cycle_sort.py * Update test_sort.py * Update __init__.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Added simulation features in insertion & selection sorts (keon#333) * Added simulation feature * Added simulation feature * Update insertion_sort.py * Update selection_sort.py * Update insertion_sort.py * Update selection_sort.py * Update bubble_sort.py * Update bubble_sort.py * Update insertion_sort.py * Update selection_sort.py * refactored variable names (keon#340) * fixed all relevant camelcase names I've seen up to 'graph' folder * fixed all instances of camelcase I noted up to 'linkedlist' folder * removed all noted camelcase up to queues folder * removed any camelcase I saw up through 'search' folder and changed 'occurance' to 'occurrence' * removed all noted camelcase up to 'trees' folder and changed 'dictionarys' to 'dictionaries' * removed all noted camelcase from 'algorithms' folder and made minor spelling changes throughout * changed setup back to setUp in relevent bst-related algos * fixed the missed curr_len in longest_abs_path.py * Update README_JP.md (keon#341) * Add decimal_to_binary_ip.py (keon#339) * Add decimal_to_binary_ip.py Converts dotted_decimal ip address to binary ip address. * Include tests for decimal_to_binary_ip Some tests cases for decimal_to_binary_ip function. * Fix TestDecimalToBinaryIP method name changed method from test_int2base to test_decimal_to_binary_ip * Import decimal_to_binary_ip Added decimal_to_binary_ip to imports * Update README.md Add to decimal_to_binary_ip * resolve conflicts in test_maths * Created BFS maze_search.py and test case (keon#343) * Create maze_search.py * Create test_bfs.py * Create __init__.py * Update README.md * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_bfs.py * Update maze_search.py * Update __init__.py * Update test_bfs.py * Update test_bfs.py * Update maze_search.py * Update maze_search.py * Update test_bfs.py * Update maze_search.py * Create top_1.py * Create trimmean.py * Delete trimmean.py * Delete top_1.py * top_1.py & trimmean.py created (keon#345) * Create top_1.py * Create trimmean.py * Rename top_1.py to algorithms/arrays/top_1.py * Rename trimmean.py to algorithms/arrays/trimmean.py * Update __init__.py * Update README.md * Update README_CN.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_array.py * Update test_array.py * Update test_array.py * Created check_bipartite.py in algorithms/graph + test cases (keon#347) * Update __init__.py * Update test_graph.py * Create check_bipartite.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update check_bipartite.py * Update check_bipartite.py * refactor PriorityQueue and tests (keon#348) * added some path problems in new algorithms/unix/ (keon#344) * Add join_with_slash.py to Unix * Add full_path.py to Unix * Add split.py to Unix * Created Preorder & Postorder traversals in tree (keon#346) * Create postorder.py * Create preorder.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update inorder.py * Update postorder.py * Update preorder.py * Create __init__.py * Update preorder.py * Update postorder.py * Create test_tree.py * Update test_tree.py * Update __init__.py * Update __init__.py * Update test_tree.py * added simulation code in quick_sort and heap_sort (keon#342) * Update quick_sort.py * Update heap_sort.py * Update heap_sort.py * Update quick_sort.py * Update heap_sort.py * Update quick_sort.py * remove `tests/*` from MANIFEST.in (keon#354) - fix keon#350 * created limit.py in /algorithms/arrays (keon#353) * Create top_1.py * Create trimmean.py * Rename top_1.py to algorithms/arrays/top_1.py * Rename trimmean.py to algorithms/arrays/trimmean.py * Update __init__.py * Update README.md * Update README_CN.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_array.py * Update test_array.py * Update test_array.py * Create limit.py * Update __init__.py * Update test_array.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_array.py * Update limit.py * Update test_array.py * added radix sort for simulation (keon#351) * added simulation to bogo_sort.py (keon#355) * Added some String algorithm (keon#356) * Add unique morse * Add judge_circle * Add strong password * added combination_memo.py using memoization (keon#358) * Update combination.py * Update test_maths.py * fixed test_maths.py * update function combination_memo * update test of combination_memo * Add some String solution (keon#359) * Add unique morse * Add judge_circle * Add strong password * Add caesar cipher * Add contain string * Add count binary substring * Fix conflict * Correction in README files (keon#360) * added exponential and some refactors to maths/ (keon#361) * added maths/modular_exponential.py and tests * cleared the requirements.txt * refactor math/factorial * refactor prime_check and sieve * added test_requirements.txt for travis * Added some solution (keon#362) * Add simplify path * Add repeat string * keon#256 change strip_url_params3 to use OrderedDict to prevent failing test on non deterministic retrieval of dict keys for query string (keon#367) * Revert "keon#256 change strip_url_params3 to use OrderedDict to prevent failing test on non deterministic retrieval of dict keys for query string (keon#367)" (keon#368) This reverts commit 81e7853. * Implemented n sum (keon#365) * Implement N sum * Add N sum test * Add docstring * Add n num link * Rearrange code * Fix import error * Move functions to inner * Fix coding style * Rename * Separate logic * Add advanced usage example * Add test * Fix error: cannot hash list object when user's nums is a list of list * Add parameters docstring * Created README file in Brazilian Portuguese (keon#370) * Created README file in Brazilian Portuguese * Added link to README_PTBR.md * Corrected language title (keon#372) * added text_justification with tests (keon#371) * add text_justification and test text_justification * add text_justification and test text_justification * PR to add some problem. (keon#375) * Add next_greatest_letter to search * Move top sort test into test_sort * Add min_distance to string * Add binary_gap to bit * Logo Designs (keon#376) * Create add * Add files via upload * Update README.md * Update README.md * Update README.md * Remove undesirable output on runnint tests Fixed keon#377 * Update logo for all README * added nearest neighbor algorithm * changed the readme * changed variable names * renamed the directory * added a test. removed test cases. renamed directory * added test for distance(...) * added empty lines * removed math. added numpy.inf * update logo path (keon#382) * fix typo (keon#385) fix typo * Add test for map (keon#386) * removed numpy * Replace min.inf by float(inf) * PR to add some problem (keon#378) * Add longest_common_prefix to string * Add brute force way for is_rotated, add rotate to string * Add first_unique_char to string * Add repeat_substring to string * generate_parenthesis (keon#384) * generate_parenthesis * format
* simplefied the calculation of the mid. * Add stutter.py to stack * Add switch_pairs.py to stack * Add is_consecutive.py to stack * Add remove_min.py to stack * Add is_sorted to stack * Added a test suite and change the division operator from / to //. * added a class-framework and a toString() method. At the end of the file a simple test case. * renamed the methods * added a simple tes case , main() method * added test suite (unittest) * changed style * Add unittest to sort * Implement binary heap * changed xrange to range * fixed merge_sort.py * fixed insertion_sort.py. * fixed selection_sort.py * Create merge_string_checker.py * Update README.md * Create merge_string_checker.py PR changes. * Update merge_string_checker.py * Update merge_string_checker.py * Implement bst tree * Update first_occurance.py The earlier code fails to output the right index for following input: (Note that the first value '1' is repeated) array = [1, 1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 6, 6, 6] firstOccurance(array, 1) * Update bst.py Removing redundant checks moving root is None check in recur_search/recur_size. Similar change could be done in recur_insert. ```python def insert(self,data): self.root = self.recur_insert(self.root, data) def recur_insert(self, root, data): if root is None: return Node(data) if root.data == data: return # Do Nothing elif data < root.data: root.left = self.recur_insert(root.left, data) else: root.right = self.recur_insert(root.right, data) ``` * Update first_occurance.py Incorporated review comments for keon#206 * Update first_occurance.py Address Keon Review comments. * Update first_occurance.py Fixing the infinite loop. It is good idea to keep the following loop condition always in binary search and incorporating additional conditions if required within the while lo <= hi: loop instead of writing multiple variants as https://leetcode.com/articles/introduction-to-binary-search/ lo, hi = 0, len(array) - 1 * Add depth_sum to bst * Add count_left_node.py to bst * Fix typo example in bst * Add num_empty.py to bst * Add height.py to bst * Update first_occurance.py Update the calculation of mid to the following instead of doing mid = lo + (hi-lo)//2 as python does not have overflow issues unlike other langauges c, c++, java,... mid = (lo+hi)//2 * typo in josephus * moving tests and PEPE 8 fixes in flatten.py * created test_array.py for all unittests in array/ module * add .travis.yml for Travis CI config * update README for pytest (now we can run tests by command pytest) * some refactor * add requirements.txt * add .cache to .gitignore * Update Maintainers List add @SaadBenn and @danghai * Delete lastfailed * fixing errors and some refactoring * fixed all errors :) * Add domain_extractor.py * Update README.md * Add sudoku_validator.py * Update README.md Add sudoku_validator to the content table. * Fix missing close parentheses * Add status badges of built to README * Test maths (keon#220) * added test suite for base_conversion.py * added test suite for extended_gcd.py * improved the code of the gcd-function * added test suite for gcd.py * fixed a bug in the function strobogrammaticInRange(...) * removed the print * added test suite for generate_strobogrammatic.py * added variables for the lengths * added test suite for is_strobogrammatic.py * renamed the function find_next_square(...) * added test suite for the file next_perfect_square.py * test for the file primes_sieve_of_eratosthenes.py * test for the file prime_test.py * test for the file pythagoras.py * test for the file rabin_miller.py * added a docstring * fixed my assert * added test for the file rsa.py * added random.seed() in genprime(k) * fixed rsa encryption * fixed rsa.py * Separate test case for sort (keon#222) * Add test_sort.py and separate test for bubble sort * Separate test for comb_sort * Add separate test for counting_sort * Separate test for heap_sort * Separate test for insertion_sort * Separate test for merge_sort * Separate test for quick_sort * Separate test for selection_sort * remove unused import * removed unused import * update information in CONTRIBUTING.md * added some informations * added a sentence * added seed in maths/rsa.py and pep8 fixes in test_maths.py * Update rabin_miller.py * Separate test for bit (keon#230) * Add test_bit to bit * Separate test for add_bitwise_operator * Separate test for count_ones * Separate test for find_missing_number * Separate test for power_of_two * Separate test for reverse_bits * Separate test for single_number * Separate test for single_number2 * Separate test for subsets * Refactor Tarjan (keon#231) * Place tarjan's graph helpers at graph.py for reuse * Transforms tarjan algorithm into class * Add tarjan's examples as test cases * Comment out testing lines * rewrote math.rsa test and commented it out * added a new test. * comment out * removed import math * Add strings/strip_url_params file. (keon#232) * Add strip_url_params function. The function removes duplicate query strings based off of an optional argument passed to the function. * Fix indentation error in strip_url_params.py * Import urlparse library in strip_url_param * Update README.md by adding strip_url_params.py * added the changes I requested on the review. - refactored names of urllib - add separate testcase for all 3 algorithms - renamed algorithms * Add name's collaborators to CONTRIBUTING.md * Separate test for linkedlist * Add merge_two_list to linkedlist * Add separate test for is_palindrome * Add algorithm that tests knowledge of strings (keon#234) * Add a function that validates latitude and longitude. * Update README.md by adding validate_coordinates.py * Fix indentation error * Fix indentation errors and follow PEP8 * Add import statement for unittest * Fix function names * Add delete_reocurring_characters * Update README.md by adding delete_reoccuring_char * Add PR review changes * Separate test for search, and add some problem (keon#233) * Separate test for search * Add search_insert to search * Add two_sum to search * Add search_range to search * Add binary search recursion to search * Add find_min_rotate to search * Add search_rotate to search * Add problem search to README.md * Add SeparateChainingHashTable implementation (keon#236) * Add SeparateChainingHashTable implementation * Optimize the SeparateChainingHashTable code * Update Readme docs * Add is_palindrome variations (keon#238) * Add variations to is_palindrome.py * Move all test into a separate test folder (keon#239) * Move all test into tests folder * Add unittest in travis * Add the way testing to README * Add __init__ for each folder test * Add pytest to README and travis * move test_search to tests * move test_array to tests * Avl tree implementation * Add a function that sanitizes the string in is_palindrome.py * fix the error in is_palindrome (keon#249) * fix the error in is_palindrome * Import string module * add import string * move tests for maths -> tests/test_maths.py (keon#248) * naming convention fixes in many files (keon#250) * Fix test Fixed keon#247 * Add heap and stack to test (keon#245) * Add test_stack io tests * Add test_heap to test * Add init file to graph module * Move graph tests to correct folder * Add comparison magic methods for Node objects * Sort each SCC for standardization * Tests for the module strings (keon#255) * changed line with // operator * added test for add_binary.py * changed formatting * added test for file breaking_bad.py * added test for the file decode_string.py * added test suite for the file delete_reoccurring.py * changed formatting * added test suite for the file domain_extractor.py * renamed the functions of the file domain_extractor.py * added test suite for encode_decode.py * removed the surrounding class. * added test suite for the file group_anagrams.py * added a new line * added test suite for the file int_to_roman.py * added test suite for the file is_palindrome.py * added a test suite for the file license_number.py * added a test suite for the file make_sentence.py * changed the description * added test suite for the file merge_string_checker.py * added test suite for the file multiply_strings.py * added test for one_edit_distance.py * added test for the file rabin_karp.py * added test suite for the file reverse_string.py * added test for the file reverse_vowel.py * added test for reverse_words * added test for roman_to_int.py * added a test for the file strip_urls_params.py * remove inline test * added test for validate_coordinates.py * added test for the file word_squares.py * Add some bit manipulation (keon#253) * Add bit_operation to bit * Add swap_pair to bit * Add find_difference to bit * Add has_alternative_bit to bit * add another method for has_alternative_bit() * test for another method * corrected typo in spelling * Add insertion to bit * Add remove_bit to bit * Add fizzbuzz.py in strings folder * Add fizzbuzz.py to README.md The algorithm is in strings folder of the repo. * add single_number3: find two elements that appear only once (keon#260) * add single_number3: find two elements that appear only once * update README.md - add single_number3 * update single number 3 * Add coverall to algorithms (keon#261) * Add coverall to Algorithms * Add .coverage to gitignore * Fix prime_test in tests.math * Add coveral badge to README * Change the prime_test to prime_check * added fibonacci * added print * Update quick_sort.py Correct the best case time complexity * Delete temporary.md (keon#267) * Add test_queue to tests (keon#262) * typo fix (keon#269) * Python packaging locally (keon#268) * Python packaging locally * Add check install and uninstall package to Travis * Add priority queue implementation using lists * Fix minor typo in README * add Dijkstra's and OrderedStack (keon#270) * Dijkstra's single source shortest path algorithm * Update dij.py provided test case * Create orderedStack.py Stack that is always sorted in order highest to lowest. Can be applied in e-mail/messages application to display latest messages at the top. * Update and rename dij.py to dijkstra.py * Update orderedStack.py Made suggested changes * Update orderedStack.py * Modify the orderedStack and add unittest * Update dijkstra.py * Update dijkstra.py * Update dijkstra.py * Update dijkstra.py * Update dijkstra.py * Update dijkstra.py corrected indentation * Update ordered_stack.py Forgot to remove return statement from push function. I needed it in one of my programs. Removed. Removed redundant brackets * Update test_stack.py * Update test_stack.py * Update priority_queue.py (keon#273) * Update priority_queue.py - refactor `insert` and `delete` -> `push` and `pop`. Because `pop` seems more natural while returning the deleted item (rather than `delete`) - `push` now takes data and priority(optional), and constructs a `PriorityQueueNode` inside the method for inserting. This simplifies the usage. - used `collections.deque()` for O(1) popleft operation. - add `__repr__` method. * Add unittest for PriorityQueue * update readme for chinese students (keon#276) * update readme * update .gitgnore * Update README_CN.md * Update README_CN.md * Update README.md * added a iterative version * changed the README.md * added a precondition with assert * added a german redame and changed the main-readme * changed something * Add is_rotated.py (keon#281) * Add tests for is_rotated * Add is_rotated.py * Conforms to PEP8 * Add empty string test to is_rotated * Updated summing_digits to not override a built-in python function (keon#283) * Update bst.py (keon#284) * update quicksort (keon#285) * add doc string * when input array type is np.array, output array type is the same rather than list * wrap the sorting function * modified the code according to the pep8 specification * use // instead of int() * add extra 2 argument to pass test * delete two arguments of quick sort and reformat test_sort.py * fix a small bug in quick_sort * reorganize arrays * reorganize linkedlist * reorganize backtrack * reorganize bfs * reorganize dfs * reorganize dp * reorganize graph * reorganize heap * reorganize map * reorganize maths * reorganize matrix * reorganize queue * reorganize search * reorganize set * reorganize sort * reorganize stack * reorganize strings * reorganize bit * reorganize tree * reorganize other files * README.md: Update python packaging following reorganize * Created README and CONTRIBUTING files in Japanese (keon#289) * Create CONTRIBUTING_JP.md * Create README_JP.md * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_JP.md * README.md: Update the link after reorganization * README_CN.md: Update the link after reorganization * README_GE.md: Update the link after reorganization * added bucket_sort.py & shell_sort.py (keon#296) * Create bucket_sort.py * Create shell_sort.py * Update test_sort.py * Update __init__.py * add some bit problems (keon#294) * add arrays/max_ones_index * add 2 algorithms to algorithms/bit * update all READMEs * Update README for bucket and shell sort (keon#298) * Update README.md * Update README_JP.md * Update README_JP.md * Update README_GE.md * Update README_CN.md * FIX README.md to correct link for the Arrays / Josephus Problem (keon#299) * Corrected link to Arrays/Josephus Problems (keon#300) * Update README_JP.md * Update README_CN.md * Update README_GE.md * Create README_KR.md file that is korean translation of README.md (keon#297) * Create README_KR.md * Added link to Korean README file in other README files (keon#302) * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Created combination.py in maths (keon#304) * Create combination.py * Update __init__.py * Update test_maths.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Created radix_sort.py in algorithms/sort (keon#303) * Create radix_sort.py * Update test_sort.py * Update __init__.py * Update radix_sort.py * Update radix_sort.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Zhengli0817 patch 1 - update topsort.py (keon#295) * Update bst.py * Update topsort.py The original algo is wrong because it is using BFS, it should use DFS instead. A counter-example is provided below: depGraph = { "a" : [ "b" ], "b" : [ "c" ], "c" : [ 'e'], 'e' : [ 'g' ], "d" : [ ], "f" : ["e" , "d"], "g" : [ ] } given = [ "b", "c", "a", "d", "e", "f", "g" ] The output of ret_dep_graph() is: ['e', 'g', 'c', 'b', 'a', 'd', 'f'] Clearly, 'g' has to be done before 'e'. * Update topsort.py * Update topsort.py The original algo in topsort.py is wrong because it is using BFS, it should use DFS instead. A counter-example is provided below: depGraph = { "a" : [ "b" ], "b" : [ "c" ], "c" : [ 'e'], 'e' : [ 'g' ], "d" : [ ], "f" : ["e" , "d"], "g" : [ ] } given = [ "b", "c", "a", "d", "e", "f", "g" ] The output of ret_dep_graph() is: ['e', 'g', 'c', 'b', 'a', 'd', 'f'] Clearly, 'g' has to be done before 'e'. * Update topsort.py * Create __init__.py * Update __init__.py * Update __init__.py * Create test_topsort.py * Update topsort.py * Update test_topsort.py * Update __init__.py * Update and rename topsort.py to top_sort.py * Update top_sort.py * Update __init__.py * Update test_topsort.py * Created CONTRIBUTING_KR.md in Korean (keon#290) * Update CONTRIBUTING_KR.md * Create linear_search.py in algorithms/search (keon#305) * Create linear_search.py * Update linear_search.py * Update linear_search.py * Update README.md * Update README.md * Update test_search.py * Update __init__.py * Created jump_seach in algorithms/seach (keon#301) * Add files via upload * Update __init__.py * Update test_search.py * Create README_KR.md * Update README_KR.md * Update jump_search.py * Update jump_search.py * Update test_search.py * Update jump_search.py * Update README_KR.md update jump search * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Added link to linear search in all README files (keon#307) * Update README_CN.md Added linear_search.py * Update README_GE.md * Update README_JP.md * Update README_KR.md * Created factorial.py in algorithms/maths (keon#309) * Create factorial.py * Update __init__.py * Update test_maths.py * Update test_maths.py I added TestFactorial, also modified TestCombination comment. * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_maths.py * Update factorial.py * Created bogo_sort.py in algorithms/sort (keon#308) * Create bogo_sort.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_sort.py * Update __init__.py * Update test_sort.py * Update test_sort.py * Update bogo_sort.py * Update bogo_sort.py * Fixed links in README files (keon#312) * Update README_CN.md * Update README.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Add documentation template (keon#314) * add docs template * add logo * create documentation template * Added link to OS Helpers, Build Status, and Coverage Status in README files. (keon#316) * Update README_CN.md * Update README_JP.md * Update README_KR.md * Created PULL_REQUEST_TEMPLATE.md (keon#311) * Create PULL_REQUEST_TEMPLATE.md * review change * Create cocktail_shaker_sort and add test case (keon#310) * Create cocktail_shaker_sort.py * Update __init__.py * Update test_sort.py * Update test_sort.py * Update README.md * Update README_CN.md * Update README_CN.md * Update README.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * add to python package index (keon#320) * Created gnome sort in sort algorithm (keon#313) * Create gnome_sort.py * Update __init__.py * Update test_sort.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update gnome_sort.py * clean up backtrack and move tests to test_backtest (keon#306) * clean up backtrack and add tests * fix typos in backtrack * add type of desc. as markdown (keon#324) fixes keon#322 * Create bitonic_sort.py in /algorithms/sort/ and update test_sort, __init__ and all README files (keon#317) * Create bitonic_sort.py * Update __init__.py * Update test_sort.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update bitonic_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Update test_sort.py * Update test_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Update bitonic_sort.py * Added simulation in bubble sort (keon#327) * Update bubble_sort.py * Update bubble_sort.py * Update bubble_sort.py * Update bubble_sort.py * logo update in all READMEs (keon#329) * add logo in README_CN * Update README_GE.md * Update README_JP.md * Update README_KR.md * WIP: Fix some issues in Travis and add more python env (keon#323) * Requirements.txt: Add requirements dependency for algorithms * Update cache in travis * Switch to use tox and add more env in python for testing * Add MANIFEST.in file * fix travis issue (#1) * Add TODO to PriorityQueue * Update tree.md (keon#332) * add PyPI badge to READMEs (keon#334) * add PyPI badge to READMEs * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Created pancake_sort.py in algorithms/sorts (keon#336) * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_sort.py * Create pancake_sort.py * Update __init__.py * Created cycle_sort.py in algorithms/sort (keon#338) * Create cycle_sort.py * Update test_sort.py * Update __init__.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Added simulation features in insertion & selection sorts (keon#333) * Added simulation feature * Added simulation feature * Update insertion_sort.py * Update selection_sort.py * Update insertion_sort.py * Update selection_sort.py * Update bubble_sort.py * Update bubble_sort.py * Update insertion_sort.py * Update selection_sort.py * refactored variable names (keon#340) * fixed all relevant camelcase names I've seen up to 'graph' folder * fixed all instances of camelcase I noted up to 'linkedlist' folder * removed all noted camelcase up to queues folder * removed any camelcase I saw up through 'search' folder and changed 'occurance' to 'occurrence' * removed all noted camelcase up to 'trees' folder and changed 'dictionarys' to 'dictionaries' * removed all noted camelcase from 'algorithms' folder and made minor spelling changes throughout * changed setup back to setUp in relevent bst-related algos * fixed the missed curr_len in longest_abs_path.py * Update README_JP.md (keon#341) * Add decimal_to_binary_ip.py (keon#339) * Add decimal_to_binary_ip.py Converts dotted_decimal ip address to binary ip address. * Include tests for decimal_to_binary_ip Some tests cases for decimal_to_binary_ip function. * Fix TestDecimalToBinaryIP method name changed method from test_int2base to test_decimal_to_binary_ip * Import decimal_to_binary_ip Added decimal_to_binary_ip to imports * Update README.md Add to decimal_to_binary_ip * resolve conflicts in test_maths * Created BFS maze_search.py and test case (keon#343) * Create maze_search.py * Create test_bfs.py * Create __init__.py * Update README.md * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_bfs.py * Update maze_search.py * Update __init__.py * Update test_bfs.py * Update test_bfs.py * Update maze_search.py * Update maze_search.py * Update test_bfs.py * Update maze_search.py * Create top_1.py * Create trimmean.py * Delete trimmean.py * Delete top_1.py * top_1.py & trimmean.py created (keon#345) * Create top_1.py * Create trimmean.py * Rename top_1.py to algorithms/arrays/top_1.py * Rename trimmean.py to algorithms/arrays/trimmean.py * Update __init__.py * Update README.md * Update README_CN.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_array.py * Update test_array.py * Update test_array.py * Created check_bipartite.py in algorithms/graph + test cases (keon#347) * Update __init__.py * Update test_graph.py * Create check_bipartite.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update check_bipartite.py * Update check_bipartite.py * refactor PriorityQueue and tests (keon#348) * added some path problems in new algorithms/unix/ (keon#344) * Add join_with_slash.py to Unix * Add full_path.py to Unix * Add split.py to Unix * Created Preorder & Postorder traversals in tree (keon#346) * Create postorder.py * Create preorder.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update inorder.py * Update postorder.py * Update preorder.py * Create __init__.py * Update preorder.py * Update postorder.py * Create test_tree.py * Update test_tree.py * Update __init__.py * Update __init__.py * Update test_tree.py * added simulation code in quick_sort and heap_sort (keon#342) * Update quick_sort.py * Update heap_sort.py * Update heap_sort.py * Update quick_sort.py * Update heap_sort.py * Update quick_sort.py * remove `tests/*` from MANIFEST.in (keon#354) - fix keon#350 * created limit.py in /algorithms/arrays (keon#353) * Create top_1.py * Create trimmean.py * Rename top_1.py to algorithms/arrays/top_1.py * Rename trimmean.py to algorithms/arrays/trimmean.py * Update __init__.py * Update README.md * Update README_CN.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_array.py * Update test_array.py * Update test_array.py * Create limit.py * Update __init__.py * Update test_array.py * Update README.md * Update README_CN.md * Update README_GE.md * Update README_JP.md * Update README_KR.md * Update test_array.py * Update limit.py * Update test_array.py * added radix sort for simulation (keon#351) * added simulation to bogo_sort.py (keon#355) * Added some String algorithm (keon#356) * Add unique morse * Add judge_circle * Add strong password * added combination_memo.py using memoization (keon#358) * Update combination.py * Update test_maths.py * fixed test_maths.py * update function combination_memo * update test of combination_memo * Add some String solution (keon#359) * Add unique morse * Add judge_circle * Add strong password * Add caesar cipher * Add contain string * Add count binary substring * Fix conflict * Correction in README files (keon#360) * added exponential and some refactors to maths/ (keon#361) * added maths/modular_exponential.py and tests * cleared the requirements.txt * refactor math/factorial * refactor prime_check and sieve * added test_requirements.txt for travis * Added some solution (keon#362) * Add simplify path * Add repeat string * keon#256 change strip_url_params3 to use OrderedDict to prevent failing test on non deterministic retrieval of dict keys for query string (keon#367) * Revert "keon#256 change strip_url_params3 to use OrderedDict to prevent failing test on non deterministic retrieval of dict keys for query string (keon#367)" (keon#368) This reverts commit 81e7853. * Implemented n sum (keon#365) * Implement N sum * Add N sum test * Add docstring * Add n num link * Rearrange code * Fix import error * Move functions to inner * Fix coding style * Rename * Separate logic * Add advanced usage example * Add test * Fix error: cannot hash list object when user's nums is a list of list * Add parameters docstring * Created README file in Brazilian Portuguese (keon#370) * Created README file in Brazilian Portuguese * Added link to README_PTBR.md * Corrected language title (keon#372) * added text_justification with tests (keon#371) * add text_justification and test text_justification * add text_justification and test text_justification * PR to add some problem. (keon#375) * Add next_greatest_letter to search * Move top sort test into test_sort * Add min_distance to string * Add binary_gap to bit * Logo Designs (keon#376) * Create add * Add files via upload * Update README.md * Update README.md * Update README.md * Remove undesirable output on runnint tests Fixed keon#377 * Update logo for all README * added nearest neighbor algorithm * changed the readme * changed variable names * renamed the directory * added a test. removed test cases. renamed directory * added test for distance(...) * added empty lines * removed math. added numpy.inf * update logo path (keon#382) * fix typo (keon#385) fix typo * Add test for map (keon#386) * removed numpy * Replace min.inf by float(inf) * PR to add some problem (keon#378) * Add longest_common_prefix to string * Add brute force way for is_rotated, add rotate to string * Add first_unique_char to string * Add repeat_substring to string * generate_parenthesis (keon#384) * generate_parenthesis * format
logo path update.
resolves #380