Binary Search Trees Insertion and Deletion Flashcards

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

1/11

flashcard set

Earn XP

Description and Tags

Flashcards covering key concepts, vocabulary, algorithms, and deletion/insertion procedures for Binary Search Trees based on lecture notes.

12 Terms

1
New cards

Binary Search Tree (BST)

A dynamic data structure that organizes data in a way that makes searching, inserting, and deleting efficient while maintaining the binary-search-tree property.

2
New cards

Autocomplete System

A web application feature that uses a BST to store product names alphabetically and execute fast queries to fetch suggestions starting with typed characters.

3
New cards

TREE-INSERT(T, z)

A procedure that inserts a node zz (where z.key=vz.key = v and z.left=z.right=NILz.left = z.right = \text{NIL}) into a binary search tree TT by tracing a simple downward path to an appropriate position.

4
New cards

Trailing Pointer y

A pointer maintained during TREE−INSERTTREE-INSERT as the parent of pointer xx, used to update the parent attribute z.pz.p when xx reaches NIL\text{NIL}.

5
New cards

TRANSPLANT(T, u, v)

A BST subroutine that replaces the subtree rooted at node uu with the subtree rooted at node vv as a child of uu's parent.

6
New cards

TREE-DELETE(T, z)

A procedure that removes a specified node zz from a binary search tree TT, organizing cases based on whether zz has zero, one, or two children.

7
New cards

Successor Node y

The node with the smallest key in node zz's right subtree (retrieved via TREE−MINIMUM(z.right)TREE-MINIMUM(z.right)), used to replace zz when zz has two children during deletion.

8
New cards

BST Deletion: No Children Case

A deletion situation where node zz has no children, handled by modifying its parent to replace zz with NIL\text{NIL}.

9
New cards

BST Deletion: One Child Case

A deletion situation where node zz has just one child, handled by elevating that child to take zz's position in the tree by modifying zz's parent.

10
New cards

BST Deletion: Two Children Case

A deletion situation where node zz has two children, requiring its successor yy in the right subtree to be spliced out and elevated to replace zz.

11
New cards

In-order Traversal

A tree traversal technique that visits and prints the nodes of a binary search tree in alphabetically or numerically sorted order.

12
New cards

Java compareTo() Method

A Java method for string comparison that returns 0 when two compared strings are identical.