Comments (2)
from awesome-coding-js.
快速排序里面的第二种写法代码里面有一处有错误。
第二行这里的
if (end - start < 2) { return; }
if里面应该是“end - start < 1”,不然的话当刚好有两个元素的话就无法去判断排序了。
比如这个数组“[23, 11, 5, 65, 7, 33, 2, 26]”,如果按照你的写法的话会输出“[ 2, 7, 5, 11, 23, 26, 33, 65 ]”,如果改成我那样的话就会正确输出“[ 2, 5, 7, 11, 23, 26, 33, 65 ]”
已修复,感谢提出。
from awesome-coding-js.
Related Issues (20)
- 文档上的栈介绍应该是`先进后出`或者`后进先出`吧 HOT 1
- 奇数放在偶数的前面【其它解法】
- 平衡二叉树的定义是不是写错了 HOT 1
- 二叉树中和为某一值的路径算法问题
- 数组去重的Object方法类型区分问题
- call的代码实现写的有漏洞,应该改为如下代码
- 字符串的排列【其他解法】
- 中序遍历,题目,代码,运行结果,发现不对 HOT 2
- 完全二叉树的排序为什么要排序呢。
- 归并排序的图出不来了
- 字符流中第一个不重复的字符
- 关于数据结构堆的基本操作中有一段代码无法运行
- 求二叉树遍历中readline函数没有声明 HOT 1
- 字符串:正则表达式匹配题目错误
- 单例模式文档有错别字,如下
- jsonp实现章节,回调执行完毕后删除window上的挂载
- 选择排序的第一层循环终止条件问题 HOT 1
- 数组去重中排序方法错误点 HOT 1
- 选择排序之稳定性 HOT 1
- 字符串翻转题目2问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awesome-coding-js.