(åæã«æ¹è¡å ¥ãã¦ã¾ã) $ uname -a Linux hostname 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3 x86_64 GNU/Linux $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 7.5 (wheezy) Release: 7.5 Codename: wheezy $ ls -l | sort -k 5 ...(çç¥ãã¾ãã¦)... -rwxr-xr-x 1 dmiyakawa dmiyakawa 185386101 Jul 16 2013 VMware-Player-5.0.2-1031769.x86_64.sh -rw-r--r-- 1 dmiyakawa dmiyakawa 210
Sort-Object ã³ãã³ãã¬ããã使ç¨ããã¨ã表示ãã¼ã¿ãè¦ãããæ´çã§ãã¾ãã Sort-Object ã§ã¯ã並ã¹æ¿ãæ¡ä»¶ã¨ãã¦ããããã£å (è¤æ°å¯) ãæå®ããã¨ããã®ããããã£å¤ã§ä¸¦ã¹æ¿ãããããã¼ã¿ãè¿ããã¾ãã åºæ¬çãªä¸¦ã¹æ¿ã ç¾å¨ã®ãã£ã¬ã¯ããªå ã®ãµããã£ã¬ã¯ããªã¨ãã¡ã¤ã«ãä¸è¦§è¡¨ç¤ºããåé¡ã«ã¤ãã¦èãã¾ãã LastWriteTime ã§ä¸¦ã¹æ¿ããå¾ãName ã§ä¸¦ã¹æ¿ããã«ã¯ã次ã®ããã«å ¥åãã¾ãã Get-ChildItem | Sort-Object -Property LastWriteTime, Name | Format-Table -Property LastWriteTime, Name LastWriteTime Name ------------- ---- 11/6/2017 10:10:11 AM .localization-config 1
sort -> Array[permalink][rdoc][edit] sort! -> self sort {|a, b| ... } -> Array sort! {|a, b| ... } -> self é åã®å 容ãã½ã¼ããã¾ããè¦ç´ å士ã®æ¯è¼ã¯ <=> æ¼ç®åã使ã£ã¦è¡ãã¾ããsort ã¯ã½ã¼ããããé åãçæãã¦è¿ãã¾ãã sort! 㯠self ãç ´å£çã«ã½ã¼ãããself ãè¿ãã¾ãã ãããã¯ã¨ã¨ãã«å¼ã³åºãããæã«ã¯ãè¦ç´ å士ã®æ¯è¼ããããã¯ãç¨ãã¦è¡ãã¾ãããããã¯ã«2ã¤ã®è¦ç´ ãå¼æ°ã¨ãã¦ä¸ãã¦è©ä¾¡ãããã®çµæã§æ¯è¼ãã¾ãããããã¯ã¯ <=> æ¼ç®åã¨åæ§ã«æ´æ°ãè¿ããã¨ãæå¾ ããã¦ãã¾ããã¤ã¾ãããããã¯ã¯ç¬¬1å¼æ°ã大ãããªãæ£ã®æ´æ°ã両è ãçãããªã0ãããã¦ç¬¬1å¼æ°ã®æ¹ãå°ãããªãè² ã®æ´æ°ãè¿ããªããã°ããã¾ããã両è ãæ¯è¼ã§ããªãæ㯠nil ãè¿ãã¾ãã
å æ¥é åæ¸ã®æããã®ä»ã®æ¸é¡ãæ¥ä»é ã«åé¡ãã¦ããã®ã ããæ¸é¡ã½ã¼ã¿ã¼ã®é¡ã使ããã«ã½ã¼ããã¦ããã¨ããå°åãã®å±±ãããããã§ãããã£ã¦ãã¾ãããã¾ãã«ã¯ã©ã®å±±ãä½ã ã£ããåãããªããªã£ã¦ãã¾ã£ãã ãµã¨ã³ã³ãã¥ã¼ã¿ãµã¤ã¨ã³ã¹ã®ææ¥ã§ç¿ã£ãã½ã¼ãã¢ã«ã´ãªãºã ã使ãã°ããã®ã§ã¯ã¨æãç«ã¡ãç´ã®å±±ããã¹ã¦å ã«æ»ãåºæ°ã½ã¼ãããããã¨ãããããªãã¨ä½æ¥ãçµãããã¨ãã§ããããã®å¾å¥ã®ä½æ¥ã§ã¯ã¤ãã¯ã½ã¼ãããã¼ã¸ã½ã¼ãã試ããã¨ãã§ããã ããã§è³ªåãªã®ã ã/.erã®çã¯ç©ççã«ã½ã¼ãããéã©ããªã¢ã«ã´ãªãºã ã使ã£ã¦ããã ãããï¼
Hadoopã®Reduceã«æ¸¡ãããã®ã¯ãã¼ã¨å¤ã®ãªã¹ãã ãããã®ã¨ãå¤ã®ãªã¹ãã«å«ã¾ããåã¢ã¤ãã ï¼å¤ãã®ãã®ï¼ã¯ã½ã¼ãããã¦ããªããã½ã¼ãããã¦ãã¦æ¬²ããå ´åã«ã¯ã»ã«ã³ããªã½ã¼ãã¨å¼ã°ãããã¯ããã¯ã使ãã®ãå®ç³ã¨ããã¦ããããããã¯å®è£ ã®é¢ã§ãæ¦å¿µçãªé¢ã§ãããããã¦ãã¦çãªå´é¢ããããHadoopã«ã¯ããã¼ãã½ã¼ããããæ©è½ã¯å®è£ ããã¦ãããããã§ãå¤ããã¼ã«å ¥ãã¦ãã¾ãããã®Hadoopã«åãã£ã¦ããããã¼ãã½ã¼ããããæ©è½ã«ãã£ã¦ãå®è³ªçã«å¤ãã½ã¼ããããã¨ããããã ã Map/Reduceã¨ããã®ã¯ãã¼ãã¨ã«ãã¼ã¿ãåå²ãã¦å¦çããæ¹æ³ãªã®ã§ãããã¼ã«å¤ãå ¥ã£ããåå²ããããããªããããï¼ãã¨æãã®ã¯å½ç¶ã§ããããã¼ã«å¤ãå ¥ã£ã¦ãã¦ããåå²ã«å½±é¿ããªããããPartitioningã¯ã©ã¹ãèªåã§æ¡å¼µããåå²ã®åºæºã¨ãªãå¤ï¼æ¬æ¥ã®ãã¼ï¼ã«ã¯ãå¤ã®å½±é¿ãåºãªãããã«ããã®ã ããã
åå¸æ°ãä¸ãã½ã¼ãã¯ãã¼ã®éè¤ã«å¯¾å¿ãã¦ããã¨ããã¾ããããã¼ãéè¤ãã¦ããã®ã¯ 3 ã§ããæ´åå¾ã®ãµãã¤ã® 3 ã®ä½ç½®(é åã®ã¤ã³ããã¯ã¹)㯠ãY - Xã 㨠ãY - 1ã ã§è¨ç®ã§ãã¾ãããã®ä¾ã ã¨ã3 - 2 = 1ãã¨ã3 - 1 = 2ãã«ãªãã¾ãã å®éã®ããã°ã©ãã³ã°ã§ã¯éè¤ãããã¼ã®ä½ç½®ã®è¨ç®ã¯ãä½æ¥ç¨é åBã«ã³ãã¼ããæã«(æé 4ã§)é åAã®å¾ãããåã¸ã³ãã¼ãã¦ãããã¨ã§ç°¡åã«å®è£ ã§ãã¾ãã å³è§£ ç¹å¾´ ãã±ããã½ã¼ãã¨åããã½ã¼ã対象ã®ãã¼ã¿ãã¨ãããå¤ã®ç¯å²ããããããããã£ã¦ããªããã°ãªãã¾ãããä½æ¥é åããã¼ã®åæ°ãæ°ããããã®é åã¨çµæãæ ¼ç´ããé åãå¿ è¦ã«ãªãã¾ãããã¾ãã«å¤§ããªç¯å²ã®ãã¼ã¿ãåãæ±ãã«ã¯ RAM ãªã©ã«é度ãããã®ã§ç©ççã«ä¸å¯è½ã«ãªãã¾ããããã大ããªä½æ¥é åã¨å¼ãæãã«ãã¼ã¿ã®å¤§å°ãæ¯è¼ããªãã¦ããã®ã§é«éãªæ´åå¦çãå®ç¾ã§ãã¾ã
ã¹ãã¥ã¼ã¸ã½ã¼ãï¼è±: Stooge sortï¼ã¯ãå帰ãç¨ããã½ã¼ãã¢ã«ã´ãªãºã ã®ã²ã¨ã¤ã§ããã è¨ç®æéã¯O(nlog 3 / log 1.5 ) = O(n2.7095...)ã§ãããããã¯ãã¼ã¸ã½ã¼ããªã©ã®å¹ççãªã¢ã«ã´ãªãºã ããããããã©ãããé常ã«å¹çã®æªãåç´ãªã½ã¼ãã®ä¾ã¨ãã¦ããæããããããã«ã½ã¼ããããé ãã ã¢ã«ã´ãªãºã ã¯ä»¥ä¸ã®éãã§ããã ããæ«å°¾ã®å¤ãå é ã®å¤ããå°ãããã°ãããããå ¥ãæ¿ããã ç¾å¨å¦çãã¦ããé¨ååã®è¦ç´ æ°ã3以ä¸ã§ããã°ã ãªã¹ãã®å é 2/3[1]ã«å¯¾ãã¦ã¹ãã¥ã¼ã¸ã½ã¼ããè¡ãã ãªã¹ãã®æ«å°¾2/3[1]ã«å¯¾ãã¦ã¹ãã¥ã¼ã¸ã½ã¼ããè¡ãã ãªã¹ãã®å é 2/3[1]ã«å¯¾ãã¦åã³ã¹ãã¥ã¼ã¸ã½ã¼ããè¡ãã ããã§ãªããã°çµäºã algorithm stoogesort(array L, i = 0, j = length(L)-1) if L[j]
ãããªããã£ã¦ã¿ãã°ãããããã Perlã®ã¹ã¯ãªããã£ã³ã°ãã¹ãã®ç¨®é¡ã¨ã ãã¼ã¸ã§ã³ã«ãã£ã¦ãéãããããªãï¼ ããã¯ãªã£ããã©ã . .. 02jXVhQo.C 06B3babN.6 098hSVk6.Z 0A4jAI0d.h 0ckAL0nN.I 0Gh8YPdf.B 0jhFZM1W.M 0kR3589m.P 0NIVBe1e.M 0Thk4emT.a 1.c 10PHP4kW.W 11cUYISZ.Y 17UlecTe.l 19Fg1eLd.o 1dCkN4RD.f 1fJDifWh.0 1fNkP1Ho.B 1glmH3DV.4 1Gpf0WiM.N 1HhVoZIL.l 1IchCFjl.B 1INVG2b7.T 1iSPnQ6d.c 1K6dCXdb.3 1NgbaMa8.a 1odMNBB8.l 1Oi5XfIW.A 1OJUOpNj.D 1oLgcFbI.6 1P3R
public void sort(int[] a){ // ãã±ãã«å ¥ã£ã¦ãããã¼ã¿æ°ãè¦ããããã®é åã§ã int[] bn=new int[bucket.length]; // æä¸ä½æ¡ã®æ°åãè¦ã¦ã対å¿ãããã±ãã«ãã¼ã¿ãå ¥ãã¾ãã for(int i=0;i<a.length;i++){ bucket[a[i]%m].add(new Integer(a[i])); notifier.notify(i,-1); } // æåã®ãã±ãããé çªã«ãã¼ã¿ãåãã ãããã¼ã¿ã®æå®æ¡ã®å¤ãè¦ã¦ã // 対å¿ãããã±ãã«ãã¼ã¿ã追å ãã¾ãã for(int j=1;j<k;j++){ // ç¾å¨ãããããã®ãã±ãã«ä½åã®ãã¼ã¿ãå ¥ã£ã¦ãããã // è¦ãã¦ããã¾ãã for(int b=0;b<bucket.length;b++) bn[b]=bucket[b].num; // åãã±ãã®å é
Twitterã®TLã§ç¥ã£ãã®ã ããå°ãåã«æµ·å¤ã®æ²ç¤ºæ¿ã§"sleep sort"ã¨ããã½ã¼ãã¢ã«ã´ãªãºã ãçºæãããå ¬éãããããã ããã®ã¢ã«ã´ãªãºã ãé¢ç½ãã£ãã®ã§ç´¹ä»ãã¦ã¿ãã Genius sorting algorithm: Sleep sort 1 Name: Anonymous : 2011-01-20 12:22 諸åï¼ãªã¬ã¯å¤©æãããããªãããã®ã½ã¼ãã¢ã«ã´ãªãºã ãã¿ã¦ãããããã¤ãã©ãæãï¼ #!/bin/bash function f() { sleep "$1" echo "$1" } while [ -n "$1" ] do f "$1" & shift done wait example usage: ./sleepsort.bash 5 3 6 3 6 3 1 4 7 2 Name: Anonymous : 2011-01-20 12:27 >>1 ãªãâ¦ã ã¨
åºæ°ã½ã¼ãï¼ãããã½ã¼ããè±: radix sortï¼ã¯ããæ¯è¼ã«ãããªãã½ã¼ãã[1]ã®ã¢ã«ã´ãªãºã ã®ä¸ã¤ã§ãä½åãè¨æ°æ³ã§è¡¨ç¾å¯è½ãªå¯¾è±¡ã«ã¤ãã¦ãä¸ã®æ¡ããé çªã«ã½ã¼ããã¦ãããæå¾ã«æä¸ä½æ¡ã§ã½ã¼ãããã¨ãå ¨ä½ãé åºéãã«ä¸¦ã¶ãã¨ããææ³ã§ããã nããã¼ã¿ã®æ°ãkãæ¡æ°ã¨ãã¦ãè¨ç®éã®ãªã¼ãã¼ã¯O(nk)ã§ãããã¾ããã¢ã«ã´ãªãºã èªèº«ã®æ§è³ªã«ãããç´ ç´ãªå®è£ ãå®å®ã½ã¼ãã«ãªãã[2] ãã®ã¢ã«ã´ãªãºã ã¯ããã¼ã¿ã®ç¨®é¡ãæéã§ãæ大å¤ã»æå°å¤ãã¯ã£ãããã¦ããã¨ããä»®å®ãç½®ãã¦ãããå ¨ã¦ã®å ¥åãã¼ã¿ãã3æ¡ã®æ´æ°ããã2æåã®ã¢ã«ãã¡ãããããªã©æ±ºã¾ã£ãå½¢å¼ã§ãããã¨ãåãã£ã¦ããªããã°ãªããªãããªãããã«å ããããå¤ã®ãã¼ã¿ãå¿ ãä¸ã¤ããç¾ããªãã¨ããåãå¤ã®ãã¼ã¿ã¯åä¸ã®ãã®ã¨ãã¦ãã¾ã£ã¦è¯ããã¨ãã£ãå ´åã«ã¯ããã¯ãã½ã¼ãããã®ã§ã¯ãªããåç´ã«ãå ¨ä½ãå ¥ã大ããã®é åãç¨æãã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}