Menu
Course Lessons
What is A* Search Algorithm?
Prim's Algorithm: Explanation, Code, and Applications
How To Start Competitive Programming - A Complete Guide
Solving N Queens Problem using Backtracking
Bellman Ford Algorithm in detail with code
Working of Kruskal's Algorithm
Understand the working of KMP Algorithm
Understanding Huffman Coding in detail
Floyd-Warshall Algorithm and its Implementation
Depth First Search (DFS) with Explanation and Code
Understand Travelling Salesman Problem
Difference Between BFS and DFS (with code and diagrams)
How to Solve Subset Sum Problem?
A Definitive Guide to Knapsack Problem
Quick Guide to Divide and Conquer Algorithm
How to Perform Level Order Traversal?
Learning About Bipartite Graphs
How to Evaluate Postfix Expression
A Quick Guide to Breadth-First Search
Quick Note - Greedy Programming v/s Dynamic Programming
A Quick Guide to Manacher's Algorithm
Introduction to Round-Robin Scheduling
A Quick Guide to Backtracking Algorithm
Longest Increasing Subsequence Problem
Coin Change Problem: DP and Recursion Approach
Graph Coloring Problem: Explained
Detect Cycle in Direct Graph
Branch And Bound Algorithm: Explained
Directed Acyclic Graph: Representation
Longest Common Substring Problem
Prims and Kruskal algorithm for Maximum Spanning Tree
Longest Common Subsequence problem: solved
Disjoint set (Union find Algorithm)
State Space Reduction in Algorithms
Apriori Algorithm
Advanced Algorithms and Problem Solving Techniques
Problem Statement
Assume that S1 and S2 are two strings and that:
- S1 = akfdcmejf
- S2=”sfkpdcnmej”
The "kdcmej" character is the Longest Common Subsequence (LCS) between these two strings. It's not a given that a subsequence will be contiguous just because it's a subsequence.
Subsequence
Take the sequence S = [s1, s2, s3, s4,..., sn] into consideration.
If and only if it can be derived from the S deletion of some components, a sequence Z = z1, z2, z3, z4,...,zm> over S is a subsequence of S.
Common Subsequence
Let's say that X and Y are sequences spanning a limited number of elements. If Z is a subsequence of both X and Y, then Z is a common subsequence of X andY.
Theory
The longest common subsequence challenge aims to identify a common subsequence of all the given sequences that has the maximum length.
A well-known topic in computer science, the most extended common subsequence problem serves as the foundation for data comparison tools like the diff-utility and has uses in bioinformatics.
Algorithm
Algorithm: LCS-Length-Table-Formulation (X, Y) |
Algorithm: Print-LCS (B, X, i, j) |
Top-Down Approach: Using C++
// Board Infinity |
Bottom-up Approach: Using C++
// Board Infinity |