Docsity

Slides for Semiconductors, Slides of Physics of semiconductor devices

Partial preview of the text

Download Slides for Semiconductors and more Slides Physics of semiconductor devices in PDF only on Docsity!

Module-IV By Dr Shola Usharani SCOPE, VIT Tree - Terminology, Binary Tree – Terminology and Properties, Tree Traversals, Expression Trees – Binary Search Trees – operations in BST – insertion, deletion, finding min and max, Finding the kth minimum element in a BST, Applications – Dictionary

Non linear Data structure

  • (^) The sequential or linear data structures are arrays, stacks and queues. These are inherently uni-dimensional in structure. In
  • (^) The non linear data structures as they are inherently two dimensional in structure like the Trees and graphs.

Tree Terminology

  • Parent of x
    • (^) The node directly above node x in the tree
  • Child of x
    • (^) A node directly below node x in the tree
  • Siblings
    • (^) Nodes with common parent
  • Root
    • (^) Only node with no parent
  • Leaf or External Node
    • (^) A node with no children
  • Internal Node
    • (^) Nonleaf node

Tree Terminology

  • Path
    • (^) A sequence of connected nodes
  • Ancestor of x
    • (^) A node on the path from the root to x
  • Descendent of x
    • (^) A node on a path from x to a leaf
  • Empty Tree
    • (^) A tree with no nodes

A NODE WITH ZERO DEGREE IS

CALLED WHICH NODE??

Type of Binary Trees

Types of Binary trees

  • (^) A binary tree of height h which has all its permissible maximum number of nodes 2h- 1. intact is known as a full binary tree of height h. Figure (a) illustrates a full binary tree of height
  • (^) A binary tree with n’ nodes and height h is complete if its nodes correspond to the nodes which are numbered 1 to n (n’≤ n) in a full binary tree of height h. In other words, a complete binary tree is one in which its nodes follow a sequential numbering that increments from a left-to-right and top-to-bottom fashion.
  • (^) A full binary tree is therefore a special case of a complete binary tree. Also, the height of a complete binary tree with n elements has a height h given by h = log 2 (n + 1). Figure (b) illustrates an example complete binary tree.
  • (^) A binary tree which is dominated solely by left child nodes or right child nodes is called a skewed binary tree or more specifically left skewed binary tree or right skewed binary tree respectively. Figure(c) illustrates examples of skewed binary trees.

Representation of Binary Tree

  • (^) Array representation
  • (^) Linked representation

Example

Memory wastage

Representation of Binary Tree using Linked

Lists

struct node { struct node *left; int data; struct node *right; } left data^ right

Some important characteristics

  • (^) If a binary tree has n nodes then the number of pointers used in its linked representation is 2 * n.
  • (^) The number of null pointers used in the linked representation of a binary tree with n nodes is n + 1.

Introduction

  • (^) It is an important operations on Binary tree.
  • (^) Visiting of nodes in a binary tree in a particular with repetitive order.
  • (^) Representing the information in a prescribed order.
  • (^) Three actions on visiting the nodes
    • (^) Move Left (L)
    • (^) Move Right (R)
    • (^) Process or Print (P) Node.
  • (^) Three computing sequences based on the above
    • (^) LPRInorder traversal
    • (^) LRPPostorder traversal
    • (^) PLRPreorder traversal

In order Traversal Operation

  • (^) Traversal keeps moving left in the tree until no more nodes further.
  • (^) Process the root node.
  • (^) Moves to the right node.
  • (^) In case of any node absent in right or left its traversal moves back to the continues its traversal