Friday, 31 August 2007

Adding an object to a linked list

What do you do when you add an element to a linked list, but that element itself links to other elements?

Before now, I've always ignored the extra links so they get lost but it seemed sort of incomplete. Today I kept them and inserted them into the list at the appropriate point but I'm not entirely sure that's what someone might expect.


Also, php is weird. Why compare two objects based on the values of their attributes rather than whether they are references to the same objects or not?

No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...