AVL tree: Difference between revisions

121 bytes removed ,  2 years ago
Line 2,959:
select left.balance
{
case left_high
{
balance = state.balanced
Line 2,966:
}
case right_high
{
subright = left.right
Line 2,972:
select subright.balance
{
case balanced
{
balance = state.balanced
Line 2,978:
}
case right_high
{
balance = state.balanced
Line 2,984:
}
case left_high
{
balance = state.right_high
Line 2,995:
}
case balanced
{
balance = state.left_high
Line 3,008:
select right.balance
{
case right_high
{
balance = state.balanced
Line 3,016:
}
case left_high
{
subleft = right.left
Line 3,022:
select subleft.balance
{
case balanced
{
balance = state.balanced
Line 3,028:
}
case left_high
{
balance = state.balanced
Line 3,034:
}
case right_high
{
balance = state.left_high
Line 3,045:
}
case balanced
{
balance = state.right_high
Line 3,068:
select balance
{
case left_high
{
if parent.is_header
Line 3,082:
}
case balanced
{
balance = state.left_high
Line 3,088:
}
case right_high
{
balance = state.balanced
Line 3,097:
select balance
{
case left_high
{
balance = state.balanced
Line 3,103:
}
case balanced
{
balance = state.right_high
Line 3,109:
}
case right_high
{
if parent.is_header
Line 3,152:
select balance
{
case left_high
{
balance = state.balanced
Line 3,159:
case balanced
{
balance = state.right_high
Line 3,165:
}
case right_high
{
if right.balance == state.right_high
Line 3,186:
select balance
{
case right_high
{
balance = state.balanced
Line 3,193:
case balanced
{
balance = state.left_high
Line 3,200:
case left_high
{
if left.balance == state.balanced
Line 3,359:
if left_most == node left_most = new_node
node.balance_tree(direction.from_left)
braacbreak
}
}
Line 3,372:
if right_most == node right_most = new_node
node.balance_tree(direction.from_right)
braacbreak
}
}
Line 3,406:
if left_most == node left_most = new_node
node.balance_tree(direction.from_left)
braacbreak
}
}
Line 3,419:
if right_most == node right_most = new_node
node.balance_tree(direction.from_right)
braacbreak
}
}
Line 3,425:
{
node.data = data
braacbreak
}
}
Line 3,521:
}
node.parent.balance_tree_remove(from)
braacbreak
}
}
Line 3,555:
return false
}
else // item ecsistsexists
return true
}