2014年3月24日

Sort Colors

摘要: 其实这个Follow up说的也很好哇,计数排序A rather straight forward solution is a two-pass algorithm using counting sort.First, iterate the array counting number of 0's, 1's, and 2's, then overwrite array with total number of 0's, then 1's and followed by 2's. 1 void sortColors(int A[], int n) 阅读全文

posted @ 2014-03-24 19:49 crane_practice 阅读(179) 评论(0) 推荐(0) 编辑

导航