Journey Roadmap to Problem Solving
1. Understand Flowcharts
● Objective: Learn to visualize the steps of an algorithm or process.
● Action Steps:
○ Study Flowchart Symbols: Learn the basic symbols like ovals (start/end),
rectangles (process), diamonds (decision), and arrows (flow of control).
○ Example Study: Look at examples of flowcharts to understand how they
represent different types of logic and processes.
○ Tool Practice: Use tools like Lucidchart, draw.io, or even paper and pencil to
practice creating flowcharts.
2. Make Algorithms on Problems and Create Flowcharts
● Objective: Translate problems into step-by-step solutions.
● Action Steps:
○ Problem Identification: Choose a simple problem to start with.
○ Algorithm Development: Write down the steps needed to solve the problem
in plain language.
○ Flowchart Creation: Convert the algorithm into a flowchart to visualize the
process.
○ Iteration: Refine the flowchart for clarity and accuracy.
3. Code the Flowchart
● Objective: Implement the visualized solution in code.
● Action Steps:
○ Select a Programming Language: Start with a language you're comfortable
with (C/C++ for this roadmap).
○ Code Translation: Convert each step of your flowchart into code.
○ Structure and Syntax: Ensure you follow proper syntax and code structure.
○ Compile and Test: Compile your code and test it to ensure it matches the
flowchart.
4. Dry Run Your Code
● Objective: Verify the correctness of your code manually.
● Action Steps:
○ Trace Execution: Step through your code line by line.
○ Check Variables: Monitor the values of variables and program state at each
step.
○ Predict Outputs: Predict what the output should be at different stages.
○ Compare Results: Compare your predictions with actual outputs to find
discrepancies.
5. Practice with Provided Problems
● Objective: Solve a variety of problems to build and improve skills.
● Action Steps:
○ Problem Collection: Gather problems from textbooks, online platforms, or
ask for specific problems.
○ Apply Steps: Use the previously outlined steps to solve each problem.
○ Review and Reflect: After solving, review your approach and reflect on any
mistakes or areas for improvement.
6. Code Consistently
● Objective: Build and maintain coding skills through regular practice.
● Action Steps:
○ Daily Coding: Set aside time each day for coding practice.
○ Challenge Yourself: Solve increasingly difficult problems over time.
○ Participate in Competitions: Join coding competitions to test your skills
under pressure.
7. Read a Book on C or C++
● Objective: Deepen your understanding of programming concepts and
language-specific details.
● Action Steps:
○ Book Selection: Choose a comprehensive book like "The C Programming
Language" by Kernighan and Ritchie or "C++ Primer" by Lippman, Lajoie, and
Moo.
○ Chapter-wise Study: Study each chapter thoroughly, and try out the
examples and exercises.
○ Apply Knowledge: Apply new concepts learned from the book to your
problem-solving practice.
Example Flowchart and Code
Example Problem: Calculate the Factorial of a Number
Algorithm:
1. Start
2. Read number n
3. Initialize factorial to 1
4. For i from 1 to n
○ Multiply factorial by i
5. Print factorial
6. End
Flowchart:
1. Start → Oval
2. Read n → Parallelogram
3. Initialize factorial = 1 → Rectangle
4. For i = 1 to n → Rectangle
○ Multiply factorial by i → Rectangle
5. Print factorial → Parallelogram
6. End → Oval
CODE 👏
#include <stdio.h>
int main() {
int n, i;
unsigned long long factorial = 1; // Use long long for larger factorials
// Input number from user
printf("Enter a number: ");
scanf("%d", &n);
// Check if the number is negative
if (n < 0)
printf("Factorial of a negative number doesn't exist.\n");
else {
for(i = 1; i <= n; ++i) {
factorial *= i; // factorial = factorial * i;
}
printf("Factorial of %d = %llu\n", n, factorial);
}
return 0;
}
Dry Run:
1. Input: n = 5
2. Initialize factorial = 1
3. Loop:
○ i = 1, factorial = 1 * 1 = 1
○ i = 2, factorial = 1 * 2 = 2
○ i = 3, factorial = 2 * 3 = 6
○ i = 4, factorial = 6 * 4 = 24
○ i = 5, factorial = 24 * 5 = 120
4. Output: Factorial of 5 = 120
Ask for Problems:
● Feel free to ask for specific problems you want to solve, and I can help guide you
through them.
Consistency:
● Aim to solve at least one problem a day and gradually increase the complexity.
Reading Books:
● Use the recommended books to reinforce your understanding and find more
exercises to practice.
By following this roadmap, you'll develop strong problem-solving skills and become proficient
in programming.