Posts

Tree Traversal

Image
  Tree Traversal Handwritten Notes- Click Here A tree is a non-linear data structure in which elements are arranged in a hierarchical structure . Tree Traversal is the process of visiting each node of a tree exactly once in a particular order. The main types of tree traversal are: Preorder Traversal ( Root → Left → Right ) Inorder Traversal ( Left → Root → Right ) Postorder Traversal ( Left → Right → Root) Preorder Traversal : In Preorder Traversal, the root node is visited first, followed by the left subtree and then the right subtree. Example A / \ B C / \ D E The Preorder Traversal is:  A → B → D → E → C Inorder Traversal: In Inorder Traversal, the left subtree is visited first, followed by the root node and then the right subtree. Example A / \ B C / \ D E The Inorder Traversal is:  D → B → E → A → C Postorder Traversal: In Postorder Traversal, the left subtree is visited first, followed by...

Binary Search Tree

Image
  Binary Search Tree(BST) Handwritten Notes- Click Here A Binary Search Tree (BST) is a type of binary tree in which each node is arranged according to a specific ordering rule. All values in the left subtree are smaller than the value of the root node. All values in the right subtree are greater than the value of the root node. The same rule is followed recursively for every node in the tree. Because of this ordering, searching, insertion, and deletion can be performed efficiently. Insertion:                       Insertion is used to add a new value to the BST. Steps Start from the root. Compare the new value with the current node. If the new value is smaller , move to the left subtree. If the new value is greater , move to the right subtree. Continue until an empty position is reached. Insert the new node at that position. Let us construct a Binary Search Tree by inserting the following values one by one:   ...

Queue ADT

Image
  Queue ADT Handwritten Notes- Click Here A  Queue  is a linear data structure in which elements are inserted at one end and removed from the other end.( Insertion → Rear,  Deletion → Front )                                   ↓ FRONT                                 ↓ REAR A B C D E    A queue follows the FIFO (First In, First Out) principle. This means that the element inserted first is removed first. A  Queue can be implemented using: Array Linked List Basic  Queue  Operations: 1. Enqueue - used to insert  a new element into the queue. 2. Dequeue - used to remove an element from the queue. 3. Peek - used to view the first element without removing it. 4. isEmpty - checks whether the queue contains any elements. 5...

Stack ADT

Image
  Stack ADT Handwritten Notes- Click Here A Stack is a linear data structure in which insertion and deletion of elements are performed only at one end. This end is called the TOP . Stack follows the LIFO (Last In, First Out) principle. It means the element inserted last will be removed first. A stack can be implemented using: Array Linked List Basic Stack Operations: 1. Push - used to insert a new element into the stack. 2. Pop - used  to remove an element from the stack. 3. Peek - used to view the element at the TOP without removing it. 4. isEmpty - checks whether the stack contains any elements. 5. isFull - checks whether the stack   has reached its maximum capacity Push() Operation The process of inserting a new element at the TOP of the stack is called Push . Algorithm Check whether the stack is full. If the stack is full, report Stack Overflow . Otherwise, increment TOP. Insert the new element at the TOP position.  Bef...

Different types of Data Models in DBMS

Image
             Data Models Handwritten Notes- Click Here A Data Model defines how data is organized, stored, related, and accessed in a database. Types of Data Models in DBMS Hierarchical Data Model Network Data Model Relational Data Model Entity-Relationship (ER) Model Object-Oriented Data Model Object-Relational Data Model 1. Hierarchical Data Model   The Hierarchical Data Model organizes data in the form of a tree structure . Each child record has only one parent record . A parent record can have multiple child records . It mainly represents a one-to-many relationship . Data retrieval is very fast in the hierarchical model.                                   Company                   |            Department             /      ...