Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QuickSort ¶
func QuickSort(nums []int)
快排的基本思想,选取一个基准值,将比基准值大的放在左边,比基准值小的放在右边,然后递归 具体的做法:每次随机选择基准值,比如选最右边那个,然后左索引选最左,右索引选择右起第二个 左边向右移,右边向左移,遇到左边比基准值大,左边停止移动,右边比基准值小,右边停止移动,左右都停止时,交换左右 左右相遇时停止移动,这个时候如果左比基准值大,交换 注意是否交换基准值,决定了子问题的规模
func SelectSort ¶
func SelectSort(nums []int)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.