NBC 103 • Unit 114 min readHigh Exam Frequency

Problem Solving Concepts, Algorithms & Flowcharts

Unit 1: Algorithms, Flowcharts & C Program ArchitectureProblem Solving Using C

👨‍🏫 Professor's Mental Model: The Master Chef's Recipe & City Traffic Navigation Map

Problem solving ek master recipe banane jaisa hai! Pehle sochte hain ki kya dish banani hai (Problem Definition), fir step-by-step samagri aur banane ka sequence likhte hain (Algorithm). Flowchart us recipe ka visual road-map hai, jisme diamond box decide karta hai ki 'kya namak kam hai?' Agar haan, toh aur daalo (Loop/Decision)! Coding toh bas us recipe ko kisi specific bhasha jaise C me translate karna hai.

Academic Lecture Notes & Solved Study Pages

Unit 1 • Core Concepts, Step-by-Step Proofs & Notebook Solutions

4 Notebook Pages
NOTEBOOK PAGE 1 OF 4

1. The 6 Systematic Phases of Program Development

Professional software engineering requires a structured discipline before writing code:

Problem Definition & Specification: Unambiguously identifying input data, required outputs, boundary constraints, and error scenarios.
Algorithm Design: Formulating a finite, logical sequence of step-by-step instructions to solve the problem independent of any computer language.
Flowcharting & Pseudocode: Visually mapping data paths and writing human-readable, language-agnostic logic skeletons.
Source Code Implementation: Translating algorithmic steps into syntactically valid C statements.
Compilation, Testing & Debugging: Detecting syntax errors at compile-time and run-time logical anomalies using edge test cases.
Documentation & Maintenance: Adding comprehensive comments and technical user manuals for future software lifecycle upgrades.
NOTEBOOK PAGE 2 OF 4

2. Formal Algorithm Definition & The 5 Mandatory Criteria

According to computer science pioneer Donald Knuth, an algorithm must satisfy 5 fundamental criteria:

Finiteness: The algorithm must terminate after a finite number of steps under all input conditions (no infinite deadlocks).
Definiteness: Each step must be precisely defined, unambiguous, and have only one clear interpretation.
Input: It accepts zero or more well-defined quantities from an external source.
Output: It must produce at least one meaningful result corresponding to the given problem statement.
Effectiveness: Every operation must be sufficiently basic that it can in principle be done exactly and in a finite length of time by a person using pencil and paper.
NOTEBOOK PAGE 3 OF 4

3. Standard ANSI Flowchart Symbols & Geometric Conventions

Flowcharts utilize internationally standardized geometric shapes connected by directional flowlines (arrows):

Terminal (Oval / Rounded Rectangle): Denotes START or STOP of the program logic.
Input/Output (Parallelogram): Represents reading input (e.g., scanf) or displaying output (e.g., printf).
Processing Box (Rectangle): Represents computational operations, arithmetic calculations, or variable initialization (e.g., sum = a + b).
Decision Box (Diamond): Contains a conditional boolean question with two or three outgoing branch paths (e.g., True/False, Yes/No, <, =, >).
Connector (Small Circle): Joins different intersecting flowlines on the same page (labeled with letters A, B, C).
Off-Page Connector (Pentagon): Connects flowcharts spanning across multiple consecutive printed pages.
Flowlines (Directed Arrows): Unambiguously indicates the sequential execution order.
NOTEBOOK PAGE 4 OF 4

4. Solved Mathematical Case Study: Roots of a Quadratic Equation

Standard University Examination Problem:

Given equation: a*x² + b*x + c = 0 (where a ≠ 0).

Discriminant: D = b² - 4ac.

