1 / 7

Review for Exam 2

Review for Exam 2. Topics covered: Recursion and recursive functions General rooted trees Binary Search Trees (BST) Splay Tree RB Tree K-D Trees For each of these data structures Basic idea of data structure and operations Be able to work out small example problems

lilika
Download Presentation

Review for Exam 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Review for Exam 2 • Topics covered: • Recursion and recursive functions • General rooted trees • Binary Search Trees (BST) • Splay Tree • RB Tree • K-D Trees • For each of these data structures • Basic idea of data structure and operations • Be able to work out small example problems • Prove related theorems • Asymptotic time performance • Advantages and limitations • comparison

  2. Review for Exam 2 • Recursion • Recurrence relation, recursive definition and recursive function • Base case(s) • Recursion part • Related to induction and problem reduction • Linear recursion, tree recursion and tail recursion • Good and bad things about recursive function (vs. iterative function) • Be able to write recursive functions (in pseudo code and C++)

  3. Review for Exam 2 • General rooted tree • Definition • Height and depth, path length • Binary and K-ary tree and their nodes • Binary trees • Full, complete and perfect binary trees • Internal and external nodes, IPL, EPL • 4 different orders of tree traversals

  4. Review for Exam 2 • BST • Definition • Basic operations and their implementations • find, • findMin, • findMax • insert, • remove, • makeEmpty • Time performance of these operations • Problems with unbalanced BST (degeneration)

  5. Review for Exam 2 • Splay tree • Definition (a special BST: balanced in some sense) • Rationale for splaying (data locality) • Splay operation • Root • without grandparent • with grandparent: zig-zag and zig-zig • When to splay (after each operation) • What to splay with find/insert/delete operations • Amortized time performance analysis: what does O(m log n) mean?

  6. Review for Exam 2 • RB tree • Definition: a BST satisfying 5 conditions • Every node is either red or black. • Root is black • Each NULL pointer is considered to be a black node • If a node is red, then both of its children are black. • Every path from a node to a NULL contains the same number of black nodes. • Theorems leading to O(log n) worst case time performance • Black height • min and max # of nodes a RB tree with bh=k can have • Bottom-up insertion and deletion, top-down insertion • Why top down?

  7. Review for Exam 2 • K-D Trees • What K-D trees are used for • Multiple keys • How K-D tree differs from the ordinary BST • levels • Be able to do insert and range query/print

More Related