Let us assume that a particular database program manages a simple mailing list which consists of one record for each person on the list, and a number of fields containing information about each person (their name, address, etc). The program can read in data produced by a word processor provided that data is structured in the following way
Each record to be read must be a single paragraph terminated by a return character, and each field within a record is separated by a tab character. For Example:
Colin Jameson|tab|33Falcon Street|tab|Waverly|tab|NSW|tab|2114|return|
Would be read as one record containing five fields. The end of the data is marked with the # (Hash) character which immediately follows the return ending the last paragraph.
Assuming that there is at least one line of valid data at the start of the input file, describe an algorithm that the program might use to read such data one character at a time and place the information into separate fields and records. The algorithm reports the number of records read when all records have been processed.
The question as said above I'm trying to understand it as to what it's asking from me is it asking for me to create a pseudocode which sorts random details into the form as shown above or to create like a database with everything sorted out? I was given a hint to use a array but I have no idea how.
Question
Occidio
Record separation problem
Let us assume that a particular database program manages a simple mailing list which consists of one record for each person on the list, and a number of fields containing information about each person (their name, address, etc). The program can read in data produced by a word processor provided that data is structured in the following way
Each record to be read must be a single paragraph terminated by a return character, and each field within a record is separated by a tab character. For Example:
Colin Jameson|tab|33Falcon Street|tab|Waverly|tab|NSW|tab|2114|return|
Would be read as one record containing five fields. The end of the data is marked with the # (Hash) character which immediately follows the return ending the last paragraph.
Assuming that there is at least one line of valid data at the start of the input file, describe an algorithm that the program might use to read such data one character at a time and place the information into separate fields and records. The algorithm reports the number of records read when all records have been processed.
The question as said above I'm trying to understand it as to what it's asking from me is it asking for me to create a pseudocode which sorts random details into the form as shown above or to create like a database with everything sorted out? I was given a hint to use a array but I have no idea how.
Link to comment
Share on other sites
11 answers to this question
Recommended Posts