Heap

April 25, 2020

A heap is a data structure that’s implemented as a binary tree. Remember, a binary tree is where each parent had a maximum of two direct child nodes. What makes a heap special? Like a binary search tree, we add additional constraints. So the basics. Heaps are a collection of objects. As we add items to the heap, they are always added top to bottom, left to right. We completely fill in the level before moving onto the next. This means we…

Binary Search Tree (BST)

April 25, 2020

A binary tree is a specialized type of tree. It adds the constraint that each node has two immediate child nodes. More terminology here. We call the child nodes left and right nodes respectively. The left child node and the right child node could both be null, both have values, or one of them could be null. What happens with a binary search tree, also called a BST? A binary…

Hash Table

April 24, 2020

What is hash table? Well, let’s say a hash table is looks like an array with a difference. In an array you know the index and you can access to the item by an index. In hash table you don’t have the index. Instead you have the key which could be an string, int, object or any other type. We are using hash tables when there is a relation between…

Value types have exact amount of memory space they take up.On the other hand Reference types have dependency of amount of data they store, based on that they extend memory space by using pointers. It’s always 32 bits of memory for int data type, regardless of data: boolean, character, float, double, int, long, decimal are value types But why we don’t allocate memory consecutively for reference types and why we…