1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import java.util.ArrayList; import java.util.Arrays; import java.util.Random; public class sortvsparllelsort { public static void main(String[] args) { Random random=new Random(); System.out.println("Comparison between Sort and Parallel Sort"); ArrayList<Integer> arraylist=new ArrayList<>(); for (long i=1;i<10000000L;i++) {arraylist.add(random.nextInt(900)); } System.out.println("ArrayList has been initialised"); Integer a[]=new Integer[arraylist.size()]; Integer b[]=new Integer[arraylist.size()]; System.out.println("Both normal arrays are initialised"); a= arraylist.toArray(a); b=Arrays.copyOf(a,a.length); System.out.println("comparison starting "); double start,end,sorttime,parallelsorttime; System.out.print("Time taken by Sort method="); start=System.nanoTime(); Arrays.sort(a); end=System.nanoTime(); sorttime=(end-start)/(Math.pow(10,9)); System.out.println( sorttime +" Seconds"); System.out.print("Time taken by parallel sort ="); start=System.nanoTime(); Arrays.parallelSort(b); end=System.nanoTime(); parallelsorttime=(end-start)/(Math.pow(10,9) ); System.out.println(parallelsorttime +" Seconds"); String verdict=""; verdict=sorttime>parallelsorttime?"ParallelSort ":"Sort "; verdict+=" IS BETTER than "; verdict+=sorttime>parallelsorttime?"Sort ":"ParallelSort"; System.out.println(verdict.trim()); } } |
1. go to blogger dashboard, select template and edit html. 2. search for </head> to add script. - you may download and upload to your site, or just use this link (no download required) script <script src='http://docs.google.com/uc?id=0B7xJbTAja8i0a0ZJbXJ2TkkwSW8&export=download' type='text/javascript'/> 2. search for ]]></b:skin> to add style/css. img.label_thumb{ float:left; padding:5px; border:1px solid #8f8f8f; background:#D2D0D0; margin-right:10px; height:55px; width:55px; } img.label_thumb:hover{ background:#f7f6f6; } .label_with_thumbs { float: left; width: 100%; min-height: 70px; margin: 0px 10px 2px 0px; adding: 0; } ul.label_with_thumbs li { padding:8px 0; min-height:65px; margin-bottom:10px; } .label_with_thumbs a {} .label_with_thumbs strong {} 2. save template. 3. add a widget. 3. edit widget. at this example i use random post with label "blogger", you must replace it with your label. <div s...
Comments
Post a Comment
share your thoughts ....