From ab292a68f28c0c2601c86374a5f659c90a729280 Mon Sep 17 00:00:00 2001 From: Powfu <1875065753@qq.com> Date: Wed, 27 Dec 2023 10:54:16 +0000 Subject: [PATCH] =?UTF-8?q?add=202101040022/chapter=5F9/=20=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E4=B8=AD=E7=9A=84=E7=AC=ACk=E4=B8=AA=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E5=85=83=E7=B4=A0.cpp.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Powfu <1875065753@qq.com> --- ...0\345\244\247\345\205\203\347\264\240.cpp" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "2101040022/chapter_9/ \346\225\260\347\273\204\344\270\255\347\232\204\347\254\254k\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240.cpp" diff --git "a/2101040022/chapter_9/ \346\225\260\347\273\204\344\270\255\347\232\204\347\254\254k\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240.cpp" "b/2101040022/chapter_9/ \346\225\260\347\273\204\344\270\255\347\232\204\347\254\254k\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240.cpp" new file mode 100644 index 00000000..f07bb65c --- /dev/null +++ "b/2101040022/chapter_9/ \346\225\260\347\273\204\344\270\255\347\232\204\347\254\254k\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240.cpp" @@ -0,0 +1,33 @@ +class Solution { +public: + int part(vector& nums,int start,int end){ + int low=start,high=end; + int tmp=nums[start]; + while(low=tmp) + high--; + nums[low]=nums[high]; + while(low& nums,int start,int end,int k){ + if(startnums.size()-k){ + return quick_sort(nums,start,idx,k); + }else if(idx& nums, int k) { + return quick_sort(nums,0,nums.size()-1,k); + } +}; \ No newline at end of file -- Gitee