CSS Prepare

optional · CSS study notes

Fundamental Concepts of Algorithms (2017)

Definition

  • An algorithm is a finite, well-defined, step-by-step sequence of instructions that takes some input, processes it, and produces output to solve a specific problem — must terminate in finite time
  • Term derives from Al-Khwarizmi, 9th-century Persian mathematician

Why Study Algorithms

  • Correctness, efficiency (time/space), and scalability of software depend on the algorithm chosen, independent of programming language/hardware
  • Same problem can have multiple algorithms with vastly different performance (e.g., O(n²) vs O(n log n) sorting)

Relationship to Data Structures

  • Algorithms operate on data structures — choice of data structure directly affects which algorithms are efficient (e.g., binary search needs sorted array/BST, not a linked list)
  • "Program = Algorithm + Data Structure" (Niklaus Wirth's famous formulation)

Exam Angle

Always open a CS-optional algorithms answer by defining the term and citing Al-Khwarizmi — a classic full-marks opener examiners look for.

📌 Sample & Repeated FPSC Questions (2016–2026)

FPSC has not directly isolated this exact definitional sub-topic ("what is an algorithm / origin of the term") as a standalone question in the 2016–2026 CS-optional papers — it typically appears folded into a broader "define an algorithm and explain its properties" style question, or as an implicit expectation in questions that ask you to design/write an algorithm.