1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/code_binary_search.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +// Generated by CoffeeScript 1.6.1 1.5 +(function() { 1.6 + 1.7 + window.binary_search = function(items, value) { 1.8 + var pivot, start, stop; 1.9 + start = 0; 1.10 + stop = items.length - 1; 1.11 + pivot = Math.floor((start + stop) / 2); 1.12 + while (items[pivot] !== value && start < stop) { 1.13 + if (value < items[pivot]) { 1.14 + stop = pivot - 1; 1.15 + } 1.16 + if (value > items[pivot]) { 1.17 + start = pivot + 1; 1.18 + } 1.19 + pivot = Math.floor((stop + start) / 2); 1.20 + } 1.21 + if (items[pivot] === value) { 1.22 + return pivot; 1.23 + } else { 1.24 + return -1; 1.25 + } 1.26 + }; 1.27 + 1.28 +}).call(this); 1.29 + 1.30 +/* 1.31 +//# sourceMappingURL=code_binary_search.map 1.32 +*/