C++ Functions, Arrays, Vectors, and Searching/Sorting

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

1/38

flashcard set

Earn XP

Description and Tags

Comprehensive vocabulary flashcards covering C++ function mechanics, array manipulation, vectors, and searching and sorting algorithms.

39 Terms

1
New cards

Function

A collection of statements that performs a specific task and breaks programs into manageable units or modules.

2
New cards

Function Definition

The complete block of code that contains the function header and the statements that make up the function.

3
New cards

Function Prototype

A declaration that specifies the function's name, return data type, and parameter data types, eliminating the need to define the function prior to all calls.

4
New cards

Function Call

A program statement that invokes and causes a function to execute, transferring program control to that function.

5
New cards

Parameter

A special-purpose variable declared inside the parentheses of a function definition header that receives incoming information.

6
New cards

Argument

A value or information passed to a function within the parentheses of a function call.

7
New cards

return Statement

A statement that causes a function to end immediately and optionally passes a single value back to the calling function.

8
New cards

Local Variable

A variable defined inside a function that is accessible only within that function, does not persist between calls, and is not initialized to zero by default.

9
New cards

Global Variable

A variable declared outside of all functions, accessible throughout the entire program, and initialized to zero by default.

10
New cards

Static Local Variable

A variable defined inside a function that persists its value between function calls and is initialized only once, the first time the function is called.

11
New cards

Default Argument

An argument passed automatically to a parameter when the actual argument is omitted from the function call, typically specified in the function prototype or header.

12
New cards

Reference Parameter

A parameter variable declared with an ampersand that references the caller's original argument, allowing the function to modify the argument directly.

13
New cards

Overloaded Functions

Two or more functions that share the same name within a program but have different parameter lists.

14
New cards

exit()

A function that causes a program to terminate immediately, regardless of which function or control mechanism is currently executing.

15
New cards

EXIT_SUCCESS and EXIT_FAILURE

Named constants passed to the exit() function to signal successful completion or abnormal termination of a program.

16
New cards

Stub

A dummy function called in place of the actual function it represents, used during program testing and development.

17
New cards

Array

A data structure that stores a collection of multiple values of the same data type in contiguous memory.

18
New cards

Element

An individual value contained inside an array, accessed via the array name combined with an index value.

19
New cards

Subscript

An integer index enclosed in brackets used to identify and access an individual element in an array, beginning with 00 in C++.

20
New cards

Size Declarator

A constant integer expression with a value greater than 00 specified inside brackets during array definition to declare the total number of elements.

21
New cards

Initialization List

A comma-separated series of starting values enclosed in braces used to populate array elements upon declaration.

22
New cards

Implicit Array Sizing

Omitting the size declarator in an array definition while providing an initialization list, causing the compiler to automatically determine the array size.

23
New cards

Range-Based for Loop

A specialized loop that iterates sequentially across every element of an array or vector using a built-in range variable.

24
New cards

Structured Binding Declaration

A C++ statement, such as auto [n1, n2, n3] = narray;, used to unpack the individual elements of an array into separate variables.

25
New cards

Two-Dimensional Array

An array structured logically as rows and columns, referenced using a row subscript followed by a column subscript, requiring all dimensions after the first to be specified in function parameter lists.

26
New cards

Vector

A standard template library container object that behaves like an array but automatically expands and adjusts its size to accommodate new elements.

27
New cards

push_back()

A vector member function used to insert a new element onto the end of a vector object.

28
New cards

pop_back()

A vector member function used to remove the last element from a vector.

29
New cards

size()

A vector member function that returns the total count of elements currently stored in the vector.

30
New cards

empty()

A vector member function that returns true if the vector contains zero elements, and false otherwise.

31
New cards

Search Algorithm

A method used to locate a specific item of information within a larger collection of data, such as an array or vector.

32
New cards

Linear Search

A simple search algorithm that uses a loop to examine array elements sequentially one by one until a match is found or the end of the array is reached.

33
New cards

Binary Search

An efficient search algorithm that operates on sorted data by beginning at the middle element and repeatedly dividing the search range in half.

34
New cards

Sorting Algorithm

A technique designed to rearrange an unsorted collection of data into an orderly sequence, such as ascending or descending order.

35
New cards

Ascending Order

An arrangement of sorted data values ordered sequentially from lowest value to highest value.

36
New cards

Descending Order

An arrangement of sorted data values ordered sequentially from highest value to lowest value.

37
New cards

Bubble Sort

An iterative sorting algorithm that repeatedly compares pairs of adjacent elements and swaps them if they are out of order, bubbling smaller or larger elements to their destination.

38
New cards

Selection Sort

A sorting algorithm that locates the smallest or largest value in the unsorted portion of an array and swaps it into its correct position, typically making fewer swaps than bubble sort.

39
New cards

Swap Operation

A procedure that exchanges the values of two variables, requiring reference parameters when implemented as a standalone function and a temporary variable to avoid data overwriting.