Git Product home page Git Product logo

algorithm's Introduction

js算法演练

  • 各种排序算法的js实现。
  • 对常用的排序提供优化方案。
  • 提供单元测试。

项目目录

  • +src 源代码目录。
  • +test 单元测试目录。

注意事项

  • js统一采用es6语法
  • 测试使用mocha + Istanbul
  • mocha在windows下使用时会存在bug,不能使用istanbul cover _mocha xxx 而要直接定位到mocha地址istanbul cover node_modules/mocha/bin/_mocha xxx

运行测试

cd path to project
npm install 
npm run test

bug处理

  • 发现bug请在issues留言或者发送邮件到[email protected] 我会及时处理,谢谢。

选择排序演示(一个一个挑出最大的或最小的)

图片来源于网络

插入排序演示(打扑克牌一样找到插入的位置,可以用二分法优化)

图片来源于网络

希尔排序演示(分区间的插入排序)

图片来源于网络

归并排序演示(找到中间元素,划分两边, 再取出一个一个元素比较序列化,归并)

图片来源于网络

快速排序演示(选一个标志元素,左右分区,一次递归合并)

图片来源于网络

计数排序(找到当前元素前面还有多少个比自己小的元素(非比较排序))

图片来源于网络

桶排序(划分区间的基数排序)

图片来源于网络

基数排序(按位数收集再采用计数排序)

图片来源于网络

algorithm's People

Contributors

maoruibin001 avatar

Stargazers

翟义东 avatar 咕噜丹 avatar  avatar Yao avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

youzuosan

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.