Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use ONLY the following vocabulary: replace the bold parts with your variables an

ID: 3851699 • Letter: U

Question

Use ONLY the following vocabulary:
replace the bold parts with your variables and expressions.

define a datatype called variable_name

example:
define an int called i

copy expression to variable_name
note: the data type of expression must match that of variable_name

example:
copy 100 to i
copy numbers[0] to i
copy i to numbers[i]

while (boolean_expression)
note1: inside a while loop, put 4 white spaces for indents
note2: you CANNOT use a break statement.

example:
while ( i < 10 )
    copy 0 to numbers[i]
    copy i + 1 to i

if (boolean_expression)
note1: inside an if statement, put 4 white spaces for indents
node2: you can use "else".

example:
if ( i < 10 )
    copy 0 to i
else if ( i < 20 )
    copy 10 to i
else
    copy 20 to i

Write the pseudocode of the two functions, addRecord and deleteRecord, to add/delete a record to/from a linked list of records.

Assume the following variables are already defined, initialized and available for you to use:

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

Assume the following struct definition:

    struct record
    {
        int               accountno;
        char              name[25];
        char              address[80];
        struct record*    next;
    };

Requirements:

Write the pseudocode for the following two functions:

addRecord: Must add a record to the end of the linked list of records

deleteRecord: Must delete ALL records (including duplicates) based on the account number

There must be no use of any C code in the algorithm

You may only use the allowed vocabulary from the list below with variations to accommodate different memory locations

The functioning code can be less than 20 lines for each function. Pseudocode with more than 30 lines for each function is not acceptable.

Vocabulary list:

replace the bold parts with your variables and expressions.

define a pointer to record called variable_name

note: you cannot define any other data type.

example:
define a pointer to record called temp

allocate space on the heap and store its address into variable_name

note: variable_name must be a pointer to record.

example:
allocate space on the heap and store its address into temp

release the space whose address is in variable_name

note: variable_name must be a pointer to record.

example:
release the space whose address is in temp

copy from variable_name1 to variable_name2

This copies the value in variable_name1 to variable_name2.
If the variables are character arrays, you can assume you can directly copy the characters.

example:
copy from temp1 to temp2
copy from string1 to string2

field_name in the record whose address is in variable_name

By this expression, you can access a field inside the record.

note1: field_name must be one of the fields in strecut record.
note2: variable_name must be a pointer to record.

example:
copy from name in the record whose address is in temp to val
copy from val to name in the record whose address is in temp

while( variable_name1 is / is not variable_name2 )

note1: inside a while loop, put 4 white spaces for indents
note2: you CANNOT use a break statement.

example:
while( accountno in the record whose address is in temp is 0 )
    ...

while( accountno in the record whose address is in temp is not 0 )
    ...

if( variable_name1 is / is not variable_name2 )

note1: inside an if statement, put 4 white spaces for indents
node2: you can use "else".

example:
if( var is not 0 )
    ...
else
    ...

Explanation / Answer

addRecord()

define a pointer to record called temp

allocate space on the heap and store its address into temp

copy from uaccountno to accontno in record whose address is in temp

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

copy from uaddress to address in record whose address is in temp

copy null to next in record whose address is in temp

if(start is null)

copy from temp to start

else

define a pointer to record called s

copy from start to s

while(next from record whose address is in s is not null)

copy from next from record whose address is in s to s

copy from temp to next from record whose address is in s

deleteRecord(define an int called accNo)

if(start is not null)

define a record called temp

copy from start to temp

while(next from record whose address is in temp is not NULL)

if(accNo is accountno from record whose address is in start and next from record whose address is in start is NULL)

release the space whose address is in temp

copy NULL to start

else if(accNo is accountno from record whose address is in start)

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

release the space whose address is in temp

else if(accNo is accountno from record whose address is in next)

define a record called temp1

copy from next from record whose address is in temp to temp1

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

release the space whose address is in temp1

else

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote