summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMario Viens <marviens@gmail.com>2020-02-29 14:01:02 -0800
committerGitHub <noreply@github.com>2020-02-29 14:01:02 -0800
commit140e87e6836012597c2b547f096b6afac86174ed (patch)
tree564d0d722f17258c5082a4221574bb6d7b640dcd
parente57e59f5f338f845ac9439378d6a9b974d465366 (diff)
Fix whitespace to be consistent
-rw-r--r--dynamic-programming.html.markdown2
1 files changed, 1 insertions, 1 deletions
diff --git a/dynamic-programming.html.markdown b/dynamic-programming.html.markdown
index 5d260206..3e3c0413 100644
--- a/dynamic-programming.html.markdown
+++ b/dynamic-programming.html.markdown
@@ -23,7 +23,7 @@ Always remember!
## Example of Dynamic Programming
-The Longest Increasing Subsequence problem is to find the longest increasing subsequence of a given sequence. Given a sequence `S= {a1 , a2 , a3, a4, ............., an-1, an }` we have to find a longest subset such that for all `j` and `i`, `j<i` in the subset `aj<ai`.
+The Longest Increasing Subsequence problem is to find the longest increasing subsequence of a given sequence. Given a sequence `S={ a1, a2, a3, a4, ............., an-1, an }` we have to find a longest subset such that for all `j` and `i`, `j<i` in the subset `aj<ai`.
First of all we have to find the value of the longest subsequences(LSi) at every index i with last element of sequence being ai. Then largest LSi would be the longest subsequence in the given sequence. To begin LSi is assigned to be one since ai is element of the sequence(Last element). Then for all `j` such that `j<i` and `aj<ai`, we find Largest LSj and add it to LSi. Then algorithm take *O(n2)* time.
Pseudo-code for finding the length of the longest increasing subsequence: