diff --git a/DIRECTORY.md b/DIRECTORY.md index 04b785b2b..e807644b6 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -45,9 +45,11 @@ * [Morse Code Implementation](https://github.com/TheAlgorithms/Python/blob/master/ciphers/morse_code_implementation.py) * [Onepad Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/onepad_cipher.py) * [Playfair Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/playfair_cipher.py) + * [Porta Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/porta_cipher.py) * [Rabin Miller](https://github.com/TheAlgorithms/Python/blob/master/ciphers/rabin_miller.py) * [Rot13](https://github.com/TheAlgorithms/Python/blob/master/ciphers/rot13.py) * [Rsa Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/rsa_cipher.py) + * [Rsa Factorization](https://github.com/TheAlgorithms/Python/blob/master/ciphers/rsa_factorization.py) * [Rsa Key Generator](https://github.com/TheAlgorithms/Python/blob/master/ciphers/rsa_key_generator.py) * [Shuffled Shift Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/shuffled_shift_cipher.py) * [Simple Substitution Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/simple_substitution_cipher.py) @@ -94,7 +96,9 @@ * [Min Heap](https://github.com/TheAlgorithms/Python/blob/master/data_structures/heap/min_heap.py) * Linked List * [Doubly Linked List](https://github.com/TheAlgorithms/Python/blob/master/data_structures/linked_list/doubly_linked_list.py) + * [From Sequence](https://github.com/TheAlgorithms/Python/blob/master/data_structures/linked_list/from_sequence.py) * [Is Palindrome](https://github.com/TheAlgorithms/Python/blob/master/data_structures/linked_list/is_palindrome.py) + * [Print Reverse](https://github.com/TheAlgorithms/Python/blob/master/data_structures/linked_list/print_reverse.py) * [Singly Linked List](https://github.com/TheAlgorithms/Python/blob/master/data_structures/linked_list/singly_linked_list.py) * [Swap Nodes](https://github.com/TheAlgorithms/Python/blob/master/data_structures/linked_list/swap_nodes.py) * Queue @@ -238,6 +242,7 @@ * [Basic Maths](https://github.com/TheAlgorithms/Python/blob/master/maths/basic_maths.py) * [Binary Exponentiation](https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exponentiation.py) * [Binomial Coefficient](https://github.com/TheAlgorithms/Python/blob/master/maths/binomial_coefficient.py) + * [Ceil](https://github.com/TheAlgorithms/Python/blob/master/maths/ceil.py) * [Collatz Sequence](https://github.com/TheAlgorithms/Python/blob/master/maths/collatz_sequence.py) * [Explicit Euler](https://github.com/TheAlgorithms/Python/blob/master/maths/explicit_euler.py) * [Extended Euclidean Algorithm](https://github.com/TheAlgorithms/Python/blob/master/maths/extended_euclidean_algorithm.py) @@ -251,6 +256,7 @@ * [Find Max Recursion](https://github.com/TheAlgorithms/Python/blob/master/maths/find_max_recursion.py) * [Find Min](https://github.com/TheAlgorithms/Python/blob/master/maths/find_min.py) * [Find Min Recursion](https://github.com/TheAlgorithms/Python/blob/master/maths/find_min_recursion.py) + * [Floor](https://github.com/TheAlgorithms/Python/blob/master/maths/floor.py) * [Gaussian](https://github.com/TheAlgorithms/Python/blob/master/maths/gaussian.py) * [Greatest Common Divisor](https://github.com/TheAlgorithms/Python/blob/master/maths/greatest_common_divisor.py) * [Hardy Ramanujanalgo](https://github.com/TheAlgorithms/Python/blob/master/maths/hardy_ramanujanalgo.py) @@ -317,7 +323,6 @@ * [Detecting English Programmatically](https://github.com/TheAlgorithms/Python/blob/master/other/detecting_english_programmatically.py) * [Euclidean Gcd](https://github.com/TheAlgorithms/Python/blob/master/other/euclidean_gcd.py) * [Fischer Yates Shuffle](https://github.com/TheAlgorithms/Python/blob/master/other/fischer_yates_shuffle.py) - * [Food Wastage Analysis From 1961-2013 Fao](https://github.com/TheAlgorithms/Python/blob/master/other/food_wastage_analysis_from_1961-2013_fao.ipynb) * [Frequency Finder](https://github.com/TheAlgorithms/Python/blob/master/other/frequency_finder.py) * [Game Of Life](https://github.com/TheAlgorithms/Python/blob/master/other/game_of_life.py) * [Greedy](https://github.com/TheAlgorithms/Python/blob/master/other/greedy.py) @@ -353,6 +358,7 @@ * Problem 03 * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_03/sol1.py) * [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_03/sol2.py) + * [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_03/sol3.py) * Problem 04 * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_04/sol1.py) * [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_04/sol2.py) @@ -371,6 +377,7 @@ * Problem 08 * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_08/sol1.py) * [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_08/sol2.py) + * [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_08/sol3.py) * Problem 09 * [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_09/sol1.py) * [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_09/sol2.py) @@ -506,16 +513,133 @@ ## Strings * [Aho-Corasick](https://github.com/TheAlgorithms/Python/blob/master/strings/aho-corasick.py) * [Boyer Moore Search](https://github.com/TheAlgorithms/Python/blob/master/strings/boyer_moore_search.py) + * [Check Panagram](https://github.com/TheAlgorithms/Python/blob/master/strings/check_panagram.py) * [Knuth Morris Pratt](https://github.com/TheAlgorithms/Python/blob/master/strings/knuth_morris_pratt.py) * [Levenshtein Distance](https://github.com/TheAlgorithms/Python/blob/master/strings/levenshtein_distance.py) * [Manacher](https://github.com/TheAlgorithms/Python/blob/master/strings/manacher.py) * [Min Cost String Conversion](https://github.com/TheAlgorithms/Python/blob/master/strings/min_cost_string_conversion.py) * [Naive String Search](https://github.com/TheAlgorithms/Python/blob/master/strings/naive_string_search.py) * [Rabin Karp](https://github.com/TheAlgorithms/Python/blob/master/strings/rabin_karp.py) + * [Remove Duplicate](https://github.com/TheAlgorithms/Python/blob/master/strings/remove_duplicate.py) ## Traversals * [Binary Tree Traversals](https://github.com/TheAlgorithms/Python/blob/master/traversals/binary_tree_traversals.py) +## Venv + * Lib + * Python3.7 + * Site-Packages + * Certifi + * [ Main ](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/certifi/__main__.py) + * [Core](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/certifi/core.py) + * Chardet + * [Big5Freq](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/big5freq.py) + * [Big5Prober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/big5prober.py) + * [Chardistribution](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/chardistribution.py) + * [Charsetgroupprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/charsetgroupprober.py) + * [Charsetprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/charsetprober.py) + * Cli + * [Chardetect](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/cli/chardetect.py) + * [Codingstatemachine](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/codingstatemachine.py) + * [Compat](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/compat.py) + * [Cp949Prober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/cp949prober.py) + * [Enums](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/enums.py) + * [Escprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/escprober.py) + * [Escsm](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/escsm.py) + * [Eucjpprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/eucjpprober.py) + * [Euckrfreq](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/euckrfreq.py) + * [Euckrprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/euckrprober.py) + * [Euctwfreq](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/euctwfreq.py) + * [Euctwprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/euctwprober.py) + * [Gb2312Freq](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/gb2312freq.py) + * [Gb2312Prober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/gb2312prober.py) + * [Hebrewprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/hebrewprober.py) + * [Jisfreq](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/jisfreq.py) + * [Jpcntx](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/jpcntx.py) + * [Langbulgarianmodel](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/langbulgarianmodel.py) + * [Langcyrillicmodel](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/langcyrillicmodel.py) + * [Langgreekmodel](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/langgreekmodel.py) + * [Langhebrewmodel](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/langhebrewmodel.py) + * [Langhungarianmodel](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/langhungarianmodel.py) + * [Langthaimodel](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/langthaimodel.py) + * [Langturkishmodel](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/langturkishmodel.py) + * [Latin1Prober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/latin1prober.py) + * [Mbcharsetprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/mbcharsetprober.py) + * [Mbcsgroupprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/mbcsgroupprober.py) + * [Mbcssm](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/mbcssm.py) + * [Sbcharsetprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/sbcharsetprober.py) + * [Sbcsgroupprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/sbcsgroupprober.py) + * [Sjisprober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/sjisprober.py) + * [Universaldetector](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/universaldetector.py) + * [Utf8Prober](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/utf8prober.py) + * [Version](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/chardet/version.py) + * Idna + * [Codec](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/idna/codec.py) + * [Compat](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/idna/compat.py) + * [Core](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/idna/core.py) + * [Idnadata](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/idna/idnadata.py) + * [Intranges](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/idna/intranges.py) + * [Package Data](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/idna/package_data.py) + * [Uts46Data](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/idna/uts46data.py) + * [Ordered Set](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/ordered_set.py) + * Pip-19.0.3-Py3.7.Egg + * Pip + * [ Main ](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/pip-19.0.3-py3.7.egg/pip/__main__.py) + * Requests + * [ Version ](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/__version__.py) + * [ Internal Utils](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/_internal_utils.py) + * [Adapters](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/adapters.py) + * [Api](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/api.py) + * [Auth](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/auth.py) + * [Certs](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/certs.py) + * [Compat](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/compat.py) + * [Cookies](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/cookies.py) + * [Exceptions](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/exceptions.py) + * [Help](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/help.py) + * [Hooks](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/hooks.py) + * [Models](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/models.py) + * [Packages](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/packages.py) + * [Sessions](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/sessions.py) + * [Status Codes](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/status_codes.py) + * [Structures](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/structures.py) + * [Utils](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/requests/utils.py) + * Urllib3 + * [ Collections](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/_collections.py) + * [Connection](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/connection.py) + * [Connectionpool](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/connectionpool.py) + * Contrib + * [ Appengine Environ](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/contrib/_appengine_environ.py) + * [Appengine](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/contrib/appengine.py) + * [Ntlmpool](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/contrib/ntlmpool.py) + * [Pyopenssl](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py) + * [Securetransport](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/contrib/securetransport.py) + * [Socks](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/contrib/socks.py) + * [Exceptions](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/exceptions.py) + * [Fields](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/fields.py) + * [Filepost](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/filepost.py) + * Packages + * Backports + * [Makefile](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/packages/backports/makefile.py) + * [Six](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/packages/six.py) + * Ssl Match Hostname + * [ Implementation](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/packages/ssl_match_hostname/_implementation.py) + * [Poolmanager](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/poolmanager.py) + * [Request](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/request.py) + * [Response](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/response.py) + * Util + * [Connection](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/connection.py) + * [Queue](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/queue.py) + * [Request](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/request.py) + * [Response](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/response.py) + * [Retry](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/retry.py) + * [Ssl ](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/ssl_.py) + * [Timeout](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/timeout.py) + * [Url](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/url.py) + * [Wait](https://github.com/TheAlgorithms/Python/blob/master/venv/lib/python3.7/site-packages/urllib3/util/wait.py) + ## Web Programming * [Crawl Google Results](https://github.com/TheAlgorithms/Python/blob/master/web_programming/crawl_google_results.py) + * [Fetch Bbc News](https://github.com/TheAlgorithms/Python/blob/master/web_programming/fetch_bbc_news.py) + * [Fetch Github Info](https://github.com/TheAlgorithms/Python/blob/master/web_programming/fetch_github_info.py) * [Get Imdbtop](https://github.com/TheAlgorithms/Python/blob/master/web_programming/get_imdbtop.py) + * [Slack Message](https://github.com/TheAlgorithms/Python/blob/master/web_programming/slack_message.py) diff --git a/strings/remove_duplicate.py b/strings/remove_duplicate.py new file mode 100644 index 000000000..0462292b7 --- /dev/null +++ b/strings/remove_duplicate.py @@ -0,0 +1,20 @@ +# Created by sarathkaul on 14/11/19 + + +def remove_duplicates(sentence: str) -> str: + """ + Reomove duplicates from sentence + >>> remove_duplicates("Python is great and Java is also great") + 'Java Python also and great is' + """ + sen_list = sentence.split(" ") + check = set() + + for a_word in sen_list: + check.add(a_word) + + return " ".join(sorted(check)) + + +if __name__ == "__main__": + print(remove_duplicates("INPUT_SENTENCE"))