For Wednesday Read Weiss, chapter 4, section 4 Homework: Weiss, - - PowerPoint PPT Presentation

for wednesday
SMART_READER_LITE
LIVE PREVIEW

For Wednesday Read Weiss, chapter 4, section 4 Homework: Weiss, - - PowerPoint PPT Presentation

For Wednesday Read Weiss, chapter 4, section 4 Homework: Weiss, chapter 4, exercise 9 Programming Assignment 2 Any questions? Bucket Sort Also known as bin sort Radix sort External Sorting Whats the issue?


slide-1
SLIDE 1

For Wednesday

  • Read Weiss, chapter 4, section 4
  • Homework:

– Weiss, chapter 4, exercise 9

slide-2
SLIDE 2

Programming Assignment 2

  • Any questions?
slide-3
SLIDE 3

Bucket Sort

  • Also known as bin sort
  • Radix sort
slide-4
SLIDE 4

External Sorting

  • What’s the issue?
  • What’s the approach?
slide-5
SLIDE 5

K-Way Merging

slide-6
SLIDE 6

Polyphase Merging

slide-7
SLIDE 7

Dictionary ADT

  • AbstractDataType Dictionary{

instances: collection of elements with distinct keys

  • perations:

Create() create an empty dictionary Search(k, x) return element with key k in x return true if element found, false otherwise Insert(x) insert element x into dictionary Delete(k, x) delete element with key k from dictionary and return the element in x }

slide-8
SLIDE 8

Binary Search Trees

  • An addition to our possible dictionary

implementations

  • We’re interested in operations:

– Search – Insert – Delete – Output in ascending order of keys – FindMin – FindMax

slide-9
SLIDE 9

Definition

  • Binary tree
  • Each element has an associated key
  • Keys are not duplicated
  • For any node, its left child (if any) has a key

smaller than its key and its right child (if any) has a key larger than its key

slide-10
SLIDE 10

Binary Search Tree Operations

  • Search

– Time Complexity

  • Insert

– Time Complexity

  • Deletion

– Of a leaf – Of a node with one non-empty subtree – Of a node with two non-empty subtrees – Time Complexity

  • Output Ordered List
  • FindMin
  • Find Max