Flashcards on Data structures
Data Structures: A Student's Guide to Essential Concepts
Tap to flip · Swipe to navigate
Fundamentals of Data Structures
45 cards
Card 1
Question: What are data structures?
Answer: Data structures are fundamental building blocks in computer science that provide efficient ways to organize and store data for various computational t
Card 2
Question: Why is the choice of an appropriate data structure important?
Answer: The choice of an appropriate data structure can significantly impact the performance of an algorithm or an entire software system.
Card 3
Question: What is an array?
Answer: An array is a collection of elements, each identified by an array index or key, stored at contiguous memory locations.
Card 4
Question: What is a defining characteristic of an array regarding memory storage?
Answer: Its elements are stored at contiguous memory locations, meaning they are next to each other in a block of memory.
Card 5
Question: What is the typical size characteristic of an array?
Answer: Arrays typically have a fixed size, which must be declared at the time of creation (for static arrays).
Card 6
Question: What is 'direct access' in the context of arrays?
Answer: Any element can be accessed directly using its index (e.g., `array[i]`), also known as random access.
Card 7
Question: What is the time complexity for accessing (read/write) an element in an array?
Answer: O(1) (constant time).
Card 8
Question: Why is accessing an element in an array O(1)?
Answer: Its memory address can be calculated directly from the base address and the index.
Card 9
Question: What is the time complexity for inserting an element into the middle of an array?
Answer: O(N), because it requires shifting all subsequent elements to make space.
Card 10
Question: What is the time complexity for inserting an element at the end of a non-full array?
Answer: O(1).