Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære BST Deletion | Trees Part I
Data Structure & Algorithms PART I
course content

Kursinnhold

Data Structure & Algorithms PART I

Data Structure & Algorithms PART I

1. Introduction to ADS
2. Data Structures Part I
3. Trees Part I
4. Trees Part II

book
BST Deletion

There are also some cases while deleting nodes from the tree:

  • Deleting the leaf node;

  • Deleting the node with 1 child;

  • Deleting the node with 2 children.

Deleting the leaf node

We may simple remove the leaf node without any crucial changes in the tree.

Deleting the node with 1 child:

  • Replace that node with its child node;

  • Remove the child node from its original position.

Deleting the node with 2 children:

  • Get the inorder successor of that node;

  • Replace the node with the inorder successor;

  • Remove the inorder successor from its original position.

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 7

Spør AI

expand
ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

course content

Kursinnhold

Data Structure & Algorithms PART I

Data Structure & Algorithms PART I

1. Introduction to ADS
2. Data Structures Part I
3. Trees Part I
4. Trees Part II

book
BST Deletion

There are also some cases while deleting nodes from the tree:

  • Deleting the leaf node;

  • Deleting the node with 1 child;

  • Deleting the node with 2 children.

Deleting the leaf node

We may simple remove the leaf node without any crucial changes in the tree.

Deleting the node with 1 child:

  • Replace that node with its child node;

  • Remove the child node from its original position.

Deleting the node with 2 children:

  • Get the inorder successor of that node;

  • Replace the node with the inorder successor;

  • Remove the inorder successor from its original position.

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 7
Vi beklager at noe gikk galt. Hva skjedde?
some-alt