1/53
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Specification
A precise, written description of the problem a program must solve. Often includes sample output or pre/postconditions.
Design
The phase of formulating the steps (algorithm) to solve the problem, often using pseudocode.
Implementation
The actual C++ code that carries out the design.
Pseudocode
A mixture of English and a programming language used to outline an algorithm without worrying about strict language syntax.
Decomposition
Breaking down a large problem into smaller, manageable subtasks (functions).
Precondition
A statement indicating what must be true before a function is called. It is the caller's responsibility.
Postcondition
A statement indicating what will be true when the function finishes its work. It is the function's guarantee.
Procedural Abstraction
A form of information hiding where you know what a function does but not how it is implemented.
`assert()`
A macro (from `
`NDEBUG`
A preprocessor directive (`#define NDEBUG`) that disables all `assert()` statements for production code.
Big-O Notation
A mathematical notation used to describe the order (time complexity) of an algorithm as the input size ($n$) grows.
Linear Time [O(n)]
Algorithm time grows proportionally to the input size. Example: Looping through an array once.
Quadratic Time [O(n²)]
Algorithm time grows proportionally to the square of the input size. Example: Nested loops.
Logarithmic Time [O(log n)]
Algorithm time grows very slowly as input size increases. Example: Binary Search.
Boundary Values
Test inputs that are 'one step away' from different behavior (e.g., 0, max size, empty string). Most likely to cause errors.
Fully Exercising Code
A testing technique ensuring every line of code is executed at least once by some test case.
Class
A user-defined data type that encapsulates data (member variables) and functions (member functions) to manipulate that data.
Object / Instance
A variable declared of a specific class type.
Member Function
A function defined within the scope of a class. It operates on the data of a specific object.
`const` Member Function
A member function that promises not to modify the object's member variables. Syntax: `void print() const;`
Constructor
A special member function called automatically when an object is created. It has the same name as the class and no return type.
Default Constructor
A constructor that takes no arguments. If you write any constructor, the compiler no longer generates the automatic default constructor.
Inline Function
A function whose definition is placed inside the class definition. It is a hint to the compiler to replace the function call with the actual code body to save overhead.
Namespace
A declarative region that provides a scope to identifiers (names) to prevent naming collisions between libraries.
Macro Guard
`#ifndef` / `#define` / `#endif` directives used in header files to prevent the compiler from seeing the same class definition twice.
Value Semantics
The behavior of copying objects via the assignment operator (`=`) and the copy constructor.
Value Parameter
A parameter where the function receives a copy of the argument. Changes inside the function do not affect the original.
Reference Parameter (`&`)
A parameter where the function receives an alias to the original argument. Changes inside the function do affect the original.
Const Reference (`const &`)
A parameter that is efficient like a reference (no copy) but safe like a value (function cannot modify the original).
Operator Overloading
Giving a standard C++ operator (like `+`, `==`, `<<`) a new meaning for a user-defined class.
Friend Function
A non-member function that has been granted access to the private members of a class. Used often for `operator >>` and `operator <<`.
Container Class
A class designed to hold a collection of items (e.g., `bag`, `sequence`).
`typedef`
A keyword used to create an alias for a data type (e.g., `typedef int value_type;`). This makes it easy to change the underlying data type of the container later.
`std::size_t`
A standard data type defined in `
`static const`
A member variable that is shared by all objects of the class (`static`) and cannot be changed after initialization (`const`). Used for constants like `CAPACITY`.
Partially Filled Array
An array where only the beginning segment holds valid data. The rest is ignored/garbage. Requires a variable (`used`) to track the valid count.
Class Invariant
A set of rules that dictate exactly how the private member variables represent the abstract state of the object. Example: 'The items are stored in `data[0]` through `data[used-1]`.'
Internal Iterator
Functions (`start`, `advance`, `current`) that allow a user to step through the items of a container one at a time, controlled by the object's internal state.
Pointer
A variable that stores the memory address of another variable or dynamic memory location.
Address Operator (`&`)
Returns the memory address of a variable. Example: `&my_var`.
Dereferencing Operator (`*`)
Accesses the value stored at the memory address held by a pointer. Example: `*ptr = 42;`.
`new` Operator
Allocates memory on the heap. Returns a pointer to the newly allocated memory.
`delete` Operator
Releases memory previously allocated with `new` back to the heap. Failure to do this causes a memory leak.
`delete[]` Operator
Releases memory previously allocated for a dynamic array with `new[]`.
Stack Memory
Memory managed automatically by the compiler for local variables and function calls. Fast, but limited size (Stack Overflow risk). Variables die when the function returns.
Heap Memory (Free Store)
Memory managed manually by the programmer (using `new`/`delete`). Larger pool of memory, accessible anywhere until freed.
`bad_alloc`
An exception thrown by the `new` operator if the heap runs out of memory.
Dynamic Array
An array whose size is determined at run time rather than compile time. Created using `new Type[size]`.
`this` Pointer
A keyword that acts as a pointer to the current object inside a member function. Used to disambiguate parameters or return the object itself (`return *this;`).
Destructor (`~ClassName`)
A member function called automatically when an object is destroyed. Critical for releasing dynamic memory held by the object to prevent leaks.
Copy Constructor
A constructor used to create a new object as a deep copy of an existing object. Prototype: `bag(const bag& source);`
Assignment Operator (`operator=`)
A member function used to assign the state of one existing object to another existing object. Must handle self-assignment and release old memory.
Shallow Copy
Copying only the pointer address. Both objects point to the same heap memory (dangerous).
Deep Copy
Allocating new heap memory and copying the actual data pointed to. Both objects have independent copies (safe).