Skip to content

Implement Data Structures and Algorithms (Sorting, Searching, Greedy, DP) from Sketch

Notifications You must be signed in to change notification settings

YuezhenQin/javase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This project is a collection of fully functional examples written in Java programming language, showing how to implement 14 typical algorithms && data Structures from sketch. It is created with ambition to make a short, complete and realistic DSA study guide for coding interviews as well as competitive programming.

  1. LinearSearch 线性查找
  2. SelectionSort 选择排序
  3. InsertionSort 插入排序
  4. QuickSort 快速排序
  5. Array
  6. Stack & Queue
  • Stack (将增删操作限制为单侧,并且数据满足后入先出 LIFO)
    • ARStack
    • LLStack
  • Queue (数据满足先入先出 FIFO)
    • ARQueue
    • LLQueue
    • CircularQueue 循环队列
    • PriorityQueue 优先队列
  1. LinkedList
  • ListNode
  1. Recursion 递归构造
  2. MergeSort 归并排序
  3. QuickSort 快速排序
  4. BinarySearchTree 二分搜索树 (左子树中所有元素小于当前节点元素,右子树中所有元素大于当前节点元素)
  • TreeNode
  1. Set&Map 集合与映射
  2. Heap 堆
LL BST
E e
Node next
E e
Node left
Node right
Node head
int size
Node root
int size
Set Map
void add(E)
void remove(E)
boolean contains(E)
int getSize()
boolean isEmpty()
void add(K, V)
V remove(K)
boolean contains(K)
V get(K)
void set(K,V)
int getSize()
boolean isEmpty()

Stack

  • ARStack
  • LLStack (栈内元素数量不可预料,时大时小)

Queue

  • Deque
  • PriorityQueue
  • BlockingQueue (ARBlockingQueue, LLBlockingQueue, PriorityBlockingQueue)

List

  • ArrayList
  • LinkedList
  • Vector

Set

HashSet SortedSet, TreeSet ConcurrentSkipListSet

Map

HashMap TreeMap ConcurrentHashMap

Problem Set

# Title Code Document Video Difficulty Tag
1 Absolute value Theory 🟩 Easy abs()
2 Celsius To Fahrenheit Theory 🟩 Easy Math
3 Roots of Quadratic equation Theory 🟩 Easy Math
4 Factorial Of Number 🟩 Easy Math
5 Count digits in a factorial 🟩 Easy Factorial, Math
6 Series GP 🟩 Easy Basic Math
7 Prime Number 🟩 Easy Basic Math
8 Exactly 3 Divisors Theory 🟩 Easy Basic Math
9 Addition Under Modulo Theory 🟩 Easy Modulo
10 Multiplication Under Modulo Theory 🟩 Easy Modulo
11 Modular Multiplicative Inverse 🟩 Easy Modulo
12 Trailing zeroes in factorial 🟧 Medium Logic
13 Prime Factors 🟧 Medium Prime

出现频度为5:

  1. Leet Code OJ 1. Two Sum [Difficulty: Easy]
  2. Leet Code OJ 8. String to Integer (atoi) [Difficulty: Easy]
  3. Leet Code OJ 15. 3Sum [Difficulty: Medium]
  4. Leet Code OJ 20. Valid Parentheses [Difficulty: Easy]
  5. Leet Code OJ 21. Merge Two Sorted Lists [Difficulty: Easy]
  6. Leet Code OJ 28. Implement strStr() [Difficulty: Easy]
  7. Leet Code OJ 56. Merge Intervals [Difficulty: Hard]
  8. Leet Code OJ 57. Insert Interval [Difficulty: Hard]
  9. Leet Code OJ 65. Valid Number [Difficulty: Hard]
  10. Leet Code OJ 70. Climbing Stairs [Difficulty: Easy]
  11. Leet Code OJ 73. 链式结构.Set Matrix Zeroes [Difficulty: Medium]
  12. Leet Code OJ 88. Merge Sorted Array [Difficulty: Easy]
  13. Leet Code OJ 98. Validate Binary Search Tree [Difficulty: Medium]
  14. Leet Code OJ 125. Valid Palindrome [Difficulty: Easy]
  15. Leet Code OJ 127. Word Ladder [Difficulty: Medium]

出现频度为4:

  1. Leet Code OJ 2. Add Two Numbers [Difficulty: Medium]
  2. Leet Code OJ 12. Integer to Roman
  3. Leet Code OJ 13. Roman to Integer
  4. Leet Code OJ 22. Generate Parentheses
  5. Leet Code OJ 23. Merge k Sorted Lists
  6. Leet Code OJ 24. Swap Nodes in Pairs
  7. Leet Code OJ 27. Remove Element [Difficulty: Easy]
  8. Leet Code OJ 46. Permutations
  9. Leet Code OJ 49. Anagrams
  10. Leet Code OJ 67. Add Binary
  11. Leet Code OJ 69. Sqrt(x)
  12. Leet Code OJ 77. Combinations
  13. Leet Code OJ 78. Subsets
  14. Leet Code OJ 79. Word Search
  15. Leet Code OJ 91. Decode Ways [Difficulty: Medium]
  16. Leet Code OJ 102. Binary Tree Level Order Traversal [Difficulty: Easy]
  17. Leet Code OJ 129. Sum Root to Leaf Numbers
  18. Leet Code OJ 131. Palindrome Partitioning

Reference

  1. https://chasserush.github.io/DataStructureVisualizations/ LixiangZhao commit

LixiangZhao has been invited as a collaborator of this project.

About

Implement Data Structures and Algorithms (Sorting, Searching, Greedy, DP) from Sketch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published