huihut / interview

📚 C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, including language, program library, data structure, algorithm, system, network, link loading library, interview experience, recruitment, recommendation, etc.

Home Page:https://interview.huihut.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

快排算法的疑问

la1den opened this issue · comments

commented

为什么 left++ 之后不交换 arr[end] 呢,移动后的 left 的位置的元素应该只是大于等于 arr[end] 而不能确定是等于吧

为什么 left++ 之后不交换 arr[end] 呢,移动后的 left 的位置的元素应该只是大于等于 arr[end] 而不能确定是等于吧

left++根本不可能执行,因为要执行left++必须left停留在<mid的元素上,也就是说退出循环left++的循环,只能是left==right,那这时left的位置的元素已经是>mid的了