Friday, August 3, 2018

Leetcode 23: Merge k sorted lists

August 3, 2018

Introduction


It is a hard level algorithm called Merge k sorted lists. I could not believe that I had to learn the algorithm again in such a short time. I spent over 30 minutes to study one of Leetcode discussion and wrote first time using SortedDictionary to implement C# minimum heap.

My practice


Here is my C# practice of the algorithm called Merge k sorted lists.


Related algorithm


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.


100-hard level algorithms 2018 summer campaign


Here is the hard level algorithm folder. I like to document the learning of the algorithm.


Challenge 

Here is the fact:

Julia, you spent 10 rounds of mock interviews from March 2017 to June 2018. You could not come out using SortedDictionary to write a simple minimum heap for K messed sorted array algorithm.

Give a few arguments to defend yourself:
I do not spend time to read SortedDictionary source code.
I do not know how SortedDictionary class is designed, why it is needed.
I do not try to memeorize all APIs from SortedDictionary.
I do not have chance to read the code using SortedDictionary to solve the problem.
I did search why C# does not provide PriorityQueue like Java.
I got so many choices to continue to study and improve. I just move on other problems to solve.


Give a few advice how to break through the problem:



Please provide a possible three solutions you can approach to come out a written solution like using SortedDictionary.


No comments:

Post a Comment