Case 1: If D > 0, roots are real and distinct: root1 = (-b + √D) / (2a), root2 = (-b - √D) / (2a).
Case 2: If D == 0, roots are real and equal: root1 = root2 = -b / (2a).
Case 3: If D < 0, roots are complex/imaginary: realPart = -b / (2a), imagPart = √(-D) / (2a).
Formula / Calculation Syntax:
Step 1: Input coefficients a, b, c.
Step 2: If a == 0, print 'Linear Equation, not Quadratic' and STOP.
Step 3: Calculate Discriminant: D = (b * b) - (4 * a * c).
Step 4: If D > 0:
          root1 = (-b + sqrt(D)) / (2 * a)
          root2 = (-b - sqrt(D)) / (2 * a)
          Print 'Roots are Real & Distinct', root1, root2.
Step 5: Else If D == 0:
          root1 = -b / (2 * a)
          Print 'Roots are Real & Equal', root1.
Step 6: Else (D < 0):
          realPart = -b / (2 * a)
          imagPart = sqrt(-D) / (2 * a)
          Print 'Complex Roots': realPart ± i(imagPart).
Step 7: STOP.
Comparative Analysis: Algorithm vs Flowchart vs Pseudocode
ParameterAlgorithmFlowchartPseudocode
DefinitionStep-by-step plain English procedureVisual graphical representation with shapesFormal structured text mimicking code syntax
FormatNumbered sequential text linesStandardized geometric symbols & arrowsIndented algorithmic blocks (IF, WHILE, FOR)
Ease of DebuggingModerate for complex logicHighest - visual branch tracking is effortlessHigh - closely maps to source code logic
StandardizationInformal natural languageStrict ANSI/ISO standard symbolsSemi-formal, depends on developer convention
Execution by MachineCannot be executed directlyCannot be executed directlyCannot be executed directly without compilation

Interactive Tested Code Example

#include <stdio.h>
#include <math.h>

int main(void) {
    double a = 1.0, b = -5.0, c = 6.0;
    double discriminant, root1, root2, realPart, imagPart;

    printf("Quadratic Equation: (%.1f)x^2 + (%.1f)x + (%.1f) = 0\n", a, b, c);

    if (a == 0.0) {
        printf("Error: 'a' cannot be 0 for a quadratic equation.\n");
        return 1;
    }

    discriminant = (b * b) - (4 * a * c);
    printf("Discriminant (D) = %.2f\n\n", discriminant);

    if (discriminant > 0) {
        root1 = (-b + sqrt(discriminant)) / (2 * a);
        root2 = (-b - sqrt(discriminant)) / (2 * a);
        printf("Roots are Real and Distinct:\n");
        printf("Root 1 = %.2f\n", root1);
        printf("Root 2 = %.2f\n", root2);
    } else if (discriminant == 0) {
        root1 = -b / (2 * a);
        printf("Roots are Real and Equal:\n");
        printf("Root 1 = Root 2 = %.2f\n", root1);
    } else {
        realPart = -b / (2 * a);
        imagPart = sqrt(-discriminant) / (2 * a);
        printf("Roots are Complex and Conjugate:\n");
        printf("Root 1 = %.2f + %.2fi\n", realPart, imagPart);
        printf("Root 2 = %.2f - %.2fi\n", realPart, imagPart);
    }

    return 0;
}
💡 Note:Computes the exact roots of quadratic equation x^2 - 5x + 6 = 0 using math.h's sqrt() function. Shows all 3 discriminant branching paths.

🎯 University Exam Scoring Blueprint

  • Always draw neat flowchart symbols using a ruler; labels like 'Yes/No' or 'True/False' on decision branches are mandatory.
  • Remember Donald Knuth's 5 properties: Finiteness, Definiteness, Input, Output, and Effectiveness.
  • In quadratic equation answers, always handle the edge condition where a == 0 to prevent division by zero!

Top Viva Questions on Problem Solving Concepts, Algorithms & Flowcharts

2 Questions
1

What is the key difference between an Algorithm and Pseudocode?

2

Why can a flowchart have multiple STOP symbols but strictly only ONE START symbol?