Skip to content

Commit 4d164d5

Browse files
author
duaraghav8@gmail
committed
Revert "Fixed tracer._print() statements for max_subarray"
This reverts commit 514f903.
1 parent 514f903 commit 4d164d5

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
var maxSubarraySum = (function maxSubarray (array) {
2-
var maxSoFar = 0,print
2+
var maxSoFar = 0,
33
maxEndingHere = 0;
44

5-
logger._print ('Initializing maxSoFar = 0 & maxEndingHere = 0');
5+
tracer._print ('Initializing maxSoFar = 0 & maxEndingHere = 0');
66

77
for (var i = 0; i < array.length; i++) {
88
tracer._select (i);
9-
logger._print (maxEndingHere + ' + ' + array [i]);
9+
tracer._print (maxEndingHere + ' + ' + array [i]);
1010
maxEndingHere += array [i];
11-
logger._print ('=> ' + maxEndingHere);
11+
tracer._print ('=> ' + maxEndingHere);
1212

1313
if (maxEndingHere < 0) {
14-
logger._print ('maxEndingHere is negative, set to 0');
14+
tracer._print ('maxEndingHere is negative, set to 0');
1515
maxEndingHere = 0;
1616
}
1717

1818
if (maxSoFar < maxEndingHere) {
19-
logger._print ('maxSoFar < maxEndingHere, setting maxSoFar to maxEndingHere (' + maxEndingHere + ')');
19+
tracer._print ('maxSoFar < maxEndingHere, setting maxSoFar to maxEndingHere (' + maxEndingHere + ')');
2020
maxSoFar = maxEndingHere;
2121
}
2222

@@ -26,4 +26,4 @@ var maxSubarraySum = (function maxSubarray (array) {
2626
return maxSoFar;
2727
}) (D);
2828

29-
logger._print ('Maximum Subarray\'s Sum is: ' + maxSubarraySum);
29+
tracer._print ('Maximum Subarray\'s Sum is: ' + maxSubarraySum);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var tracer = new Array1DTracer ();
2-
var logger = new LogTracer ();
32
var D = [-2, -3, 4, -1, -2, 1, 5, -3];
43

54
tracer._setData (D);

0 commit comments

Comments
 (0)