Posts

Data Structure - Binary Tree

Image
  Binary Tree  Binary Tree  is a non-linear and hierarchical   data structure where each node has  at most two children  referred to as the left child and the right child.  The topmost node in a binary tree is called the root, and the bottom-most nodes(having no children) are called leaves. Representation of Binary Tree Each node in a Binary Tree has three parts: ·          Data ·          Pointer to the left child ·          Pointer to the right child   Terminologies in Binary Tree ·          Parent Node : A node that is the  direct ancestor  of a node(its child node). ·          Child Node : A node that is the  direct descendant  of another node (its parent). ·        ...

Data Structure - Lab

  1.a. List Abstract Data Type (ADT) using an array   Aim To write a Python program to implement the List Abstract Data Type (ADT) using an array , and to perform basic operations such as insertion, deletion, searching, and display .   Algorithm Start the program. Create an empty list L. Display the menu with list operations. Read the user’s choice. If choice is Insert , read the element and add it to the list. If choice is Delete , read the element and remove it from the list if it exists. If choice is Search , check whether the element is present in the list. If choice is Display , print all the elements of the list. Repeat steps 3–8 until the user selects Exit . Stop the program. # List ADT using Array   L = []    # empty list (array)   while True:     print("\nLIST ADT MENU")     print("1. Insert")     print("2. Delete") ...