정렬 알고리즘 몇가지
오랜만에 공부하면서 짜본 정렬 알고리즘 몇가지 BubbleSort private void sort(int[] set) { for(int i=0; i<set.length; i++) { for(int j=0; j<set.length-1-i; j++) { if(set[j] > set[j+1]) { int tmp = set[j]; set[j] = set[j+1]; set[j+1] = tmp; } } } } SelectSort public void sort(int[] set) { for(int i=0; i<set.length-1; i++) { for(int j=i+1; j<set.length; j++) { if(set[i] > set[j]) { int tmp = set[i]; set[i] = set[j]; set[j] = tmp; } } } } QuickSort public void sort(int[] set, int left, int right) { int pivot = set[(left+right)/2]; int i = left, j = right, tmp; while(i <= j) { wh.......
2015-01-13 00:20:18 |
산소소년
정렬 알고리즘 몇가지
오랜만에 공부하면서 짜본 정렬 알고리즘 몇가지 BubbleSort private void sort(int[] set) { for(int i=0; i
2015-01-13 00:20:18 |
산소소년
정렬 알고리즘 몇가지
오랜만에 공부하면서 짜본 정렬 알고리즘 몇가지 BubbleSort private void sort(int[] set) { for(int i=0; i<set.length; i++) { for(int j=0; j<set.length-1-i; j++) { if(set[j] > set[j+1]) { int tmp = set[j]; set[j] = set[j+1]; set[j+1] = tmp; } } } } SelectSort public void sort(int[] set) { for(int i=0; i<set.length-1; i++) { for(int j=i+1; j<set.length; j++) { if(set[i] > set[j]) { int tmp = set[i]; set[i] = set[j]; set[j] = tmp; } } } } QuickSort public void sort(int[] set, int left, int right) { int pivot = set[(left+right)/2]; int i = left, j = right, tmp; while(i <= j) { wh.......
2015-01-12 15:20:18 |
산소소년
정렬 알고리즘 몇가지
오랜만에 공부하면서 짜본 정렬 알고리즘 몇가지 BubbleSort private void sort(int[] set) { for(int i=0; i<set.length; i++) { for(int j=0; j<set.length-1-i; j++) { if(set[j] > set[j+1]) { int tmp = set[j]; set[j] = set[j+1]; set[j+1] = tmp; } } } } SelectSort public void sort(int[] set) { for(int i=0; i<set.length-1; i++) { for(int j=i+1; j<set.length; j++) { if(set[i] > set[j]) { int tmp = set[i]; set[i] = set[j]; set[j] = tmp; } } } } QuickSort public void sort(int[] set, int left, int right) { int pivot = set[(left+right)/2]; int i = left, j = right, tmp; while(i <= j) { wh.......
2015-01-12 15:20:18 |
산소소년
Median, Percentile
중위값과 몇%의 위치를 알아내는 함수 public static double getMedian(Double[] value_list) { int size = value_list.length; int med = size / 2; if(size == 0) return 0; if(size == 1) return value_list[0]; if(size % 2 == 1) return value_list[med]; return (value_list[med-1] + value_list[med])/2; } public static double getPercentile(Double[] value_list, Double percent) { Arrays.sort(value_list); int N = value_list.length; double n = percent / 100d * ((double)N - 1) + 1; int k = (int)n; if(k == 0) return value_list[0]; if(k >= N) return value_list[N-1]; double diff = n - (double)k; return value_list.......
2015-01-11 22:46:14 |
산소소년
Median, Percentile
중위값과 몇%의 위치를 알아내는 함수 public static double getMedian(Double[] value_list) { int size = value_list.length; int med = size / 2; if(size == 0) return 0; if(size == 1) return value_list[0]; if(size % 2 == 1) return value_list[med]; return (value_list[med-1] + value_list[med])/2; } public static double getPercentile(Double[] value_list, Double percent) { Arrays.sort(value_list); int N = value_list.length; double n = percent / 100d * ((double)N - 1) + 1; int k = (int)n; if(k == 0) return value_list[0]; if(k >= N) return value_list[N-1]; double diff = n - (double)k; return value_list.......
2015-01-11 22:46:14 |
산소소년
Median, Percentile
중위값과 몇%의 위치를 알아내는 함수 public static double getMedian(Double[] value_list) { int size = value_list.length; int med = size / 2; if(size == 0) return 0; if(size == 1) return value_list[0]; if(size % 2 == 1) return value_list[med]; return (value_list[med-1] + value_list[med])/2; } public static double getPercentile(Double[] value_list, Double percent) { Arrays.sort(value_list); int N = value_list.length; double n = percent / 100d * ((double)N - 1) + 1; int k = (int)n; if(k == 0) return value_list[0]; if(k >= N) return value_list[N-1]; double diff = n - (double)k; return value_list.......
2015-01-11 13:46:14 |
산소소년
Median, Percentile
중위값과 몇%의 위치를 알아내는 함수 public static double getMedian(Double[] value_list) { int size = value_list.length; int med = size / 2; if(size == 0) return 0; if(size == 1) return value_list[0]; if(size % 2 == 1) return value_list[med]; return (value_list[med-1] + value_list[med])/2; } public static double getPercentile(Double[] value_list, Double percent) { Arrays.sort(value_list); int N = value_list.length; double n = percent / 100d * ((double)N - 1) + 1; int k = (int)n; if(k == 0) return value_list[0]; if(k >= N) return value_list[N-1]; double diff = n - (double)k; return value_list.......
2015-01-11 13:46:14 |
산소소년
[HADOOP] map/reduce legacy template (org.apache.hadoop.mapred)
이번엔 옛날 형식 template 입니다. Mapper public class first_mapper extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> { private String SEPARATOR = "\t"; private String LogDate = ""; public void configure(JobConf job) { super.configure(job); String full_path = job.get("map.input.file"); int StartPosi = full_path.indexOf("summarized/")+"summarized/".length(); LogDate = full_path.substring(StartPosi, StartPosi+6); } public void map(LongWritable k, Text v, OutputCollector<Text, Text> o, Reporter r) throws IOException { o.collect(new Text("ERR"), new Text(v.toString.......
2015-01-05 19:34:14 |
산소소년
[HADOOP] map/reduce legacy template (org.apache.hadoop.mapred)
이번엔 옛날 형식 template 입니다. Mapper public class first_mapper extends MapReduceBase implements Mapper { private String SEPARATOR = "\t"; private String LogDate = ""; public void configure(JobConf job) { super.configure(job); String full_path = job.get("map.input.file"); int StartPosi = full_path.indexOf("summarized/")+"summarized/".length(); LogDate = full_path.substring(StartPosi, StartPosi+6); } public void map(LongWritable k, Text v, OutputCollector o, Reporter r) throws IOException { o.collect(new Text("ERR"), new Text(v.toString.......
2015-01-05 19:34:14 |
산소소년
[HADOOP] map/reduce legacy template (org.apache.hadoop.mapred)
이번엔 옛날 형식 template 입니다. Mapper public class first_mapper extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> { private String SEPARATOR = "\t"; private String LogDate = ""; public void configure(JobConf job) { super.configure(job); String full_path = job.get("map.input.file"); int StartPosi = full_path.indexOf("summarized/")+"summarized/".length(); LogDate = full_path.substring(StartPosi, StartPosi+6); } public void map(LongWritable k, Text v, OutputCollector<Text, Text> o, Reporter r) throws IOException { o.collect(new Text("ERR"), new Text(v.toString.......
2015-01-05 10:34:14 |
산소소년
[HADOOP] map/reduce legacy template (org.apache.hadoop.mapred)
이번엔 옛날 형식 template 입니다. Mapper public class first_mapper extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> { private String SEPARATOR = "\t"; private String LogDate = ""; public void configure(JobConf job) { super.configure(job); String full_path = job.get("map.input.file"); int StartPosi = full_path.indexOf("summarized/")+"summarized/".length(); LogDate = full_path.substring(StartPosi, StartPosi+6); } public void map(LongWritable k, Text v, OutputCollector<Text, Text> o, Reporter r) throws IOException { o.collect(new Text("ERR"), new Text(v.toString.......
2015-01-05 10:34:14 |
산소소년
[HADOOP] map/reduce template (org.apache.hadoop.mapreduce)
legacy 방식(mapred) + streamming 조합으로만 M/R개발을 하다보니 종종 코드가 섞이는 상황이 발생하여 template을 메모해 놨습니다. (0.20.3 부터인가 지원되는 방식입니다.... 0.20.2였던가????) Mapper package com.airguy.mapreduce.template; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class TemplateMapper extends Mapper<LongWritable, Text, Text, Text> { private final static IntWritable outputValue = new IntWritable(1); public void map(LongWritable key, Text value, Context conte.......
2015-01-05 10:27:12 |
산소소년
[HADOOP] map/reduce template (org.apache.hadoop.mapreduce)
legacy 방식(mapred) + streamming 조합으로만 M/R개발을 하다보니 종종 코드가 섞이는 상황이 발생하여 template을 메모해 놨습니다. (0.20.3 부터인가 지원되는 방식입니다.... 0.20.2였던가????) Mapper package com.airguy.mapreduce.template; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class TemplateMapper extends Mapper { private final static IntWritable outputValue = new IntWritable(1); public void map(LongWritable key, Text value, Context conte.......
2015-01-05 10:27:12 |
산소소년
[HADOOP] map/reduce template (org.apache.hadoop.mapreduce)
legacy 방식(mapred) + streamming 조합으로만 M/R개발을 하다보니 종종 코드가 섞이는 상황이 발생하여 template을 메모해 놨습니다. (0.20.3 부터인가 지원되는 방식입니다.... 0.20.2였던가????) Mapper package com.airguy.mapreduce.template; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class TemplateMapper extends Mapper<LongWritable, Text, Text, Text> { private final static IntWritable outputValue = new IntWritable(1); public void map(LongWritable key, Text value, Context conte.......
2015-01-05 01:27:12 |
산소소년
[HADOOP] map/reduce template (org.apache.hadoop.mapreduce)
legacy 방식(mapred) + streamming 조합으로만 M/R개발을 하다보니 종종 코드가 섞이는 상황이 발생하여 template을 메모해 놨습니다. (0.20.3 부터인가 지원되는 방식입니다.... 0.20.2였던가????) Mapper package com.airguy.mapreduce.template; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class TemplateMapper extends Mapper<LongWritable, Text, Text, Text> { private final static IntWritable outputValue = new IntWritable(1); public void map(LongWritable key, Text value, Context conte.......
2015-01-05 01:27:12 |
산소소년
참고자료 들
시각화 툴 GEPHI : https://gephi.github.io/ TreeMap : http://www.cs.umd.edu/hcil/treemap/ ImagePlot : http://lab.softwarestudies.com/p/imageplot.html IndieMapper : http://indiemapper.com/ ArcGis : http://www.arcgis.com/features/ Graphviz : http://www.graphviz.org/Home.php 챠트 D3Chart : http://d3js.org/ (Tutorial : http://alignedleft.com/tutorials/d3/) NVD3 : http://nvd3.org/ jqPlot : http://www.jqplot.com/ amCharts : http://www.amcharts.com/ Ext JS 4 Charts : http://dev.sencha.com/deploy/ChartsDemo/ YUI 3 Charts : http://yuilibrary.com/yui/docs/charts/ FusionCharts : http://www.fusioncharts.co.......
2014-10-13 10:39:43 |
산소소년
참고자료 들
시각화 툴 GEPHI : https://gephi.github.io/ TreeMap : http://www.cs.umd.edu/hcil/treemap/ ImagePlot : http://lab.softwarestudies.com/p/imageplot.html IndieMapper : http://indiemapper.com/ ArcGis : http://www.arcgis.com/features/ Graphviz : http://www.graphviz.org/Home.php 챠트 D3Chart : http://d3js.org/ (Tutorial : http://alignedleft.com/tutorials/d3/) NVD3 : http://nvd3.org/ jqPlot : http://www.jqplot.com/ amCharts : http://www.amcharts.com/ Ext JS 4 Charts : http://dev.sencha.com/deploy/ChartsDemo/ YUI 3 Charts : http://yuilibrary.com/yui/docs/charts/ FusionCharts : http://www.fusioncharts.co.......
2014-10-13 10:39:43 |
산소소년
참고자료 들
시각화 툴 GEPHI : https://gephi.github.io/ TreeMap : http://www.cs.umd.edu/hcil/treemap/ ImagePlot : http://lab.softwarestudies.com/p/imageplot.html IndieMapper : http://indiemapper.com/ ArcGis : http://www.arcgis.com/features/ Graphviz : http://www.graphviz.org/Home.php 챠트 D3Chart : http://d3js.org/ (Tutorial : http://alignedleft.com/tutorials/d3/) NVD3 : http://nvd3.org/ jqPlot : http://www.jqplot.com/ amCharts : http://www.amcharts.com/ Ext JS 4 Charts : http://dev.sencha.com/deploy/ChartsDemo/ YUI 3 Charts : http://yuilibrary.com/yui/docs/charts/ FusionCharts : http://www.fusioncharts.co.......
2014-10-13 01:39:43 |
산소소년
참고자료 들
시각화 툴 GEPHI : https://gephi.github.io/ TreeMap : http://www.cs.umd.edu/hcil/treemap/ ImagePlot : http://lab.softwarestudies.com/p/imageplot.html IndieMapper : http://indiemapper.com/ ArcGis : http://www.arcgis.com/features/ Graphviz : http://www.graphviz.org/Home.php 챠트 D3Chart : http://d3js.org/ (Tutorial : http://alignedleft.com/tutorials/d3/) NVD3 : http://nvd3.org/ jqPlot : http://www.jqplot.com/ amCharts : http://www.amcharts.com/ Ext JS 4 Charts : http://dev.sencha.com/deploy/ChartsDemo/ YUI 3 Charts : http://yuilibrary.com/yui/docs/charts/ FusionCharts : http://www.fusioncharts.co.......
2014-10-13 01:39:43 |
산소소년