Question: Design a linear-time algorithm to sort an array of Comparable objects that is known to have at most three distinct values. (Edsger Dijkstra named this
Design a linear-time algorithm to sort an array of Comparable objects that is known to have at most three distinct values. (Edsger Dijkstra named this the Dutch-national-flag problem because the result is three "stripes" of values like the three stripes in the flag.)
Step by Step Solution
3.54 Rating (164 Votes )
There are 3 Steps involved in it
In this problem we can use whats known as the Dutch National Flag algori... View full answer
Get step-by-step solutions from verified subject matter experts
