Click here to Skip to main content
15,892,005 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionProblem with variation of gas station problem. Pin
Karol Nowak16-Apr-18 2:42
Karol Nowak16-Apr-18 2:42 
AnswerRe: Problem with variation of gas station problem. Pin
Karol Nowak16-Apr-18 22:44
Karol Nowak16-Apr-18 22:44 
AnswerRe: Problem with variation of gas station problem. Pin
Daniel Pfeffer17-Apr-18 22:38
professionalDaniel Pfeffer17-Apr-18 22:38 
QuestionProving an algorithm wrong Pin
Member 1377958614-Apr-18 6:39
Member 1377958614-Apr-18 6:39 
AnswerRe: Proving an algorithm wrong Pin
Richard Andrew x6415-Apr-18 6:04
professionalRichard Andrew x6415-Apr-18 6:04 
GeneralRe: Proving an algorithm wrong Pin
Gerry Schmitz15-Apr-18 8:05
mveGerry Schmitz15-Apr-18 8:05 
GeneralRe: Proving an algorithm wrong Pin
Richard Andrew x6415-Apr-18 8:26
professionalRichard Andrew x6415-Apr-18 8:26 
GeneralRe: Proving an algorithm wrong Pin
Richard MacCutchan15-Apr-18 21:30
mveRichard MacCutchan15-Apr-18 21:30 
But, if you take it that it is a 1 based array it will work, as demonstrated by the following bit of Python:
Python
def maxi(A): # where A is a simple array that ignores the zeroth element
    m = A[1]
    i = 1
    n = len(A) - 1
    while i < n:
        if A[i+1] > A[i]: # but as Jochen points out, is wrong
            m = A[i+1]
        i += 1
    return m


modified 16-Apr-18 5:15am.

AnswerRe: Proving an algorithm wrong Pin
Jochen Arndt15-Apr-18 21:45
professionalJochen Arndt15-Apr-18 21:45 
GeneralRe: Proving an algorithm wrong Pin
Richard MacCutchan15-Apr-18 22:27
mveRichard MacCutchan15-Apr-18 22:27 
QuestionCan someone please help me optimize(decrease time complexity) this algorithm.. Pin
Member 137677177-Apr-18 10:37
Member 137677177-Apr-18 10:37 
AnswerRe: Can someone please help me optimize(decrease time complexity) this algorithm.. Pin
Patrice T7-Apr-18 20:15
mvePatrice T7-Apr-18 20:15 
QuestionRe: Can someone please help me optimize(decrease time complexity) this algorithm.. Pin
claymorehack18-May-18 3:38
claymorehack18-May-18 3:38 
AnswerRe: Can someone please help me optimize(decrease time complexity) this algorithm.. Pin
Richard MacCutchan18-May-18 5:59
mveRichard MacCutchan18-May-18 5:59 
QuestionAlgorithm for golf putting. Slope 1-4 degrees Pin
Member 1375000827-Mar-18 11:06
Member 1375000827-Mar-18 11:06 
AnswerRe: Algorithm for golf putting. Slope 1-4 degrees Pin
Gerry Schmitz2-Apr-18 6:01
mveGerry Schmitz2-Apr-18 6:01 
Questionrecursive algorithm Pin
Member 1374335523-Mar-18 7:00
Member 1374335523-Mar-18 7:00 
AnswerRe: recursive algorithm Pin
Gerry Schmitz23-Mar-18 12:00
mveGerry Schmitz23-Mar-18 12:00 
AnswerRe: recursive algorithm Pin
Peter_in_278023-Mar-18 14:53
professionalPeter_in_278023-Mar-18 14:53 
QuestionSquare root of positive integer using binary search. Pin
lnikon25-Feb-18 9:40
lnikon25-Feb-18 9:40 
GeneralRe: Square root of positive integer using binary search. Pin
harold aptroot25-Feb-18 10:29
harold aptroot25-Feb-18 10:29 
GeneralRe: Square root of positive integer using binary search. Pin
lnikon25-Feb-18 10:54
lnikon25-Feb-18 10:54 
AnswerRe: Square root of positive integer using binary search. Pin
Richard Deeming26-Feb-18 1:21
mveRichard Deeming26-Feb-18 1:21 
AnswerRe: Square root of positive integer using binary search. Pin
Patrice T7-Apr-18 21:01
mvePatrice T7-Apr-18 21:01 
Question3D Points to 2D Points Pin
Member 1368222216-Feb-18 15:34
Member 1368222216-Feb-18 15:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.