Wednesday, June 28, 2017

C# Minimum Heap implementation

June 28, 2017

Introduction


There is a PriorityQueue class in Java for minimum heap, but in csharp programming language, there is no class. Julia has to figure out how to write one by herself.

Search the blog using minimum heap implementation, the link is here.

Algorithm study 


8:00 pm - 8:30 pm C# practice is here.

Julia met a peer who is a computer science Ph.D., and she was asked to simulate the minimum heap using Array, Array.Sort. Julia followed the hint and she did write one. It works and the solution is correct. But she likes to make her simulation better. There is only 30 minutes in mocking experience, Julia could not write a real minimum heap so she chose to use an array and then sort it using O(nlogn) algorithm.

She needs to look into C# books and figure out how to do it better in short future.

One of ideas is to use C# SortedSet class. Review previous practice on Leetcode 295: Median of stream.


No comments:

Post a Comment