What is the primary disadvantage of using an array for a dynamic list?
Practice Questions
Q1
What is the primary disadvantage of using an array for a dynamic list?
Fixed size
Slower access time
Higher memory usage
Complexity of implementation
Questions & Step-by-Step Solutions
What is the primary disadvantage of using an array for a dynamic list?
Step 1: Understand what an array is. An array is a collection of items stored in a fixed size.
Step 2: Know that a dynamic list is a list that can change in size, meaning it can grow or shrink as needed.
Step 3: Realize that when you create an array, you must decide how many items it will hold in advance. This is the fixed size.
Step 4: If you need to add more items than the array can hold, you will run into a problem called overflow, meaning you can't add more items.
Step 5: If you set the array size too large, you may end up with empty spaces that are not used, which is wasted space.
Step 6: Therefore, the primary disadvantage of using an array for a dynamic list is that it has a fixed size, leading to either overflow or wasted space.