Writing append and search methods (singly-linked list) Given main.py and a Node class in Node.py, complete the LinkedList class in LinkedList.py by writing the append() and search() methods. The search() method should return the Node whose data value matches a given key, and None if the key is not found. The search() method should also set the position of each Node searched in the LinkedList, starting with 1. Ex: If the input is: 12 23 59 37 923 2 12 the output is: 12 found in list at position 1. If the input is: 12 23 59 37 923 2 68 the output is: 68 not found in list.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18SA
icon
Related questions
Question

python 

8.7 LAB: Writing append and search methods (singly-linked list)
Given main.py and a Node class in Node.py, complete the LinkedList class in LinkedList.py by writing the append() and search() methods. The search() method should return the Node whose data value matches a given key, and None if the key is not found. The search() method should also set the position of each Node searched in the LinkedList, starting with 1.

Ex: If the input is:

12 23 59 37 923 2
12
the output is:

12 found in list at position 1.
If the input is:

12 23 59 37 923 2
68
the output is:

68 not found in list.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Operations of Linked List
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning