Giter Club home page Giter Club logo

base-data-structures-and-algorithms's Introduction

数据结构和算法必知必会的 50 个代码实现

目录

  • 1 数组

    • 1.1 实现一个支持动态扩容的数组
    • 1.2 实现一个大小固定的有序数组,支持动态增删改操作
    • 1.3 实现两个有序数组合并为一个有序数组
  • 2 链表

    • 2.1 实现单链表、循环链表、双向链表,支持增删操作
    • 2.2 实现单链表反转
    • 2.3 实现两个有序的链表合并为一个有序链表
    • 2.4 实现求链表的中间结点
  • 3 栈

    • 3.1 用数组实现一个顺序栈
    • 3.2 用链表实现一个链式栈
    • 3.3 编程模拟实现一个浏览器的前进、后退功能
  • 4 队列

    • 4.1 用数组实现一个顺序队列
    • 4.2 用链表实现一个链式队列
    • 4.3 实现一个循环队列
  • 5 递归

    • 5.1 编程实现斐波那契数列求值f(n)=f(n-1)+f(n-2)
    • 5.2 编程实现求阶乘n!
    • 5.3 编程实现一组数据集合的全排列
  • 6 排序

    • 6.1 实现归并排序、快速排序、插入排序、冒泡排序、选择排序
    • 6.2 编程实现O(n)时间复杂度内找到一组数据的第K大元素
  • 7 二分查找

    • 7.1 实现一个有序数组的二分查找算法
    • 7.2 实现模糊二分查找算法(比如大于等于给定值的第一个元素)
  • 8 散列表

    • 8.1 实现一个基于链表法解决冲突问题的散列表
    • 8.2 实现一个LRU缓存淘汰算法
  • 9 字符串

    • 9.1 实现一个字符集,只包含a~z这26个英文字母的Trie树
    • 9.2 实现朴素的字符串匹配算法
  • 10 二叉树

    • 10.1 实现一个二叉查找树,并且支持插入、删除、查找操作
    • 10.2 实现查找二叉查找树中某个节点的后继、前驱节点
    • 10.3 实现二叉树前、中、后序以及按层遍历
  • 11 堆

    • 11.1 实现一个小顶堆、大顶堆、优先级队列
    • 11.2 实现堆排序
    • 11.3 利用优先级队列合并K个有序数组
    • 11.4 求一组动态数据集合的最大Top K
  • 12 图

    • 12.1 实现有向图、无向图、有权图、无权图的邻接矩阵和邻接表表示方法
    • 12.2 实现图的深度优先搜索、广度优先搜索
    • 12.3 实现Dijkstra算法、A*算法
    • 12.4 实现拓扑排序的Kahn算法、DFS算法
  • 13 回溯

    • 13.1 利用回溯算法求解八皇后问题
    • 13.1 利用回溯算法求解0-1背包问题
  • 14 分治

    • 14.1 利用分治算法求一组数据的逆序对个数
  • 15 动态规划

    • 15.1 0-1背包问题
    • 15.2 最小路径和
    • 15.3 编程实现莱文斯坦最短编辑距离
    • 15.4 编程实现查找两个字符串的最长公共子序列
    • 15.5 编程实现一个数据序列的最长递增子序列

测试

每个题目在源代码中有一个对应的目录,切换到相应目录,执行以下命令即可

$ make
$ ./test

License

Apache v2

base-data-structures-and-algorithms's People

Contributors

kevinbai-cn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.