View Single Post
  #2 (permalink)  
Old 11-11-2007, 09:33 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,124
hardwired is on a distinguished road
I guess my basic question is how does the position() mehod work in a unsorted list, and can it work if there is multiple elements in the list with the same data?
Looks like you are inserting a value at an index (position) into the list. If this is so then all you care about is that you can find the position, ie, 0 <= position < lastElement. It shouldn't make any difference what the values on either side are or if there are multiple values.
If you were inserting a value after another value (vis-a-vis poisition), ie,
addBefore(Element E_in_list, Element E)
then you would likely insert it before the first instance of the value ("E_in_list") that you find in the list.
Reply With Quote