Practice Set · Exam Two Preparation: Pointers & Dynamic Arrays

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

flashcard set

Earn XP

Description and Tags

Flashcards covering pointers, dynamic memory allocation, class design for dynamic arrays, and the Bag/String/Polynomial ADTs.

Last updated 4:36 AM on 6/26/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

20 Terms

1
New cards

Dereference operator (*p)

A syntax that refers to 'the box p points at' (the value stored at the address contained in the pointer p).

2
New cards

Address-of operator (&)

An operator used to retrieve the memory address of a specific variable.

3
New cards

Heap

The location where dynamic variables reside, described as a 'rental warehouse' that must be manually returned using delete.

4
New cards

Run-time stack

The memory location where local variables reside, which automatically clean themselves up.

5
New cards

Default constructor

The no-argument constructor used by C++ to initialize every element when allocating an array of objects.

6
New cards

Reference parameter for pointers

A parameter used when a function reassigns a pointer itself and needs that redirection to survive outside the function.

7
New cards

Array name as argument

The practice of passing an array by its name alone, which acts as a pointer to the first element.

8
New cards

Bag constructor (Dynamic Memory Timing)

The point in the Bag ADT lifecycle where the dynamic array is allocated via new.

9
New cards

Friend function

A non-member function uniquely declared to have access to the private data members of a class.

10
New cards

Self-application

A situation where the argument of a function is the same object running the function, occurring in statements like a = a or a += a.

11
New cards

Resizing Performance

Growing with n elements, usually resulting in linear time (O(n)O(n)) worst-case performance for container resizing.

12
New cards

Law of the Big Three

The rule that a class using dynamic memory should provide three member functions: the destructor, the copy constructor, and the assignment operator.

13
New cards

Copy constructor usage

Triggered when calling a function with a value parameter, declaring a variable as a copy of a existing object, or returning a value from a function.

14
New cards

C-string storage requirement

A char array must contain exactly enough slots for the letters plus one hidden terminator character (\text{'\0'}) marking the end.

15
New cards

Function Overloading signature

The unique parameter lists that allow the compiler to distinguish between multiple operators or functions with the same name.

16
New cards

std::bad_alloc

The exception thrown by new when the heap is out of memory.

17
New cards

Shallow Copy

The automatic compiler-generated assignment that copies the data pointer rather than the underlying array, causing two objects to share the same storage.

18
New cards

Deep Copy

An assignment operator implementation that provides a new object with its own separate array, avoiding the problems of shared storage and dangling pointers.

19
New cards

Amortized Constant Time (O(1)O(1))

The average cost per insertion achieved when resizing a container by a multiplicative factor (e.g., doubling capacity) rather than adding a single slot.

20
New cards

Polynomial Degree

The highest exponent in a polynomial that has a non-zero coefficient.