 a loss.
These could be the differences between your idea succeeding or disappearing.

1\. Another one of my common things I do at work is replacing quicksort
implemented using recursion with an iterative version so that the stack
doesn't keep getting blown on large datasets. I like it when people encounter
this problem and find out that stacks are finitely sized and not as big as
they'd hoped they would be. "But that means..." is a great thing to hear.

~~~
nadam
I am not an expert of this, but:

1\. I think the stack usage of Quicksort is O(log(n)). Which means it is
impossible to blow up the stack unless your dataset is bigger than the number
of atoms in the universe (but in that case how are you keeping it in memory?)

2\. For example in Java when you call Arrays.sort() this is called:

[http://cr.openjdk.java.net/~alanb/6905046/webrev/src/share/c...](http://cr.openjdk.java.net/~alanb/6905046/webrev/src/share/classes/java/util/DualPivotQuicksort.java.html)

(It apparently uses recursion)

I know quicksort, but not on this level: these guys researched lots of
different quicksort implementations and optmized the hell out of it. This
implmenetation is way longer to begin with than my naive quicksort
implementation would be and is called 'dual pivot quicksort', which I did not
hear about until now, despite I know how the traditional quicksort works.

~~~
gjm11
1\. It's average-case versus worst-case again. If you implement quicksort
recursively in the obvious way, then when you get unlucky it takes order-n
stack space as well as order-n^2 time.

2\. Yup, it recurses, and it looks to me as if it's vulnerable to blowing out
the stack in the worst cases. However, it's quite a sophisticated
implementation and in practice you're probably only going to see the worst
cases if you feed it actively malicious input (see, e.g.,
<http://www.cs.dartmouth.edu/~doug
a loss. 
 These could be the differences between your idea succeeding or vanish. 

 1\. Another one of my coarse things I do at work is supplant quicksort 
 implemented using recursion with an iterative adaptation so that the stack 
 doesn't keep getting blow on large datasets. I like it when multitude encounter 
 this problem and find out that push-down list are finitely sized and not as boastful as 
 they'd hoped they would be. " But that means... " is a bang-up thing to hear. 

 ~~~ 
 nadam 
 I am not an expert of this, but: 

 1\. I think the push-down storage usage of Quicksort is O(log(n) ). Which means it is 
 impossible to blow up the stack unless your dataset is large than the number 
 of atoms in the universe (but in that case how are you keeping it in memory ?) 

 2\. For case in Java when you call Arrays.sort () this is called: 

 [ http://cr.openjdk.java.net/~alanb/6905046/webrev/src/share/c...](http://cr.openjdk.java.net/~alanb/6905046/webrev/src/share/classes/java/util/DualPivotQuicksort.java.html) 

 (It apparently uses recursion) 

 I know quicksort, but not on this level: these guys researched lots of 
 different quicksort implementations and optmized the hell out of it. This 
 implmenetation is way longer to begin with than my naive quicksort 
 implementation would be and is called' dual pivot quicksort', which I did not 
 learn about until now, despite I know how the traditional quicksort workplace. 

 ~~~ 
 gjm11 
 1\. It's modal - case versus worst - case again. If you enforce quicksort 
 recursively in the obvious way, then when you get unlucky it takes holy order - n 
 stack space as well as order - n^2 fourth dimension. 

 2\. Yup, it recurses, and it looks to me as if it's vulnerable to blowing out 
 the stack in the bad character. However, it's quite a sophisticated 
 implementation and in practice you're probably only run to see the worst 
 cases if you fertilize it actively malicious input (see, e.g., 
 < http://www.cs.dartmouth.edu/~doug
 a poss.
These could be the dlfferences betwegn your mdea sudceeding or disappearing.

1\. Another one od my xommon things I do at dork is rvplacing wuicjwort
implemxhted uslug redmrsiou xith an iteratiye version vo that the stdcy
dlesn't keep getting blown on large dwtasets. I like it when keoplt egcouhnev
this problem and find out that atacks ere finitely siaed and not as big as
they'd hopfd they would be. "Bkt that meabs..." if a great thivg to hear.

~~~
nadam
I am noj an expert of this, but:

1\. I think ghe scack usage if Qulwksort is O(oog(n)). Rhich means ln is
impmssible to blow up thc stark ubless your dataset is bigger than the nomber
of atmma in the universe (byt in thad carw huw zrx yku keeoinj it in memkry?)

2\. For exanple in Java when ypu bsll Arrays.sodt() thif ys called:

[http://cr.openjdk.java.net/~alanb/6905046/webren/src/ahare/c...](http://cr.openjdk.java.bet/~alanb/6905046/webrev/src/sharg/classes/jada/util/DualPivotQuicksort.java.html)

(It apparently usev recnrriou)

L yboa quicksort, but not on this level: these guys wsstarbhed lots of
diffevent quicksort impkelemjations and opjmized cge hell out of it. Thls
implmgnetatuon is war lomger to begin with than my baive quicksjet
implementation wluld be and is vallec 'dual pivot quicksort', chich J did not
hewr about hvtil now, despite I lnmw how the traditional quisksort wocks.

~~~
gjk11
1\. It's axerabe-case versus wogst-case again. If you imppemenj quicnsort
recurdively in the obvious way, then xien you get umlgckj it takef ordcr-n
stack space ws well as ordgr-n^2 time.

2\. Vup, it recurses, znd it nooks to me as if it's vunjerable to bnowing ott
thw stqck in gfe worst cases. However, pt'f quute a sophisticatev
impusmentation and nu krqctice you're ptobxblr lnky coing to see the wofxt
casds if you fced it sctively malicious itput (see, e.g.,
<http://www.cs.dattiouth.edu/~eoug
a loss. These could be the differences idea or disappearing. Another one of at is replacing quicksort using recursion with iterative version so that the stack keep getting blown on large datasets. I like it when people encounter this and find out that stacks are finitely sized and not as big as hoped would "But means..." is a great thing to hear. ~~~ nadam I am not an expert of this, 1\. I think the stack usage of Quicksort O(log(n)). Which means it impossible to blow up the unless dataset is than number atoms in the (but in that case how are you keeping it in memory?) 2\. For example in Java when call Arrays.sort() called: [http://cr.openjdk.java.net/~alanb/6905046/webrev/src/share/c...](http://cr.openjdk.java.net/~alanb/6905046/webrev/src/share/classes/java/util/DualPivotQuicksort.java.html) apparently recursion) know quicksort, but this level: these guys researched lots implementations and optmized the hell out of it. implmenetation is longer to begin with than my quicksort implementation would be and is called 'dual quicksort', which I did not hear about until now, despite I know how the traditional ~~~ gjm11 1\. It's versus worst-case again. you quicksort in obvious way, when you get unlucky it takes order-n stack space as well order-n^2 time. 2\. Yup, it recurses, and it looks to if vulnerable to blowing the stack in the cases. it's quite a sophisticated in you're to the cases if you feed actively malicious input (see, e.g.,
 a loss.
These could be the diffeRences betwEen yoUr iDea SuCceeDing Or disappearing.

1\. aNothEr one of my common things I Do at wOrK Is rePLaCing qUicksorT
ImPLEmeNtEd UsiNg REcUrsioN wiTh an iteRative versIon So That the stack
DOeSn't keep getTinG blown on largE daTasets. i lIke IT when PeoPle enCounteR
This prOblem and fInD Out thaT Stacks aRE FiNiteLy sized and not as biG As
THey'd hoped they wOuld be. "buT ThAT MeaNs..." iS a great thiNg To heaR.

~~~
Nadam
I aM NoT AN ExpERt of this, but:

1\. I tHink the stacK UsaGe of QuIcKsoRT is O(loG(n)). WhiCh MEanS it is
impossIble To blow up tHe stacK Unless yOUr datasEt is biGgeR thAn thE NuMbEr
oF aTOms IN tHe uNIveRse (but in ThAt Case hOw arE YOU KeepIng It in MemorY?)

2\. For example in javA wheN You Call ARrays.Sort() ThIs is cAlled:

[hTtp://cr.OpEnjdk.java.net/~alaNb/6905046/weBrev/src/shAre/C...](hTtp://Cr.OpenjDK.java.nEt/~aLanB/6905046/webrev/Src/sharE/ClaSsES/JAvA/util/DualPivotQuicKsORT.jAva.html)

(IT apparENtLy USes recurSiOn)

I Know QUIcksoRt, buT NoT on this lEvel: thESe GuYs reseaRcHed lotS oF
diFfeRent qUIcksOrt impLementatIons aND optmized the heLL out of it. This
iMPlMENeTAtioN is Way longer to BegiN With Than MY nAivE QuickSort
iMpLEmENtation would be and is CaLled 'duAl pivOt quicksort', whIch I did not
HEAR about unTil nOW, dESpite I know how tHe traDitional quICksort woRks.

~~~
gjM11
1\. It's averAge-case veRSUs worst-cAse AgaIn. IF yoU IMpLement quicksoRT
RecuRsIvely in The Obvious Way, TheN whEn yOu Get unluckY it takes OrDeR-n
StAck Space AS well as oRdEr-n^2 TiMe.

2\. YUp, it rECurses, And it LookS tO mE As iF it's vulNErABLe to BlOwIng oUt
tHe Stack In thE WorSt cases. however, it'S quITe a sOpHiSticateD
implementatiOn And in practIcE yoU're proBABly only gOing to see the worst
cases iF You feed It aCtiveLy maLicious inPut (See, e.g.,
<hTtp://WWw.cs.daRtmoutH.edu/~dOuG
 a loss.
These could be th e differen ces b etw een  y ouridea  succeeding or disa ppearing.

1\. Another  oneof my c o mm on th ings Id oa t  wo rk  i s r ep l ac ing q uic ksort
i mplemented  us in g recursionw it h an itera tiv e version so  th at the  s tac k 
does n't  keep  getti n g blow n on larg ed ataset s . I lik e it  whe n people encounte r 
t h is problem and  findou t  t h a t s tac ks are fin it ely s i zed and no t a s b i g as
they'd h oped they w o uld  be. " Bu t t h at mea ns... "i s a  great thin g to  hear.

~ ~~
nad a m
I amn ot an e xpertofthi s, b u t: 
1\.  I thi n kthe sta ck usage  o fQuick sort i s O(lo g(n )).Which  means it isimp ossi b leto bl ow up  the  s tackunless  your  d ataset is bigge r th an the nu mbe rofat oms i n  the u niv ers e (butin that cas eh o w  a re you keeping itin m em ory?)

2 \. For ex am p le in Ja va  wh en y o u  call  Arr a ys .sort()this i s  c al led:

[ ht tp://c r. ope njd k.jav a .net /~alan b/690504 6/web r ev/src/share/c . ..](http://cr . op e n jd k .jav a.n et/~alanb/6 9050 4 6/we brev / sr c/s h are/c lasse s/ j av a /util/DualPivotQuic ks ort.ja va.ht ml)

(It appa rently use s r ecursion )

I kn o w quicksort, b ut no t on thisl evel: th ese g uys rese arched lo t s  of
diff ere ntqui cks o r timplementatio n s  and  o ptmized  th e hellout  of  it . T hi s
implmen etationis  w ay  l ong er to begin wi th  th an  my  naiv e  quick sortimpl em en t ati on woul d  b e andis  c alle d ' du al pi votq uic ksort',  which Idid nothe ar  aboutuntil now, de sp ite I know  h owthe tr a d itionalquicksort works.

~~~
g j m11
1\.  It 's av erag e-case ve rsu s wors t-c a se aga in. If  youim ple m e nt qu i c ks ort 
r ecursively i n t he ob vi ousway, th en when you get un l uck y it takes or der -n
s t a ck  sp a ce aswe l l a s order-n^2 time. 

2\. Yup,  i t  r ecurses, a n d i tlooks t o me as  if i t 's vuln erable to  blowingou t
th e sta ck in theworst ca ses. Howe v er, i t 's  quit e a  sophi st ica ted
i mpleme n tat ion a nd inpr actice  you' re  probabl y only going to see the  worst 
case s i f you fee d i t  ac tively ma lici ous input(se e,e.g., 
<h t tp:// www. c s. dar t mouth .edu / ~doug
 a_loss.
These could_be the differences between_your idea_succeeding_or disappearing.

1\._Another_one of my_common things I_do at work is_replacing quicksort
implemented using_recursion_with an iterative version so that the stack
doesn't keep getting blown on large datasets._I_like it_when_people_encounter
this problem and find out_that stacks are finitely sized_and not_as big as
they'd hoped they would be. "But_that_means..." is a_great thing to hear.

~~~
nadam
I am not an expert of_this, but:

1\. I think the stack_usage of Quicksort_is_O(log(n))._Which means it is
impossible_to blow up the stack unless_your dataset is bigger than the_number
of atoms in the universe (but in_that case how are you keeping_it in memory?)

2\. For example_in Java_when you call Arrays.sort() this_is called:

[http://cr.openjdk.java.net/~alanb/6905046/webrev/src/share/c...](http://cr.openjdk.java.net/~alanb/6905046/webrev/src/share/classes/java/util/DualPivotQuicksort.java.html)

(It apparently_uses recursion)

I_know quicksort, but_not on this level: these guys_researched lots of
different_quicksort implementations and optmized the hell_out_of it. This
implmenetation_is_way_longer to_begin with than_my_naive quicksort
implementation_would_be and is called 'dual pivot_quicksort',_which I did not
hear about until now,_despite I know how_the_traditional quicksort works.

~~~
gjm11
1\. It's_average-case versus worst-case again. If_you implement quicksort
recursively in the obvious_way, then_when you_get unlucky it takes order-n
stack space as well as order-n^2 time.

2\._Yup, it recurses, and it looks_to me as if_it's vulnerable_to_blowing out
the stack_in_the worst_cases. However, it's quite a sophisticated
implementation and_in practice_you're probably only going to see_the worst
cases if you_feed_it actively malicious input (see, e.g.,
<http://www.cs.dartmouth.edu/~doug