Convert Figma logo to code with AI

greyireland logoalgorithm-pattern

算法模板,最科学的刷题方式,最快速的刷题路径,你值得拥有~

15,147
2,585
15,147
29

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

175,755

: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:

  1. Visit the repository at https://github.com/greyireland/algorithm-pattern
  2. Navigate through the table of contents in the README.md file
  3. Click on the topic you're interested in to access the explanations and implementations
  4. 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.

175,755

: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 Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

算法模板

来刷题了

算法模板,最科学的刷题方式,最快速的刷题路径,一个月从入门到 offer,你值得拥有 🐶~

算法模板顾名思义就是刷题的套路模板,掌握了刷题模板之后,刷题也变得好玩起来了~

此项目是自己找工作时,从 0 开始刷 LeetCode 的心得记录,通过各种刷题文章、专栏、视频等总结了一套自己的刷题模板。

这个模板主要是介绍了一些通用的刷题模板,以及一些常见问题,如到底要刷多少题,按什么顺序来刷题,如何提高刷题效率等。

在线文档

在线文档 Gitbook:算法模板 🔥

核心内容

入门篇 🐶

数据结构篇 🐰

基础算法篇 🐮

算法思维 🦁

心得体会

文章大部分是对题目的思路介绍,和一些问题的解析,有了思路还是需要自己手动写写的,所以每篇文章最后都有对应的练习题

刷完这些练习题,基本对数据结构和算法有自己的认识体会,基本大部分面试题都能写得出来,国内的 BAT、TMD 应该都不是问题

从 4 月份找工作开始,从 0 开始刷 LeetCode,中间大概花了一个半月(6 周)左右时间刷完 240 题。

一个半月刷完240题

刷题记录

开始刷题时,确实是无从下手,因为从序号开始刷,刷到几道题就遇到 hard 的题型,会卡住很久,后面去评论区看别人怎么刷题,也去 Google 搜索最好的刷题方式,发现按题型刷题会舒服很多,基本一个类型的题目,一天能做很多,慢慢刷题也不再枯燥,做起来也很有意思,最后也收到不错的 offer(最后去了宇宙系)。

回到最开始的问题,面试到底要刷多少题,其实这个取决于你想进什么样公司,你定的目标如果是国内一线大厂,个人感觉大概 200 至 300 题基本就满足大部分面试需要了。第二个问题是按什么顺序刷及如何提高效率,这个也是本 repo 的目的,给你指定了一个刷题的顺序,以及刷题的模板,有了方向和技巧后,就去动手吧~ 希望刷完之后,你也能自己总结一套属于自己的刷题模板,有所收获,有所成长~

推荐的刷题路径

按此 repo 目录刷一遍,如果中间有题目卡住了先跳过,然后刷题一遍 LeetCode 探索基础卡片,最后快要面试时刷题一遍剑指 offer。

为什么这么要这么刷,因为 repo 里面的题目是按类型归类,都是一些常见的高频题,很有代表性,大部分都是可以用模板加一点变形做出来,刷完后对大部分题目有基本的认识。然后刷一遍探索卡片,巩固一下一些基础知识点,总结这些知识点。最后剑指 offer 是大部分公司的出题源头,刷完面试中基本会遇到现题或者变形题,基本刷完这三部分,大部分国内公司的面试题应该就没什么问题了~

1、 algorithm-pattern 练习题

练习题

2、 LeetCode 卡片

探索卡片

3、 剑指 offer

剑指offer

刷题时间可以合理分配,如果打算准备面试了,建议前面两部分 一个半月 (6 周)时间刷完,最后剑指 offer 半个月刷完,边刷可以边投简历进行面试,遇到不会的不用着急,往模板上套就对了,如果面试管给你提示,那就好好做,不要错过这大好机会~

注意点:如果为了找工作刷题,遇到 hard 的题如果有思路就做,没思路先跳过,先把基础打好,再来刷 hard 可能效果会更好~

面试资源

分享一些计算机的经典书籍,大部分对面试应该都有帮助,强烈推荐 🌝

我看过的 100 本书

更新计划

持续更新中,觉得还可以的话点个 star 收藏呀 ⭐️~

【 Github 】https://github.com/greyireland/algorithm-pattern ⭐️

完成打卡

完成计划之后,可以提交 Pull requests,在下面添加自己的项目仓库,完成自己的算法模板打卡呀~

完成用户项目地址
✅easyuialgorithm-pattern-swift(Swift 实现),在线文档 Gitbook
✅wardseptembernotes(Java 实现)
✅dashidhyalgorithm-pattern-python(Python 实现)
✅binzi56algorithm-pattern-c(c++ 实现)
✅lvseourenalgorithm-study-record(c++ 实现)
✅chienmyalgorithm-pattern-java(Java 实现), 在线文档 Gitbook
✅ligecarrymealgorithm-pattern-JavaScript(JS+TS实现)
✅Esdeathalgorithm-pattern-dart(dart实现),在线文档 Gitbook
✅longpi1algorithm-pattern-golang(golang实现)
✅tpxxnalgorithm-pattern-CSharp(C# 实现)