linked list question

BlitzMax Forums/BlitzMax Beginners Area/linked list question

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Could you not just give each element in the list an index field.

and then traverse through them starting from the first link until you find the index of value your looking for.

like
pseudo code ish..
  seach(6,mylist)
  function search(index:int,list)
    if list.id<>index
      search(index:+1,list)
    end if
  end function


Im not doing it all in the above code , I mean im not checking for the next list item pointer or anything but you should be able to get the idea.

its called a traversal and it uses recurtion so im not sure if max can do it, but its worth a shot.

hope it helps if not oh well.