Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
Loading...
Searching...
No Matches
longest_palindromic_subsequence.cpp File Reference

Program to find the Longest Palindormic Subsequence of a string. More...

#include <cassert>
#include <string>
#include <vector>
Include dependency graph for longest_palindromic_subsequence.cpp:

Namespaces

namespace  dynamic_programming
 Dynamic Programming algorithms.
 

Functions

std::string dynamic_programming::lps (const std::string &a)
 Function that returns the longest palindromic subsequence of a string.
 
static void test ()
 Self-test implementations.
 
int main ()
 Main Function.
 

Detailed Description

Program to find the Longest Palindormic Subsequence of a string.

Palindrome string sequence of characters which reads the same backward as forward Subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.

Author
Anjali Jha

Function Documentation

◆ main()

int main ( void )

Main Function.

Returns
0 on exit
97 {
98 test(); // execute the tests
99 return 0;
100}
static void test()
Self-test implementations.
Definition longest_palindromic_subsequence.cpp:86
Here is the call graph for this function:

◆ test()

static void test ( )
static

Self-test implementations.

Returns
void
86 {
87 assert(dynamic_programming::lps("radar") == "radar");
88 assert(dynamic_programming::lps("abbcbaa") == "abcba");
89 assert(dynamic_programming::lps("bbbab") == "bbbb");
90 assert(dynamic_programming::lps("") == "");
91}
std::string lps(const std::string &a)
Function that returns the longest palindromic subsequence of a string.
Definition longest_palindromic_subsequence.cpp:31
Here is the call graph for this function: