ã¯ããã«
ãC++ã®æ°ããè¦æ ¼ãC++0xãã§ã¯ãè¨èªã¨ã©ã¤ãã©ãªã®ä¸¡é¢ãã便å©ãªæ©è½ã追å ããã¾ãããTR1ãï¼Technical Report 1ï¼ã¯C++0xã®ã©ã¤ãã©ãªé¨ã§ãæ¨æºC++ã«æ°ãã«è¿½å ãããã©ã¤ãã©ãªã®å¤ãã¯Boostã®ä¸ããé¸ã°ãããã®ã§ãã2008å¹´æ¥ã«ãªãªã¼ã¹ãäºå®ããã¦ããVisual Studio 2008ã«ã追å ããã±ã¼ã¸ã¨ãã¦ä¾çµ¦ãããã¨ã®æ å ±ãå¾ã¦ãã¾ãã
ãTR1ã«åé²ãããã¯ã©ã¹/é¢æ°ã®ä¸ããããã¤ããããã¯ã¢ãããããã®æ¦è¦ã¨ä½¿ãæ¹ãäºç¿ãã¦ããã¾ããããããã¾ã§ã®ä¸é£ã®ãTR1ã解説ã§ã¯Boostã®å®è£ ã使ã£ã¦ãã¾ããããä»åç´¹ä»ãã unorderedã³ã³ããã¯Boostã«ã¯å«ã¾ãã¦ãã¾ããããã®ããåè¿°ã®è¿½å ããã±ã¼ã¸ãVisual C++ 2008 Feature Pack Betaã使ãã¾ããFeature Pack Betaã¯ç¾æç¹ã§ã¯è±èªçVisual Studio 2008ã«ã®ã¿å¯¾å¿ãã¦ãã¾ãï¼VC++ 2008 Express è±èªçã§ãNGï¼ããããæ¥æ¬èªçã«ã対å¿ãã¦ããããã¨ã§ãããã
"unordered"ã®æå³
ãæ¨æºC++ã©ã¤ãã©ãªã«ã¯set
ãmultiset
ãmap
ãmultimap
ã®4ã¤ã®ã³ã³ãããç¨æããã¦ãã¾ãããããã¯äºåæ¨ï¼binary-treeï¼ããã®å®è£
ã«ç¨ãããã®ã§ãã大å°é¢ä¿ã«åºã¥ãã¦è¦ç´ ãäºåæ¨ã®æã«ã¶ãä¸ãããã®ã§ãæ¿å
¥ãæ¤ç´¢ã«è¦ããæéè¨ç®éã¯Î(logN)ããªãã¡è¦ç´ æ°ã®logã«æ¯ä¾ãã¾ãã
ãä»åTR1ã§æ°ãã«è¿½å ããã unordered_set
ãunordered_multiset
ãunordered_map
ãunordered_multimap
ã¯å¾æ¥ã®set
ãmultiset
ãmap
ãmultimap
ã¨ããããæ©è½çã«ã¯åãã§ããç°ãªãã®ã¯ãã®å®è£
ãäºåæ¨ã§ã¯ãªãããã·ã¥è¡¨ï¼hash-tableï¼ãç¨ãããã¦ãã¾ããæ大ã®ç¹å¾´ã¯ãã®ã¹ãã¼ãã«ããã¾ãã
ããã·ã¥è¡¨ãéãã¯ã±
ãããã·ã¥è¡¨ã¯ãã ãã¦è¨ãã°ãä¸åã«ä¸¦ãã ãã±ããã§ããããããã®ãã±ãã«ã¯éãçªå·ãæ¯ããã¦ãããåãã±ãã«ã¯è¤æ°ã®ãã¼ã«ï¼è¦ç´ ï¼ãæ ¼ç´ã§ãã¾ãããã±ãã¯ãã¼ã«ãè¦ç´ ã¨ããå¯å¤é·é åã¨èãã¦ããã§ãããã
ãããã«ãã±ããä¸ã¤ãããNåã®ãã¼ã«ãå ¥ã£ã¦ããã¨ãã¾ãããããã¼ã«ã«ã¯çªå·ãæ¸ãã¦ããã¾ãããã®ã¨ãé©å½ãªçªå·ãæå®ãã¦ããã®çªå·ãæ¸ããããã¼ã«ããã±ãã®ä¸ããè¦ã¤ãã ããã¨ãèãã¾ãã
ããã±ãã®ä¸ã®ãã¼ã«ã¯é ä¸åã§ããããç®çã®ãã¼ã«ãè¦ã¤ãåºãã«ã¯ä¸ã¤ãã¤åãåºãã¦ã¯ãããç®çã®ãã®ã§ãããã調ã¹ãªãã¦ã¯ãªãã¾ããã好éã«æµã¾ããã°ä¸åç®ã®ãã¼ã«ããæ¢ãã®ãã¼ã«ã§ãããææªã®ã±ã¼ã¹ã¯æå¾ã¾ã§èª¿ã¹ãããã©è¦ã¤ãããªãã£ãã¨ããå¹³åããã°ãã¼ã«æ¢ãã«å¿ è¦ãªæ¯è¼åæ°ã¯N/2ããªãã¡æ¤ç´¢ã«è¦ããæéã¯Nã«æ¯ä¾ãã¾ãã
ãã§ã¯ãã±ããäºã¤ç¨æããå¶æ°çªã®ãã¼ã«ã0çªãã±ãã«/å¥æ°çªã®ãã¼ã«ã1çªãã±ãã«å ¥ãã¦ãã¨ç´æãã¦ããã¾ããããã¨é©å½ãªçªå·ã®ãã¼ã«ãè¦ã¤ããã«ã¯ããã®çªå·ãå¶æ°ãªã0çªãã±ã/å¥æ°ãªã1çªãã±ãã®ä¸èº«ã ãã調ã¹ãã°ããããã¼ã«ã®çªå·ã«å¤§ããªåãããªããªãåãã±ãå ã®ãã¼ã«ã¯ã»ã¼åæ°ã®N/2ã§ããããæ¤ç´¢ã«è¦ããæéã¯ãã±ãä¸åã®å ´åã®ååã§ãã
ããã®èª¿åã§ãã±ãæ°ãMåã«ããåãã¼ã«ã¯ããã«æ¯ãããçªå·ãMã§å²ã£ãä½ãã示ããã±ãã«å ¥ãã¾ããããããããã¨æ¤ç´¢æã«èª¿ã¹ãªããã°ãªããªããã¼ã«ã®æ°ããªãã¡æ¤ç´¢ã«è¦ããæéã¯N/Mã«ç縮ããã¾ãã
ãã¨ãããã¨ã¯ãMãNã¨åããããã«ãã¦ããã°N/Mããããã1ã«ãªãã¾ããããã¯ãã¼ã«ã®ç·æ°ã«é¢ä¿ãªãã»ã¨ãã©ç¬æã«æ¤ç´¢ãçµäºãããã¨ãæå³ãã¾ããè¦ç´ ã®æ¤ç´¢å¯¾è±¡ã¨ãªãæ¯éå£ã®è¦ç´ æ°ã1ã«è¿ã¥ãããã¨ã§æ¤ç´¢ã¹ãã¼ããä¸ãããã¨ããæ¦ç¥ã§ãã
ãããã§éè¦ãªãã¯åãã¼ã«ãã©ã®ãã±ãã«æ ¼ç´ãããã決å®ããæ段ã§ããä¸è¨ã®ä¾ã§ã¯ããã¼ã«çªå·ããã±ãæ°ã§å²ã£ãä½ããã¨ãã¦ãã¾ããããããã¼ã«çªå·ã«å¤§ããªåããããã¨ãã±ãå ã®ãã¼ã«æ°ã«åããçãã¦æ¤ç´¢æéã伸ã³ã¦ãã¾ãã¾ãããã¼ã«ãããããè©°ã¾ã£ããã±ãã¨ã»ã¨ãã©ã«ã©ããã®ãã±ããã§ãã¦ãã¾ãã¾ããããã
ãè¦ç´ ï¼ãã¼ã«ï¼x ããä½ããã®ä¸æãªå¤ï¼ãã±ãçªå·ï¼ãå°åºããé¢æ°ããããã·ã¥é¢æ° h(x)ãã¨åä»ãã¾ããããããã·ã¥é¢æ° h ãæºãããªããã°ãªããªãæ¡ä»¶ã¯:
x = y ãªã h(x) = h(y)
ãã§ããããã§ãªãã¨ãã¼ã«æ¤ç´¢æã«å ¥ã£ã¦ããã¯ãã®ãªã"ããã£ã¦ã®ãã±ã"å ãæ¢ãã¦ãã¾ããã¨ã«ãªãã¾ãããã
ããã ããx â y ã§ã h(x) = h(y) ã¨ãªããã¨ãããã¾ããããã·ã¥é¢æ° h ããã±ãçªå·ã決å®ããã®ã§ãxã¨yã¯åããã±ãã«æ ¼ç´ããã¾ãã
ãããã·ã¥é¢æ°ãè¿ãå¤ï¼ããã·ã¥å¤ï¼ãåãè¦ç´ 群ãã·ããã ï¼synonym:å義èªï¼ã¨å¼ãã§ãã¾ãã