Welcome to the Rewind CS50 repository! This repository is designed to help revisit key Computer Science concepts, focusing on Sorting Algorithms, Data Structures, Searching Techniques, and Time/Space Complexity. We will use Go and Google Colab to illustrate these concepts interactively.
- Bubble Sort β Repeatedly swaps adjacent elements if they are in the wrong order.
- Insertion Sort β Builds a sorted array one element at a time by inserting in the correct position.
- Selection Sort β Repeatedly selects the smallest element and swaps it with the first unsorted element.
- Merge Sort β Recursively divides the array and merges sorted halves.
- Quick Sort β Uses a pivot to partition the array and sorts recursively.
- Counting Sort β Counts occurrences of elements and reconstructs the sorted array (works for limited range of integers).
- Heap Sort β Uses a binary heap for O(n log n) sorting.
- Radix Sort β Sorts numbers digit by digit.
- Tim Sort β Hybrid of Merge and Insertion Sort, optimized for real-world data.
- Shell Sort β Optimized version of Insertion Sort.
- Bucket Sort β Distributes elements into multiple buckets before sorting.
- Bitonic Sort β A parallel sorting algorithm useful for hardware implementation.
- Definition: Hashing is a technique for fast data retrieval using a hash function.
- Chaining: A collision resolution technique storing multiple elements at the same index using a linked list.
- Array-based Stack
- Linked List Stack
- Monotonic Stack
- Simple Queue (FIFO)
- Circular Queue
- Deque (Double-Ended Queue)
- Priority Queue
- Singly Linked List
- Doubly Linked List
- Circular Linked List
- Binary Tree
- Binary Search Tree (BST)
- Balanced Trees (AVL Tree, Red-Black Tree)
- Heap (Min Heap, Max Heap)
- Trie (Prefix Tree)
- Segment Tree / Fenwick Tree (BIT)
- Directed & Undirected Graphs
- Weighted & Unweighted Graphs
- Adjacency Matrix & List Representation
- Cyclic & Acyclic Graphs
- Checks each element one by one.
- Works on sorted data.
- Efficient for sorted data.
- Works best on uniformly distributed data.
- Used for unbounded or infinite-sized arrays.
- Uses Fibonacci numbers to divide search space.
- Fast lookups using hash tables.
- Similar to Binary Search but divides into three parts.
- Measures how execution time grows with input size.
- Examples:
- O(1) β Constant time
- O(log n) β Logarithmic time
- O(n) β Linear time
- O(nΒ²) β Quadratic time
- Measures memory usage based on input size.
- Examples:
- O(1) β Constant space
- O(n) β Linear space (storing an array of size n)
- O(n!) β Factorial space complexity (worst-case recursive algorithms)
- Clone the repository:
git clone https://github.com/yourusername/rewind-cs50.git cd rewind-cs50 - Run Sorting Algorithms in Go:
go run sorting/bubble_sort.go
- Use Google Colab for interactive explanations:
- Open
rewind_cs50_colab.ipynb - Run and visualize algorithms step by step
- Open
Contributions are welcome! Feel free to submit pull requests with improvements or new explanations.
This project is licensed under the MIT License.