ä»åã¯é¸æã¢ã«ã´ãªãºã ã®ç´¹ä»ã§ãã ããã¯ãé åããkçªç®ã«å°ããæ°ãç·å½¢æé㧠æ¢ãã ãã¯ã¤ãã¯ã»ã¬ã¯ã(Quick Select)ã¨ãã ã¯ã¤ãã¯ã½ã¼ãã®æ´¾çã¢ã«ã´ãªãºã ã§ãã åé¡ ã½ã¼ãããã¦ããªãa1ããanã¾ã§ã®æ°åãnåããã ãã®ä¸ããkçªç®ã«å°ããæ°åãæ¢ãã ä¾ï¼ ãµã¤ãºã9ã®é åã[2, 5, 3, 7, 1, 8, 6, 0, 4]ã«ããã¦ã 3çªç®ã«å°ããæ°ã¯2ã§ãã 解1ï¼ã½ã¼ãããã ã½ã¼ããã¦kçªç®ã®æ°åãåãæ¹æ³ã§ãã ã½ã¼ãã«Î¸(nlogn)ã¨è¦ã¤ããã®ã«Î¸(n)ãªã®ã§ãT(n) â θ(nlogn) 解2ï¼é¸æã½ã¼ãç解 ãªã¹ãããä¸çªå°ããæ°åãè¦ã¤ããåãåºãã¾ãã ãããkåç¹°ãè¿ãã¾ãã ãªã¹ãããæå°å¤ãè¦ã¤ããã®ã«O(n)ãªã®ã§ T(n) â O(kn)ã§ãã 解3ï¼ãã¼ãã½ã¼ãã®å©ç¨ ãã¼ãã½ã¼ãã®æ§æã«O(n)ãåãåºãã«O(logn)
{{#tags}}- {{label}}
{{/tags}}