From a0c8b41fbc2d3ef12c53930de48648bdd4c0ae98 Mon Sep 17 00:00:00 2001 From: kemasama Date: Wed, 27 Apr 2022 18:32:13 +0900 Subject: [PATCH] fix: quick sort --- quick_sort/quick_sort | Bin 33943 -> 33943 bytes quick_sort/quick_sort.c | 10 +++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/quick_sort/quick_sort b/quick_sort/quick_sort index d2033040789486d7563d8301d82d580efd1832a4..7cb9404ceec240260bafa9a8c03448ab1ebec195 100755 GIT binary patch delta 837 zcmZ8fUr1A76hGhnrfeo`<}&}xZ4X78<%2$ix_>urL0E#V6|UMALJ}2$kR~;9a=||j zk@GHw58;$S*Y#pZa4TwvMEOu=V)Rfs!v`Zw=%06ptaIlG>4WdP_nhyX^ZWhI`Jw|% zbbuLrTNG~qAOH|l;ejjuaA}0m6*?E~RIWe##Ogh*n%GDQgS3uxP0rBdL7`b?5c(Ug z5s$FhU?WvRy^Ysg0`OoJeTgt-t578}nWzx68HVhoyIy26yJIvUk52ogm16cWlLzhh zg&KP?8554!_q0-GP7N@j*05W@{b?bj%9~7tN_pNOLO8*nkk`-V@0WN}qX&DkOm$wsXL-6Eu zwy0j5_DSOk5Yb#NV77?F=oxvG`lK-=dP*URb|d6LM5JC}-C^{jpF_Wrw?Z|E3BelHSH`=r!daOaHo|SjxhAPm5u_KX{~vZDhpj;LIo&1LzibG9PBx(o zk@HI;S1PPIO{7K8x}K5vw7sp>Z;gecFN zhZkpCy$b=hd-kWNG2r|)vcD|#;PY_jvFf>te(jA~VVw_|#j1@9-@o*=&Gfyx{b6EZ VY2VGB)bl%W`f;=OPsUy6_zSa1ARYh! delta 884 zcmZ8fZAep57=F(^DtAUWKk{qN2`Ox-P!Lhhwi_!jBMeiVxv3xsAykWm1k2_9(fpA* zuQAQYDJEz3qe6mfP!=oDqR1o(i%RW>kr4>t6^iwqxgXMjbMAe=pXWIz&?N-AgxK(rx&D65bO&Rv{vJJc_i^iP|ng!0DdMLl$Fwgj#~izL2A$#t<%Z~Jmese zb1xLx{6iQM!JEQxrWyFmY}JGDAm$SAz7x>bgE`Z(QRQ{q-^u$qjH(z1dmFh7=w}YM zDq6tv3}Uv7HWFpBu_Iczj;b(pGC4!j{l2n|NalY;oKYecBw{B>T+T$`+1hqMEgVpI z3lIyt)es*>bS;U(*6^TQi|V`7Q3QJ$b|PAIRA3R4oyrbdZU+}4YSw67NYZ>+91?Z2 zHyJgmA?j9Fscs_TfVrqh?KVFb)=XftoD-Lw8piw#^Z3o8NR?T5yVEo`%9GLhXb+BO zB8CUYY9V@C)wP|8_E!3BN7GU0sBqM!nUE)Q)T_*qq5QI$NR5(Ye@uLnukBTbPx@Mc z!VEvYUg9scRT`l96>ujJd;++z52WKx!k@;{EjuS>&%|E3IcEDNJy#QiygzXh(xb8R z23=L%$Cr2L{NU%{sf1>4!j0m={5^&FYf3 array[larger_index] ) { - swap(&array[smaller_index], &array[larger_index]); - } else if ( array[smaller_index] == array[larger_index] ) { + if ( array[smaller_index] < array[larger_index] ) { + break; + } + + swap(&array[smaller_index], &array[larger_index]); + + if ( array[smaller_index] == array[larger_index] ) { smaller_index++; } }