{"ScriptPreparationCode":"var array = [1, 2, 3, 4, 5, 7, 8];\r\nvar value = 6;\r\n","TestCases":[{"Name":"binary search","Code":"function sortedIndex(array, value) {\r\n var low = 0,\r\n high = array.length;\r\n\r\n while (low \u003C high) {\r\n var mid = (low \u002B high) \u003E\u003E\u003E 1;\r\n if (array[mid] \u003C value) low = mid \u002B 1;\r\n else high = mid;\r\n }\r\n return low;\r\n}","IsDeferred":false},{"Name":"linear search","Code":"function sortedIndex(array, value) {\r\n for(var i=0; i\u003Carray.length; \u002B\u002Bi) {\r\n if(value \u003C array[i]) return i;\r\n }\r\n return array.length;\r\n}","IsDeferred":false}]}