{"id":28265,"date":"2021-07-27T19:15:07","date_gmt":"2021-07-27T12:15:07","guid":{"rendered":"https:\/\/wiki.tino.org\/staging\/?p=28265"},"modified":"2021-11-22T17:42:17","modified_gmt":"2021-11-22T10:42:17","slug":"quick-sort-la-gi","status":"publish","type":"post","link":"https:\/\/tino.vn\/blog\/quick-sort-la-gi\/","title":{"rendered":"Quick Sort l\u00e0 g\u00ec? T\u00ecm hi\u1ec3u chi ti\u1ebft v\u1ec1 Quick Sort"},"content":{"rendered":"\n<p><strong>C\u00e1c thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp d\u1eef li\u1ec7u l\u00e0 m\u1ed9t y\u1ebfu t\u1ed1 quan tr\u1ecdng kh\u00e1 quan tr\u1ecdng trong l\u1eadp tr\u00ecnh, \u0111i\u1ec3n h\u00ecnh trong s\u1ed1 \u0111\u00f3 l\u00e0 Quick Sort. V\u1eady Quick Sort l\u00e0 g\u00ec? Trong b\u00e0i vi\u1ebft h\u00f4m nay, b\u1ea1n h\u00e3y c\u00f9ng <a href=\"https:\/\/tino.vn\/blog\/\" target=\"_blank\" rel=\"noreferrer noopener\">Tino Group<\/a> t\u00ecm hi\u1ec3u v\u1ec1 Quick Sort \u0111\u1ec3 xem c\u00e1ch thu\u1eadt to\u00e1n n\u00e0y tri\u1ec3n khai v\u00e0 ho\u1ea1t \u0111\u1ed9ng nh\u01b0 th\u1ebf n\u00e0o nh\u00e9!<\/strong><\/p>\n\n\n\n<h2 id=\"Quick_Sort_l\u00e0_g\u00ec?\"><strong>Quick Sort l\u00e0 g\u00ec?<\/strong><\/h2>\n\n\n\n<h3 id=\"Kh\u00e1i_ni\u1ec7m_Quick_Sort\"><strong>Kh\u00e1i ni\u1ec7m Quick Sort<\/strong><\/h3>\n\n\n\n<p>Thu\u1eadt to\u00e1n Quick Sort (S\u1eafp x\u1ebfp nhanh) l\u00e0 m\u1ed9t quy tr\u00ecnh c\u00f3 h\u1ec7 th\u1ed1ng \u0111\u1ec3 s\u1eafp x\u1ebfp c\u00e1c ph\u1ea7n t\u1eed c\u1ee7a m\u1ed9t m\u1ea3ng. Gi\u1ed1ng nh\u01b0 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Merge_sort\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Merge Sort<\/a>, QuickSort l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n s\u1eed d\u1ee5ng c\u00e1ch th\u1ee9c chia \u0111\u1ec3 tr\u1ecb (Divide and Conquer algorithm).<\/p>\n\n\n\n<p>T\u00ean g\u1ecdi &#8220;Quick Sort&#8221; \u00e1m ch\u1ec9 thu\u1eadt to\u00e1n n\u00e0y c\u00f3 kh\u1ea3 n\u0103ng s\u1eafp x\u1ebfp d\u1eef li\u1ec7u nhanh h\u01a1n nhi\u1ec1u so v\u1edbi b\u1ea5t k\u1ef3 thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp truy\u1ec1n th\u1ed1ng n\u00e0o kh\u00e1c. Tuy nhi\u00ean, Quick Sort kh\u00f4ng \u0111\u01b0\u1ee3c \u1ed5n \u0111\u1ecbnh v\u00ec th\u1ee9 t\u1ef1 t\u01b0\u01a1ng \u0111\u1ed1i c\u1ee7a c\u00e1c ph\u1ea7n t\u1eed b\u1eb1ng nhau kh\u00f4ng \u0111\u01b0\u1ee3c \u0111\u1ea3m b\u1ea3o.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1265.png\" alt=\"Quick-sort-la-gi\" class=\"wp-image-28268\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1265.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1265-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<h3 id=\"C\u00e1ch_th\u1ee9c_ho\u1ea1t_\u0111\u1ed9ng_c\u1ee7a_Quick_Sort\"><strong>C\u00e1ch th\u1ee9c ho\u1ea1t \u0111\u1ed9ng c\u1ee7a Quick Sort<\/strong><\/h3>\n\n\n\n<p>Thu\u1eadt to\u00e1n s\u1ebd ch\u1ecdn ra m\u1ed9t ph\u1ea7n t\u1eed trong m\u1ea3ng \u0111\u1ec3 l\u00e0m \u0111i\u1ec3m \u0111\u00e1nh d\u1ea5u g\u1ecdi l\u00e0 <strong>pivot<\/strong>. Sau khi ch\u1ecdn \u0111\u01b0\u1ee3c \u0111i\u1ec3m \u0111\u00e1nh d\u1ea5u, n\u00f3 s\u1ebd chia m\u1ea3ng \u0111\u00f3 th\u00e0nh hai m\u1ea3ng con b\u1eb1ng c\u00e1ch so s\u00e1nh v\u1edbi pivot \u0111\u00e3 ch\u1ecdn. M\u1ed9t m\u1ea3ng s\u1ebd bao g\u1ed3m c\u00e1c ph\u1ea7n t\u1eed nh\u1ecf h\u01a1n ho\u1eb7c b\u1eb1ng pivot v\u00e0 m\u1ea3ng c\u00f2n l\u1ea1i lu\u00f4n l\u1edbn h\u01a1n ho\u1eb7c b\u1eb1ng pivot.<\/p>\n\n\n\n<p>Sau \u0111\u00f3, qu\u00e1 tr\u00ecnh n\u00e0y \u0111\u01b0\u1ee3c l\u1eb7p l\u1ea1i \u0111\u1ee7 s\u1ed1 l\u1ea7n cho \u0111\u1ebfn khi c\u00e1c m\u1ea3ng nh\u1ecf c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eafp x\u1ebfp m\u1ed9t c\u00e1ch d\u1ec5 d\u00e0ng \u0111\u1ec3 t\u1ea1o ra m\u1ed9t t\u1eadp d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c s\u1eafp x\u1ebfp \u0111\u1ea7y \u0111\u1ee7.<\/p>\n\n\n\n<p>C\u00e1c nhi\u1ec1u phi\u00ean b\u1ea3n Quick Sort kh\u00e1c nhau ch\u1ecdn pivot theo nh\u1eefng c\u00e1ch kh\u00e1c nhau. T\u1ed1c \u0111\u1ed9 s\u1eafp x\u1ebfp c\u1ee7a thu\u1eadt to\u00e1n ph\u1ea3i ph\u1ee5 thu\u1ed9c v\u00e0o vi\u1ec7c l\u1ef1a ch\u1ecdn pivot, c\u00f3 m\u1ed9t s\u1ed1 c\u00e1ch \u0111\u1ec3 ch\u1ecdn nh\u01b0 sau:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Lu\u00f4n ch\u1ecdn ph\u1ea7n t\u1eed \u0111\u1ea7u ti\u00ean l\u00e0m pivot.<\/li><li>Lu\u00f4n ch\u1ecdn ph\u1ea7n t\u1eed cu\u1ed1i c\u00f9ng l\u00e0m pivot<\/li><li>Ch\u1ecdn m\u1ed9t ph\u1ea7n t\u1eed ng\u1eabu nhi\u00ean l\u00e0m pivot.<\/li><li>Ch\u1ecdn v\u1ecb tr\u00ed \u1edf gi\u1eefa l\u00e0m pivot.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1266.png\" alt=\"Quick-sort-la-gi\" class=\"wp-image-28269\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1266.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1266-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<h3 id=\"\u1ee8ng_d\u1ee5ng_c\u1ee7a_thu\u1eadt_to\u00e1n_Quick_Sort\"><strong>\u1ee8ng d\u1ee5ng c\u1ee7a thu\u1eadt to\u00e1n Quick Sort<\/strong><\/h3>\n\n\n\n<p>Quick Sort cung c\u1ea5p m\u1ed9t c\u00e1ch ti\u1ebfp c\u1eadn nhanh ch\u00f3ng v\u00e0 c\u00f3 ph\u01b0\u01a1ng ph\u00e1p \u0111\u1ec3 s\u1eafp x\u1ebfp b\u1ea5t k\u1ef3 th\u1ee9 g\u00ec. Sau \u0111\u00e2y l\u00e0 m\u1ed9t s\u1ed1 \u1ee9ng d\u1ee5ng c\u1ee7a Quick Sort<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>M\u00e1y t\u00ednh th\u01b0\u01a1ng m\u1ea1i:<\/strong> \u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng trong c\u00e1c t\u1ed5 ch\u1ee9c ch\u00ednh ph\u1ee7 v\u00e0 t\u01b0 nh\u00e2n v\u1edbi m\u1ee5c \u0111\u00edch ph\u00e2n lo\u1ea1i d\u1eef li\u1ec7u kh\u00e1c nhau nh\u01b0 s\u1eafp x\u1ebfp t\u00e0i kho\u1ea3n\/h\u1ed3 s\u01a1 theo t\u00ean ho\u1eb7c theo ID, ph\u00e2n lo\u1ea1i giao d\u1ecbch theo th\u1eddi gian ho\u1eb7c \u0111\u1ecba \u0111i\u1ec3m, ph\u00e2n lo\u1ea1i file theo t\u00ean ho\u1eb7c ng\u00e0y t\u1ea1o, v.v.<\/li><li><strong>T\u00ednh to\u00e1n s\u1ed1:<\/strong> H\u1ea7u h\u1ebft c\u00e1c thu\u1eadt to\u00e1n \u0111\u01b0\u1ee3c ph\u00e1t tri\u1ec3n hi\u1ec7u qu\u1ea3 s\u1eed d\u1ee5ng h\u00e0ng \u0111\u1ee3i \u01b0u ti\u00ean v\u00e0 s\u1eafp x\u1ebfp inturn \u0111\u1ec3 \u0111\u1ea1t \u0111\u01b0\u1ee3c \u0111\u1ed9 ch\u00ednh x\u00e1c trong t\u1ea5t c\u1ea3 c\u00e1c ph\u00e9p t\u00ednh.<\/li><li><strong>T\u00ecm ki\u1ebfm th\u00f4ng tin:<\/strong> Thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp h\u1ed7 tr\u1ee3 t\u00ecm ki\u1ebfm th\u00f4ng tin nhanh h\u01a1n v\u00e0 hi\u1ec7u qu\u1ea3 h\u01a1n<\/li><\/ul>\n\n\n\n<h2 id=\"\u0110\u1ed9_ph\u1ee9c_t\u1ea1p_c\u1ee7a_Quick_Short\"><strong>\u0110\u1ed9 ph\u1ee9c t\u1ea1p c\u1ee7a Quick Short<\/strong><\/h2>\n\n\n\n<p>Khi ch\u1ecdn m\u1ed9t thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp, hi\u1ec7u qu\u1ea3 l\u00e0 m\u1ed9t trong nh\u1eefng y\u1ebfu t\u1ed1 quan tr\u1ecdng nh\u1ea5t. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 m\u1ed9t s\u1ed1 \u0111i\u1ec3m hi\u1ec7u qu\u1ea3 c\u1ee7a thu\u1eadt to\u00e1n Quicksort.<\/p>\n\n\n\n<h3 id=\"\u0110\u1ed9_ph\u1ee9c_t\u1ea1p_v\u1ec1_th\u1eddi_gian_c\u1ee7a_Quick_Short\"><strong>\u0110\u1ed9 ph\u1ee9c t\u1ea1p v\u1ec1 th\u1eddi gian c\u1ee7a Quick Short<\/strong><\/h3>\n\n\n\n<p>Trong c\u00e1c tr\u01b0\u1eddng h\u1ee3p t\u1ed1t nh\u1ea5t, trung b\u00ecnh v\u00e0 x\u1ea5u nh\u1ea5t, thu\u1eadt to\u00e1n Quick Sort th\u1ef1c hi\u1ec7n v\u1edbi \u0111\u1ed9 ph\u1ee9c t\u1ea1p O (n), O (n log n) v\u00e0 O (n ^ 2) t\u01b0\u01a1ng \u1ee9ng. \u0110\u00e2y l\u00e0 m\u1ed9t trong nh\u1eefng thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp hi\u1ec7u qu\u1ea3 nh\u1ea5t khi n\u00f3i \u0111\u1ebfn \u0111\u1ed9 ph\u1ee9c t\u1ea1p v\u1ec1 th\u1eddi gian.<\/p>\n\n\n\n<h3 id=\"\u0110\u1ed9_ph\u1ee9c_t\u1ea1p_v\u1ec1_kh\u00f4ng_gian_c\u1ee7a_Quick_Short\"><strong>\u0110\u1ed9 ph\u1ee9c t\u1ea1p v\u1ec1 kh\u00f4ng gian c\u1ee7a Quick Short<\/strong><\/h3>\n\n\n\n<p>\u0110\u1ed9 ph\u1ee9c t\u1ea1p kh\u00f4ng gian trung b\u00ecnh c\u1ee7a Quick Sort l\u00e0 O (log n) v\u00e0 \u0111\u1ed9 ph\u1ee9c t\u1ea1p kh\u00f4ng gian trong tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t l\u00e0 O (n). \u0110i\u1ec1u n\u00e0y ngang b\u1eb1ng v\u1edbi h\u1ea7u h\u1ebft c\u00e1c thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp ph\u1ed5 bi\u1ebfn, nh\u01b0ng b\u1ea3n ch\u1ea5t c\u1ee7a thu\u1eadt to\u00e1n \u0111\u1ec7 quy l\u00e0 ch\u00fang kh\u00f4ng t\u1ed1i \u01b0u h\u00f3a vi\u1ec7c s\u1eed d\u1ee5ng b\u1ed9 nh\u1edb.<\/p>\n\n\n\n<h3 id=\"T\u1ed1i_\u01b0u_h\u00f3a\"><strong>T\u1ed1i \u01b0u h\u00f3a<\/strong><\/h3>\n\n\n\n<p>V\u1edbi b\u1ea5t k\u1ef3 thu\u1eadt to\u00e1n n\u00e0o, th\u01b0\u1eddng c\u00f3 m\u1ed9t s\u1ed1 t\u1ed1i \u01b0u h\u00f3a c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c \u00e1p d\u1ee5ng cho c\u00e1c tr\u01b0\u1eddng h\u1ee3p kh\u00e1c. \u0110\u1ec3 \u0111\u1ea3m b\u1ea3o r\u1eb1ng kh\u00f4ng gian \u0111\u00e3 s\u1eed d\u1ee5ng \u0111\u01b0\u1ee3c gi\u1edbi h\u1ea1n \u1edf O (log n), thu\u1eadt to\u00e1n c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n \u0111\u1ec3 \u0111\u1ec7 quy v\u00e0o ph\u00eda nh\u1ecf h\u01a1n c\u1ee7a ph\u00e2n v\u00f9ng v\u00e0 c\u0169ng s\u1eed d\u1ee5ng \u0111\u1ec7 quy \u0111u\u00f4i. Ng\u01b0\u1eddi ta c\u0169ng c\u00f3 th\u1ec3 tri\u1ec3n khai m\u1ed9t thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp k\u1ebft h\u1ee3p chuy\u1ec3n sang m\u1ed9t thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp l\u1eb7p \u0111i l\u1eb7p l\u1ea1i c\u00f3 th\u1ec3 hi\u1ec7u qu\u1ea3 h\u01a1n v\u1ec1 th\u1eddi gian cho c\u00e1c m\u1ea3ng nh\u1ecf h\u01a1n.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1267.png\" alt=\"Quick-sort-la-gi\" class=\"wp-image-28270\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1267.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1267-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<h2 id=\"Thu\u1eadt_to\u00e1n_Quick_Sort_trong_ng\u00f4n_ng\u1eef_l\u1eadp_tr\u00ecnh_C++\"><strong>Thu\u1eadt to\u00e1n Quick Sort trong ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh C++<\/strong><\/h2>\n\n\n\n<h3 id=\"M\u00f4_t\u1ea3_thu\u1eadt_to\u00e1n\"><strong>M\u00f4 t\u1ea3 thu\u1eadt to\u00e1n<\/strong><\/h3>\n\n\n\n<p>Thu\u1eadt to\u00e1n s\u1ebd c\u00f3 hai giai \u0111o\u1ea1n. Giai \u0111o\u1ea1n \u0111\u1ea7u l\u00e0 ph\u00e2n \u0111o\u1ea1n m\u1ea3ng (partition()) v\u00e0 giai \u0111o\u1ea1n sau l\u00e0 s\u1eafp x\u1ebfp (quickSort()).<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ch\u1ecdn pivot cho m\u1ea3ng.<\/li><li>T\u1ea1o hai bi\u1ebfn l\u00e0 left v\u00e0 right \u0111\u1ec3 tr\u1ecf \u0111\u1ebfn b\u00ean tr\u00e1i v\u00e0 b\u00ean ph\u1ea3i c\u1ee7a danh s\u00e1ch.<\/li><li>Ti\u1ebfn h\u00e0nh so s\u00e1nh c\u00e1c ph\u1ea7n t\u1eed v\u1edbi pivot. Trong tr\u01b0\u1eddng h\u1ee3p ph\u1ea7n t\u1eed nh\u1ecf h\u01a1n pivot th\u00ec d\u1ecbch chuy\u1ec3n qua b\u00ean tr\u00e1i v\u00e0 ng\u01b0\u1ee3c l\u1ea1i.<\/li><li>Sau khi \u0111\u00e3 d\u1ecbch chuy\u1ec3n th\u00ec ti\u1ebfn h\u00e0nh c\u00f4ng vi\u1ec7c s\u1eafp x\u1ebfp c\u00e1c ph\u1ea7n t\u1eed trong m\u1ea3ng con m\u1edbi, tr\u01b0\u1edbc khi ti\u1ebfp t\u1ee5c ph\u00e2n \u0111o\u1ea1n ti\u1ebfp theo.<\/li><\/ul>\n\n\n\n<h3 id=\"Code_thu\u1eadt_to\u00e1n_Quick_Sort_trong_C++\"><strong>Code thu\u1eadt to\u00e1n Quick Sort trong C++<\/strong><\/h3>\n\n\n\n<p>\u1ede ph\u1ea7n tr\u00ean \u0111\u00e3 tr\u00ecnh b\u00e0i c\u00e1c b\u01b0\u1edbc vi\u1ebft thu\u1eadt to\u00e1n. \u0110\u1ec3 chi ti\u1ebft h\u01a1n, b\u1ea1n h\u00e3y tham kh\u1ea3o c\u00e1c d\u00f2ng code trong thu\u1eadt to\u00e1n d\u01b0\u1edbi \u0111\u00e2y.<\/p>\n\n\n\n<h4 id=\"H\u00e0m_partition()\"><strong>H\u00e0m partition()<\/strong><\/h4>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1268.png\" alt=\"Quick-sort-la-gi\" class=\"wp-image-28271\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1268.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1268-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<h4 id=\"H\u00e0m_quicksort()\"><strong>H\u00e0m quicksort()<\/strong><\/h4>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1269.png\" alt=\"Quick-sort-la-gi\" class=\"wp-image-28272\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1269.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1269-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<h4 id=\"H\u00e0m_swap()\"><strong>H\u00e0m swap()<\/strong><\/h4>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1270.png\" alt=\"Quick-sort-la-gi\" class=\"wp-image-28273\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1270.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1270-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<h3 id=\"V\u00ed_d\u1ee5_v\u1ec1_Quick_Sort_trong_m\u1ea3ng_\"><strong>V\u00ed d\u1ee5 v\u1ec1 Quick Sort trong m\u1ea3ng <\/strong><\/h3>\n\n\n\n<p>\u0110\u1ec3 minh h\u1ecda cho h\u00ecnh \u1ea3nh \u1edf tr\u00ean, ch\u00fang ta h\u00e3y c\u00f9ng l\u00e0m m\u1ed9t v\u00ed d\u1ee5 \u00e1p d\u1ee5ng thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp nhanh (Quick Sort). S\u1eafp x\u1ebfp c\u00e1c ph\u1ea7n t\u1eed trong m\u1ea3ng arr[] = {9, -3, 5, 2, 6, 8, -6, 1, 3} theo th\u1ee9 t\u1ef1 t\u0103ng d\u1ea7n.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;stdio.h>\r\n\r\n#include&lt;iostream>\r\n\r\nusing namespace std;\r\n\r\nvoid swap(int &amp;a, int &amp;b)\r\n\r\n{\r\n\r\nint t = a;\r\n\r\na = b;\r\n\r\nb = t;\r\n\r\n}\r\n\r\nint partition (int arr&#91;], int low, int high)\r\n\r\n{\r\n\r\nint pivot = arr&#91;high];\r\n\r\nint left = low;\r\n\r\nint right = high - 1;\r\n\r\nwhile(true){\r\n\r\nwhile(left &lt;= right &amp;&amp; arr&#91;left] &lt; pivot) left++;\r\n\r\nwhile(right >= left &amp;&amp; arr&#91;right] > pivot) right--;\r\n\r\nif (left >= right) break;\r\n\r\nswap(arr&#91;left], arr&#91;right]);\r\n\r\nleft++;\r\n\r\nright--;\r\n\r\n}\r\n\r\nswap(arr&#91;left], arr&#91;high]);\r\n\r\nreturn left;\r\n\r\n}\r\n\r\nvoid quickSort(int arr&#91;], int low, int high)\r\n\r\n{\r\n\r\nif (low &lt; high)\r\n\r\n{\r\n\r\nint index = partition(arr, low, high);\r\n\r\nquickSort(arr, low, index - 1);\r\n\r\nquickSort(arr, index + 1, high);\r\n\r\n}\r\n\r\n}\r\n\r\nvoid printArray(int arr&#91;], int size)\r\n\r\n{\r\n\r\nint i;\r\n\r\nfor (i=0; i &lt; size; i++){\r\n\r\ncout &lt;&lt; arr&#91;i];\r\n\r\ncout&lt;&lt;\"\\t\";\r\n\r\n}\r\n\r\n}\r\n\r\nint main()\r\n\r\n{\r\n\r\nint arr&#91;] = {9, -3, 5, 2, 6, 8, -6, 1, 3};\r\n\r\nint n = sizeof(arr)\/sizeof(arr&#91;0]);\r\n\r\nquickSort(arr, 0, n-1);\r\n\r\ncout&lt;&lt;\"M\u1ea3ng sau khi \u0111\u01b0\u1ee3c s\u1eafp x\u1ebfp: \\n\";\r\n\r\nprintArray(arr, n);\r\n\r\ncout&lt;&lt;\"\\n---------------------------------------\\n\";\r\n\r\ncout&lt;&lt;\"Ch\u01b0\u01a1ng tr\u00ecnh n\u00e0y \u0111\u01b0\u1ee3c \u0111\u0103ng t\u1ea1i Freetuts.net\";\r\n\r\n}<\/code><\/pre>\n\n\n\n<p>K\u1ebft qu\u1ea3 ta \u0111\u01b0\u1ee3c:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1271.png\" alt=\"Quick-sort-la-gi\" class=\"wp-image-28274\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1271.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2021\/07\/word-image-1271-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<h3 id=\"T\u1ea1i_sao_Quick_Sort_l\u1ea1i_hi\u1ec7u_qu\u1ea3_h\u01a1n_Merge_Sort?\"><strong>T\u1ea1i sao Quick Sort l\u1ea1i hi\u1ec7u qu\u1ea3 h\u01a1n Merge Sort?<\/strong><\/h3>\n\n\n\n<p><strong>V\u1ec1 kh\u00f4ng gian ph\u1ee5 tr\u1ee3:<\/strong> Quick Sort l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp t\u1ea1i ch\u1ed7 trong khi Merge Sort ph\u1ea3i s\u1eed d\u1ee5ng th\u00eam kh\u00f4ng gian. S\u1eafp x\u1ebfp t\u1ea1i ch\u1ed7 c\u00f3 ngh\u0129a l\u00e0 kh\u00f4ng c\u00f3 dung l\u01b0\u1ee3ng l\u01b0u tr\u1eef b\u1ed5 sung n\u00e0o \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 th\u1ef1c hi\u1ec7n s\u1eafp x\u1ebfp (ngo\u1ea1i tr\u1eeb ng\u0103n x\u1ebfp \u0111\u1ec7 quy). Merge Sort y\u00eau c\u1ea7u m\u1ed9t m\u1ea3ng t\u1ea1m th\u1eddi \u0111\u1ec3 h\u1ee3p nh\u1ea5t c\u00e1c m\u1ea3ng \u0111\u00e3 s\u1eafp x\u1ebfp, v\u00ec v\u1eady Quick Sort tr\u1edf th\u00e0nh t\u00f9y ch\u1ecdn t\u1ed1t h\u01a1n.<\/p>\n\n\n\n<p><strong>Tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t: <\/strong>Tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t c\u1ee7a Quick Sort l\u00e0 O (n2) c\u00f3 th\u1ec3 tr\u00e1nh \u0111\u01b0\u1ee3c b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng Quick Sort ng\u1eabu nhi\u00ean. L\u00fac n\u00e0y s\u1ebd c\u00f3 \u0111\u01b0\u1ee3c tr\u01b0\u1eddng h\u1ee3p trung b\u00ecnh b\u1eb1ng c\u00e1ch ch\u1ecdn ph\u1ea7n t\u1eed xoay ng\u1eabu nhi\u00ean v\u00e0 c\u1ea3i thi\u1ec7n hi\u1ec7u su\u1ea5t nh\u01b0 Merge Sort<\/p>\n\n\n\n<p><strong>Th\u00e2n thi\u1ec7n v\u1edbi b\u1ed9 nh\u1edb cache: <\/strong>Quick Sort c\u0169ng l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp th\u00e2n thi\u1ec7n v\u1edbi b\u1ed9 nh\u1edb cache v\u00ec thu\u1eadt to\u00e1n n\u00e0y c\u00f3 v\u1ecb tr\u00ed tham chi\u1ebfu t\u1ed1t khi \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho c\u00e1c m\u1ea3ng.<\/p>\n\n\n\n<p>T\u00f3m l\u1ea1i, Quick Sort l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp r\u1ea5t h\u1eefu \u00edch trong nhi\u1ec1u tr\u01b0\u1eddng h\u1ee3p v\u00e0 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ph\u1ed5 bi\u1ebfn hi\u1ec7n nay. B\u00e0i vi\u1ebft tr\u00ean \u0111\u00e3 cung c\u1ea5p cho b\u1ea1n m\u1ed9t s\u1ed1 th\u00f4ng tin li\u00ean quan \u0111\u1ebfn Quick Sort, hy v\u1ecdng b\u1ea1n s\u1ebd \u00e1p d\u1ee5ng thu\u1eadt to\u00e1n n\u00e0y hi\u1ec7u qu\u1ea3 \u0111\u1ec3 s\u1eafp x\u1ebfp d\u1eef li\u1ec7u nh\u00e9!<\/p>\n\n\n\n<h2 id=\"FAQs_v\u1ec1_Quick_Sort\"><strong>FAQs v\u1ec1 Quick Sort<\/strong><\/h2>\n\n\n\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"C\u00f3_bao_nhi\u00eau_lo\u1ea1i_thu\u1eadt_to\u00e1n_s\u1eafp_x\u1ebfp?\">C\u00f3 bao nhi\u00eau lo\u1ea1i thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>Quick Sort l\u00e0 m\u1ed9t lo\u1ea1i thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp trong r\u1ea5t nhi\u1ec1u lo\u1ea1i kh\u00e1c nhau, m\u1ed7i lo\u1ea1i s\u1ebd c\u00f3 nh\u1eefng \u01b0u \u0111i\u1ec3m ri\u00eang. C\u00e1c thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp ph\u1ed5 bi\u1ebfn trong <a href=\"https:\/\/tino.vn\/blog\/html-css-javascript-la-gi\/\" target=\"_blank\" rel=\"noreferrer noopener\">JavaScript<\/a> g\u1ed3m:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Bubble Sort.<\/li><li>Selection Sort.<\/li><li>Insertion Sort.<\/li><li>Merge Sort.<\/li><li>Quick sort.<\/li><li>Bucket Sort.<\/li><\/ul>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Quick_Sort_c\u00f3_ph\u1ea3i_l\u00e0_m\u1ed9t_thu\u1eadt_to\u00e1n_\u1ed5n_\u0111\u1ecbnh_kh\u00f4ng?\">Quick Sort c\u00f3 ph\u1ea3i l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n \u1ed5n \u0111\u1ecbnh kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>Quick Sort kh\u00f4ng ph\u1ea3i l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n \u1ed5n \u0111\u1ecbnh v\u00ec vi\u1ec7c ho\u00e1n \u0111\u1ed5i c\u00e1c ph\u1ea7n t\u1eed \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n theo v\u1ecb tr\u00ed c\u1ee7a pivot (m\u00e0 kh\u00f4ng xem x\u00e9t v\u1ecb tr\u00ed ban \u0111\u1ea7u c\u1ee7a ch\u00fang). Thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp \u0111\u01b0\u1ee3c cho l\u00e0 \u1ed5n \u0111\u1ecbnh n\u1ebfu n\u00f3 duy tr\u00ec th\u1ee9 t\u1ef1 t\u01b0\u01a1ng \u0111\u1ed1i c\u1ee7a c\u00e1c b\u1ea3n ghi trong tr\u01b0\u1eddng h\u1ee3p c\u00e1c kh\u00f3a b\u1eb1ng nhau.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Quick_Sort_c\u00f3_ph\u1ea3i_l\u00e0_m\u1ed9t_thu\u1eadt_to\u00e1n_t\u1ea1i_ch\u1ed7_kh\u00f4ng?\">Quick Sort c\u00f3 ph\u1ea3i l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n t\u1ea1i ch\u1ed7 kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>Quick Sort l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n t\u1ea1i ch\u1ed7, ngh\u0129a l\u00e0 t\u1ea5t c\u1ea3 c\u00e1c s\u1ed1 \u0111\u1ec1u \u0111\u01b0\u1ee3c s\u1eafp x\u1ebfp trong ch\u00ednh m\u1ea3ng ban \u0111\u1ea7u.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"T\u1ea1i_sao_n\u00ean_s\u1eed_d\u1ee5ng_Quick_Sort_ng\u1eabu_nhi\u00ean?\">T\u1ea1i sao n\u00ean s\u1eed d\u1ee5ng Quick Sort ng\u1eabu nhi\u00ean?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>\u0110\u00f4i khi, vi\u1ec7c ch\u1ecdn ph\u1ea7n t\u1eed ngo\u00e0i c\u00f9ng b\u00ean ph\u1ea3i c\u00f3 th\u1ec3 d\u1eabn \u0111\u1ebfn tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t. Trong nh\u1eefng tr\u01b0\u1eddng h\u1ee3p nh\u01b0 v\u1eady, vi\u1ec7c ch\u1ecdn m\u1ed9t ph\u1ea7n t\u1eed ng\u1eabu nhi\u00ean l\u00e0m tr\u1ee5c xoay c\u1ee7a b\u1ea1n \u1edf m\u1ed7i b\u01b0\u1edbc s\u1ebd gi\u1ea3m x\u00e1c su\u1ea5t d\u1eabn \u0111\u1ebfn h\u00e0nh vi trong tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t.<\/p>\n\n\n\n<p>Ch\u00fang ta s\u1ebd c\u00f3 nhi\u1ec1u kh\u1ea3 n\u0103ng ch\u1ecdn c\u00e1c tr\u1ee5c g\u1ea7n t\u00e2m c\u1ee7a m\u1ea3ng h\u01a1n v\u00e0 khi \u0111i\u1ec1u n\u00e0y x\u1ea3y ra, c\u00e1c nh\u00e1nh \u0111\u1ec7 quy \u0111\u1ed3ng \u0111\u1ec1u h\u01a1n v\u00e0 do \u0111\u00f3 thu\u1eadt to\u00e1n k\u1ebft th\u00fac nhanh h\u01a1n r\u1ea5t nhi\u1ec1u.<\/p>\n\n\n\n<p>\u0110\u1ed9 ph\u1ee9c t\u1ea1p th\u1eddi gian ch\u1ea1y d\u1ef1 ki\u1ebfn \u200b\u200bl\u00e0 O (n log n) v\u00ec c\u00e1c tr\u1ee5c ng\u1eabu nhi\u00ean \u0111\u00e3 ch\u1ecdn \u0111\u01b0\u1ee3c cho l\u00e0 \u0111\u1ec3 tr\u00e1nh h\u00e0nh vi trong tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\n<script type=\"application\/ld+json\">\n\t{\n\t\t\"@context\": \"https:\/\/schema.org\",\n\t\t\"@type\": \"FAQPage\",\n\t\t\"mainEntity\": [\n\t\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"C\u00f3 bao nhi\u00eau lo\u1ea1i thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Quick Sort l\u00e0 m\u1ed9t lo\u1ea1i thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp trong r\u1ea5t nhi\u1ec1u lo\u1ea1i kh\u00e1c nhau, m\u1ed7i lo\u1ea1i s\u1ebd c\u00f3 nh\u1eefng \u01b0u \u0111i\u1ec3m ri\u00eang. C\u00e1c thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp ph\u1ed5 bi\u1ebfn trong <a>JavaScript<\/a> g\u1ed3m:<\/p><ul><li>Bubble Sort.<\/li><li>Selection Sort.<\/li><li>Insertion Sort.<\/li><li>Merge Sort.<\/li><li>Quick sort.<\/li><li>Bucket Sort.<\/li><\/ul>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Quick Sort c\u00f3 ph\u1ea3i l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n \u1ed5n \u0111\u1ecbnh kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Quick Sort kh\u00f4ng ph\u1ea3i l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n \u1ed5n \u0111\u1ecbnh v\u00ec vi\u1ec7c ho\u00e1n \u0111\u1ed5i c\u00e1c ph\u1ea7n t\u1eed \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n theo v\u1ecb tr\u00ed c\u1ee7a pivot (m\u00e0 kh\u00f4ng xem x\u00e9t v\u1ecb tr\u00ed ban \u0111\u1ea7u c\u1ee7a ch\u00fang). Thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp \u0111\u01b0\u1ee3c cho l\u00e0 \u1ed5n \u0111\u1ecbnh n\u1ebfu n\u00f3 duy tr\u00ec th\u1ee9 t\u1ef1 t\u01b0\u01a1ng \u0111\u1ed1i c\u1ee7a c\u00e1c b\u1ea3n ghi trong tr\u01b0\u1eddng h\u1ee3p c\u00e1c kh\u00f3a b\u1eb1ng nhau.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Quick Sort c\u00f3 ph\u1ea3i l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n t\u1ea1i ch\u1ed7 kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Quick Sort l\u00e0 m\u1ed9t thu\u1eadt to\u00e1n t\u1ea1i ch\u1ed7, ngh\u0129a l\u00e0 t\u1ea5t c\u1ea3 c\u00e1c s\u1ed1 \u0111\u1ec1u \u0111\u01b0\u1ee3c s\u1eafp x\u1ebfp trong ch\u00ednh m\u1ea3ng ban \u0111\u1ea7u.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"T\u1ea1i sao n\u00ean s\u1eed d\u1ee5ng Quick Sort ng\u1eabu nhi\u00ean?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>\u0110\u00f4i khi, vi\u1ec7c ch\u1ecdn ph\u1ea7n t\u1eed ngo\u00e0i c\u00f9ng b\u00ean ph\u1ea3i c\u00f3 th\u1ec3 d\u1eabn \u0111\u1ebfn tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t. Trong nh\u1eefng tr\u01b0\u1eddng h\u1ee3p nh\u01b0 v\u1eady, vi\u1ec7c ch\u1ecdn m\u1ed9t ph\u1ea7n t\u1eed ng\u1eabu nhi\u00ean l\u00e0m tr\u1ee5c xoay c\u1ee7a b\u1ea1n \u1edf m\u1ed7i b\u01b0\u1edbc s\u1ebd gi\u1ea3m x\u00e1c su\u1ea5t d\u1eabn \u0111\u1ebfn h\u00e0nh vi trong tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t.<\/p><p>Ch\u00fang ta s\u1ebd c\u00f3 nhi\u1ec1u kh\u1ea3 n\u0103ng ch\u1ecdn c\u00e1c tr\u1ee5c g\u1ea7n t\u00e2m c\u1ee7a m\u1ea3ng h\u01a1n v\u00e0 khi \u0111i\u1ec1u n\u00e0y x\u1ea3y ra, c\u00e1c nh\u00e1nh \u0111\u1ec7 quy \u0111\u1ed3ng \u0111\u1ec1u h\u01a1n v\u00e0 do \u0111\u00f3 thu\u1eadt to\u00e1n k\u1ebft th\u00fac nhanh h\u01a1n r\u1ea5t nhi\u1ec1u.<\/p><p>\u0110\u1ed9 ph\u1ee9c t\u1ea1p th\u1eddi gian ch\u1ea1y d\u1ef1 ki\u1ebfn \u200b\u200bl\u00e0 O (n log n) v\u00ec c\u00e1c tr\u1ee5c ng\u1eabu nhi\u00ean \u0111\u00e3 ch\u1ecdn \u0111\u01b0\u1ee3c cho l\u00e0 \u0111\u1ec3 tr\u00e1nh h\u00e0nh vi trong tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t]\n\t}\n<\/script>\n\n\n","protected":false},"excerpt":{"rendered":"<p>C\u00e1c thu\u1eadt to\u00e1n s\u1eafp x\u1ebfp d\u1eef li\u1ec7u l\u00e0 m\u1ed9t y\u1ebfu t\u1ed1 quan tr\u1ecdng kh\u00e1 quan tr\u1ecdng trong l\u1eadp tr\u00ecnh, \u0111i\u1ec3n h\u00ecnh trong s\u1ed1 \u0111\u00f3 l\u00e0 Quick Sort. V\u1eady Quick Sort l\u00e0 g\u00ec? Trong b\u00e0i vi\u1ebft h\u00f4m nay, b\u1ea1n h\u00e3y c\u00f9ng Tino Group t\u00ecm hi\u1ec3u v\u1ec1 Quick Sort \u0111\u1ec3 xem c\u00e1ch thu\u1eadt to\u00e1n n\u00e0y tri\u1ec3n khai [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":28267,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5404],"tags":[6242],"class_list":["post-28265","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webmasters","tag-kien-thuc-website"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/28265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=28265"}],"version-history":[{"count":0,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/28265\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/28267"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=28265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/categories?post=28265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=28265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}