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
function findLargestSubarray(arr) { | |
var result = {max:-1,start:-1,stop:-1}; | |
var row_data = []; | |
for (var i = 0; i < arr.length; i++) | |
for (var k = i; k < arr.length; k++) { | |
if (k == i) { | |
row_data.push(new Array(arr.length)); | |
row_data[i][k] = arr[i]; | |
} | |
else |
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
function findLargestSubarray(arr) { | |
var max = 0; | |
var start, end; | |
for (var i = 0; i < arr.length; i++) | |
for (var j = i; j < arr.length; j++) | |
{ | |
var current = 0; | |
for (var k = i; k <= j; k++) | |
current += arr[k]; | |
if (current > max) |