MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which uses more memory storage?
A
Array
B
Linked List
C
They are the same in terms of memory storage
D
None of the above
Explanation: 

Detailed explanation-1: -Memory consumption is more in Linked Lists when compared to arrays. Because each node contains a pointer in linked list and it requires extra memory. Elements cannot be accessed at random in linked lists.

Detailed explanation-2: -More memory is required to store elements in linked list as compared to array. Because in linked list each node contains a pointer and it requires extra memory for itself.

Detailed explanation-3: -Memory space The doubly linked list holds two addresses in a node, one is of the next node and the other one is of the previous node; therefore, the space occupied by the two pointer variables is 8 bytes.

Detailed explanation-4: -Larger memory allocation: Unlike an array, each node within a linked list needs to store both its value and a reference to another node; therefore, it takes up more memory.

Detailed explanation-5: -A LinkedList consumes a bit more memory than an ArrayList since every node stores two references to the previous and next element. The insertion, addition, and removal operations are faster in a LinkedList because there is no resizing of an array done in the background.

There is 1 question to complete.