Lazy loaded image
🤨<Python> 快速排序
字数 542阅读时长 2 分钟
2024-10-11
2024-10-12
type
status
date
slug
summary
tags
category
icon
password
😀
快速排序

今天和大家介绍一下快速排序

基本思想就是:
选择一个基准数,让它在数组里找到它的左边都小于它,它的右边都大于它,也就是让这个基准数去到自己排序完之后应该在的位置
然后不断的分割成左右数组,递归
代码⬇️
notion image
运行⬇️
notion image
notion image
​编辑
分为两个部分:分割 & 递归
🥚其实可以一起写到一个函数里
代码⬇️
notion image
运行⬇️
notion image
notion image
IN 2024/10/8
引用来源:Hello算法
 
上一篇
正则表达式
下一篇
<Python> 排序算法

评论
Loading...