User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
algorithm:insertion_sort [2014/07/14 22:57]
will Animated slider.
algorithm:insertion_sort [2015/02/02 08:28] (current)
Line 1: Line 1:
-====== Insertion ​Sort ====== +======= λ Insertion ​sort ======
-[algorithm Insertion sort]+
  
-====== Algorithm ======+<​nowiki>​ 
 +======= Algorithm ​=======
 <syntax js> <syntax js>
 function insertSort(a) { function insertSort(a) {
Line 14: Line 14:
 </​syntax>​ </​syntax>​
  
-====== Support ======+======= Support ​=======
 <syntax js> <syntax js>
 function swap(a, i, j) { function swap(a, i, j) {
Line 27: Line 27:
 </​syntax>​ </​syntax>​
  
-====== Options ======+======= Tests ======= 
 +<syntax js> 
 +</​syntax>​ 
 + 
 +======= Options ​=======
 <syntax js> <syntax js>
 { {
 +    "​title":​ "​Insertion sort",
     "​height":​ "​270px"​     "​height":​ "​270px"​
 } }
 </​syntax>​ </​syntax>​
  
-====== Visualisation ======+======= Visualisation ​=======
 <syntax html> <syntax html>
 <​html>​ <​html>​
 <​head>​ <​head>​
-<link rel="​stylesheet"​ type="​text/​css"​ href="file:///​Users/​will/​Dropbox/​graph.css"/>​+<link rel="​stylesheet"​ type="​text/​css"​ href="algorithms-lib/​graph.css"/>​
 <script src="​http://​d3js.org/​d3.v2.js"></​script>​ <script src="​http://​d3js.org/​d3.v2.js"></​script>​
-<script src="file:///​Users/​will/​Dropbox/​graph.js"></​script>​+<script src="algorithms-lib/​graph.js"></​script>​
 <script type="​text/​javascript">​ <script type="​text/​javascript">​
 var graph = new Graph(20); var graph = new Graph(20);
Line 59: Line 64:
     }     }
     if (x) {     if (x) {
-        ​var ease = "​cubic-in-out";​ +        graph.drawGraph(duration,​ 0);
-        if (duration === 0) { +
-            var date = new Date(); +
-            var ease = date-lastUpdateDate > 50? "​cubic-in-out"​ : "​linear";​ +
-            var duration = Math.min(date-lastUpdateDate,​ 100); +
-            lastUpdateDate = date; +
-        } +
-         +
-        ​graph.drawGraph(duration,​ 0, ease);+
         ​         ​
         var sortedN = x.lookupInScope("​sortedN"​);​         var sortedN = x.lookupInScope("​sortedN"​);​
Line 100: Line 97:
 </​html>​ </​html>​
 </​syntax>​ </​syntax>​
 +</​nowiki>​
algorithm/insertion_sort.1405403859.txt.gz · Last modified: 2015/02/02 08:23 (external edit)