Saturday, August 11, 2018

K messed array using minimum heap using C#

August 11, 2018


Introduction


K messed array is the algorithm I practice over 10 times from March 2017 to August 2018 through mock interviews. I did not have chance to write one using minimum heap in C# since mock interview is only allowed 30 minutes for one algorithm.

Recently I practiced Leetcode 23: Merge k sorted lists. I had chance to learn to write a minimum heap using SortedDictionary.


K messed array


I spent 30 minutes to rewrite mock interview algorithm called K messed array using minimum heap. It is so excited to learn how to write a minimum heap using C# using less than 20 lines of code.

Here is the algorithm code written for K messed array.

No comments:

Post a Comment