Advanced Programming I Lecture Notes

Advanced Programming I Lecture Notes

27 February 2007 • Trees


Outline

Linked Lists Again

Fast Interior Access

Fast-Access Structure

Trees

Node Relations

Tree Properties

The Tree ADT

Implementing Trees

Tree ADT Data

Dynamic Implementation

Trees And Recursion

Binary Tree Operations

Binary-Tree Search

Binary-Tree Add

Removing Nodes

Binary-Tree Remove

Operation Performance

Binary Trees and Order

Binary Search Trees

Binary Search Tree Member

Binary Search Tree Add

Removing Nodes

Binary Search Tree Remove

node * remove(node * r)

  if r.left ≠ nil
    r.left = remove_max(r.left, r.data)

  or r.right ≠ nil
    r.right = remove_min(r.right, r.data)

  or
    delete r
    r = nil

  return r

Performance

Points to Remember


This page last modified on 24 February 2006.

This work is covered by a
Creative Commons License.