Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For an unordered linked-list, write an algorithm called count which will count t

ID: 3570403 • Letter: F

Question

For an unordered linked-list, write an algorithm called count which will count the number of occurrences of a specific piece of data.

use the node structure and a linked-list structure as shown below:

                   Class Node:

                         def __init__(self,initdata):

                               self.data = initdata

                               self.next = none

                   Class UnorderedList:

                          def __init__(self):

                                self.hed = None

Explanation / Answer

Class Node:

                         def __init__(self,initdata):

                               self.data = initdata

                               self.next = none

                   Class UnorderedList:

                          def __init__(self):

                                self.head = None

def __count__(searchData):
temp = self.head
count = 0
while (temp != none):
   if (temp.data == searchData):
   count = count +1
   temp = temp.next
   return count

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote