From 8b68ee293f2d366c2c62605cbcb7308da72df7ae Mon Sep 17 00:00:00 2001 From: RudraNilBasu Date: Wed, 29 Jun 2016 21:11:39 +0530 Subject: [PATCH 1/2] Longest Palindromic Subsequence --- algorithm/category.json | 5 +- .../basic/code.js | 60 +++++++++++++++++++ .../basic/data.js | 23 +++++++ .../longest_palindromic_subsequence/desc.json | 13 ++++ gulpfile.babel.js | 1 + 5 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 algorithm/dp/longest_palindromic_subsequence/basic/code.js create mode 100644 algorithm/dp/longest_palindromic_subsequence/basic/data.js create mode 100644 algorithm/dp/longest_palindromic_subsequence/desc.json diff --git a/algorithm/category.json b/algorithm/category.json index f0e3dbf9..991133b4 100644 --- a/algorithm/category.json +++ b/algorithm/category.json @@ -20,6 +20,7 @@ "knapsack_problem": "Knapsack Problem", "longest_common_subsequence": "Longest Common Subsequence", "longest_increasing_subsequence": "Longest Increasing Subsequence", + "longest_palindromic_subsequence": "Longest Palindromic Subsequence", "max_subarray": "Maximum Subarray", "max_sum_path": "Maximum Sum Path", "pascal_triangle": "Pascal's Triangle", @@ -57,8 +58,8 @@ }, "number_theory": { "list": { - "euclidean_algorithm": "Euclidean Algorithm", - "sieve_of_eratosthenes": "Sieve of Eratosthenes" + "euclidean_algorithm": "Euclidean Algorithm", + "sieve_of_eratosthenes": "Sieve of Eratosthenes" }, "name": "Number Theory" }, diff --git a/algorithm/dp/longest_palindromic_subsequence/basic/code.js b/algorithm/dp/longest_palindromic_subsequence/basic/code.js new file mode 100644 index 00000000..5a066e4f --- /dev/null +++ b/algorithm/dp/longest_palindromic_subsequence/basic/code.js @@ -0,0 +1,60 @@ +function max(a,b) { + if(a>b){ + return a; + } else { + return b; + } +} +logger._print("LPS for any string with length = 1 is 1"); +for(i=2;i<=N;i++) { + logger._print("--------------------------------------------------"); + logger._print("Considering a sub-string of length "+i); + logger._print("--------------------------------------------------"); + for(j=0;j2)", + "space": "O(n2)" + }, + "References": [ + "GeeksForGeeks" + ], + "files": { + "basic": "Longest Palindromic Subsequence" + } +} diff --git a/gulpfile.babel.js b/gulpfile.babel.js index da390bde..b9a2b4bd 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -1,3 +1,4 @@ +var Promise = require ('es6-promise').Promise; 'use strict'; import path from "path"; From 3a27803188a767d7890b58febe6030d723f67559 Mon Sep 17 00:00:00 2001 From: RudraNilBasu Date: Wed, 29 Jun 2016 21:48:44 +0530 Subject: [PATCH 2/2] Undo changes in gulpfile.babel.js --- gulpfile.babel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index b9a2b4bd..1e528a2f 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -1,4 +1,4 @@ -var Promise = require ('es6-promise').Promise; + 'use strict'; import path from "path"; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy