Skip to content

Programming of Introduction to algorithm. Mathmatics in computer Science

Notifications You must be signed in to change notification settings

fooSynaptic/exam

Repository files navigation

Exam - Algorithm Practice Repository note

A collection of algorithm implementations and solutions to coding problems from various sources including LeetCode, "Introduction to Algorithms" (CLRS), and computer science coursework.

book Overview

This repository contains my solutions to data structure and algorithm problems, with a focus on:

  • Classic algorithm implementations
  • Data structure manipulations
  • Interview preparation problems
  • Time and space complexity analysis

card index Repository Structure

exam/
├── Coding/                   # Algorithm implementations
│   ├── binary_insert.py     # Binary insertion algorithm
│   ├── Bucket_sort.py       # Bucket sort implementation
│   ├── build_binary_tree.py # Construct binary tree from traversals
│   ├── canFinish.py         # Course schedule (topological sort)
│   ├── check_palim.py       # Palindrome checking
│   ├── climb_steps.py       # Climbing stairs (Fibonacci variant)
│   ├── combine.py           # Combinations generation
│   ├── common_ancestry.py   # Lowest common ancestor
│   ├── common_prefix.py     # Longest common prefix
│   ├── countPrime.py        # Count prime numbers
│   ├── Dijkstra_Floyd.py    # Shortest path algorithms
│   ├── LCS_string.py        # Longest common subsequence
│   ├── merge_link_list.py   # Merge sorted linked lists
│   ├── reverse_link_list.py # Linked list reversal
│   ├── rotate_matrix.py     # Matrix rotation
│   ├── top_k.py             # Top K elements
│   ├── Trie.py              # Trie data structure
│   └── ...                  # Many more algorithms
├── combination/             # Combination-related experiments
│   ├── test.c               # C implementation
│   └── .env/                # Python virtual environment
└── interviewProblem/        # Interview problem solutions

rocket Getting Started

Prerequisites

  • Python 3.6+
  • (Optional) Virtual environment for isolated dependencies

Running Solutions

# Run a specific solution
python Coding/climb_steps.py

# Run with Python 3 explicitly
python3 Coding/binary_insert.py

book Topics Covered

Data Structures

  • Arrays and Strings: Sorting, searching, manipulation
  • Linked Lists: Reversal, merging, fast-slow pointer techniques
  • Trees and Graphs: Binary trees, BST validation, graph traversal
  • Heaps: Priority queues, top-k problems
  • Hash Tables: Frequency counting, two-sum patterns
  • Tries: Prefix-based string storage

Algorithms

Sorting

  • Bucket Sort
  • Binary Insertion
  • Linked List Sort

Graph Algorithms

  • Dijkstra's Shortest Path
  • Floyd-Warshall
  • Topological Sort (Course Schedule)
  • Cycle Detection

Dynamic Programming

  • Climbing Stairs (Fibonacci)
  • Longest Common Subsequence (LCS)
  • Maximum Subarray
  • Coin Change Variants

Tree Operations

  • Build tree from preorder/inorder
  • Serialize/Deserialize
  • Maximum subtree sum
  • Validate balanced BST

String Algorithms

  • Longest Common Prefix
  • Word Search (Backtracking)
  • Regular Expression Matching
  • Palindrome Checking

Mathematical

  • Prime Counting (Sieve)
  • Matrix Rotation
  • Random Number Generation
  • Permutations

bulb Problem Sources

target Interview Problems

Special section dedicated to interview preparation:

  • Object serialization/deserialization
  • System design considerations
  • Edge case handling

📝 Code Style

This repository follows these conventions:

  • Python: PEP 8 style guide
  • Functions: snake_case naming
  • Classes: PascalCase naming
  • Constants: UPPER_SNAKE_CASE
  • Docstrings: Google-style documentation

search Example Usage

# Building a binary tree from traversals
from build_binary_tree import Solution, TreeNode

solution = Solution()
preorder = [3, 9, 20, 15, 7]
inorder = [9, 3, 15, 20, 7]
tree = solution.buildTree(preorder, inorder)

# Climbing stairs (dynamic programming)
from climb_steps import Solution
solution = Solution()
ways = solution.climbStairs2(38)  # Efficient O(n) solution

🤝 Contributing

This is a personal learning repository. While not actively seeking contributions, feel free to fork and adapt for your own learning!

📄 License

For educational purposes only.

About

Programming of Introduction to algorithm. Mathmatics in computer Science

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages