Data Structures, unit: Arrays and Strings. Core concepts, terminology, and worked-example cues a college student meets for this unit, building on prior units without repeating them. Front: a term, concept, or short problem cue. Back: the definition, explanation, or answer.
30 cards · basic cards · AI-written, checked twice. Edit anything.
- What is an array?
- A fixed-size, contiguous block of memory storing elements of the same type
- What is the time complexity of accessing an array element by index?
- O(1), constant time
- What is the time complexity of inserting an element at the end of a dynamic array (amortized)?
- O(1) amortized
- What is the time complexity of inserting an element at the beginning of an array?
- O(n), since all existing elements must shift
- What is a dynamic array?
- An array that automatically resizes itself when it runs out of capacity
- What happens when a dynamic array's underlying storage is full and a new element is added?
- A new, larger array is allocated and existing elements are copied over
- What is amortized time complexity?
- The average cost per operation over a sequence of operations, smoothing out occasional expensive ones
- What is a multidimensional array?
- An array of arrays, such as a 2D grid used for matrices
- What is a string, in terms of its underlying data structure?
- Typically an array (or sequence) of characters
- What is string immutability?
- A property where a string's contents cannot be changed after creation, common in languages like Python and Java
- What is a substring?
- A contiguous sequence of characters within a larger string
- What is string concatenation?
- Joining two or more strings together into one
- What is the time complexity of searching for an element in an unsorted array?
- O(n), linear time
- What is the time complexity of searching for an element in a sorted array using binary search?
- O(log n)
- What is an index out of bounds error?
- An error from accessing an array position beyond its valid range