Question: Please fix my Pseudocode . Thanks! -------------------------------------------------------------------------------- addRecord *** Assume the following variables are already defined. *** - start: The pointer to the first record

Please fix my Pseudocode. Thanks!

-------------------------------------------------------------------------------- addRecord

*** Assume the following variables are already defined. ***

- start: The pointer to 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 -------------------------------------------------------------------------------- define a pointer to record called temp allocate a heap space and store its address into temp

/* Allows user's account number to be stored in the record, else it would look if the address match a previous address by copying addresses in start and temp to avoid duplicates */

if( start is not equal to NULL ) if( uaccountno is not equal to accountno in the record whose address is in temp)

copy from uaccountno to accountno in the record whose address is in temp

copy from uname to name in the record whose address is in temp

copy from uaddress to address in the record whose address is in temp copy from NULL to next in the record whose address is in temp

else

copy from accountno in the record whose address is in start to accountno in the record whose address is in temp

copy from name in the record whose address is in start to name in the record whose address is in temp

copy from address in the record whose address is in start to address in the record whose address is in temp

copy from next in the record whose address is in start to next in the record whose address is in temp

/* head points to temp in the linked list whose accountno is either equal or smaller to uaccountno, and tail points to temp just before head. This way we get the linked list sorted */

define a pointer to record call head copy from start to head

define a pointer to record called tail copy from NULL to tail

while ( accountno in the record whose address is in head is greater to uaccountno )

copt from head to tail

copy from next in the record whose address is in head to head

copy from next in record whose address is in tail to next in the record whose address is in temp

copy from temp to next in the record whose address is in tail

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!