DOC PREVIEW
UCF COT 4810 - Search Trees

This preview shows page 1-2-3-4-5-6 out of 18 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 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 18 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 18 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 18 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 18 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 18 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Search TreesOverviewTree BasicsImplementationTraversalsSlide 6Binary TreesBinary Search TreesAVL TreesSingle RotationDouble RotationRed Black TreesProblemsOther TypesApplicationsSummaryReferencesQuestionsSearch TreesDouglas HowellJanuary 29, 2008COT 4810Overview•Basics•Traversals•Implementation•Binary Search Trees•AVL Trees•Red Black Trees•Other Trees•ApplicationsTree Basics•Root node: first node in tree•Parent-Child relationships•Leaf node: node with no child•Height: length from node to deepest leaf •Depth: length from root to nodeImplementation•Linked lists•Fields:–Data–Pointer to child nodes•Alternate method–First child / next siblingTraversals•Pre-order: Root, Left, Right•In-order: Left, Root, Right•Post-order: Left, Right, Root•Level-order: Top down, left to right•Pre-Order: 1 2 4 5 3 6 7•In-Order: 4 2 5 1 6 3 7•Post-Order: 4 5 2 6 7 3 1•Level-Order: 1 2 3 4 5 6 712 34 5 6 7TraversalsBinary Trees•No more than 2 child nodes•Useful:–Compiler expressions–Huffman Coding–Binary Search TreesBinary Search Trees•All nodes in the left sub-tree must have a value less than the root node•All nodes in the right sub-tree must have a value greater than the root node•Faster searching, worst depth still O(n)AVL Trees•Height of left and right subtrees cannot differ by more than 1•Depth close to logN•Inserting / Removing balance issuesSingle Rotation41 62 5 73=>42 63 5 71Double Rotation52 634=>32 54 611Red Black Trees•Nodes must be red or black•Root must be black•Red nodes must have black children•Each path must have equal black nodes42 63 5 71•Serious balancing issues!•Single / Double rotations•Color changesProblemsOther Types•aa-trees: red-black tree, left children cannot be red•b-trees: data stored in leaf nodes, parents guide the search•Splay trees: accessed nodes become root•Ternary search trees: three way trees•2-3-4 trees: nodes have 2, 3, or 4 children and have 1,2, or 3 elements in that nodeApplications•O.S. file storage•Searching algorithms•Text processing•Compiler design•Overall: structures that are fast at looking up and inserting data, log N time averageSummary•Basics: root, parent-child, leaf nodes•Implementation: linked lists, arrays•Traversals: pre, in, post, level-order•Binary Search Trees•AVL Trees: single, double rotations•Red-Black Trees and others•Very useful in computer science!References•Weiss, Mark A. Data Structures & Problem Solving Using Java, 3rd Ed. Pearson, 2006.•Dewdney, A. K. The New Turing Omnibus, Henry Holt and Company, New York, 1989.•www.wikipedia.com, 2008.Questions•1) Name 3 types of search trees.•2) Give the pre, in, post, and level order traversals of this tree.94 83 725


View Full Document

UCF COT 4810 - Search Trees

Documents in this Course
Spoofing

Spoofing

25 pages

CAPTCHA

CAPTCHA

18 pages

Load more
Download Search Trees
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 Search Trees 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 Search Trees 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?