Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 ...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions