The following function implements the find_earnings_by_id function for mini_project_04 where the Leaderboard class supports a sorted, doubly linked list of Node objects that hold information about players and their earnings. As a reminder, the bottom_ pointer points to the player with the LOWEST earnings. double Leaderboard: :find_earnings_by_id (const string& id) const { Node* ptr = this->bottom_; while (ptr != nullptr && ptr->element.getID() != id) { ptr = ptr->prev; } } if (ptr == nullptr) { return -1; } else { return ptr->element.getEarnings(); Assume some code segment in the main function has built a Leaderboard object called esports to contain the following players. The first column shows the IDs for the players. Leaderboard from highest to lowest: $7,172,111.58 $6,480,400.02 down by $691,711.56 $6,004,411.96 down by $475,988.06 $5,773,909.40 down by $230,502.56 $5,226,081.53 down by $547,827.87 Notail JerAx ana Ceb | KuroKy On the following line, write a call to the find_earnings_by_id function that would require LEAST amount of times for the ptr = ptr->prev statement be executed. Would searching for Abby's earnings require more or less times of execution for the ptr = ptr->prev statement than searching for ana's earnings? Why?

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
100%

This is hard help please its from my study guide in C++ LEVEL 2

 

The following function implements the find_earnings_by_id function for
mini_project_04 where the Leaderboard class supports a sorted, doubly linked list of Node
objects that hold information about players and their earnings. As a reminder, the bottom_
pointer points to the player with the LOWEST earnings.
double Leaderboard: :find_earnings_by_id (const string& id) const {
Node* ptr = this->bottom_;
while (ptr != nullptr && ptr->element.getID() != id) {
ptr = ptr->prev;
}
}
if (ptr == nullptr) {
return -1;
} else {
return ptr->element.getEarnings ();
}
Assume some code segment in the main function has built a Leaderboard object called esports
to contain the following players. The first column shows the IDs for the players.
Leaderboard from highest to lowest:
$7,172,111.58
$6,480,400.02 down by $691,711.56
$6,004,411.96 down by $475,988.06
$5,773,909.40 down by $230,502.56
$5,226,081.53
down by $547,827.87
Notail
JerAx
ana
Ceb
KuroKy
On the following line, write a call to the find_earnings_by_id function that would require
LEAST amount of times for the ptr = ptr->prev statement executed.
Would searching for Abby's earnings require more or less times of execution for the ptr =
ptr->prev statement than searching for ana's earnings? Why?
Transcribed Image Text:The following function implements the find_earnings_by_id function for mini_project_04 where the Leaderboard class supports a sorted, doubly linked list of Node objects that hold information about players and their earnings. As a reminder, the bottom_ pointer points to the player with the LOWEST earnings. double Leaderboard: :find_earnings_by_id (const string& id) const { Node* ptr = this->bottom_; while (ptr != nullptr && ptr->element.getID() != id) { ptr = ptr->prev; } } if (ptr == nullptr) { return -1; } else { return ptr->element.getEarnings (); } Assume some code segment in the main function has built a Leaderboard object called esports to contain the following players. The first column shows the IDs for the players. Leaderboard from highest to lowest: $7,172,111.58 $6,480,400.02 down by $691,711.56 $6,004,411.96 down by $475,988.06 $5,773,909.40 down by $230,502.56 $5,226,081.53 down by $547,827.87 Notail JerAx ana Ceb KuroKy On the following line, write a call to the find_earnings_by_id function that would require LEAST amount of times for the ptr = ptr->prev statement executed. Would searching for Abby's earnings require more or less times of execution for the ptr = ptr->prev statement than searching for ana's earnings? Why?
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