quicksort and binary search trees

108
Quicksort & Search Trees (Distinct Keys) Quicksort 7 4 2 9 1 3 8 5 6 Sebastian Wild Quicksort and Binary Search Trees 1/4

Upload: university-of-kaiserslautern

Post on 15-Apr-2017

35 views

Category:

Science


1 download

TRANSCRIPT

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 8

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

8

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

85

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

85

6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

85

6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

85

6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

85

6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

85

6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?

Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Quicksort & Search Trees (Distinct Keys)

Quicksort Binary Search Tree

7 4 2 9 1 3 8 5 6

4 2 1 3 5 6 9 87

2 1 3 5 64 8 9

1 3 62 5 8

1 3 6

7 4 2 9 1 3 8 5 6

7

4

2

9

1 3

85

6

Well-Known Facts:Recursion Tree of Quicksort = Naturally Grown BSTComparisons in Quicksort = Comparison to built BSTComparisons in Quicksort = Comparisons to search each element in BST

How about median-of-three Quicksort etc.?Sebastian Wild Quicksort and Binary Search Trees 1 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

Insertionsort

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 87

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 87

Insertionsort

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 87

Insertionsort

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

7

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

7 4

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

7 4 2

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

7 4 2 9

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

7 4 2 9 1

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

2 1 4 7 9

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

2 1 7 94

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

4

2 1 7 9

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

4

2 1 3 7 9

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

4

2 1 3 7 9 8

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

4

2 1 3 7 9 8 5

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

4

2 1 3 7 9 8 5 6

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

4

2 1 3 5 6 7 9 8

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

4

2 1 3 5 6 9 87

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Fringe-Balanced Trees (Distinct Keys)

Rules for Fringe-Balanced Search TreesLeaves have buffer for elementsIf buffer is full, leaf is splitA new internal node with the median is created.

Median-of-5 Quicksort Fringe-Balanced Tree

7 4 2 9 1 3 8 5 6

2 1 3 7 9 8 5 64

5 6 9 872 1 3

5 6 9 8

7 4 2 9 1 3 8 5 6

4

2 1 3 7

5 6 9 8

Sebastian Wild Quicksort and Binary Search Trees 2 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 5

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot)

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

3

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

4

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

1

4

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

1

3

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

1

5

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

1

2

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

1

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

1

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Quicksort & Search Trees (Equal Keys)

How about inputs with duplicates?

Quicksort (Fat-Pivot) Binary Search Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 3 2 5 54 44

1 3 3 32 2 5 5

1 3 33

4 2 1 3 3 5 4 4 3 5 2

4

2

1 3

5

1

Equivalence holds also with duplicates.

This was basic Quicksort . . . how about pivot sampling?

Sebastian Wild Quicksort and Binary Search Trees 3 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

Insertionsort

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 44

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 44

Insertionsort

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2)

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

4

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

4 2

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

4 2 1

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

4 2 1 3

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

4 2 1 3 3

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

2 1 3 3 4

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

2 1 43

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

2 1 4

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

2 1 4 5

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

2 1 4 5 4

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

2 1 4 5 4 4

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

4 5 4 42 1

3

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

2 1 4 5 4 4 5

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

2 1 4 4 4 5 5

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

2 1 5 54

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

2 1 4

5 5

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

4

5 5

2 1 2

Sebastian Wild Quicksort and Binary Search Trees 4 / 4

Fringe-Balanced Trees (Equal Keys)

Recall: Fringe-Balanced Search TreesLeaves have buffer for elements, to emulate pivot sampling

If buffer is full, leaf is split

A new internal node with the chosen pivot(s) is created.

Median-of-5 Quicksort ~t = (2,2) Fringe-Balanced Tree

4 2 1 3 3 5 4 4 3 5 2

2 1 2 4 5 4 4 533 3

5 54 442 1 2

5 5

4 2 1 3 3 5 4 4 3 5 2

3

4

5 5

2 1 2

Sebastian Wild Quicksort and Binary Search Trees 4 / 4