C Programming Data Structures
- 45Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
45 questions
- 1CS50 Week 5 is described as the_____challenging week, leading to a climax of material.
Hint
Consider the overall sentiment expressed about the difficulty of this particular week in the course.
Answer
most
- 2The course content explores data structures, building upon the brief introduction to_____in Week 2.
Hint
Recall the simplest data structure mentioned as having been covered early in the course.
Answer
arrays
- 3Arrays are a data structure where elements are generally of the same data type and stored_____to back to back in memory.
Hint
Think about the physical arrangement of data elements in an array within the computer's memory.
Answer
back
- 4A key limitation of arrays is that their_____must be decided in advance.
Hint
Consider what fixed property of an array must be known before it's created.
Answer
size
- 5Abstract data types are ways of structuring information that do not depend on the underlying_____details.
Hint
Focus on what aspect of data structuring abstract data types intentionally hide or are independent of.
Answer
implementation
- 6While data structures are concrete, involving variables and pointers, abstract data types are more broadly_____.
Hint
Think about the nature of abstract data types compared to concrete data structures; one is specific, the other is general.
Answer
descriptive
- 7A queue in the real world, like a line at a movie theater, is an example of a_____data type.
Hint
Consider the principle by which elements are processed in a standard queue, regarding their entry and exit order.
Answer
FIFO
- 8The two fundamental operations for a queue in code are_____to add an element and dequeue to remove one.
Hint
Recall the specific terms used for adding items to and removing items from a queue.
Answer
enqueue
- 9When implementing a queue in code, the total maximum number of items is the_____of the queue.
Hint
Think about the difference between the current number of items and the maximum number it can hold.
Answer
capacity
- 10The_____
sizevariable in a queue implementation tracks thenumber of people or things currently in the queue.Hint
Contrast this with 'capacity' which is the maximum; what does 'size' dynamically represent?
Answer
current
- 11Unlike queues, stacks exhibit a_____property, meaning the last item added is the first one removed.
Hint
Consider the principle of how clothes are typically retrieved from a stack or emails from an inbox.
Answer
LIFO
- 12The operations for a stack are `_____
, to add an element to the top, andpop`, to remove an element from the top.Hint
Recall the specific terms for adding and removing items from a stack, which are different from a queue's operations.
Answer
push
- 13A major disadvantage of growing an array by copying its elements to a new, larger array is that it takes more_____.
Hint
Consider the computational cost associated with repeatedly copying data, as opposed to finding immediate space.
Answer
time
- 14Over-allocating memory for an array from the start to avoid future resizing leads to a waste of_____.
Hint
Think about the resource that is limited in a computer and would be consumed unnecessarily by pre-allocating too much.
Answer
space
- 15The two common trade-offs in computer science when solving problems are often between time and_____.
Hint
Consider the two primary computational resources that are typically balanced against each other in algorithmic design.
Answer
space
- 16The_____
reallocfunction in C is used toan existing chunk of memory, potentially moving it if contiguous space isn't available.Hint
Recall the purpose of the
reallocfunction in memory management, related to changing the size of an allocated block.Answer
resize
- 17Unlike_____
malloc,realloctakes two arguments: the address of the original memory chunk and thenew size.Hint
Remember the two pieces of information
reallocneeds: where to start and what to change it to.Answer
desired
- 18A `_____list` is a data structure that uses pointers to connect elements in memory, avoiding the need for contiguous storage.
Hint
Think about the structure that 'stitches things together' with arrows rather than requiring elements to be side-by-side.
Answer
linked
- 19The special sentinel value used to mark the end of a linked list in C memory is_____.
Hint
Recall the specific value that indicates an invalid or non-existent memory address, often used to terminate data structures.
Answer
null
- 20The upside of linked lists is that they no longer need elements to be_____in memory, allowing for more efficient use of fragmented space.
Hint
Consider the primary constraint of arrays that linked lists overcome regarding memory arrangement.
Answer
contiguous
- 21A downside of linked lists is that they require extra_____to store the pointers that link nodes together.
Hint
Think about the additional resource consumed by the arrows or connections between nodes.
Answer
space
- 22In a_____
structdefinition for a linked list node, the pointer to the next node is typically named ``.Hint
Recall the conventional naming for the pointer field that points to the subsequent element in a list.
Answer
next
- 23The arrow operator (_____
->) in C is a shorthand for dereferencing a pointer to a struct and then accessing a member, equivalent to `(*pointer).`.Hint
Consider what the dot operator
.is used for when combined with dereferencing a pointer to a structure.Answer
member
- 24When building a linked list, failing to update pointers correctly can lead to_____a node, making it unreachable and causing a memory leak.
Hint
Think about what happens to a piece of data in memory if no variable or pointer references it anymore.
Answer
orphaning
- 25A_____-linked list allows traversal in only one direction, as each node points only to the subsequent node.
Hint
Consider the number of pointers a node has for directional movement.
Answer
singly
- 26To correctly free all memory in a linked list, one must iterate through each node, freeing it, and then moving to the_____node before the freed one is touched again.
Hint
Consider the sequence of operations required when deallocating a linked list to avoid accessing freed memory.
Answer
next
- 27In a linked list, searching for a value from left to right typically takes Big O of_____time.
Hint
Consider the worst-case scenario for finding an element in an unsorted linear data structure.
Answer
n
- 28Pre-pending elements to a linked list, as in the example of building it backwards, achieves Big O of_____insertion time.
Hint
Think about the efficiency of adding an element to the very beginning of a list, regardless of its current size.
Answer
1
- 29Appending elements to the end of a singly-linked list generally requires Big O of_____time because it involves traversing the list.
Hint
Consider the steps needed to find the end of a linked list to add a new element there.
Answer
n
- 30A_____search tree is a two-dimensional tree-like structure that allows for binary search operations.
Hint
Recall the specific type of tree that inherently supports efficient searching similar to the binary search algorithm.
Answer
binary
- 31In a binary search tree, each node typically contains two pointers: one for a left child and one for a_____child.
Hint
Consider the two directions of branching in a binary tree structure.
Answer
right
- 32The property of a binary search tree is that every node's left child is_____than the root, and every right child is greater than the root.
Hint
Recall the ordering rule that enables binary search in this tree structure.
Answer
less
- 33The height of a perfectly balanced binary search tree is approximately log base 2 of_____, where
nis the total number of nodes.Hint
Think about the relationship between the number of nodes and the number of levels in a balanced binary tree, which allows logarithmic search time.
Answer
n
- 34A perverse case where a binary search tree devolves into a linked list occurs when numbers are inserted in strictly_____order.
Hint
Consider an input sequence that would cause a tree to grow only in one direction, like 1, 2, 3, 4, 5.
Answer
sequential
- 35To maintain optimal performance in binary search trees, some effort is required to ensure the tree remains_____.
Hint
Think about the ideal structural characteristic that prevents worst-case linear time scenarios.
Answer
balanced
- 36A_____is an abstract data type that associates words with definitions, or more generally, keys with values.
Hint
Recall the common data structure used to map one piece of information to another, often found in phonebooks or actual dictionaries.
Answer
dictionary
- 37The ultimate goal for efficient algorithms and data structures is to achieve_____time access, meaning no dependency on
n.Hint
Think about the ideal running time where the operation takes the same amount of time regardless of input size.
Answer
constant
- 38Hashing involves a_____function that takes input and produces output, mapping a large domain to a smaller range of values.
Hint
Recall the specific type of function used in hashing to determine where a value goes in memory.
Answer
hash
- 39A_____table is a data structure that combines an array (for buckets) and linked lists (for handling collisions).
Hint
Think about the structure that 'somehow leverages the best of both worlds arrays and linked lists' using hashing.
Answer
hash
- 40In a hash table, when two different inputs map to the same bucket, it is known as a_____.
Hint
Consider what happens when a hash function produces the same index for multiple distinct data items.
Answer
collision
- 41A hash table for names using the first letter as the hash key can devolve into Big O of_____time if all names collide.
Hint
Think about the worst-case scenario where all elements end up in a single linked list within the hash table.
Answer
n
- 42A_____
trieis a data structure, short for ``, used for retrieving data and implementing dictionaries.Hint
Recall the full word from which 'trie' is derived, indicating its primary purpose.
Answer
retrieval
- 43A trie can be thought of as a tree of_____, where each array represents a letter of the alphabet.
Hint
Consider the building blocks used to construct a trie, which are repeatedly used for each character.
Answer
arrays
- 44In a trie, searching, inserting, or deleting a name takes time dependent only on the_____of the name itself, not the total number of names.
Hint
Consider the characteristic of the input that directly influences the number of steps in a trie operation.
Answer
length
- 45Tries achieve true Big O of_____running time for search, insertion, and deletion, but at the cost of significant space.
Hint
Think about the ideal running time that is independent of the total number of elements in the data structure.
Answer
1

Ask anything
We've read this whole study set, so questions about it get the best answers.