Maximum Contiguous Subsequence - Dynamic Programming

  Рет қаралды 26,322

CSBreakdown

CSBreakdown

Күн бұрын

Пікірлер: 25
@JayPatel12928
@JayPatel12928 5 жыл бұрын
I want you to know that, among all the explanations on youtube, your's is the best one.
@fitoor0997
@fitoor0997 9 жыл бұрын
beautifully explained!!! saved a lot of time of mine..
@neobonzi
@neobonzi 7 жыл бұрын
By far the best explanation of the cost function out of all the videos I've seen on youtube
@jackkalman8195
@jackkalman8195 7 жыл бұрын
too bad its wrong. [-1,-2] is the counter example.
@AjayByadgi
@AjayByadgi 8 ай бұрын
@@jackkalman8195 lol noob he said if its all negative just take the largest value (-1) in the list
@sbonelo
@sbonelo 8 жыл бұрын
Extremely helpful, thank you so much
@SmartProgramming
@SmartProgramming 6 жыл бұрын
awesome explanation, keep it up, thank you 👍👍🙂🙂
@KrishanuKonar
@KrishanuKonar 8 жыл бұрын
What happens when when two sub-sequences generate same sum?? Should we take the longer one or the shorter one? Marking the number red would only give the most recent solution(subsequence).
@sabio234
@sabio234 8 жыл бұрын
Do you have any which teaches how to come up with a formula to solve DP ?
@ffatheranderson
@ffatheranderson 5 жыл бұрын
Thank you. Very good explanation.
@eithanmartinez2852
@eithanmartinez2852 4 жыл бұрын
Do you have the pseudocode?
@PreethaDatta
@PreethaDatta 8 жыл бұрын
how would you define s? the code in c++ that is
@technomissilecraft4532
@technomissilecraft4532 8 жыл бұрын
please upload travelling salesman problem,Bellman Ford algorithm.
@thanga2317
@thanga2317 5 жыл бұрын
is this subsequence or subarray ? if its subsequence then answer should be 2 + 3 + 5 = 10. correct me if am wrong .
@RooonilWazlib
@RooonilWazlib 5 жыл бұрын
Contiguous means you can't skip anything in the sequence. You have a starting index and an ending index and take the sum of all the values within that subsequence.
@groupsvkg
@groupsvkg 7 жыл бұрын
For A = [-6, 2, -4] S(2) = -2 or 2 ?
@jackkalman8195
@jackkalman8195 7 жыл бұрын
his algorithm is wrong lol.. idk why so many ppl thumbed up
@oliverliu9205
@oliverliu9205 7 жыл бұрын
S(0) = -6, S(1) = either -6 + 2 or 2, we will take 2. S(2) = either 2 - 4, or -4. We will take 2-4 = -2. But now you take the maximum number from this array, so the final answer is 2.
@matheusrotta1589
@matheusrotta1589 6 жыл бұрын
His algorithm is correct, you take the maximum in the array afterwards.
@ffatheranderson
@ffatheranderson 5 жыл бұрын
@@jackkalman8195 it works perfect for me.
@kameshsriram
@kameshsriram 6 жыл бұрын
I think the problem you are solving is Maximum contiguous sub-array but not Maximum Contiguous Subsequence
@jasdn93bsad992
@jasdn93bsad992 5 жыл бұрын
A[i] could be a negative number, in taht case, S[i] = S[i-1];
@chuongxl
@chuongxl 6 жыл бұрын
great :) thank!
@jackkalman8195
@jackkalman8195 7 жыл бұрын
Bro what about this input [-1,-2]? your algorithm returned -2 and obviously the answer should be -1 lol
@oliverliu9205
@oliverliu9205 7 жыл бұрын
His algorithm is right and yourself are wrong. the solution array would be: [-1,-2] But now you take the maximum number from this array, which is -1. Remember, S[i] is the largest contiguous sum you can get ENDING AT (NOT UP TO) index i. Therefore you cannot simply take the last element in the solution array.
Rod Cutting - Dynamic Programming
15:22
CSBreakdown
Рет қаралды 161 М.
Longest Common Subsequence - Dynamic Programming
13:56
CSBreakdown
Рет қаралды 33 М.
🎈🎈🎈😲 #tiktok #shorts
0:28
Byungari 병아리언니
Рет қаралды 4,5 МЛН
Kadane's Algorithm to Maximum Sum Subarray Problem
11:17
CS Dojo
Рет қаралды 727 М.
Maximum sum sub-array
18:29
mycodeschool
Рет қаралды 391 М.
Longest Common Subsequence (Dynamic Programming)
10:13
CS Dojo
Рет қаралды 140 М.
Longest Palindromic Subsequence
9:18
Tushar Roy - Coding Made Simple
Рет қаралды 317 М.
5 Simple Steps for Solving Dynamic Programming Problems
21:27
Reducible
Рет қаралды 1,1 МЛН
Maximum Sum Increasing Subsequence Dynamic Programming
8:30
Tushar Roy - Coding Made Simple
Рет қаралды 82 М.
Longest Common Subsequence
7:55
Tushar Roy - Coding Made Simple
Рет қаралды 777 М.