Threaded Binary Tree

Duration: 15 min

This video lesson is available to enrolled students.

Return to /learn/NIACL-AO-IT-SPECIALIST/data-structure-it-specialist/tree/advanced-k-ary-trees/asset-threaded-binary-tree after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. Quantitative Aptitude: Ratio and Proportion (Ratios), Data Interpretation, Mixture and Alligation, Permutation and Combination, Number System, Sequence and Series (Series), Speed Time and Distance, Speed Mathematics and Basic Mathematics, Algebra, Percentage, Profit and Loss, Simple Interest and Compound Interest, Powers and Exponents (Surds and Indices), Time and Work, Mensuration and Geometry, Partnership
  2. Reasoning Ability: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Seating Arrangements, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Directions (Direction Test), Ranking, Order and Sequence, Syllogisms, Blood Relations, Puzzle Solving (Puzzles), Inequality, Machine Input-Output
  3. English Language: Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Correction (Error Correction), Sentence Completion (Fill in the blanks), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Construction, Pronoun, Preposition, Conjunction, Adverb, Verb, Modals, Articles, Determiner, Interjection
  4. General Awareness: Evolution of Indian Banking (Banking & Financial Awareness), GK- Current Affairs, Static General Knowledge, Indian Economy
  5. C Concepts + MCQs (IT Specialist): C Programming by Yash Sir, C Language Core
  6. Java (IT Specialist): Java
  7. Python (IT Specialist): Python for Placements by Yash Sir, Python Basics
  8. OOPs (IT Specialist): Object Oriented Programming (OOPS)
  9. DBMS (IT Specialist): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, Relational Calculus, Transaction Management, Concurrency Control, Database Recovery, ORDBMS, Database Security & Authorization, Query Processing & Optimization, Enhanced Data Models, Data Warehousing & Mining, Big Data Systems, NoSQL
  10. SQL (IT Specialist): SQL
  11. Software Engineering (IT Specialist): Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management
  12. Data Structure (IT Specialist): Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
  13. Operating System (IT Specialist): Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS, Linux OS, Security, Distributed Systems, Virtual Machines
  14. Compiler Design (IT Specialist): Intro to Compilers, Lexical Analysis, Grammar & CFG, Syntax Analysis: Top-Down, Syntax Analysis: Bottom-Up, Semantic Analysis & SDT, Intermediate Code Gen, Code Optimization, Run Time Environment
  15. Computer Architecture (IT Specialist): Basics of COA, Floating Point Rep, Cache Memory Organization, Input Output Organisation, Pipelining, Instr Formats & Modes, Control Unit Design, Register Transfer and Microoperations, Multiprocessors, Programming the Basic Computer
  16. Data Communication & Networking (IT Specialist): Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security
  17. Descriptive Test (Main Exam): English Writing Ability
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This lecture introduces threaded binary trees, a data structure that replaces NULL pointers with special links called threads to enable tree traversal without recursion or an auxiliary stack. The instructor defines the concept, distinguishes between single-threaded and double-threaded variants, and demonstrates how left and right pointers are repurposed to point to inorder predecessors or successors. A worked example uses a binary search tree with nodes 1, 2, 3, 5, and 7 (later expanded to a larger tree with values like 10, 8, 30, 4, 9, etc.) to show how NULL pointers are identified and replaced with thread links. The inorder traversal sequence 5, 8, 29, 4, 10, 9, 30, 41, 16, 52 is written on screen to illustrate predecessor and successor relationships. The instructor highlights specific nodes (e.g., 5, 4, 29, 8) and draws arrows to show how traversal proceeds from a node's right child or its inorder successor. The final segment demonstrates the complete inorder traversal of the threaded tree, showing how threads allow sequential access to all nodes without backtracking or stack operations.

Chapters

  1. 0:00 – 2:00 00:00-02:00

    The lecture opens with the definition of a Threaded Binary Tree on screen: 'A Threaded Binary Tree is a binary tree in which NULL pointers are replaced with special links (threads) to make traversal easier.' The stated purpose is 'To perform tree traversal without using recursion or stack.' Two types are introduced: Single Threaded Binary Tree (with subtypes Left-Threaded, where the left NULL pointer points to the Inorder Predecessor, and Right-Threaded, described as 'Most Common,' where the right NULL pointer points to the Inorder Successor) and Double Threaded Binary Tree. The instructor begins drawing a node structure with fields labeled 'Left Child Add.', 'Data', and 'Right Child Add.'

  2. 2:00 – 5:00 02:00-05:00

    The instructor draws a binary tree with nodes 1, 2, 3, 5, and 7, then expands individual nodes to show their internal three-field structure. Node 5 is expanded to display 'NULL, Data, 7000' and node 7 shows 'NULL, 7, null,' illustrating how NULL pointers appear in an unthreaded tree. A table format is used to show the left child address, data, and right child address for each node. The instructor then draws a more complete binary tree structure with colored boxes representing node fields and arrows indicating pointer directions, annotating nodes with inorder predecessor and successor threads to demonstrate the double-threaded variant.

  3. 5:00 – 10:00 05:00-10:00

    A larger binary tree is displayed with three-field nodes annotated with specific values: the root shows '100 10 300,' its left child shows '400 8 500,' and the right child shows '600 30 700.' Leaf nodes display values like 'NULL 5 NULL' and '800 4 NULL.' At the bottom, an inorder traversal sequence is written: '5 8 29 4 10 9 30 41 16 52.' The instructor circles the leftmost node (value 5) and draws a horizontal line under it to indicate its NULL pointers. The words 'Predecessor' and 'Successor' are written with arrows pointing to the inorder sequence, establishing that threads will link each node to its adjacent nodes in this traversal order.

  4. 10:00 – 14:50 10:00-14:50

    The instructor demonstrates the threading process by circling specific values in nodes and connecting them to their positions in the inorder sequence. The value 4 is circled with its null right child highlighted, and a line connects it to the inorder sequence. The value 29 is circled in both the tree and the traversal list, as are values 8 and 5. Green brackets are drawn under several nodes to indicate value ranges. In the final segment, arrows are drawn between nodes to represent successor pointers: an arrow from node 41 points to its successor 16, and an arrow from node 52 points to NULL. The inorder traversal sequence is updated step-by-step at the bottom, progressing through '5 8 29 4 10 9 30 41 16 52 NULL,' demonstrating how threads enable sequential traversal without recursion or a stack.

The lecture progresses from definition to demonstration. First, the core concept is established: NULL pointers in a binary tree are replaced with threads that point to inorder predecessors or successors, eliminating the need for recursion or a stack during traversal. Second, the two main variants are distinguished: single-threaded trees (left or right) and double-threaded trees, with the node structure shown as having three fields (left pointer, data, right pointer). Third, a concrete example is built incrementally: starting with a small tree (nodes 1-7), the instructor expands to show internal node structure, then moves to a larger tree with specific pointer values (e.g., '100 10 300' at the root). The inorder traversal sequence is written out to make predecessor-successor relationships explicit. Finally, the threading process is demonstrated by highlighting NULL pointers and drawing arrows to show how each node's thread links it to its inorder neighbor. The key pedagogical move is connecting the abstract definition (NULL replaced by thread) to a concrete visual example where students can trace the traversal path using only the threads, confirming that no stack or recursion is needed. The sequence 5-8-29-4-10-9-30-41-16-52 serves as the reference for all predecessor and successor links throughout the demonstration.

Loading lesson…