Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript中11_sorts的simpleSort文件有一处错误 #503

Open
chengyoung1016 opened this issue Jan 11, 2021 · 1 comment
Open

typescript中11_sorts的simpleSort文件有一处错误 #503

chengyoung1016 opened this issue Jan 11, 2021 · 1 comment

Comments

@chengyoung1016
Copy link

插入排序,也就是第45行,array[j+1]经过排序后,值已经改变,此时无法继续作为比较的标准,应该改为temp

@OrangeTien
Copy link

arrat[j+1]经过一轮排序之后,它的值要么不改变,要么变成array[j]的值,确实存在值会改变的情况。当它的值一旦发生改变,那么循环至于已经执行了一次,此时J的值已经发生了改变,那么arrar[j+1]的值又不是原来的值了,所以不需要使用tmep来存储原值。(个人观点,也许有遗漏之处,欢迎指正。)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants