Co-Sequential Processing - Coggle Diagram
What has to be set up for the main loop to work correctly?
- Getting the next item on each list.
Progress of access in the lists should be coordinated
- Handling End-Of-File conditions
For a match, processing can stop when the end of any list is reached.
- Recognizing Errors
Items out of sequence can "break" the synchronization.
- Initialize (open the input and output files.)
- Get the first item from each list.
- While there is more to do:
3.1: Compare the current items from each list.
3.1.1: If the items are equal,
3.1.2: If the item from list A is less than the item from list B,
Process the item.
Get the next item from each list.
Set more to true iff none of this lists is at end of file.
3.1.3: If the item from list A is more than the item from list B,
Get the next item from list A.
Set more to true iff list A is not at end-of-file.
Get the next item from list B.
Set more to true iff list B is not at end-of-file.
- Finalize (close the files.)