Posts

Java

                                    Need of Abstract classes  and   Interfaces in Java What is Abstraction ? Abstraction is a process of hiding the internal implementation details and showing only functionality to the user.  It shows only essential things to the user and hides the internal details.    eg. As in the car case relevant parts like steering, gear, horn, accelerator, breaks, etc. are shown to driver because they are necessary for driving. But the driver need not know the internal functioning of engine, gear, etc. Thus, showing relevant data to the user and hiding implementation or details from the user is Abstraction. What is Abstract class ? An abstract class is a class which has the abstract keyword in its declaration. It should have atleast one abstract method. i.e., methods without a body. It can have multiple concrete methods. Abstract classes allows to crea...

AVL TREE vs RB TREE

Image
This blog refers to tree which is a data structure, made up of nodes. Where each node stores a value and there is also some type of hierarchical relationship between the nodes such that one node is the parent of its children. The trees are typically drawn with circles and lines also. The circles represent the nodes of the tree.  The lines represent the relationships between a parent node and its child node. Both AVL and RB trees fall under Self-Balancing Binary Search Trees. These are height-balanced binary search trees that automatically keep the height as small as possible when insertion and deletion operations are performed on trees. A Binary Search Tree (BST) is a Binary Tree that conforms to the following conditions: ⦁ All nodes stored in the left subtree of a node must have values that are less than that node. ⦁ All nodes stored in the right subtree of a node must have values that are greater than that node. AVL Tree : AVL tree (Adelson-Velsky and Landis) is a self-balancin...