Week 11 - Monday What did we talk about last time? Euler paths - - PowerPoint PPT Presentation

week 11 monday what did we talk about last time euler
SMART_READER_LITE
LIVE PREVIEW

Week 11 - Monday What did we talk about last time? Euler paths - - PowerPoint PPT Presentation

Week 11 - Monday What did we talk about last time? Euler paths Network flow Started B-trees Lab hours Wednesdays at 5 p.m. in The Point 113 Saturdays at noon in The Point 113 CS Club Tuesdays at 5 p.m. in The


slide-1
SLIDE 1

Week 11 - Monday

slide-2
SLIDE 2

 What did we talk about last time?  Euler paths  Network flow  Started B-trees

slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5

 Lab hours

  • Wednesdays at 5 p.m. in The Point 113
  • Saturdays at noon in The Point 113

 CS Club

  • Tuesdays at 5 p.m. in The Point 113 (or next door in The Point 112)
  • Halloween party tomorrow!

 Women in STEM panel

  • Tonight at 6 p.m. in The Point 113
slide-6
SLIDE 6

s t a b c d 12 16 10 9 20 7 4 4 14 13

slide-7
SLIDE 7
slide-8
SLIDE 8

 Binary trees are great  However, only two splits means that you have a height of log2

n when you want to store n things

  • If n = 1,000,000, log2 n = 20

 What if depth was expensive? Could we have say, 10 splits?

  • If n = 1,000,000, log10 n = 6
slide-9
SLIDE 9

 Answer: When the tree is in secondary storage  Each read of a block from disk storage is slow

  • We want to get a whole node at once
  • Each node will give us information about lots of child nodes
  • We don’t have to make many decisions to get to the node we want
slide-10
SLIDE 10

 A B-tree of order m has the following properties: 1.

The root has at least two subtrees unless it is a leaf

  • 2. Each nonroot and each nonleaf node holds k keys and k + 1 pointers

to subtrees where m/2 ≤ k ≤ m

3.

Each leaf node holds k keys where m/2 ≤ k ≤ m

  • 4. All leaves are on the same level
slide-11
SLIDE 11

50 10 15 20 70 80 6 8 11 12 16 18 21 25 27 29 54 56 71 76 81 89

slide-12
SLIDE 12

12 5 8 13 15

Insert 7

12 5 7 8 13 15

slide-13
SLIDE 13

12 2 5 7 8 13 15

Insert 6

6 12 2 5 13 15 7 8

slide-14
SLIDE 14

 Insert the following numbers:

  • 86 69 81 15 100 94 8 27 56 68 92 89 38 53 88
slide-15
SLIDE 15

 When the list of keys drops below half m, we have to

redistribute keys

 In the worst case, we have to delete a level

slide-16
SLIDE 16

 Instead of requiring every non-root node to be half full, every

non-root node must be at least 2/3 full

 Key redistribution becomes more complex  However, the tree is fuller

slide-17
SLIDE 17

 Essentially, make a B-tree such that all the leaves are tied

together in a linked list

 It is also necessary that all keys in a B-tree appear as leaves  Some other variations are possible, but we’ll end the list here

6 12 2 5 12 13 15 6 7 8

slide-18
SLIDE 18
slide-19
SLIDE 19

 Hard graph problems  Intractability and NP-completeness

slide-20
SLIDE 20

 Work on Project 3  Study for Exam 2

  • Next Monday