Of course, the index numbers lower than the book being checked out,
don't need to be changed, just the higher numbers.

I like using an array of structs with structure members which can
group all the relevant data together that I want for that book, or
student, etc.

So Books[] might have: title, origLocation, (on the bookshelf),
borrower,  etc. The original location number shouldn't be needed here,
but in practice, it's too important not to have it duplicated.
Especially while coding it up and testing.

Linked lists can be substituted for arrays, if memory is a problem, of
course. The other list or array would have the original index number,
as the value in the current bookshelf number's element.

Since the weak link in this type of organization of the program is so
striking (the index numbers), in practice, it would be preferred to
give each book it's own unique ID number, and forget the "places from
the left", routine. Obviously this is just an exercise with that as a
"monkey wrench", to be worked out, but it's worth keeping in mind for
RL programs.






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to