POTD 8: Indexing

Due 11-Apr-2024, 12pm/noon EST

Purpose:

You may make a copy of a worksheet and complete this activity or type your answers in any text editor.

You may work alone or with 3-4 other students in this course.


  1. Construct a B+ tree for the following set of key values:
    (10, 15, 20, 30, 60, 65, 80, 95, 100, 112, 124, 140, 148)
    Assume that the tree is initially empty and values are added in ascending order. Construct B+ tree for the cases where the number of pointers (n) that will fit in one node is five.
    [sample solution]
    Insert 10 solution to B+ tree, question 1
    Insert 15 solution to B+ tree, question 1
    Insert 20 solution to B+ tree, question 1
    Insert 30 solution to B+ tree, question 1

    Insert 60, node (root) full, split
    solution to B+ tree, question 1
    Add parent (new root), copy 20 to root
    solution to B+ tree, question 1

    Insert 65
    solution to B+ tree, question 1

    Insert 80, leaf full, split
    solution to B+ tree, question 1
    Copy 60 to root (update parent)
    solution to B+ tree, question 1

    Insert 95
    solution to B+ tree, question 1

    Insert 100, leaf full, split
    solution to B+ tree, question 1
    Copy 80 to root (update parent)
    solution to B+ tree, question 1

    Insert 112
    solution to B+ tree, question 1

    Insert 124, leaf full, split
    solution to B+ tree, question 1
    Copy 100 to root (update parent)
    solution to B+ tree, question 1

    Insert 140
    solution to B+ tree, question 1

    Insert 148, leaf full, split
    solution to B+ tree, question 1
    Copy 124 to root
    solution to B+ tree, question 1

    Root full, split, push middle value up (becomes new root node)
    solution to B+ tree, question 1

    Update pointers
    solution to B+ tree, question 1

  2. Use the B+ tree constructed in question 1, what is the minimum number of pointers to be followed to satisfy the query: Get all records of data associated with key(s) between 40 and 85?
    [sample solution]
    solution to B+ tree, question 2
    Need at least 4 pointers to answer this question


  3. Use the B+ tree from question 1, apply each of the following operations in order, and show the tree after each operation.
    1. Insert 18
      [sample solution]
      solution to B+ tree, question 3

    2. Insert 40
      [sample solution]
      solution to B+ tree, question 3

    3. Insert 85
      [sample solution]
      solution to B+ tree, question 3

    4. Delete 124
      [sample solution]
      solution to B+ tree, question 3

      Shift left
      solution to B+ tree, question 3

    5. Insert 138
      [sample solution]
      solution to B+ tree, question 3

    6. Insert 135
      [sample solution]
      solution to B+ tree, question 3

    7. Insert 120
      [sample solution]
      Node full, split solution to B+ tree, question 3

      Copy 120 up to parent, update pointers solution to B+ tree, question 3


Grading rubric

[Total: 10 points]: Done (or provide evidence of your attempt, full or reasonable effort)

(-2.5 points) for 24 hours late (submitted after 11-Apr-2024 12pm/noon EST, by 12-Apr-2024 12pm/noon EST)
(-5 points) for 48 hours late (submitted after 12-Apr-2024 12pm/noon EST, by 13-Apr-2024 12pm/noon EST)


Submission


Copyright © 2024 Upsorn Praphamontripong
Released under the Creative Commons License CC-BY-NC-SA 4.0 license.
Last updated 2024-04-07 9:51