Name an advantage of array over linked list?
Answers were Sorted based on User's Feedback
Answer / santhosh k
Array size is fixed.But Linked is not fixed
| Is This Answer Correct ? | 148 Yes | 31 No |
Answer / nidhi singh
memory requirement is less.
no pointers required..
| Is This Answer Correct ? | 91 Yes | 18 No |
Answer / chandan
Linked List have an extra Overhead in its each node to
store the pointer to the next node.
| Is This Answer Correct ? | 67 Yes | 5 No |
Answer / sumeet choudhury
Arrays have random access and less overheads compared to
Linked list have sequential access only with too much
overheads and no cache memory support.
On the other hand, arrays allow random access, while linked
lists allow only sequential access to elements. Singly-
linked lists, in fact, can only be traversed in one
direction. This makes linked lists unsuitable for
applications where it's useful to look up an element by its
index quickly, such as heapsort. Sequential access on
arrays is also faster than on linked lists on many machines
due to locality of reference and data caches. Linked lists
receive almost no benefit from the cache.
Another disadvantage of linked lists is the extra storage
needed for references, which often makes them impractical
for lists of small data items such as characters or boolean
values. It can also be slow, and with a naïve allocator,
wasteful, to allocate memory separately for each new
element, a problem generally solved using memory pools.
| Is This Answer Correct ? | 64 Yes | 10 No |
Answer / anu
I think linked list is better when compared to arrays
because size of array is restricted to
declaration.Insertion/Deletion of values in middle of array
is not possible.
| Is This Answer Correct ? | 68 Yes | 16 No |
Answer / neha sharma
as arrays are static in nature, therefore all operations
like memory allocation occur at the time of compilation
only. So processor has to put less effort at its runtime .
| Is This Answer Correct ? | 43 Yes | 4 No |
Answer / amandeep singh bhatia
IN array we can directly access any element by index number
but in linked list if we want to access any element then we
have to go from starting and linearly we access that
element.
| Is This Answer Correct ? | 43 Yes | 11 No |
Answer / kiran
The Main advantage of array data structure is which is used
to hold like kind of data. in other words arrays hold
(save) similar kind of data items and array items stored in
contigues locations in memory. on the other hand link list
may hold unlike kind of data (group of data) and items
stored is not contigues in linked list.
| Is This Answer Correct ? | 23 Yes | 3 No |
Answer / eren tsanglao
Array can be access randomly and it can even access the
middle element by just the array name with the
subscript,eg, a[5].The elemente are allocated a contagious
memory.Whereas in linked list more space is required for
the pointer and the information.Accessing elements in
linked list is sequential.
| Is This Answer Correct ? | 26 Yes | 7 No |
What does and I oop mean in text?
what is code for call by value and call by reference?
Can we have a private constructor ?
12 Answers HSBC, Ness Technologies, TCS, Wipro,
Tell me the scenario,Where we can use interfaces or Abstract class.And What is the difference between interfaces and abstract class?
When is an object created and what is its lifetime?
Describe these concepts: Polymorphism, Inheritance and Abstraction.
What is abstraction in oop with example?
should we use linear search or binary search if elements are placed in random order or mixed?in both cases? i need a little bit detail ans?thnks
What is the difference between Home and $Home?
write a program to print * * * * * *
what is virtual function?
26 Answers Aspire, HP, Infosys, RoboSoft, TCS,
Objective The objective of this problem is to test the understanding of Object-Oriented Programming (OOP) concepts, in particular, on encapsulation. Problem Description Create a program for managing customer’s bank accounts. A bank customer can do the following operations: 1. Create a new bank account with an initial balance. 2. Deposit money into his/her account. 3. Withdraw money from his/her account. For this operation, you need to output “Transaction successful” if the intended amount of money can be withdrawn, otherwise output “Transaction unsuccessful” and no money will be withdrawn from his/her account. Input The input contains several operations and is terminated by “0”. The operations will be “Create name amount”, “Deposit name amount”, or “Withdraw name amount”, where name is the customer’s name and amount is an integer indicating the amount of money. There will be at most 100 bank accounts and they are all created on the first month when the bank is opening. You may assume that all account holders have unique names and the names consist of only a single word. Output The output contains the transaction result of withdrawal operations and the final balance of all customers after some withdrawal and deposit operations (same order as the input). Sample Input Create Billy 2500 Create Charlie 1000 Create John 100 Withdraw Charlie 500 Deposit John 899 Withdraw Charlie 1000 0