1. Auto Question -Answer Generation on
Dynamic Programming
MAHATMA GANDHI MISSION’S COLLEGE OF
ENGINEERING,
NANDED
GUIDED BY:
DR. KAPRE MAM
PRESENTED BY :
TEJAS KOTALWAR (218)
SOHAM KASHETTIWAR (225)
GANESH KONDAMWAR (224)
AKSHRAPLUS (INTERNSHIP)
2. Introduction to Dynamic Programming
What is Dynamic Programming (DP)?
Dynamic Programming is a technique to solve complex problems by breaking them down into
simpler overlapping subproblems and storing their results to avoid redundant computations.
Applications
It's widely applied in various fields.
• Sequence analysis
• Computational biology
• Text processing
Key Features of DP:
Overlapping Subproblems:
Problems can be broken down into smaller, repeated subproblems.
Optimal Substructure:
An optimal solution can be constructed from optimal solutions of
subproblems.
Memoization or Tabulation:
Used to store subproblem results (Top-down or Bottom-up approach).
3. Subtopics of Dynamic Programming
Overlapping subproblems and optimal substructure
Longest Common Subsequence (LCS)
Fibonacci sequence and memoization
Matrix Chain Multiplication
0/1 Knapsack Problem
Floyd-Warshall Algorithm
4. What is LCS (Longest Common Subsequence)?
LCS is the longest sequence that appears in the same relative order (but not necessarily contiguous)
in both strings.
Example:
•String X: ABCBDAB
•String Y: BDCAB
•LCS: BCAB or BDAB (Length = 4)
LCS Characteristics:
•Not a substring (can skip characters).
•Has optimal substructure → perfect for dynamic programming.
•Frequently used in:
• DNA sequence alignment
• File diff tools
• Plagiarism detection
• Code similarity checkers
Time Complexity:
•O(m * n) using DP table (where m and n are lengths of the two strings)
5. Project Objective
Why Auto Question Generation?
Why Auto Question Generation?
•To reduce manual effort in creating diverse and meaningful coding questions.
•To support automated learning tools, mock tests, and online coding platforms.
•Useful for students, educators, and interview preparation platforms.
Our Goal:
Build an intelligent system that can automatically generate unique, high-quality questions related
to LCS across different categories (conceptual, implementation, algorithmic) and difficulty levels
(easy, medium, hard).
6. Dataset Creation
Custom Dataset Built for LCS Question Generation
Custom Dataset Built for LCS Question Generation
•Designed a template-based dataset using JSON.
•Each entry includes:
•Template: Text format with placeholders {X}, {Y}
•Category: Conceptual | Implementation | Algorithmic
•Difficulty: Easy | Medium | Hard
•Variables: List of possible values for placeholders
7. T5 Model Overview
1 Transformer-Based
A powerful model designed for text-to-text tasks.
2 Fine-Tuned
Specifically for generating questions on coding concepts
related to LCS.
3 Dataset
Curated from platforms like HackerRank and LeetCode.
8. System Workflow
Input
Provide keywords and a difficulty level for the question.
Processing
The system preprocesses data and fine-tunes the T5 model.
Output
The system generates and refines questions with test cases.
10. Sample Questions Generated
✅ Q1:
"Write a recursive function to compute the LCS of AB and AX."
✅ Q2:
"Find the length of the longest common subsequence between
the strings HELLO and WORLD."
✅ Q3:
"What is the LCS of MNOP and PROGRAM?"
✅ Q4:
"Determine the longest common subsequence of DYNAMIC and
LANGUAGE."
11. Answer Generation
Answer Generation using BERT Model
Objective:
Automatically understand the type of LCS question and generate the
correct answer or response using classification + logic.
How It Works:
1. 🧾 Input: LCS-related question
e.g., “Find the LCS of apple and maple.”
2. 🧠 Question Classification using BERT
•Fine-tuned a BERT-based classifier to detect the type of question:
•Basic LCS
•Only Length
•Multiple Pairs
•Incomplete/Vague Question
3. 🔁 Function Mapping
•Each category maps to a function from lcs_solver.py:
•solve_basic_lcs() – Extracts and computes full LCS
•solve_lcs_length_only() – Returns only LCS length
•solve_multiple_pairs() – Handles multi-comparison
•solve_incomplete_question() – Gracefully handles vague inputs
12. Answer Generation
Answer Generation using BERT Model
4. ✅ Answer Output
Example:
Q: "What is the LCS of apple and maple?"
A: 💡 The Longest Common Subsequence is
‘aple’, with length 4.
13. Conclusion and Future
Scope
AI Automation
AI automates tasks for scalable educational tools.
Future Extension
Extend to other dynamic programming problems.
Multilingual Support
Incorporate multilingual support and interactive components.