Amazon Interview Question
Software Engineer / DevelopersThe obvious answer is that arrays are more useful when referring to consolidated data, ie, data of specific size and parameters. Linked lists are more useful in creation and allocation of records.and also when you are unaware of the number of records.
Disadvantage of using an array is that deletion of front element is very expansive whereas in list it can be done in constant time.Advantage of using array is that it is indexable in constant time.
Dynamic array could still be a better choice if scaling is done infrequently. A linked list would take up more space and perform worse for many operations. Not to mention that it would require a memory allocation for every new element.
Abstraction is an emphasis on the idea, qualities and properties rather than the particulars (a suppression of detail). The importance of abstraction is derived from its ability to hide irrelevant details and from the use of names to reference objects. Abstraction is essential in the construction of programs. It places the emphasis on what an object is or does rather than how it is represented or how it works. Thus, it is the primary means of managing complexity in large programs.
The obvious answer is that arrays are more useful when referring to consolidated data, ie, data of specific size and parameters. Linked lists are more useful in creation and allocation of records.and also when you are unaware of the number of records.
- Anonymous July 26, 2011Disadvantage of using an array is that deletion of front element is very expansive whereas in list it can be done in constant time.Advantage of using array is that it is indexable in constant time.