Thread: Kadane's algorithm for all negative number

  1. #1
    Registered User
    Join Date
    May 2018
    Posts
    11

    Kadane's algorithm for all negative number

    Can you explain Kadane's algorithm to find sub array having maximum sum value for all negative array numbers?
    For example:
    Array - [ -10, -10, -10] should return -10. But normally Kadane's algorithm will return 0 for this array. So i want to know how to make it work for all negative array numbers.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,530
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how defined an negative number
    By igalka in forum C Programming
    Replies: 2
    Last Post: 09-03-2014, 04:52 PM
  2. Read until negative number
    By m_user in forum C Programming
    Replies: 10
    Last Post: 04-03-2009, 06:38 AM
  3. How can i convert negative number to positive number ?
    By winsonlee in forum C Programming
    Replies: 2
    Last Post: 05-05-2004, 08:02 AM
  4. random number between negative and positive number
    By anomaly in forum C++ Programming
    Replies: 6
    Last Post: 12-06-2003, 08:40 AM
  5. how to read in a negative number using cin
    By revelation437 in forum C++ Programming
    Replies: 4
    Last Post: 04-02-2003, 02:32 PM

Tags for this Thread