Package: algorithms
Pythonic Data Structures and AlgorithmsMinimal and clean example implementations of data structures and algorithms in Python 3.ContributingThanks for your interest in contributing! There are many ways to contribute to this project.Get started hereTestsUse unittestFor running all tests write down:$ python3 -m unittest discover testsFor running some specific tests you can do this as following (Ex: sort):$ python3 -m unittest tests.test_sortUse pytestFor running all tests write down:$ python3 -m pytest testsInstallIf you want to use the API algorithms in your code, it is as simple as:$ pip3 install algorithmsYou can test by creating a python file: (Ex: usemerge_sortinsort)fromalgorithms.sortimportmerge_sortif__name__=="__main__":my_list=[1,8,3,5,6]my_list=merge_sort(my_list)print(my_list)UninstallIf you want to uninstall algorithms, it is as simple as:$ pip3 uninstall -y algorithmsList of Implementationsarraysdelete_nthflattengaragejosephus_problemlimitlongest_non_repeatmax_ones_indexmerge_intervalsmissing_rangesplus_onerotatesummarize_rangesthree_sumtrimmeantop_1two_summove_zerosn_sumautomataDFAbacktrackgeneral_solution.mdadd_operatorsanagramarray_sum_combinationscombination_sumfactor_combinationsgenerate_abbreviationsgenerate_parenthesisletter_combinationpalindrome_partitioningpattern_matchpermutepermute_uniquesubsetssubsets_uniquebfsmaze_searchshortest_distance_from_all_buildingsword_ladderbitadd_bitwise_operatorbit_operationbytes_int_conversioncount_flips_to_convertcount_onesfind_differencefind_missing_numberflip_bit_longest_sequencepower_of_tworeverse_bitssingle_numbersingle_number2single_number3subsetsswap_pairhas_alternative_bitinsert_bitremove_bitbinary_gapcompressionhuffman_codingrle_compressioneliasdfsall_factorscount_islandspacific_atlanticsudoku_solverwalls_and_gatesdistributionhistogramdpbuy_sell_stockclimbing_stairscoin_changecombination_sumegg_drophouse_robberint_dividejob_schedulingknapsacklongest_increasingmatrix_chain_ordermax_product_subarraymax_subarraymin_cost_pathnum_decodingsregex_matchingrod_cutword_breakfibonaccihosoya trianglegraphcheck_bipartitestrongly_connectedclone_graphcycle_detectionfind_all_cliquesfind_pathgraphdijkstramarkov_chainminimum_spanning_treesatisfiabilityminimum_spanning_tree_primstarjantraversalmaximum_flowmaximum_flow_bfsmaximum_flow_dfsall_pairs_shortest_pathbellman_fordCount Connected Componentsheapmerge_sorted_k_listsskylinesliding_window_maxbinary_heapk_closest_pointslinkedlistadd_two_numberscopy_random_pointerdelete_nodefirst_cyclic_nodeis_cyclicis_palindromekth_to_lastlinkedlistremove_duplicatesreverserotate_listswap_in_pairsis_sortedremove_rangemaphashtableseparate_chaining_hashtablelongest_common_subsequencerandomized_setvalid_sudokuword_patternis_isomorphicis_anagrammathspowerbase_conversioncombinationcosine_similaritydecimal_to_binary_ipeuler_totientextended_gcdfactorialgcd/lcmgenerate_strobogrammticis_strobogrammaticmodular_exponentialnext_biggernext_perfect_squarenth_digitprime_checkprimes_sieve_of_eratosthenespythagorasrabin_millerrsasqrt_precision_factorsumming_digitshailstonerecursive_binomial_coefficientfind_orderfind_primitive_rootdiffie_hellman_key_exchangematrixsudoku_validatorbomb_enemycopy_transformcount_pathsmatrix_exponentiationmatrix_inversionmatrix_multiplicationrotate_imagesearch_in_sorted_matrixsparse_dot_vectorsparse_mulspiral_traversalcrout_matrix_decompositioncholesky_matrix_decompositionsum_sub_squaresqueuesmax_sliding_windowmoving_averagequeuereconstruct_queuezigzagiteratorsearchbinary_searchfirst_occurrencelast_occurrencelinear_searchsearch_inserttwo_sumsearch_rangefind_min_rotatesearch_rotatejump_searchnext_greatest_letterinterpolation_searchsetrandomized_setset_coveringfind_keyboard_rowsortbitonic_sortbogo_sortbubble_sortbucket_sortcocktail_shaker_sortcomb_sortcounting_sortcycle_sortgnome_sortheap_sortinsertion_sortmeeting_roomsmerge_sortpancake_sortpigeonhole_sortquick_sortradix_sortselection_sortshell_sortsort_colorsstooge_sorttop_sortwiggle_sortstacklongest_abs_pathsimplify_pathstackvalid_parenthesisstutterswitch_pairsis_consecutiveremove_minis_sortedstringsfizzbuzzdelete_reoccurringstrip_url_paramsvalidate_coordinatesdomain_extractormerge_string_checkeradd_binarybreaking_baddecode_stringencode_decodegroup_anagramsint_to_romanis_palindromelicense_numbermake_sentencemultiply_stringsone_edit_distancerabin_karpreverse_stringreverse_vowelreverse_wordsroman_to_intword_squaresunique_morsejudge_circlestrong_passwordcaesar_ciphercheck_pangramcontain_stringcount_binary_substringrepeat_stringmin_distancelongest_common_prefixrotatefirst_unique_charrepeat_substringatbash_cipherlongest_palindromic_substringknuth_morris_pratttreebstarray_to_bstbst_closest_valueBSTIteratordelete_nodeis_bstkth_smallestlowest_common_ancestorpredecessorserialize_deserializesuccessorunique_bstdepth_sumcount_left_nodenum_emptyheightred_black_treered_black_treesegment_treesegment_treeiterative_segment_treetraversalinorderlevel_orderpostorderpreorderzigzagtrieadd_and_searchtrieb_treebinary_tree_pathsbin_tree_to_listdeepest_leftinvert_treeis_balancedis_subtreeis_symmetriclongest_consecutivelowest_common_ancestormax_heightmax_path_summin_heightpath_sumpath_sum2pretty_printsame_treetreeunixpathjoin_with_slashfull_pathsplitsimplify_pathunionfindcount_islandsContributorsThanks toall the contributorswho helped in building the repo.