Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi there 9.14 LAB: Finding the first and last occurrence of a value (doubly-linked list) Given main.py and a PersonNode class, complete the PersonList class

Hi there

9.14 LAB: Finding the first and last occurrence of a value (doubly-linked list)


Given main.py and a PersonNode class, complete the PersonList class by writing find_first() and find_last() methods at the end of the PersonList.py file. The find_first() method should find the first occurrence of an age value in the linked list and return the corresponding node. Similarly, the find_last() method should find the last occurrence of the age value in the linked list and return the corresponding node. For both methods, if the age value is not found, None should be returned. The program will replace the name value of each found node with a new name.

Ex. If the input is:

Alex 23    Tom 41    Michelle 34    Vicky 23    -1    23    Connor    34    Michela

the output is:

List before replacing:    Alex, 23    Tom, 41    Michelle, 34    Vicky, 23        List after replacing the first occurrence of 23:    Connor, 23    Tom, 41    Michelle, 34    Vicky, 23        List after replacing the last occurrence of 34:    Connor, 23    Tom, 41    Michela, 34    Vicky, 23I need assistance with the below question.

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

Discovering Advanced Algebra An Investigative Approach

Authors: Jerald Murdock, Ellen Kamischke, Eric Kamischke

1st edition

1559539844, 978-1604400069, 1604400064, 978-1559539845

More Books

Students also viewed these Programming questions

Question

Do women lead differently than men?

Answered: 1 week ago