|
Got a question for you programmers out there
|
View this Thread in Original format
| Vaedyn |
Alright heres the current dilema. Right now I have an external txt file filled with Employee data(First name, last name, Id, phone number). What I need to do it put this data (As objects) in order of ID on a linked list.
I know how to put it on a linked list...but I can't see to put it on in order. Can anyone help me?
Thanks,
Vaedyn |
|
|
| tribu |
| quote: | Originally posted by Vaedyn
Alright heres the current dilema. Right now I have an external txt file filled with Employee data(First name, last name, Id, phone number). What I need to do it put this data (As objects) in order of ID on a linked list.
I know how to put it on a linked list...but I can't see to put it on in order. Can anyone help me?
Thanks,
Vaedyn |
When placing each id#, use a loop to place them in order. Sine I dont know what language youre in, Ill try to keep this somewhat general:
You didnt say what order you wanted, so I made it biggest to smallest
DO{
variables:
- CurrentID - The ID youre looking at: Integer?
- CompareID - The ID# youll be comparing
FOR (this counter will count for each item in the list){
If (CurrentId < CompareID) {
Go To next iteration of For Loop
Set Compare ID to the newest ID!
}
Else if (CurrentID > CompareID){
Move everyone from this point of the list down one spot. Current ID, and all its user info gets this newly cleared spot
}
}THIS IS THE END OF THE FOR LOOP
Put anything you want done between checking each ID here
}WHILE theres still text being read from the file.
is this totally crap? I think it would work |
|
|
|
|