First page
Q197: The Dutch National Flag Problem (The following problem was proposed by W.H.J. Feijen and made famous by Edsger W.Dijkstra, both of Dutch origin.) You are given a row of n buckets, each containing one ball, which may be either red, white, or blue. Your goal is to rearrange the balls in the buckets such that they appear in the order of the colors on the Dutch national flag: red balls should be grouped on the left, the order of the colors on the Dutch national flag: red balls should be grouped on the left, move balls is swap(i,j), which swaps the contents of the i and j buckets. Give pseudocode for a linear-time algorithm for sorting an array B[1..n] of balls in the Dutch national flag order. Your algorithm should use only constant space in addition to the given array.
tags: microsoft ebay hp yahoo programming algorithms sw
Q245: How do you delete duplicates in a table?
tags: Yahoo database
Q197: The Dutch National Flag Problem (The following problem was proposed by W.H.J. Feijen and made famous by Edsger W.Dijkstra, both of Dutch origin.) You are given a row of n buckets, each containing one ball, which may be either red, white, or blue. Your goal is to rearrange the balls in the buckets such that they appear in the order of the colors on the Dutch national flag: red balls should be grouped on the left, the order of the colors on the Dutch national flag: red balls should be grouped on the left, move balls is swap(i,j), which swaps the contents of the i and j buckets. Give pseudocode for a linear-time algorithm for sorting an array B[1..n] of balls in the Dutch national flag order. Your algorithm should use only constant space in addition to the given array.
tags: microsoft ebay hp yahoo programming algorithms sw
Q245: How do you delete duplicates in a table?
tags: Yahoo database
