{"id":13543990,"url":"https://github.com/sherxon/AlgoDS","last_synced_at":"2025-04-02T13:31:25.426Z","repository":{"id":41947864,"uuid":"76670734","full_name":"sherxon/AlgoDS","owner":"sherxon","description":"Implementation of Algorithms and Data Structures, Problems and Solutions","archived":false,"fork":false,"pushed_at":"2023-10-27T13:05:54.000Z","size":1585,"stargazers_count":3429,"open_issues_count":21,"forks_count":610,"subscribers_count":169,"default_branch":"master","last_synced_at":"2024-11-03T10:33:32.172Z","etag":null,"topics":["algorithms","binary-search-tree","bst","data-structrues","dfs","dijkstra","dynamic-programming","graph-algorithms","interview-questions","java","linked-list","mergesort","search-algorithm","shortest-paths","sort","sorting-algorithms"],"latest_commit_sha":null,"homepage":"http://sherxon.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sherxon.png","metadata":{"files":{"readme":"README-CN.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"sherxon","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"custom":null}},"created_at":"2016-12-16T17:01:22.000Z","updated_at":"2024-10-30T21:16:31.000Z","dependencies_parsed_at":"2024-01-14T06:53:07.305Z","dependency_job_id":"cf5fb177-c425-4fd2-bcc7-6bf1709429c0","html_url":"https://github.com/sherxon/AlgoDS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherxon%2FAlgoDS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherxon%2FAlgoDS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherxon%2FAlgoDS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherxon%2FAlgoDS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sherxon","download_url":"https://codeload.github.com/sherxon/AlgoDS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246823734,"owners_count":20839771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","binary-search-tree","bst","data-structrues","dfs","dijkstra","dynamic-programming","graph-algorithms","interview-questions","java","linked-list","mergesort","search-algorithm","shortest-paths","sort","sorting-algorithms"],"created_at":"2024-08-01T11:00:40.222Z","updated_at":"2025-04-02T13:31:20.409Z","avatar_url":"https://github.com/sherxon.png","language":"Java","readme":"[English](https://github.com/yunshuipiao/AlgoDS) | 简体中文\n# 算法与数据结构\n\n这是 一份 **算法和数据结构** 和 **面试题目**（附解答）的集合。\n该仓库包含了我对常见算法的解答和用 `Java`实现的数据结构。 \n创建该仓库用于学习更多的算法，并持续添加问题和解答。\n到目前为止，已经包含了 **算法和数据结构** 和 **超过250个问题和答案**。\n\n\n### 简述\n  \n根据困难程度将问题分为三个等级：\n\n1) [简单问题](https://github.com/sherxon/AlgoDS/blob/master/src/problems/Easy.txt) -- [答案](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy)  \n2) [中等问题](https://github.com/sherxon/AlgoDS/blob/master/src/problems/Medium.txt) -- [答案](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium)  \n3) [困难问题](https://github.com/sherxon/AlgoDS/blob/master/src/problems/Hard.txt) -- [答案](https://github.com/sherxon/AlgoDS/blob/master/src/problems/hard)  \n       \n\n\n## 问题\n  \n### 数组\n1) [Rotate Array：旋转数组](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/RotateArray.java)      \n2) [Contains Duplicate：包含重复值](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/ContainsDuplicate.java)  \n3) [Find Peak Element：寻找最大值](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/FindPeakElement.java)  \n4) [Maximum Subarray：最大子数列（子串和）](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/MaximumSubarray.java)  \n5) [Kth Largest Element in an Array：数组中的第K大元素](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/KthLargestElementinanArray.java)  \n6) [Find All Duplicates in an Array：寻找数组中的全部重复元素](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/FindAllDuplicatesinanArray.java)  \n7) [Longest Increasing Subsequence：最长递增子序列](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/MaxIncreasingSubsequence.java)  \n8) [Rotate Image, matrix：旋转图像，矩阵](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/RotateImage.java)  \n9) [Shuffle an Array：数组洗牌](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/ShuffleanArray.java)  \n10) [Find Min in Rotated Array：寻找旋转排序数组中的最小值](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/FindMinimuminRotatedSortedArray.java)  \n11) [Search in Rotated Array：在旋转数组中查找](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/SearchinRotatedSortedArray.java)  \n  \n\n### 链表\n\n1) [Singly Linked List Implementation： 单向链表实现](https://github.com/sherxon/AlgoDS/blob/master/src/ds/LinkedList.java)  \n1) [Doubly Linked List Implementation：双向链表实现](https://github.com/sherxon/AlgoDS/blob/master/src/ds/DoublyLinkedList.java)  \n3) [Delete Node in a Linked List：删除链表节点](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/DeleteNodeSingleLinkedList.java)  \n4) [Palindrome Linked List：回文链表](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/PalindromeLinkedList.java)  \n5) [Reverse Linked List：反转链表](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/ReverseLinkedList.java)  \n6) [Intersection of Two Linked Lists：两链表的交叉点](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/IntersectionofTwoLinkedLists.java)  \n7) [Linked List Cycle：带环链表](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/LinkedListCycle.java)  \n8) [Remove Nth Node From End of List：删除链表中倒数第n个节点](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/RemoveNthNodeFromEndofList.java)   \n9) [Merge Sort List：合并有序链表](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/SortList.java)  \n10) [Find Linked List Cycle：寻找带环链表](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/LinkedListCycle2.java)  \n11) [Merge k Sorted Lists： 合并k个排序链表](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/MergekSortedLists.java)   \n [And many other Linked list problems：其余有关链表的题目](https://github.com/sherxon/AlgoDS/tree/master/src/problems)\n \n### 二叉树\n1) [Binary Tree Level Order Traversal：二叉树的层次遍历](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/BinaryTreeLevelOrderTraversal.java)  \n2) [Sum of Left Leaves：左叶子节点的和](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/SumofLeftLeaves.java)  \n3) [Invert Binary Tree：反转二叉树](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/InvertBinaryTree.java)  \n4) [Binary Search Tree Iterator：二叉搜索树迭代器](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/BinarySearchTreeIterator.java)  \n5) [Binary Tree Postorder Traversal：二叉树后续遍历](https://github.com/sherxon/AlgoDS/blob/master/src/problems/hard/PostOrderTraversalTree.java)  \n6) [Binary Tree Preorder Traversal：二叉树前序遍历](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/BinaryTreePreorderTraversal.java)  \n7) [Flatten Binary Tree to Linked List：二叉树转换成链表](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/FlattenBinaryTreetoLinkedList.java)  \n8) [Symmetric Tree：对称树](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/SymmetricTree.java)  \n9) [Binary Tree Inorder Traversal：二叉树中序遍历](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/BinaryTreeInorderTraversal.java)  \n10) [Same Tree：相同树](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/SameTree.java)  \n11) [Maximum Depth of Binary Tree：二叉树的最大深度](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/MaximumDepthofBinaryTree.java)  \n12) [Balanced Binary Tree：平衡二叉树](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/BalancedBinaryTree.java)  \n13) [Minimum Depth of Binary Tree：二叉树的最小深度](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/MinimumDepthofBinaryTree.java)     \n14) [Sorted List to Balanced Binary Search Tree：有序链表转换平衡二叉查找树](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/ConvertSortedListtoBinarySearchTree.java)   \n15) [Validate Binary Search Tree：验证二叉搜索树](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/ValidateBinarySearchTree.java)  \n16) [Sorted Array to Balanced BST ：有序数组转换二叉查找树](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/ConvertSortedArraytoBinarySearchTree.java)  \n17) [Kth Smallest Element in a BST：二叉搜索树的第k小元素](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/KthSmallestElementinaBST.java)  \n18) [Binary Tree Zigzag Level Order Traversal：二叉树的锯齿形层次遍历](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/ZigZagOrderLevelTraversalBST.java)  \n19) [Delete Node in a BST：删除二叉查找树的节点](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/DeleteNodeinaBST.java)  \n20) [Lowest Common Ancestor of BST：二叉查找树最近公共祖先](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/LowestCommonAncestorBST.java)  \n21) [Binary Tree Left Side View：二叉树的左侧视图](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/BinaryTreeLeftSIdeView.java)  \n22) [Binary Tree Right Side View：二叉树的右侧视图](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/BinaryTreeRightSideView.java)  \n23) [Mode in BST：二叉查找树的模式](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/FindModeinBST.java)   \n24) [Most Frequent Subtree Sum：最常出现的子树和](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/MostFrequentSubtreeSum.java)  \n25) [ Find Largest Element in Each Row：寻找每行的最大元素](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/FindLargestElementinEachRow.java)   \n26) [Serialize and Deserialize BT：二叉树的序列化和反序列化](https://github.com/sherxon/AlgoDS/blob/master/src/problems/hard/SerializeAndDeserializeBT.java)   \n [And many other tree problems：其余有关树的问题](https://github.com/sherxon/AlgoDS/tree/master/src/problems)  \n\n### 数学\n1) [Integer Break：整数分解](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/IntegerBreak.java)  \n2) [Reverse Bits：反转位](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/ReverseBits.java)   \n3) [Palindrome Number：回文数](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/PalindromeNumber.java)  \n4) [Math.pow：幂](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/Pow.java)  \n5) [Jug and Water Problem：水罐问题](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/WaterAndJugProblem.java)  \n6) [Sieve of Eratosthenes：埃拉托斯特尼筛法](https://github.com/sherxon/AlgoDS/blob/master/src/algo/numerals/SieveofEratosthenes.java)  \n7) [Fermat's primality：费马素数](https://github.com/sherxon/AlgoDS/blob/master/src/algo/numerals/FermatPrimality.java)     \n8) [Evaluate Reverse Polish Notation：计算逆波兰波表达式](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/EvaluateReversePolishNotation.java)  \n\n\n### 栈和队列\n1) [Min Stack：最小栈](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/MinStack.java)  \n2) [Min Queue：最小队列](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/QueuewithMinimum.java)  \n3) [Implement Stack Using Queue：用队列实现栈](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/ImplementStackUsingQueues.java)  \n4) [Implement Queue Using Stack：用栈实现队列](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/ImplementQueueusingStacks.java)\n5) [Sort Stack：有序栈](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/SortStack.java)  \n\n\n### 动态规划问题\n1) [Fibonacci Numbers：斐波那契数列](https://github.com/sherxon/AlgoDS/blob/master/src/algo/dp/FibonacciNumber.java)  \n2) [Word Break：单词分割](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/WordBreak.java)  \n3) [Subset Sum：子集和问题](https://github.com/sherxon/AlgoDS/blob/master/src/algo/dp/SubsetSum.java)     \n4) [0/1 Knapsack Problem：0/1背包问题](https://github.com/sherxon/AlgoDS/blob/master/src/algo/dp/Knapsack01.java)     \n5) [Shortest Palindrome (KMP)：最短回文串](https://github.com/sherxon/AlgoDS/blob/master/src/problems/hard/ShortestPalindrome.java) \n6) [Minimum Square Sum：最小平方和](https://github.com/sherxon/AlgoDS/blob/master/src/algo/dp/MinimumSquareSum.java)\n7) [Maximum weight transformation of a String：字符串的最大重量转换](https://github.com/sherxon/AlgoDS/blob/master/src/algo/dp/MaxWeightTransformation.java)\n8) [Coin Change：硬币找零](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/CoinChange.java)  \n\n\n### 混合问题\n1) [Union Find：并查集](https://github.com/sherxon/AlgoDS/blob/master/src/algo/UnionFind.java)  \n2) [Permutations：排列组合](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/Permutations.java)  \n3) [Subsets：子集问题](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/SubSets.java)     \n\n\n ## 算法\n \n### 排序和查找   \n1) [Bubble Sort：冒泡排序](https://github.com/sherxon/AlgoDS/blob/master/src/algo/sortingandsearching/BubbleSort.java)  \n2) [Insertion Sort：插入排序](https://github.com/sherxon/AlgoDS/blob/master/src/algo/sortingandsearching/InsertionSort.java)  \n3) [Selection Sort：选择排序](https://github.com/sherxon/AlgoDS/blob/master/src/algo/sortingandsearching/SelectionSort.java)  \n4) [Counting Sort：计数排序](https://github.com/sherxon/AlgoDS/blob/master/src/algo/sortingandsearching/CountingSort.java)  \n5) [Binary Search , Lower \u0026 Upper Bounds：二分查找，上下界](https://github.com/sherxon/AlgoDS/blob/master/src/algo/sortingandsearching/BinarySearch.java)  \n6) [MergeSort：归并排序](https://github.com/sherxon/AlgoDS/blob/master/src/algo/sortingandsearching/MergeSort.java)  \n7) [QuickSort：快速排序](https://github.com/sherxon/AlgoDS/blob/master/src/algo/sortingandsearching/QuickSort.java)  \n\n \n### 图 \n1) [Breadth First Search (BFS)：广度优先遍历](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/BFS.java)  \n2) [Depth First Search (DFS)：深度优先遍历](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/DFS.java)  \n3) [Prim's Minimum Spanning Tree (MST)：最小生成树(Prim's算法)](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/PrimsMST.java)  \n4) [KrusKal's Minimum Spanning Tree (MST)：最小生成树(KrusKal's算法)](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/KruskalsMST.java)  \n5) [Topological Sorting：拓扑排序](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/TopologicalSorting.java)      \n6) [Shortest Path Dijsktra：Dijsktra最短路径](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/Dijsktra.java)  \n7) [Shortest Path Bellman-Ford：Bellman-Ford最短路径](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/BellmanFord.java)  \n8) [A* Heuristic Path Finding：启发式搜索A*算法](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/AStar.java)  \n9) [Is Graph Bipartite：二分图判断](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/IsBipartite.java)    \n10) [Is Graph Connected：连通图判断](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/IsConnected.java)  \n11) [Cycle Detection：周期检测](https://github.com/sherxon/AlgoDS/blob/master/src/algo/graph/CycleDetection.java)  \n12) [Undirected Graph Bridge Detection：无向图的桥梁检测](https://github.com/prafful1/AlgoDS/blob/master/src/algo/graph/BridgeUndirectedGraph.java)\n\n\n### 字符串\n1) [Rabin Karp Subsequence search：Rabin Karp子序列搜索](https://github.com/sherxon/AlgoDS/blob/master/src/algo/string/RabinKarpSubsequenceSearch.java)   \n2) [Ransom Note：勒索信](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/RansomNote.java)  \n3) [Reverse String：反转字符串](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/ReverseString.java)  \n4) [Longest Common Prefix：最长公共前缀](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/LongestCommonPrefix.java)  \n5) [Is Anagram：回文字符串](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/ValidAnagram.java)  \n6) [Needle and Haystack：针和草堆](https://github.com/sherxon/AlgoDS/blob/master/src/problems/easy/ImplementstrSt.java)  \n7) [Word Break：单词分割](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/WordBreak.java)  \n8) [Meta Strings：元字符串](https://github.com/sherxon/AlgoDS/blob/master/src/problems/medium/MetaStrings.java)  \n\n\n## 数据结构      \n\n\n### 树\n1) [Binary Search Tree (recursive)：二叉查找树(递归)](https://github.com/sherxon/AlgoDS/blob/master/src/ds/BST.java)  \n2) [Binary Search Tree (iterative)：二叉查找树(迭代)](https://github.com/sherxon/AlgoDS/blob/master/src/ds/BSTIterative.java)  \n3) [AVL Tree：平衡二叉查找树(BBST)](https://github.com/sherxon/AlgoDS/blob/master/src/ds/AVLTree.java)    \n4) [Trie (Prefix tree)：字典树、前缀树（Prefix Tree）、单词查找树 或 键树](https://github.com/sherxon/AlgoDS/blob/master/src/algo/string/Trie.java)  \n5) [Hashed Array Tree：散列数组树](https://github.com/sherxon/AlgoDS/blob/master/src/ds/HashedArrayTree.java)  \n6) [LRU Cache：最近最少使用缓存](https://github.com/sherxon/AlgoDS/blob/master/src/problems/hard/LRUCache.java)  \n\n\n## 贡献\n\n发现bug？另一种更好的方法？请提交PR。\n","funding_links":["https://github.com/sponsors/sherxon"],"categories":["Java","🧑‍💻 Sites related to your preferred programming language (For me C++)","DSA and System Design"],"sub_categories":["Android samples"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsherxon%2FAlgoDS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsherxon%2FAlgoDS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsherxon%2FAlgoDS/lists"}