Programming Concepts and Data Structures
Algorithm, flowchart and pseudocode
- An algorithm is a finite, ordered set of steps to solve a problem. It must be clear, finite and give a result.
- Pseudocode is an algorithm written in plain, code-like English.
- A flowchart draws the algorithm with symbols:
| Symbol | Shape | Meaning |
|---|---|---|
| Terminal | Oval | Start and Stop |
| Input / Output | Parallelogram | Read or print data |
| Process | Rectangle | Calculation or action |
| Decision | Diamond | Yes or No question |
| Flow line | Arrow | Direction of flow |
| Connector | Small circle | Joins parts of a flowchart |
Basic ideas
- Variable: named memory location. Constant: value that does not change.
- Data types: integer, float (decimal), character, string, boolean.
- Control structures: sequence (one after another), selection (if, else, switch), iteration (loops: for, while, do-while).
- Function (procedure): a named block of code that can be reused. Recursion: a function that calls itself. Array: an ordered collection of items of one type, accessed by an index (usually from 0).
- IDE: Integrated Development Environment. Debugging: finding and fixing errors. API: a set of rules for programs to talk to each other.
Software Development Life Cycle (SDLC)
Requirements → Design → Coding → Testing → Deployment → Maintenance.
| Model | Idea |
|---|---|
| Waterfall | Each stage finishes before the next begins. |
| Agile | Short cycles, constant feedback. |
| Spiral | Repeated cycles with risk analysis. |
| Prototype | Build a quick sample first. |
Testing: unit (one part), integration (parts together), system, acceptance (by the customer). Black-box testing checks output without seeing code; white-box examines the code. Alpha test is inside the company; beta test is with real users outside.
Data structures
| Structure | Rule | Operations |
|---|---|---|
| Array | Fixed size, indexed. | Access by index |
| Stack | LIFO: Last In, First Out. Like a pile of plates. | Push, Pop, Peek |
| Queue | FIFO: First In, First Out. Like a ticket line. | Enqueue, Dequeue |
| Linked list | Nodes joined by pointers. Easy insertion and deletion. | |
| Tree | Hierarchy: root, parent, child, leaf. Binary tree: at most two children. | Traversals: inorder, preorder, postorder |
| Graph | Vertices joined by edges. | Used in maps and networks |
Uses: a stack handles undo, function calls and bracket checking; a queue handles printer jobs and CPU scheduling.
Postfix example. Infix 2+3*4 written in postfix is 2 3 4 * +. Evaluate by pushing numbers on a stack: 3 × 4 = 12, then 2 + 12 = 14.
Searching and sorting
| Algorithm | Idea | Time |
|---|---|---|
| Linear search | Check items one by one. | O(n) |
| Binary search | Halve a sorted list each step. | O(log n) |
| Bubble sort | Swap neighbouring items repeatedly. | O(n²) |
| Selection sort | Pick the smallest each time. | O(n²) |
| Insertion sort | Insert each item in place. | O(n²) |
| Merge sort | Divide, sort, merge. | O(n log n) |
| Quick sort | Partition around a pivot. | O(n log n) average, O(n²) worst |
Big-O describes how the running time grows with the size n. Binary search needs sorted data; a list of 1,000 items needs at most 10 comparisons (2^10 = 1,024).
Keep practising
Notes are only half the work. Test yourself with questions and discuss doubts with other aspirants.
Prepared for exam revision from standard computer textbooks, Microsoft documentation and official sources. Features differ between Excel and Word versions (2016, 2019, 2021, 365) so check which version your exam follows. Found a mistake? Tell us.