tNode class, define the IndexOf() function to return -1 if not found. rst index after the head node is 0. Et contains:

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question
Please answer in c++
zy Section 19.12-COMP B12: Pro X
YouTube - Broadca..... G Google
= zyBooks
zy Section 19.12-COMP B12: Pro X
learn.zybooks.com/zybook/BAKERSFIELDCOL....
head -> 14 -> 191 -> 22 -> 99
head ->
IndexOf(headNode, 22) returns 2.
Ex: If the list contains:
19.12 Programming Assignment #12
Given the IntNode class, define the IndexOf() function to return the index of parameter
target or -1 if not found.
Note: The first index after the head node is 0.
Ex: If the list contains:
LAB
ACTIVITY
IndexOf(headNode, 22) returns -1.
397756.2436636.qx3zqy7
+
19.12.1: Programming Assignment #12
<
main.cpp
Other bookmar
0/10
V
Transcribed Image Text:zy Section 19.12-COMP B12: Pro X YouTube - Broadca..... G Google = zyBooks zy Section 19.12-COMP B12: Pro X learn.zybooks.com/zybook/BAKERSFIELDCOL.... head -> 14 -> 191 -> 22 -> 99 head -> IndexOf(headNode, 22) returns 2. Ex: If the list contains: 19.12 Programming Assignment #12 Given the IntNode class, define the IndexOf() function to return the index of parameter target or -1 if not found. Note: The first index after the head node is 0. Ex: If the list contains: LAB ACTIVITY IndexOf(headNode, 22) returns -1. 397756.2436636.qx3zqy7 + 19.12.1: Programming Assignment #12 < main.cpp Other bookmar 0/10 V
zyBooks
AB 19.12.1: Programming Assignment #12
ACTIVITY
38 IntNode* IntNode::GetNext() {
39 return this->nextNodePtr;
40
41
42 /* Insert node after this node.
43
Before: this -- next
44
After: this -- node -- next
45 */
46 void IntNode:: InsertAfter (IntNode* newNode) {
47
48
49
50 }
51
IntNode* tempNext = this->nextNodePtr;
this->nextNodePtr = newNode;
newNode->nextNodePtr = tempNext;
52 // Return index of target item
53 int IndexOf(IntNode* headNode, int target) {
/* Type your code here.
54
55
Develop mode Submit mode
E
main.cpp
0/10
Run your program as often as you'd like, before s
input values in the first box, then click Run progr
second box.
Transcribed Image Text:zyBooks AB 19.12.1: Programming Assignment #12 ACTIVITY 38 IntNode* IntNode::GetNext() { 39 return this->nextNodePtr; 40 41 42 /* Insert node after this node. 43 Before: this -- next 44 After: this -- node -- next 45 */ 46 void IntNode:: InsertAfter (IntNode* newNode) { 47 48 49 50 } 51 IntNode* tempNext = this->nextNodePtr; this->nextNodePtr = newNode; newNode->nextNodePtr = tempNext; 52 // Return index of target item 53 int IndexOf(IntNode* headNode, int target) { /* Type your code here. 54 55 Develop mode Submit mode E main.cpp 0/10 Run your program as often as you'd like, before s input values in the first box, then click Run progr second box.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 10 steps with 8 images

Blurred answer
Knowledge Booster
Binary Tree
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT