DOC PREVIEW
TRINITY CSCI 1321 - Lecture Notes

This preview shows page 1-2 out of 7 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7AVL Trees4-27-2011Opening DiscussionDo you have any questions about the quiz?Minute essay comments:Relationship of a “script” with programming. Not directly related to actors.Balanced BSTsThe critical flaw of BSTs is that they can become unbalanced leading to O(n) behavior instead of O(n log n).There are approaches to keeping trees balanced where you alter the structure of the tree occasionally.It has to be O(log n) or else it isn't worth it.AVL TreesOne approach to maintaining balance is the AVL tree.Each node should keep track of its height. The height of the left and right children should not differ by more than one. If it does, a modification is made to bring it back into balance.This can be done by running back up through the nodes to the root on an add or remove and doing rotations when things aren't balanced.RotationsDepending on the structure in the imbalance, you do either a single or double rotation. Tall outer grandchild is single, tall inner grandchild is double.Image from Wikimedia Commons, AVL tree entry.Functional TreesYou can do AVL trees in a non-functional way by keeping track of parents so you can walk back up.You can also do them functionally with immutable nodes by rebuilding altered nodes and the path back to the root.Minute EssayAny final requests before the last


View Full Document

TRINITY CSCI 1321 - Lecture Notes

Documents in this Course
Recursion

Recursion

11 pages

Iterators

Iterators

10 pages

Actors

Actors

9 pages

Recursion

Recursion

15 pages

Recursion

Recursion

10 pages

Threads

Threads

7 pages

Trees

Trees

11 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?