• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between random access data and sequential acces.

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
what is difference between "random access" data store (such as an array) and sequential access data (such as a linked list)?
I got this doubt while reading difference between AbstractList and AbstractSequentialList, two abstract classes.
Hope somebody will help me..
 
Ranch Hand
Posts: 48
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These terms have more to do with how elements are stored.
Random Access - Is self explanatory in the sense you can access elements without worrying about how they are stored. The cost of accessing the element is always constant(independent of number of elements)
Sequntial Access - You need to traverse a list to access a particular object. Depending on how the elements are stored will affect the way you access it. The cost in this case may vary from 1(case when ur searching for first element) or 'n'(case when ur searching for last element)
Do post ur views if ur still not clear about it
Thanks
 
Greenhorn
Posts: 5
Spring AngularJS Flex
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Citing implementation about them:
With an array, you can use the array index to access any element immediately. This is called random access.
Whereas,
With a linked list, you have to start at the top of the list and then move from node to node until you get to the node you want, which is termed sequential access.

References:
LinkedList Vs Array
Random_Access

Additional read:
java.util.RandomAccess is marker class that is used to indicate that they(Collections) support fast (generally constant time) random access.
 
I'm full of tinier men! And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic