Implement min heap

minheap feature

Min heap is a complete binary tree, in which all levels are completely filled and all the nodes in the last level are as left as possible. Min heap also meets this criteria: the parent’s key is less than both children’s keys. The smallest value is at the root. This post …

Continue reading

Merge two sorted arrays (2 solutions) – Code

merge two arrays

To merge two sorted arrays in one sorted array, you can loop through the elements of both arrays and compare them. Put the smaller one in the output array. When one array reaches the end, move the rest of elements of the other array into the output array. Interview Question: …

Continue reading