Thursday, April 21, 2016

K nearest point

April 21, 2016

Try to find similar algorithm in HackerRank about K nearest point, and get some workout on coding.

Read the blog:

https://www.glassdoor.co.in/Interview/Given-a-list-of-points-in-2D-and-a-single-reference-point-find-k-nearest-neighbors-No-code-required-iirc-QTN_296848.htm


https://www.careercup.com/question?id=4751976126480384

https://www.quora.com/What-are-the-some-of-the-problems-on-the-heap-priority-queue-on-SPOJ-HackerRank-CodeChef-Codeforces-or-HackerEarth

Julia, try to work on one of 4 questions using priority queue/ heap:

https://www.hackerearth.com/code-monk-heaps-and-priority-queues/judge/

Read the tutorial: (Excellent reading time - 1 hour)

https://www.hackerearth.com/notes/heaps-and-priority-queues/

Take some notes:
Heapify process, using array to store the heap, amortized heapify analysis - O(N) instead of O(nlogN)

Many ways to implement the priority queue.

Naive approach to build priority queue:
1. a list, sorted them, so O(NlogN) time

Efficient approach:
using heaps to implement the priority queue. It will take O(logN)to insert and delete each element in the priority queue.


No comments:

Post a Comment