Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Comparison tree?

Definition 19.8 University Computer Science — Year 1 · Capítulo 19 — Sorting

The comparison tree of a comparison sort for inputs of size nn is the binary tree whose internal nodes are the comparisons the sort makes, with one subtree for each outcome, and whose leaves are the outputs. An input follows one path from the root to a leaf; the length of the path is the number of comparisons.

The comparison tree of insertion sort on three keys a, b, c: six leaves, one for each order, and height 3. A sorted input takes the rightmost path, two comparisons.
The comparison tree of insertion sort on three keys a,b,ca, b, c: six leaves, one for each order, and height 3. A sorted input takes the rightmost path, two comparisons.
Comparisons from , averaged over 200 random orders. Quicksort on sorted input leaves the chart at n = 36 (630 comparisons). Merge sort hugs the bound; heapsort makes about twice as many.
Comparisons from Output 19.4, averaged over 200 random orders. Quicksort on sorted input leaves the chart at n=36n = 36 (630 comparisons). Merge sort hugs the bound; heapsort makes about twice as many.
Leer en el capítulo →