Search: | |||||

| ||||

Home » Forum » Java | RSS Feeds |

for one of my classes i have to implement a binary search tree

using Nodes, where each node has a key value, a reference to the left

child, and a reference to the right child.

The problem i am having is implementing "remove(int key)". this

method takes a key parameter and removes the node in the tree with

that key. It's really difficult because after you find the node and

remove it, you can't have empty nodes, so you have to rearrange the

tree to make it correct.

Tree-Delete (T, x)

if x has no children case 0

then remove x

if x has one child case 1

then make p[x] point to child

if x has two children case 2

then swap x with its successor

perform case 0 or case 1 to delete it

Sounds like you need to cross link the left and right children to each

other after deleting (or maybe before),

rather than to the node you are deleting (which is what they are linked

to before the delete).

Didn't find what you were looking for?
Find more on Implement a binary search tree using Nodes
Or get search suggestion and latest updates.

Related Topics:

- Binary Search Tree
- Binary Search Tree
- binary search tree
- Binary tree for algebraic expression
- help regarding change color of tree node
- trees and more trees
- Program of binary search with process output
- Reading Binary Files with Leading Binary Zeros
- Tree structure using jsf
- Tree View using database
- dataminig using Decsion tree
- Implement RPC in java without using RMI
- Depth first search and Breath first search ...
- Depth first search and Breath first search
- Splay tree apps
- Splay tree
- Splay tree
- Splay tree
- Using Case to do a multi-textbox search
- code to convert fixed point decimal to binary
- Multiplication And division of real binary and Hexa numbers in linux
- binary
- please help me ---- B Tree
- Convert Binary to octal program
- JSP Tree Tag Examples