Career upgrade: Learn practical AI skills for better jobs and higher pay.
Level up

5.5 Software Engineering & Algorithms

Key Takeaways

  • Big-O describes worst-case growth: binary search is O(log n), linear scan is O(n), and a simple nested-loop sort is O(n^2).
  • Arrays give O(1) indexed access but O(n) insertion; linked lists give O(1) insertion at a known node but O(n) search.
  • Stacks are last-in-first-out (LIFO); queues are first-in-first-out (FIFO).
  • Binary search requires a sorted array and halves the search space each step, reaching O(log n) comparisons.
  • The waterfall SDLC moves linearly through phases, while Agile delivers working software in short iterative sprints.
Last updated: May 2026

Data structures

A data structure organizes data so a program can access and modify it efficiently. The FE expects you to know the access trade-offs of the common ones:

  • Array: contiguous, fixed-size; O(1) access by index, but inserting or deleting in the middle costs O(n) because elements shift.
  • Linked list: nodes connected by pointers; O(1) insertion or deletion at a known node, but O(n) to search because you must traverse.
  • Stack: LIFO (last-in, first-out); push and pop at one end. Used for function-call management and expression evaluation.
  • Queue: FIFO (first-in, first-out); enqueue at the rear, dequeue at the front. Used for buffering and scheduling.
  • Hash table: maps keys to values with average O(1) lookup using a hash function.
  • Tree: hierarchical; a balanced binary search tree supports O(log n) search, insert, and delete.

Big-O complexity

Big-O notation expresses how an algorithm's running time or memory grows as the input size n grows, keeping only the dominant term and dropping constants. It describes the worst-case asymptotic bound, which is what scales when inputs get large.

The ordering from best to worst is:

O(1) < O(log n) < O(n) < O(n log n) < O(n^2) < O(2^n)

An O(1) constant-time operation does not depend on n, O(log n) halves the problem each step, O(n) touches each element once, O(n log n) is the bound of efficient comparison sorts, and O(n^2) shows up in nested loops over the same data.

Big-O of common operations

Algorithm / OperationAverage Big-ONotes
Array access by indexO(1)Direct addressing
Linear searchO(n)Unsorted data
Binary searchO(log n)Requires sorted data
Bubble / insertion / selection sortO(n^2)Simple, nested loops
Merge sort / quicksortO(n log n)Efficient comparison sorts
Hash table lookupO(1)Average; O(n) worst case
Balanced BST searchO(log n)Self-balancing tree

Quicksort degrades to O(n^2) in its worst case (already-sorted input with poor pivots), a frequent exam nuance.

Test Your Knowledge

What is the worst-case time complexity of performing binary search on a sorted array of n elements?

A
B
C
D

Control flow and fundamental algorithms

Program logic is built from three control flow structures: sequence (statements in order), selection (if/else and switch), and iteration (for and while loops). Any algorithm can be expressed with these, a result formalized by structured programming.

Two algorithms recur on the FE:

  • Binary search: repeatedly compare the target to the middle element of a sorted array, discarding the half that cannot contain it. O(log n).
  • Sorting: simple sorts (bubble, insertion, selection) are O(n^2) and easy to trace; efficient sorts (merge, quick) are O(n log n). Merge sort is stable and guarantees O(n log n); quicksort is usually faster in practice but has an O(n^2) worst case.

Be ready to hand-trace a short loop and count how many times the body executes.

The software development lifecycle

The software development lifecycle (SDLC) is the set of phases a project moves through: requirements, design, implementation, testing, deployment, and maintenance. The FE asks you to distinguish the main process models:

  • Waterfall: strictly sequential phases; each must finish before the next begins. Simple and well-documented, but inflexible to late changes.
  • Agile: iterative and incremental; small cross-functional teams deliver working software in short sprints and welcome changing requirements.
  • Spiral: risk-driven, repeating waterfall-like cycles with explicit risk analysis each loop.
  • V-model: an extension of waterfall that pairs each development phase with a corresponding test phase.

Supporting practices include version control (such as Git) for tracking changes, and testing levels from unit to integration to system to acceptance.

Test Your Knowledge

Which SDLC model is best characterized by strictly sequential phases where each phase must be completed before the next begins?

A
B
C
D