Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone fix my pseudocode so it will perform as the example given below? This is my pseudocode: define a pointer to record called temp

Can someone fix my pseudocode so it will perform as the example given below?

This is my pseudocode:

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

This is how my pseudocode supposes to work.

  1. Adding a record to an empty list

    For example,

  • uaccountno: 1000
  • uname: Spongebob Squarepants
  • uaddress: 123 Bikini Bottom
  • Heap: No record
  1. Adding a record to a list which has two records (every account number is different form others)

    For example,

  • uaccountno: 1000
  • uname: Spongebob Squarepants
  • uaddress: 123 Bikini Bottom
  • Heap:
    • Record1:
      • accountno: 1200
      • name: Plankton
      • address: 321 Chum Bucket
    • Record2:
      • accountno: 900
      • name: Mr.Krabs
      • address: 231 Krusty Krab
  1. Adding a record to a list that has two records (the second existing record has the same account number as that of the new record)

    For example,

  • uaccountno: 1000
  • uname: Spongebob Squarepants
  • uaddress: 123 Bikini Bottom
  • Heap:
    • Record1:
      • accountno: 1200
      • name: Plankton
      • address: 321 Chum Bucket
    • Record2:
      • accountno: 1000
      • name: Mr.Krabs
      • address: 231 Krusty Krab

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

b. What roles did these ethnic groups have in the show?

Answered: 1 week ago

Question

How is slaked lime powder prepared ?

Answered: 1 week ago

Question

Why does electric current flow through acid?

Answered: 1 week ago

Question

What is Taxonomy ?

Answered: 1 week ago

Question

1. In taxonomy which are the factors to be studied ?

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago