max-sub-arr-sum

0.0.3 • Public • Published

max-sub-arr-sum, khadan's algo

What is this?

It's basis on khadan's algorithm which provides us calculate maximum sub-array sum of an array in linear time O(n).

Installation

npm i max-sub-arr-sum --save

How to use?

....

const {maxSubArrSum} = require('max-sub-arr-sum');

let result = maxSubArrSum([-2, -3, 4, -1, -2, 1, 5, -3]);

....

Note

If the given array is empty then it will return "undefined".

And every time array will be a numeric array. String or non-numeric elements are not allowed.

Package Sidebar

Install

npm i max-sub-arr-sum

Weekly Downloads

0

Version

0.0.3

License

ISC

Unpacked Size

1.45 kB

Total Files

3

Last publish

Collaborators

  • golammostafa