Question: Write the pseudocode for the function, addRecord , to add a record to a linked list of records. Assume the following variables are already defined,
Write the pseudocode for the function, addRecord, to add a record to a linked list of records.
Assume the following variables are already defined, initialized, and available for you to use:
- start: A pointer holding the address of the first record of the list (or NULL)
- uaccountno: The user's account number (integer)
- uname: a character array containing the user's name
- uaddress: a character array containing the user's address
Assume you have the following struct definition:
struct record { int accountno; char name[25]; char address[50]; struct record* next; };
The pseudocode must have the following features:
-
Records must be stored in a linked list.
-
The linked list must be sorted in a ascending order of account #.
-
A new record must be inserted to the linked list without breaking the order.
For example, if the list has records with the following account numbers:
950, 980, 1002, 1005, 1010,
and you are going to add a record with 1000, the list will be
950, 980, 1000, 1002, 1005, 1010,
-
The list CANNOT have records with a duplicate account number.
- If there is a duplicate in the list, return -1 at the end.
- Otherwise (so a successful case), return 0.
-
You can ONLY use the vocabulary from the list below
-
Pseudocode is not a standardized language.
-
You MUST NOT write any C code (of course in the pseudocode.
Don't even think of writing C code first and then translating it to pseudocode. It is no point to do it,
-
Functioning pseudocode can be about 30 lines or less. Excessfively long pseudocode may end up with significant point deduction.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
