Sorting Problem: Difference between revisions

mNo edit summary
mNo edit summary
 
Line 3: Line 3:
'''Input:'''  A sequence of $n$ numbers $<a_1,a_2,a_3 \cdots a_n>$
'''Input:'''  A sequence of $n$ numbers $<a_1,a_2,a_3 \cdots a_n>$


'''Output:''' A permutated reordering $<a_1^`, a_2^`,a_3^` \cdots a_n^`>$ so that  $<a_1^` \geq a_2^` \geq a_3^` \cdots  \geq a_n^`>$ or $<a_1^` \leq a_2^` \leq a_3^` \cdots  \leq a_n^`>$
'''Output:''' A permutated reordering $<a_1^`, a_2^`,a_3^` \cdots a_n^`>$ so that  $<a_1^` \geq a_2^` \geq a_3^` \cdots  \geq a_n^`>$ or $<a_1^` \leq a_2^` \leq a_3^` \cdots  \leq a_n^`>$ <ref>Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Clifford (2009). Introduction to Algorithms (3rd ed.). Cambridge, MA: The MIT Press. ISBN 978-0-262-03384-8.</ref>
 
== References ==
<references />