## Heap Sort – Java Implementation

What is Heap Sort?? Heap sort is comparison based sorting algorithm. Heap sort is considered as improved selection sort, it divides the input into sorted and unsorted region. The improvement from selection sort is...

What is Heap Sort?? Heap sort is comparison based sorting algorithm. Heap sort is considered as improved selection sort, it divides the input into sorted and unsorted region. The improvement from selection sort is...

Earlier we have seen what Dijkstra’s algorithm is and how it works. In this article we will see its implementation using adjacency list and Priority Queue. Prerequisites: Adjacency List Priority Queue Dijkstra’s Algorithm basics...

Earlier we have seen what is Prim’s algorithm is and how it works. In this article we will see its implementation using adjacency list and Priority Queue. We strongly recommend to read – prim’s...

Objective: You have k lists of sorted integers. Find the smallest range that includes at least one number from each of the k lists. This is very nice and tricky solution, This problem was asked...

Objective: Given ‘N’ windows where each window contains certain number of tickets at each window. Price of a ticket is equal to number of tickets remaining at that window. Write an algorithm to sell...

Objective: Given an array of integers. find the Kth Smallest/largest element in the array. Example: int[] A = { 1, 2, 10, 20, 40, 32, 44, 51, 6 }; K=4. 4th smallest element in...

Earlier in we have seen Min-Heap and Max-Heap Implementation. Priority Queue is its built-in implementation in Java. In this article we will see how to perform Min-Heap and Max-Heap using Priority Queue. Brief: A...

Objective: Given k sorted array, write an algorithm to merge Them into One sorted array. Example : int[][] A = new int[5][]; A[0] = new int[] { 1, 5, 8, 9 }; A[1] =...

A binary heap is a heap data structure created using a binary tree. binary tree has two rules – Binary Heap has to be complete binary tree at all levels except the last level....

%d bloggers like this: