Results 1 to 1 of 1

Thread: Looking for a data structure that . . .

  1. #1
    Join Date
    May 2007
    Location
    USA
    Posts
    373
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default Looking for a data structure that . . .

    Would anyone know of an array-like data structure that has the following properties that exectute at constant time?

    • Lookup
    • Insertion at the front
    • Insertion at the back


    If this is not possible, I need a structure with random access and fast insertion to at least one of the ends.

    For those who want to know, I'm making a Befunge interpreter in Java using Funge-98 specification.

    Another possibility I had in mind is a list of arrays. Not a 2d array, but perhaps like a ArrayList or LinkedList containing arrays of size X. Basically it would function as a linear array with the benefit of only rewriting "sub"array references rather than the whole deal when expanding, while at the same time being more or less random access. Perhaps this only seems good at a surface level. Either I'll test it or take someone's word.
    Last edited by Trinithis; 12-31-2007 at 09:16 PM.
    Trinithis

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •