a) Write a function to get the value of the
Nth node in a Linked List. [Note: The first (N=1)
item in the list means the item at index 0.] It takes two
parameters: the list or its head, and N. Return False if the list
has fewer than N elements. The Linked List structure supports the
following function.
def getHead(self):
return self.head # it points to a Node
structure
The Node structure supports the following functions.
def getData(self):
return self.data # it returns the value
stored in the Node
def getNext(self):
return self.next # it points to the next
Node
b) Write a function that counts the number of times a given
integer occurs in a Linked List. Assume similar structures as
defined in (1).
a) Write a function to get the value of the Nth node in a Linked List. [Note: The first (N=1) item in the list means the
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
a) Write a function to get the value of the Nth node in a Linked List. [Note: The first (N=1) item in the list means the
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!