Question
A developer is choosing between an array and a linked
list to store a collection of elements. If the primary operations will be frequent insertions and deletions at arbitrary positions, and infrequent random access, which data structure is generally more suitable?Solution
Linked List: Insertion and deletion at arbitrary positions (once the position is found) are O(1) because only pointers need to be updated. However, random access (finding an element at a specific index) is O(N) as it requires traversing from the beginning. Â Â Array: Insertion and deletion at arbitrary positions are O(N) because elements need to be shifted. Random access is O(1). Â Â Given the emphasis on frequent insertions/deletions at arbitrary positions and infrequent random access, a linked list is more suitable.
- 741, 852, 1074, 1407, ?
82, 98, 130, 178, 242, ?
What will come in place of the question mark (?) in the following series?
75, 219, 388, ?, 809, 106513, 14, 23, 48, 97, 178, ?
What will come in place of the question mark (?) in the following series?
11, 13, 19, ?, 51, 81
Which of the following numbers will replace the question mark (?) in the given series?
17, 30, 44, 59, 75, ?
What will come in place of the question mark (?) in the following series?
9, 19, 41, 87, ?, 359
74, 84, 64, 104, ?, 184
114, 115, 118, 127, ?, 235
6, 30, 43, 58, 75, ?