IsolateTargetSoloAsTail

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Your Tasks
  Read the description thoroughly and carefully to understand exactly what IsolateTargetSoloAsTail is meant to do and the IMPORTANT requirements you must meet when implementing the function.
  Fill in the prototype for IsolateTargetSoloAsTail in the supplied header file (llcpInt.h).
  Fill in the definition for IsolateTargetSoloAsTail in the supplied implementation file (llcpImp.cpp).

●If node target cannot be found on the given list, a new node containing target is created and added to the end (made the new tail node) of the list.

●If target appears only once on the given list, the target-matching node is moved to the end (made the new tail node) of the list.

If target appears multiple times on the given list, the first target-matching node is moved to the end (made the new tail node) of the list, and all other target-matching nodes are to be deleted from the list.

The order in which non-target-matching nodes originally appear in the given list must be preserved

7890103
11
12
14
15
16
17
18
19
26 21 22 23 24 25 25 27 28 29 30 1 2 3 34 35 3678 39 40
20
26
27
31
32
33
// definition of Isolate TargetSoloAs Tail of Assignment 5 Part 1
41
int FindList Length (Node* headPtr)
int length = 0;
{
{
while (headPtr != 0)
{
36 {
}
}
bool
return length;
++length;
headPtr headPtr->link;
}
void
Is Sorted Up (Node* headptr)
if (headptr == 0 ||headPtr->link
return true;
while (headPtr->link != 0) // not at last node
{
}
return true;
==
8) // empty or 1-node
if (headPtr->link->data <headPtr->data)
return false;
headPtr headPtr->link;
InsertAsHead (Node*& headPtr, int value)
Node *newNodePtr = new Node;
newNodePtr->data = value;
newNodePtr->link = headPtr;
headPtr = newNodePtr;
Transcribed Image Text:7890103 11 12 14 15 16 17 18 19 26 21 22 23 24 25 25 27 28 29 30 1 2 3 34 35 3678 39 40 20 26 27 31 32 33 // definition of Isolate TargetSoloAs Tail of Assignment 5 Part 1 41 int FindList Length (Node* headPtr) int length = 0; { { while (headPtr != 0) { 36 { } } bool return length; ++length; headPtr headPtr->link; } void Is Sorted Up (Node* headptr) if (headptr == 0 ||headPtr->link return true; while (headPtr->link != 0) // not at last node { } return true; == 8) // empty or 1-node if (headPtr->link->data <headPtr->data) return false; headPtr headPtr->link; InsertAsHead (Node*& headPtr, int value) Node *newNodePtr = new Node; newNodePtr->data = value; newNodePtr->link = headPtr; headPtr = newNodePtr;
#ifndef ASSIGN05P1_H
#define ASSIGN05P1_H
#include <iostream>
struct Node
{
};
int data;
Node *link;
int
FindList Length (Node* headptr);
bool IsSortedUp (Node* headptr);
void
void
void
bool
InsertAsHead (Node*& headPtr, int value);
InsertAsTail (Node*& headPtr, int value);
InsertSortedUp (Node*& headPtr, int value);
DelFirstTargetNode (Node*& headPtr, int target);
DelNodeBefore1st Match (Node*& headPtr, int target);
ShowAll (std::ostream& outs, Node* headptr);
bool
void
void FindMinMax (Node* headPtr, int& minValue, int& maxValue);
double FindAverage (Node* headptr);
void ListClear (Node*& headPtr, int noMsg = 0);
// prototype of Isolate TargetSoloAsTail of Assignment 5 Part 1
#endif
Transcribed Image Text:#ifndef ASSIGN05P1_H #define ASSIGN05P1_H #include <iostream> struct Node { }; int data; Node *link; int FindList Length (Node* headptr); bool IsSortedUp (Node* headptr); void void void bool InsertAsHead (Node*& headPtr, int value); InsertAsTail (Node*& headPtr, int value); InsertSortedUp (Node*& headPtr, int value); DelFirstTargetNode (Node*& headPtr, int target); DelNodeBefore1st Match (Node*& headPtr, int target); ShowAll (std::ostream& outs, Node* headptr); bool void void FindMinMax (Node* headPtr, int& minValue, int& maxValue); double FindAverage (Node* headptr); void ListClear (Node*& headPtr, int noMsg = 0); // prototype of Isolate TargetSoloAsTail of Assignment 5 Part 1 #endif
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY