Created
December 27, 2014 14:09
-
-
Save vamshisuram/da56fcb0b644e978f763 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/vocoju
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> | |
| // sorting trial 1 | |
| var a = []; | |
| var item, i, j, k; | |
| for (i=0; i<20; i++) { | |
| item = Math.floor(Math.random() * 100 + 1); | |
| a.push(item); | |
| } | |
| console.log(a); | |
| var f_item; | |
| for (j=0; j<19; j++) { | |
| for (k=j+1; k < 20; k++) { | |
| if(a[j] < a[k]) { | |
| // | |
| } else if (a[j] >= a[k]) { | |
| f_item = a[k]; | |
| a[k] = a[j]; | |
| a[j] = f_item; | |
| } | |
| } | |
| } | |
| console.log(a); | |
| </script> | |
| <script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"><\/script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| </body> | |
| </html></script> | |
| <script id="jsbin-source-javascript" type="text/javascript">// sorting trial 1 | |
| var a = []; | |
| var item, i, j, k; | |
| for (i=0; i<20; i++) { | |
| item = Math.floor(Math.random() * 100 + 1); | |
| a.push(item); | |
| } | |
| console.log(a); | |
| var f_item; | |
| for (j=0; j<19; j++) { | |
| for (k=j+1; k < 20; k++) { | |
| if(a[j] < a[k]) { | |
| // | |
| } else if (a[j] >= a[k]) { | |
| f_item = a[k]; | |
| a[k] = a[j]; | |
| a[j] = f_item; | |
| } | |
| } | |
| } | |
| console.log(a);</script></body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // sorting trial 1 | |
| var a = []; | |
| var item, i, j, k; | |
| for (i=0; i<20; i++) { | |
| item = Math.floor(Math.random() * 100 + 1); | |
| a.push(item); | |
| } | |
| console.log(a); | |
| var f_item; | |
| for (j=0; j<19; j++) { | |
| for (k=j+1; k < 20; k++) { | |
| if(a[j] < a[k]) { | |
| // | |
| } else if (a[j] >= a[k]) { | |
| f_item = a[k]; | |
| a[k] = a[j]; | |
| a[j] = f_item; | |
| } | |
| } | |
| } | |
| console.log(a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment