Course/[Progrmiz] Data Structure Algorithm

    [Tree DSA] Balanced Binary Tree

    [Tree DSA] Balanced Binary Tree

    1. Balanced Binary Tree A Balanced Binary Tree is defined as a binary tree in which the height of the left and right subtree of any node differ by not more than 1. Conditions for balanced binary tree are same as below : Difference between the left and the right subtree for any node is not more than one. The left subtree is balanced. The right subtree is balanced. class Node: def __init__(self, v..

    [Tree DSA] Binary Tree

    [Tree DSA] Binary Tree

    1. Binary Tree A binary tree is a tree data structure in which each parent node can have at most two children. Each node of a binary tree consists of three items : data item address of left child address of right child 1.1 Type of Binary Tree Full Binary Tree : A full binary tree is a special type of binary tree in which every parent node/internal node has either tw oor no children. Perfect Bina..

    [Tree DSA] Tree Data Structure

    [Tree DSA] Tree Data Structure

    1. Tree Data Structure A tree is a nonlinear hierarchical data structure that consists of nodes connected by edges. Tree data structure allows quicker and easier access to the data as it is a non-linear datastructre, while linear data structures, such as arrays, linked list, stack, and queue increase the time complexity with the increase in the data size. 1.1 Tree Terminologies Node/Vertex : A n..

    [DS2] Binary Heap

    1. What is Heap Data Structure Heap data structure is a complete binary tree that satisfies the heap property. Max Heap Property : Any given node is always greater than its child node and the key of the root node is the largest among all other nodes. Min Heap Property : Any given node is always smaller than the child nodes and the key of the root node is the smallest among all other nodes. 1.1 H..