- This is a repository for algorithm enthusiasts, including general algorithms and specific problems for algorithm enthusiasts to solve.
- all algorithms and problem solutions should be implemented in python
- versions and lib requirements should be marked
- all algorithms and problem solutions should have documentation and tests
-
Algorithms
-
arrays
- rotate_matrix: rotate a matrix
- two_sum: Given an array of integers, find two numbers such that they add up to a specific target number
- max_product_subarray: Givein an array of integers, find the max product of a sub-array
-
data_structures
- linked_list
- add_two_numbers: add two numbers represented as two linked_list
- check_loop: check if a linked_list contains loop
- check_palindrome: check if a linked_list is palindrome
- find_intersection: find if two linked_lists intersect each other
- partition: divide a linked_list into two, one has items larger than a value and the rest in the other
- remove_duplicates: remove duplicates nodes
- return_kth_to_last: return the kth to last element in the linked_list
- queue
- stack_queue: implement a queue using two stacks
- stack
- sort_stack: return a sorted stack
- stack_min: implement a stack that can track its min
- priority queue
- MaxPQ
- MinPQ
- linked_list
-
searching
- binary_search
-
sorting
- bubble_sort
- insertion_sort
- selection_sort
- shell_sort
- merge_sort
- quick_sort
-
strings
- check_permutation: given two strings, check if one is the permutation of the other
- check_permutation_of_palindrome: check if an input string is a permutation of palindrome
- is_unique_characters: check if a string has unique characters
- one_edit_away: check if a string is one edit away from the other
- string_compression: string compression algorithms
- string_permutation: string permutation algorithms
- zig_zag_conversion: convert a string in zig zag order into line by line order
-
-
Problems:
- book_pricing: calculate total price based on group discounts
- count_num_of_islands: given a matrix, 1 is land and 0 is water, count how many islands in the matrix
- game_of_life: simulation of game of life evolution