Heaps are a great example of many core computer science concepts working together in order to form one very large abstraction, which is made up of smaller parts that we’re already familiar with!
In this article we’ll be having an in-depth discussion about heaps as a data structure and in order to understand them completely let’s first discuss the below mentioned topics :
1. Array representation of a Binary Tree.
2. Complete Binary Tree.
Post that, we will broaden our knowledge by understanding the following:
3. What are heaps?
4. Insert/Delete in a heap.
5. Heapify and HeapSort.
In computer science , an AVL tree (named after inventors Adelson-Velsky and Landis) is a self-balancing binary search tree . It was the first such data structure to be invented. In an AVL tree, the heights of the two child subtrees of any node differ by at most one.
Many of these words that I mentioned above might be a jargon for you. You might be wondering, what do you mean by a Binary Search Tree , what is an AVL tree, etc.
Let’s have a brief discussion on the below mentioned topics :
1. What is BST(Binary Search Tree) ?
Although people make a big deal about how scary dynamic programming problems are, there’s really no need to be afraid of them. In fact, once you get the hang of them, these can actually be very easy problems.
What is dynamic programming?
Dynamic programming is a technique to solve problems by breaking it down into a collection of sub-problems, solving each of those sub-problems just once and storing these solutions inside the cache memory in case the same problem occurs the next time. Dynamic Programming is mainly an optimization over plain recursion . Wherever we see a recursive solution that…
A couple of days ago, I was going through a mock interview, and I was tasked with a question on linked list, which involved finding and returning the node where the cycle begins(if there is no cycle, return null).
For more details ->https://leetcode.com/problems/linked-list-cycle-ii/
I worked through it and found out that the easiest way to do this would be to mark each element as you visit it, but what if you’ve been told you’re not allowed to modify the list. You could keep track of the nodes you’ve encountered by putting them in a separate list. Then you would compare…
Student, College of Engineering and Technology, Bhubaneswar