Showing posts with label distribution sort. Show all posts
Showing posts with label distribution sort. Show all posts

Sunday, May 22, 2016

Radix Sort - a distribution sort

May 22, 2016

Read the blog, have some code using C# in short future:


C# practice based on the above blog:
comment: Line 47, change array name from int[] count -> int[] position, but still get confused; This variable does more than one task. 
https://gist.github.com/jianminchen/ba73ca1550b88eae99c1617c1636180d
Make some changes:
Change the array's name to helper, helper serves three functions (line 47): 
1. First, get count for each digit
2. Second, add sum from 0 to up 
3. Third, decrease one by one to track index of next available position for i. 
comment: Line 47, change array name to helper, and add comment to list tasks for helper. Feel more control, there is a term called "express the intent." 
https://gist.github.com/jianminchen/09f12e539fce1b267e75d808e13c4ff6
Prepare for Leetcode 164: Maximum Gap 

Tuesday, June 9, 2015

leetcode 164: Maximum Gap - a Distribution sort (bucket, counting, radix) algorithm

Here is the leetcode link I am reading in the morning on April 4, 2015.
And then, find out myself to read this article from the following links, try to find readable explanation about the algorithms related to distribution sort algorithms.

May 22, 2016   (30 minutes at least)
Review the solution on this blog:


Read blogs talking about algorithm first, 

Distribution Sort - 分布排序
Radix Sort - 基数排序

Actionable Items:
Spend 4 hours + work on code implementation, Java, C++ -> C# code.