median-of-medians

Understanding “median of medians” algorithm

若如初见. 提交于 2019-11-27 06:27:05
I want to understand "median of medians" algorithm on the following example: We have 45 distinct numbers divided into 9 group with 5 elements each. 48 43 38 33 28 23 18 13 8 49 44 39 34 29 24 19 14 9 50 45 40 35 30 25 20 15 10 51 46 41 36 31 26 21 16 53 52 47 42 37 32 27 22 17 54 The first step is sorting every group (in this case they are already sorted) Second step recursively, find the "true" median of the medians ( 50 45 40 35 30 25 20 15 10 ) i.e. the set will be divided into 2 groups: 50 25 45 20 40 15 35 10 30 sorting these 2 groups 30 10 35 15 40 20 45 25 50 the medians is 40 and 15 (in

Understanding “median of medians” algorithm

筅森魡賤 提交于 2019-11-26 11:59:57
问题 I want to understand \"median of medians\" algorithm on the following example: We have 45 distinct numbers divided into 9 group with 5 elements each. 48 43 38 33 28 23 18 13 8 49 44 39 34 29 24 19 14 9 50 45 40 35 30 25 20 15 10 51 46 41 36 31 26 21 16 53 52 47 42 37 32 27 22 17 54 The first step is sorting every group (in this case they are already sorted) Second step recursively, find the \"true\" median of the medians ( 50 45 40 35 30 25 20 15 10 ) i.e. the set will be divided into 2 groups