Data Structures & Algorithms in Python
Implementations and study notes are based on Problem Solving with Algorithms and Data Structures using Python
Data Structures:
-
stack.py - Implementation of the "Stack" data structure.
-
queue.py - Implementation of the "Queue" data structure.
-
deque.py - Implementation of the "Deque" data structure.
-
linked_list_ordered_singly.py - Implementation of a ordered singly "Linked List" data structure.
-
hash_table.py - Implementation of a "Hash Table" data structure that uses a simple "remainder method" (key % table_size).
-
binary_tree.py - Implementation of a "Binary Tree" data structure. It includes preorder, postorder and inorder traversals.
-
binary_search_tree.py - Implementation of a "Binary Search Tree" data structure. It highlights how to create a python "Class" that implements a container object, such as a list or dictionary.
Algorithms:
-
binary_search.py - Implementation of the "Binary Search" algorithm.
-
binary_search_recursive.py - Implementation of the recursive version of the "Binary Search" algorithm.
-
bubble_sort.py - Implementation of the "Bubble Sort" algorithm.
-
short_bubble_sort.py - Implementation of the "Short Bubble Sort" algorithm. It modifies a standard bubble sort by stopping short when no exchanges are left to be made.
-
selection_sort.py - Implementation of the "Selection Sort" algorithm.
-
insertion_sort.py - Implementation of the "Insertion Sort" algorithm.
-
shell_sort.py - Implementation of the "Shell Sort" algorithm.
-
merge_sort.py - Implementation of the "Merge Sort" algorithm.
-
quick_sort.py - Implementation of the "Quick Sort" algorithm.
Examples:
-
stack_paren_checker.py - Function that assumes that a Stack class is available and returns a boolean result as to whether the string of parentheses is balanced.
-
queue_hot_potato.py - General simulation of the children's game "hot potato" that makes use of the Queue data structure.
-
deque_palindrome_checker.py - This function uses the Deque data structure and takes input as a string of characters to check whether it is a palindrome.