Top Related Projects
刷算法全靠套路,认准 labuladong 就够了!English version supported! Crack LeetCode, not only how, but also why.
Everything you need to know to get the job.
A complete computer science study plan to become a software engineer.
💯 Curated coding interview preparation materials for busy software engineers
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
:books: 技术面试必备基础知识、Leetcode、计算机操作系统、计算机网络、系统设计
Quick Overview
The greyireland/algorithm-pattern repository is a comprehensive collection of algorithm and data structure patterns, primarily focused on preparing for technical interviews. It covers a wide range of topics including binary search, sorting algorithms, dynamic programming, and more, providing explanations and implementations in Go.
Pros
- Extensive coverage of common algorithm and data structure topics
- Clear explanations and implementations in Go
- Well-organized content structure for easy navigation
- Includes practical interview preparation tips and strategies
Cons
- Primarily in Chinese, which may limit accessibility for non-Chinese speakers
- Lacks implementations in other programming languages
- Some sections may require more detailed explanations or examples
- Not frequently updated, with the last commit being over a year ago
Code Examples
Since this is not a code library but rather a collection of algorithm patterns and explanations, there are no specific code examples to showcase. The repository contains implementations of various algorithms and data structures, but they are meant for learning and reference rather than for use as a library.
Getting Started
As this is not a code library, there's no specific installation or setup process. To use this resource:
- Visit the repository at https://github.com/greyireland/algorithm-pattern
- Navigate through the table of contents in the README.md file
- Click on the topic you're interested in to access the explanations and implementations
- Study the content and practice implementing the algorithms and data structures in your preferred programming language
Note: Knowledge of Chinese is beneficial for fully understanding the explanations, as most of the content is written in Chinese.
Competitor Comparisons
刷算法全靠套路,认准 labuladong 就够了!English version supported! Crack LeetCode, not only how, but also why.
Pros of fucking-algorithm
- More comprehensive coverage of algorithms and data structures
- Detailed explanations with step-by-step breakdowns
- Available in multiple languages (Chinese and English)
Cons of fucking-algorithm
- Less organized structure compared to algorithm-pattern
- May be overwhelming for beginners due to its extensive content
- Updates less frequently than algorithm-pattern
Code Comparison
algorithm-pattern:
func binarySearch(nums []int, target int) int {
left, right := 0, len(nums)-1
for left <= right {
mid := left + (right-left)/2
if nums[mid] == target {
return mid
} else if nums[mid] < target {
left = mid + 1
} else {
right = mid - 1
}
}
return -1
}
fucking-algorithm:
int binarySearch(int[] nums, int target) {
int left = 0, right = nums.length - 1;
while(left <= right) {
int mid = left + (right - left) / 2;
if (nums[mid] == target)
return mid;
else if (nums[mid] < target)
left = mid + 1;
else if (nums[mid] > target)
right = mid - 1;
}
return -1;
}
Both repositories provide similar implementations of binary search, with fucking-algorithm using Java and algorithm-pattern using Go. The core logic remains the same, demonstrating the algorithm's language-agnostic nature.
Everything you need to know to get the job.
Pros of interviews
- More comprehensive coverage of algorithms and data structures
- Includes solutions in multiple programming languages (Java, Python, JavaScript)
- Provides additional resources like books and online judge platforms
Cons of interviews
- Less structured organization of content
- May be overwhelming for beginners due to the large amount of information
- Lacks detailed explanations for some solutions
Code comparison
interviews:
public ListNode reverseList(ListNode head) {
ListNode prev = null;
while (head != null) {
ListNode next = head.next;
head.next = prev;
prev = head;
head = next;
}
return prev;
}
algorithm-pattern:
func reverseList(head *ListNode) *ListNode {
var prev *ListNode
for head != nil {
next := head.Next
head.Next = prev
prev = head
head = next
}
return prev
}
Both repositories provide similar implementations for reversing a linked list, with interviews using Java and algorithm-pattern using Go. The logic remains consistent across both examples, demonstrating the universal nature of algorithmic problem-solving regardless of the programming language used.
A complete computer science study plan to become a software engineer.
Pros of coding-interview-university
- More comprehensive coverage of computer science topics
- Includes a structured study plan and learning roadmap
- Offers resources in multiple languages
Cons of coding-interview-university
- Can be overwhelming due to its extensive content
- Less focused on specific algorithm patterns
- May require more time to complete
Code comparison
algorithm-pattern:
func binarySearch(nums []int, target int) int {
left, right := 0, len(nums)-1
for left <= right {
mid := left + (right-left)/2
if nums[mid] == target {
return mid
} else if nums[mid] < target {
left = mid + 1
} else {
right = mid - 1
}
}
return -1
}
coding-interview-university:
def binary_search(list, item):
low = 0
high = len(list) - 1
while low <= high:
mid = (low + high) // 2
guess = list[mid]
if guess == item:
return mid
if guess > item:
high = mid - 1
else:
low = mid + 1
return None
Both repositories provide similar implementations of binary search, but algorithm-pattern uses Go while coding-interview-university uses Python. The algorithm-pattern example is more concise and uses a common optimization for calculating the midpoint to avoid integer overflow.
💯 Curated coding interview preparation materials for busy software engineers
Pros of tech-interview-handbook
- More comprehensive coverage of interview topics beyond algorithms
- Includes soft skills advice and interview preparation strategies
- Regularly updated with contributions from a large community
Cons of tech-interview-handbook
- Less focused on in-depth algorithm explanations
- May be overwhelming for beginners due to the breadth of content
Code Comparison
tech-interview-handbook:
function binarySearch(arr, target) {
let left = 0;
let right = arr.length - 1;
while (left <= right) {
const mid = Math.floor((left + right) / 2);
if (arr[mid] === target) return mid;
if (arr[mid] < target) left = mid + 1;
else right = mid - 1;
}
return -1;
}
algorithm-pattern:
func binarySearch(nums []int, target int) int {
left, right := 0, len(nums)-1
for left <= right {
mid := left + (right-left)>>1
if nums[mid] == target {
return mid
} else if nums[mid] < target {
left = mid + 1
} else {
right = mid - 1
}
}
return -1
}
The code examples show similar implementations of binary search, with tech-interview-handbook using JavaScript and algorithm-pattern using Go. Both repositories provide clear, concise code samples for common algorithms, but algorithm-pattern focuses more on Go-specific implementations.
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
Pros of javascript-algorithms
- More comprehensive coverage of algorithms and data structures
- Includes explanations and examples in JavaScript
- Active community with frequent updates and contributions
Cons of javascript-algorithms
- May be overwhelming for beginners due to its extensive content
- Focuses primarily on JavaScript, limiting its applicability to other languages
Code Comparison
algorithm-pattern (Go):
func binarySearch(nums []int, target int) int {
left, right := 0, len(nums)-1
for left <= right {
mid := left + (right-left)/2
if nums[mid] == target {
return mid
} else if nums[mid] < target {
left = mid + 1
} else {
right = mid - 1
}
}
return -1
}
javascript-algorithms (JavaScript):
function binarySearch(array, target) {
let left = 0;
let right = array.length - 1;
while (left <= right) {
const mid = Math.floor((left + right) / 2);
if (array[mid] === target) return mid;
if (array[mid] < target) left = mid + 1;
else right = mid - 1;
}
return -1;
}
Both repositories provide implementations of common algorithms, but javascript-algorithms offers a more extensive collection with detailed explanations. algorithm-pattern focuses on Go, while javascript-algorithms is JavaScript-centric. The code comparison shows similar implementations of binary search in their respective languages, demonstrating the repositories' approach to presenting algorithms.
:books: 技术面试必备基础知识、Leetcode、计算机操作系统、计算机网络、系统设计
Pros of CS-Notes
- Comprehensive coverage of computer science topics beyond algorithms
- Well-organized structure with detailed explanations and diagrams
- Regularly updated with contributions from a large community
Cons of CS-Notes
- Primarily in Chinese, which may limit accessibility for non-Chinese speakers
- Less focused on specific algorithm patterns and implementations
- May be overwhelming for beginners due to its extensive content
Code Comparison
CS-Notes:
public class Solution {
public ListNode reverseList(ListNode head) {
ListNode prev = null;
ListNode curr = head;
while (curr != null) {
ListNode nextTemp = curr.next;
curr.next = prev;
prev = curr;
curr = nextTemp;
}
return prev;
}
}
algorithm-pattern:
func reverseList(head *ListNode) *ListNode {
var prev *ListNode
for head != nil {
head.Next, prev, head = prev, head, head.Next
}
return prev
}
The CS-Notes example is in Java and provides a more verbose implementation, while the algorithm-pattern example is in Go and offers a more concise solution. Both achieve the same result of reversing a linked list.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ç®æ³æ¨¡æ¿
ç®æ³æ¨¡æ¿ï¼æç§å¦çå·é¢æ¹å¼ï¼æå¿«éçå·é¢è·¯å¾ï¼ä¸ä¸ªæä»å ¥é¨å° offerï¼ä½ å¼å¾æ¥æ ð¶~
ç®æ³æ¨¡æ¿é¡¾åæä¹å°±æ¯å·é¢çå¥è·¯æ¨¡æ¿ï¼ææ¡äºå·é¢æ¨¡æ¿ä¹åï¼å·é¢ä¹åå¾å¥½ç©èµ·æ¥äº~
æ¤é¡¹ç®æ¯èªå·±æ¾å·¥ä½æ¶ï¼ä» 0 å¼å§å· LeetCode çå¿å¾è®°å½ï¼éè¿åç§å·é¢æç« ãä¸æ ãè§é¢çæ»ç»äºä¸å¥èªå·±çå·é¢æ¨¡æ¿ã
è¿ä¸ªæ¨¡æ¿ä¸»è¦æ¯ä»ç»äºä¸äºéç¨çå·é¢æ¨¡æ¿ï¼ä»¥åä¸äºå¸¸è§é®é¢ï¼å¦å°åºè¦å·å¤å°é¢ï¼æä»ä¹é¡ºåºæ¥å·é¢ï¼å¦ä½æé«å·é¢æççã
å¨çº¿ææ¡£
å¨çº¿ææ¡£ Gitbookï¼ç®æ³æ¨¡æ¿ ð¥
æ ¸å¿å 容
å ¥é¨ç¯ ð¶
æ°æ®ç»æç¯ ð°
åºç¡ç®æ³ç¯ ð®
ç®æ³æç»´ ð¦
å¿å¾ä½ä¼
æç« å¤§é¨åæ¯å¯¹é¢ç®çæè·¯ä»ç»ï¼åä¸äºé®é¢ç解æï¼æäºæè·¯è¿æ¯éè¦èªå·±æå¨ååçï¼æ以æ¯ç¯æç« æåé½æ对åºçç»ä¹ é¢
å·å®è¿äºç»ä¹ é¢ï¼åºæ¬å¯¹æ°æ®ç»æåç®æ³æèªå·±ç认è¯ä½ä¼ï¼åºæ¬å¤§é¨åé¢è¯é¢é½è½åå¾åºæ¥ï¼å½å ç BATãTMD åºè¯¥é½ä¸æ¯é®é¢
ä» 4 æ份æ¾å·¥ä½å¼å§ï¼ä» 0 å¼å§å· LeetCodeï¼ä¸é´å¤§æ¦è±äºä¸ä¸ªåæ(6 å¨)å·¦å³æ¶é´å·å® 240 é¢ã
å¼å§å·é¢æ¶ï¼ç¡®å®æ¯æ ä»ä¸æï¼å 为ä»åºå·å¼å§å·ï¼å·å°å éé¢å°±éå° hard çé¢åï¼ä¼å¡ä½å¾ä¹ ï¼åé¢å»è¯è®ºåºçå«äººæä¹å·é¢ï¼ä¹å» Google æç´¢æ好çå·é¢æ¹å¼ï¼åç°æé¢åå·é¢ä¼èæå¾å¤ï¼åºæ¬ä¸ä¸ªç±»åçé¢ç®ï¼ä¸å¤©è½åå¾å¤ï¼æ ¢æ ¢å·é¢ä¹ä¸åæ¯ç¥ï¼åèµ·æ¥ä¹å¾æææï¼æåä¹æ¶å°ä¸éç offerï¼æåå»äºå®å®ç³»ï¼ã
åå°æå¼å§çé®é¢ï¼é¢è¯å°åºè¦å·å¤å°é¢ï¼å ¶å®è¿ä¸ªåå³äºä½ æ³è¿ä»ä¹æ ·å ¬å¸ï¼ä½ å®çç®æ å¦ææ¯å½å ä¸çº¿å¤§åï¼ä¸ªäººæè§å¤§æ¦ 200 è³ 300 é¢åºæ¬å°±æ»¡è¶³å¤§é¨åé¢è¯éè¦äºã第äºä¸ªé®é¢æ¯æä»ä¹é¡ºåºå·åå¦ä½æé«æçï¼è¿ä¸ªä¹æ¯æ¬ repo çç®çï¼ç»ä½ æå®äºä¸ä¸ªå·é¢ç顺åºï¼ä»¥åå·é¢ç模æ¿ï¼æäºæ¹ååæå·§åï¼å°±å»å¨æå§~ å¸æå·å®ä¹åï¼ä½ ä¹è½èªå·±æ»ç»ä¸å¥å±äºèªå·±çå·é¢æ¨¡æ¿ï¼æææ¶è·ï¼æææé¿~
æ¨èçå·é¢è·¯å¾
ææ¤ repo ç®å½å·ä¸éï¼å¦æä¸é´æé¢ç®å¡ä½äºå è·³è¿ï¼ç¶åå·é¢ä¸é LeetCode æ¢ç´¢åºç¡å¡çï¼æåå¿«è¦é¢è¯æ¶å·é¢ä¸éåæ offerã
为ä»ä¹è¿ä¹è¦è¿ä¹å·ï¼å 为 repo éé¢çé¢ç®æ¯æç±»åå½ç±»ï¼é½æ¯ä¸äºå¸¸è§çé«é¢é¢ï¼å¾æ代表æ§ï¼å¤§é¨åé½æ¯å¯ä»¥ç¨æ¨¡æ¿å ä¸ç¹åå½¢ååºæ¥ï¼å·å®å对大é¨åé¢ç®æåºæ¬ç认è¯ãç¶åå·ä¸éæ¢ç´¢å¡çï¼å·©åºä¸ä¸ä¸äºåºç¡ç¥è¯ç¹ï¼æ»ç»è¿äºç¥è¯ç¹ãæååæ offer æ¯å¤§é¨åå ¬å¸çåºé¢æºå¤´ï¼å·å®é¢è¯ä¸åºæ¬ä¼éå°ç°é¢æè åå½¢é¢ï¼åºæ¬å·å®è¿ä¸é¨åï¼å¤§é¨åå½å å ¬å¸çé¢è¯é¢åºè¯¥å°±æ²¡ä»ä¹é®é¢äº~
1ã algorithm-pattern ç»ä¹ é¢
2ã LeetCode å¡ç
3ã åæ offer
å·é¢æ¶é´å¯ä»¥åçåé ï¼å¦ææç®åå¤é¢è¯äºï¼å»ºè®®åé¢ä¸¤é¨å ä¸ä¸ªåæ ï¼6 å¨ï¼æ¶é´å·å®ï¼æååæ offer å个æå·å®ï¼è¾¹å·å¯ä»¥è¾¹æç®åè¿è¡é¢è¯ï¼éå°ä¸ä¼çä¸ç¨çæ¥ï¼å¾æ¨¡æ¿ä¸å¥å°±å¯¹äºï¼å¦æé¢è¯ç®¡ç»ä½ æ示ï¼é£å°±å¥½å¥½åï¼ä¸è¦éè¿è¿å¤§å¥½æºä¼~
注æç¹ï¼å¦æ为äºæ¾å·¥ä½å·é¢ï¼éå° hard çé¢å¦æææ路就åï¼æ²¡æè·¯å è·³è¿ï¼å æåºç¡æ好ï¼åæ¥å· hard å¯è½ææä¼æ´å¥½~
é¢è¯èµæº
å享ä¸äºè®¡ç®æºçç»å ¸ä¹¦ç±ï¼å¤§é¨å对é¢è¯åºè¯¥é½æ帮å©ï¼å¼ºçæ¨è ð
æ´æ°è®¡å
æç»æ´æ°ä¸ï¼è§å¾è¿å¯ä»¥çè¯ç¹ä¸ª star æ¶èå âï¸~
ã Github ãhttps://github.com/greyireland/algorithm-pattern âï¸
å®ææå¡
å®æ计åä¹åï¼å¯ä»¥æ交 Pull requestsï¼å¨ä¸é¢æ·»å èªå·±ç项ç®ä»åºï¼å®æèªå·±çç®æ³æ¨¡æ¿æå¡å~
Top Related Projects
刷算法全靠套路,认准 labuladong 就够了!English version supported! Crack LeetCode, not only how, but also why.
Everything you need to know to get the job.
A complete computer science study plan to become a software engineer.
💯 Curated coding interview preparation materials for busy software engineers
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
:books: 技术面试必备基础知识、Leetcode、计算机操作系统、计算机网络、系统设计
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot