Binary Search Tree Theory

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/13

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:03 AM on 2/23/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

14 Terms

1
New cards

Binary Traversal - Preorder traversal

  • visit root

  • traverse left subtree in preorder

  • traverse right subtree in preorder

<ul><li><p>visit root </p></li><li><p>traverse left subtree in preorder </p></li><li><p>traverse right subtree in preorder</p></li></ul>
2
New cards

Build Binary Tree

public class BinaryTreeNode{

int val ;

BinaryTreeNode left ;

BinaryTreeNode right;

}

3
New cards

Post Order Traversal

  • Traverse the left subtree in Postorder.

  • Traverse the right subtree in Postorder.

  • Visit the root.

<p></p><ul><li><p><span>Traverse the left subtree in Postorder.</span></p></li><li><p><span>Traverse the right subtree in Postorder.</span></p></li><li><p><span>Visit the root.</span></p></li></ul><p></p>
4
New cards

In order traversal

  • Traverse the left subtree in Inorder.

  • Visit the root.

  • Traverse the right subtree in Inorder.

<ul><li><p><span>Traverse the left subtree in Inorder.</span></p></li><li><p><span>Visit the root.</span></p></li><li><p><span>Traverse the right subtree in Inorder.</span></p></li></ul><p></p>
5
New cards

Properties of Binary Tree : give h as a height of a binary tree

What is number of maximun node in a full binary tree ?

The maximum number of nodes in a binary tree of height h is 2^(h+1) - 1.

6
New cards

Properties of Binary Tree : give h as a height of a binary tree

What is number of maximun node in a complete binary tree ?

Its range from 2^h → 2^(h+1) -1

7
New cards

Properties of Binary Tree : give h as a height of a binary tree

What is number of leaf node in a full binary tree

2^h

8
New cards

Properties of Binary Tree : give h as a height of a binary tree

What is number of NULL links (wasted pointers ) in a complete binary tree of n nodes

n+1

9
New cards

Basic Operations of full binary tree

  • insert element into a tree

  • delete element from a tree

  • searching an element from tree

  • traversing tree

10
New cards

Auxilliary Operations of Binary Tree

  • find size of tree

  • find height of tree

  • find level which has maximun sum

  • find LCA

11
New cards

Application of Binary Tree

  • Expression trees are used in compilers.

  • Huffman coding trees that are used in data compression algorithms.

  • Binary Search Tree (BST), which supports search, insertion and deletion on a

    collection of items in O(logn) (average).

  • Priority Queue (PQ), which supports search and deletion of minimum (or maximum)

    on a collection of items in logarithmic time (in worst case).

12
New cards

Tree Traversal Ways

  1. DLR ( Preorder)

  2. LDR (Inorder)

  3. LRD (post order)

  4. Level Order Traveral (go through each level)

13
New cards

Level Order Traversal

  • Visit the root.

  • While traversing level (, keep all the elements at level ( + 1 in queue.

  • Go to the next level and visit all the nodes at that level.

  • Repeat this until all levels are completed.

14
New cards
<p>Given a tree , return value In order traversal</p>

Given a tree , return value In order traversal

Explore top notes

note
PATHOLOGY
Updated 1126d ago
0.0(0)
note
Invisible Man Chapter 20
Updated 1194d ago
0.0(0)
note
Of Tests and Testing
Updated 1226d ago
0.0(0)
note
World: Political Systems
Updated 1229d ago
0.0(0)
note
PATHOLOGY
Updated 1126d ago
0.0(0)
note
Invisible Man Chapter 20
Updated 1194d ago
0.0(0)
note
Of Tests and Testing
Updated 1226d ago
0.0(0)
note
World: Political Systems
Updated 1229d ago
0.0(0)

Explore top flashcards

flashcards
3.4: donner une instruction
36
Updated 707d ago
0.0(0)
flashcards
topic 1.1
32
Updated 1206d ago
0.0(0)
flashcards
Belangrijksten Heiligen A-Z
50
Updated 119d ago
0.0(0)
flashcards
Neurons PNS and CNS
36
Updated 902d ago
0.0(0)
flashcards
Conrad JROTC ACP SY 25-26
100
Updated 115d ago
0.0(0)
flashcards
3.4: donner une instruction
36
Updated 707d ago
0.0(0)
flashcards
topic 1.1
32
Updated 1206d ago
0.0(0)
flashcards
Belangrijksten Heiligen A-Z
50
Updated 119d ago
0.0(0)
flashcards
Neurons PNS and CNS
36
Updated 902d ago
0.0(0)
flashcards
Conrad JROTC ACP SY 25-26
100
Updated 115d ago
0.0(0)