What code can be added

Assignment Help Computer Engineering
Reference no: EM132155903

Use C++

The ADT UnsortedType List function ‘DeleteItem(ItemType item)' creates an endless loop error when trying to delete a word or key that is not in the list.

Example: Delete the word "letter" from the unsorted list.

Here are the lists contents before the DeleteItem(ItemType item) call:

super formula travel free thick Josephine Clara education

The question is ‘how can I exit gracefully from the DeleteItem(itemType Item) call when the word or key is not in the unsorted list and not get an endless loop but instead printing out a message that the word ‘letter' is not in the loop? What code can be added?

void UnsortedType::DeleteItem(ItemType item)

{

NodeType* location;

NodeType* tempLocation;

location = listData;

if (item.ComparedTo(location->info) == EQUAL)

{

tempLocation = location;

listData = listData->next;

}

else

{

while (!((item.ComparedTo((location->next)->info) == EQUAL)))

location = location->next;

tempLocation = location->next;

location->next = (location->next)->next;

}

delete tempLocation;

length--;

}

Reference no: EM132155903

Questions Cloud

A sample of 18 widgets has a mean : A sample of 18 widgets has a mean of 37.300 and standard division 8.150. At 99% confidence, the upper limit with 3 decimal places is?
To check a hamming code for a single-bit error : The program checks a Hamming code for a single-bit error based on choosing from a menu of choices.
Find the mean for the number of people : About 8% of the population has a particular genetic mutation. 900 people are randomly selected.
What is the probability that at least 3 of the 5 trees : What is the probability that at least 3 of the 5 trees that he measures are really Douglas-firs?
What code can be added : The ADT UnsortedType List function ‘DeleteItem(ItemType item)' creates an endless loop error when trying to delete a word or key that is not in the list.
Confidence interval for the true proportion : Construct a 95% confidence interval for the true proportion, mean, of Phantol users who got relief from using the drug.
How many would you expect to weigh between 3 and 8 pounds : The weights for newborn babies is approximately normally distributed with a mean of 5.5 pounds and a standard deviation of 1.1 pounds.
Modify the classify numbers programming : Data to the program is input from a file of an unspecified length; that is, the program does not know in advance how many numbers are in the file.
What is the efficiency rating : The expected value with no survey is $62,000 and the EVPI is $4,000. What is the efficiency rating?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd