SlideServe
Menu
Préférences
© SlideServe · v2026

Generalized Median Finding Algorithm for Unsorted Lists

mio avatar
6 diapositives · 166 Views · Jul 29, 2014

Recursively find the k'th largest element in an unsorted list using the median-of-medians technique. Divide list into blocks of 5, find block medians, and use selection method to locate k'th element.

Generalized Median Finding Algorithm for Unsorted Lists - slide 1
01 / 6Generalized Median Finding Algorithm for Unsorted Lists
1 / 17

Télécharger la présentation

Generalized Median Finding Algorithm for Unsorted Lists
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Recurrence Warmup

  2. Finding the Median Without Sorting Generalize to finding the k’th largest element of a list: Find(L, k) Median ::= Find(L, |L|/2)

  3. Find(L, k) Let |L| = n. Assume distinct elements Divide L into blocks of 5 and find the medians (third of five elements) of the blocks: O(n) time. Recursively find the median of the medians, M M < half the medians, and each median < 2 of the 5 elements of its block So those medians are < 2/10 of the elements of L So M < 3/10 of the elements of L Likewise M > 3/10 the elements of L

  4. Find(L, k) Use M to split L into two sublists: elements < M and elements > M. On the basis of the size of these lists, figure out which part the k’th element of L belongs to. Recursively find the corresponding element within that sublist, which is of size at most 7n/10.

  5. Analysis T(1) = 1 T(n) ≤ T(n/5) + T(7n/10) (Time to find median of medians plus time to select from elements that have not been excluded) Linear solution! Because n + .9n + .92n + … < 10n So T(n) = O(n)

  6. FINIS