Is there any data structure that has the random access feature of an array and the element insertion efficiency of a linked list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Is there any data structure that has the random access feature of an array and the element insertion efficiency of a linked list

Maybe not because I can't find such type of data structure when I do a search.

18th Sep 2019, 3:46 AM
Sonic
Sonic - avatar
7 Answers
+ 4
To be able to access the element at position i without going through previous elements and to be able to insert an element at position j without shifting subsequent elements. Why? Perhaps for computational efficiency and have a high speed of operation.
18th Sep 2019, 3:55 AM
Sonic
Sonic - avatar
+ 4
Dynamic arrays. vector in C, List in C#, ArrayList in Java
18th Sep 2019, 3:58 PM
Rustem Sharipov
Rustem Sharipov - avatar
+ 4
No I don't think so. Every data structure has its own complexity to an algorithm and features which make the algo simpler. As arrays are best for accessing and linked lists for insertion and deletion. Please let me know if there is some data type you're looking for.👍
19th Sep 2019, 7:09 PM
Manoj
Manoj - avatar
+ 2
But why would you want such a data structure?
18th Sep 2019, 3:48 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Did you ever thought about SQL ? This is on my opinion the best option Sonic.
18th Sep 2019, 10:20 AM
🇺🇸 Anatoli🇧🇪🇪🇺 ,
🇺🇸 Anatoli🇧🇪🇪🇺 , - avatar
+ 2
I would say hashtable could match what your are looking for. It is quite efficient for accessing and inserting data.
19th Sep 2019, 10:22 PM
Loïc Mahé
Loïc Mahé - avatar
- 1
Try Ruby!😃
26th Sep 2019, 11:49 AM
Nilavazhagan Ramakrishnan
Nilavazhagan Ramakrishnan - avatar