What is an array?
An array is an ordered collection whose elements are stored under one variable name and accessed by index.
Study 6 Arrays and Collections with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is an array?
An array is an ordered collection whose elements are stored under one variable name and accessed by index.
What indexes are valid for an array of length n?
For an array of length n, valid indexes range from 0 through n−1.
What does updating an array element change?
Assigning a new value to one index changes that element but does not change the array's length.
What is array traversal?
Traversal visits each element, usually in order. A traversal of n elements takes approximately O(n) time.
What does linear search return when a target is absent?
Linear search checks elements from left to right and returns the first matching index, or −1 when the target is absent.
What prerequisite does binary search have?
Binary search requires the array to be sorted according to the same ordering used by the search.
How can an algorithm find every matching index?
Continue through the entire array and append every matching index. For [4, 2, 4, 7, 4], the matching indexes for 4 are [0, 2, 4].
What must an average algorithm decide for an empty array?
An average divides the sum by the number of elements, so the empty-array case must be handled before division.
How should an array maximum be initialized?
Initialize the candidate maximum from the first element, then compare the remaining elements with it.
How does an in-place array reversal work?
An in-place reversal swaps elements from both ends while moving inward. It runs in O(n) time and uses O(1) extra space.
How can a set improve duplicate detection?
A set records values already seen, allowing duplicate detection in approximately O(n) time at the cost of additional memory.
Why sort an array before repeated searches?
Sorting rearranges values into an order, such as ascending order, which can enable binary search and simplify reporting.
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
Learn how Boolean expressions, logical operators, and conditional structures let programs make reliable decisions, including how to handle boundaries, branch order, and testing.
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.