Computer Science Basics — Advanced
This section covers the topics that separate a working knowledge of Python from genuine CS fundamentals: a real data structure (the stack), organizing code across files with modules, and the searching/sorting algorithms that come up constantly in board exams and practicals.
The Stack — LIFO in Practice
A stack is a data structure where the last item added is the first one removed — LIFO: Last In, First Out (think of a stack of plates: you add to the top, and you take from the top, never the bottom). Python doesn't have a dedicated stack type, but a list implements one directly:
Where a stack actually matters: undo functionality (each action pushed, undo pops the most recent one), matching brackets in an expression, and reversing the order of a sequence are all naturally stack problems. A CBSE Class 12 practical often asks you to implement a stack-based menu (push, pop, peek, display) using a list exactly like this.
Modules — Splitting Code Across Files
As programs grow, keeping everything in one file becomes unmanageable. A module is just a .py file whose functions/variables you can reuse from another file:
Python's own standard library works exactly this way — import math, import random, import csv (which you've already used in this course's file-handling examples) are all modules someone else wrote, imported the same way you'd import your own.
Linear Search and Binary Search
Two ways to find a value in a list, with very different performance characteristics:
Why binary search is faster: linear search may check every single element in the worst case. Binary search eliminates half the remaining possibilities at every step — for 1000 sorted items, linear search could take 1000 checks, binary search takes at most 10. The trade-off: binary search only works on data that's already sorted.
A Sorting Algorithm — Bubble Sort
Bubble sort repeatedly compares neighboring pairs and swaps them if they're in the wrong order — after each full pass, the largest remaining unsorted value "bubbles up" to its correct position. It's not the fastest sorting algorithm (Python's built-in sorted() uses a much faster one internally), but it's the standard first sorting algorithm taught precisely because tracing through it by hand builds real intuition for what "sorting" actually involves step by step.
Next Steps
You've now covered the full progression from this course's Overview through Advanced. From here: work through the Projects section (a report-card generator, a quiz game, and a file-based student-records system — all using what you've learned) and the Interview/Practice Q&A section for board-exam-style questions on everything covered across these four sections.

