answersLogoWhite

0


Best Answer

Array is always faster to read from disk/access any element in the array is quicker since elements in a array are stored in contiguous location in the memory, you need the pointer to the head or 0th element in the array and then it much quick to navigate to the next on index based. But you need to know INDEX of the element for best results

List (say linked list) will be slower since not always elements are stored in contiguous location in the memory as well it involves a function call which is can be assembler/cpu expensive.

However getting an individual object from an array is faster if you know the index of the object. Walking through a linked list is faster than walking through an array, if you use a non-recursive algorithm.

--Vinay Solanki

User Avatar

Wiki User

16y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

arrays are written in single blocks and is generally used for small set of data.

on the other hand,linked lists are used for large set of data.

so insertion,deletion,sorting of data in array is faster.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Arrays are variables, too.

Accessing array-elements is obviously a bit slower than accessing scalars.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Elements of an array don't access anything, but you can access the elements of an array, example:

int a[10];

a[3]= 7;

a[7]= 2*a[3];

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is faster access the element in an array or in a list?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you use subscripts with an array?

An array is a list of several related elements. You use the subscript to specify which element you want to access. For example, in Java you might have an array called myArray, with 10 elements (numbered from 0 to 9); myArray[3] would access the fourth element in the array. A variable may be used instead of a constant.


An array is a list of data items that all have the same type and the same name?

An array element has the same type as the array name.


What are the merits and demerits of array based implementation over linked implementation?

The merits of an array are that it provides the most compact storage mechanism of any data container, and enables constant-time, random access to that data. The demerits are that insertions and extractions can be costly in terms of performance due to the need to copy/move elements within the array. For large arrays, the cost can become prohibitive. Also, arrays can only be used to store elements of the same type.


Write a program to delete an array element in c?

Enter how many elements you want to enter: 4 Enter the array elements: 10 20 30 40 Enter the location, where you want to delete: 3 Deleted value : 30 The new element list: 10 20 40


Can Array-based lists can never be empty?

It's either an array or it's a list, it cannot be both. However, an empty array is entirely possible: std::vector<int> my_vector; // an empty array my_vector.push_back(42); // an array of 1 element my_vector.push_back(1); // an array of 2 elements my_vector.clear(); // an empty array An empty list is also possible: std::list<int> my_list; // an empty list my_list.push_back(42); // a list of 1 element my_list.push_back(1); // a list of 2 elements my_list.clear(); // an empty list The same thing can be done in C: int* my_array = nullptr; // an empty array my_array = malloc (2*sizeof(int)); // an array of 2 elements my_array[0] = 42; my_array[1] = 1; free my_array; // an empty array my_array = 0;

Related questions

How do you use subscripts with an array?

An array is a list of several related elements. You use the subscript to specify which element you want to access. For example, in Java you might have an array called myArray, with 10 elements (numbered from 0 to 9); myArray[3] would access the fourth element in the array. A variable may be used instead of a constant.


An array is a list of data items that all have the same type and the same name?

An array element has the same type as the array name.


Difference between vector and array list?

Vectors are thread safe but array lists are not. Hence array lists are faster than Vectors.


What is an error in java?

An error or more commonly known as an Exception is a situation where the java program behaves in a way it is not supposed to do so. It is a problem in the code that is causing the JVM to terminate or throw error messages in the console. Ex: When you initialize an array list with 10 elements and try to access the 11th element in the array list you will get an array index out of bounds exception.


What are the merits and demerits of array based implementation over linked implementation?

The merits of an array are that it provides the most compact storage mechanism of any data container, and enables constant-time, random access to that data. The demerits are that insertions and extractions can be costly in terms of performance due to the need to copy/move elements within the array. For large arrays, the cost can become prohibitive. Also, arrays can only be used to store elements of the same type.


Write a program to delete an array element in c?

Enter how many elements you want to enter: 4 Enter the array elements: 10 20 30 40 Enter the location, where you want to delete: 3 Deleted value : 30 The new element list: 10 20 40


Can Array-based lists can never be empty?

It's either an array or it's a list, it cannot be both. However, an empty array is entirely possible: std::vector<int> my_vector; // an empty array my_vector.push_back(42); // an array of 1 element my_vector.push_back(1); // an array of 2 elements my_vector.clear(); // an empty array An empty list is also possible: std::list<int> my_list; // an empty list my_list.push_back(42); // a list of 1 element my_list.push_back(1); // a list of 2 elements my_list.clear(); // an empty list The same thing can be done in C: int* my_array = nullptr; // an empty array my_array = malloc (2*sizeof(int)); // an array of 2 elements my_array[0] = 42; my_array[1] = 1; free my_array; // an empty array my_array = 0;


How do you write a quick sort program using linked list and recursive methods?

Although you can quicksort a linked list in place, the lack of constant-time random-access into the list makes this operation inefficient, particularly if you wish to make use of the median-of-three optimisation when selecting pivots. That is, locating the middle element in a partition of n elements in a list will take O(n/2) time, and that's an unacceptable overhead for a large n due to the sheer number of partitions. The only alternative is to use the first or last element when selecting a pivot as those are the only two elements you have constant time access to. However, if memory is not an issue, you can easily construct a parallel array of bi-directional iterators into the list with a single traversal, taking O(n) time. Once you have an array of iterators you can efficiently sort it. You then have the option of using the array to access the list in sorted order or you can traverse the array to reconstruct the list, extracting each element in turn and pushing it to the end of the list. Thus the total overhead is O(n*2) time.


How do you use push operation in stack give the exampale of the program?

A stack can be implemented as an array or a list. If an array, simply push the new element onto the end of the array. If a list, point the new node at the head node then make the new node the new head of the list.


Index of an element in array?

An array is a group of related elements, with a common variable name. The index is a number that indicates the position of an element within an array: the 1st. element, the 2nd. element, etc. (many languages start counting at zero).


C plus plus array-based lists?

If you mean an array where each element is a list, then the STL is your friend. To create an array of lists of any type T, use the following declaration: std::vector<std::list<T>> my_array_of_lists;


Is it true or false that a dynamically linked list can be accessed both sequentially and randomly?

No. Linked lists require traversal, and are therefore accessed sequentially. For random access you need an array. An array of pointers to the data in your list would do, but you will incur an overhead in creating the array on top of the list.