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

IN PYTHON CODE: Class Node: def __init__(self,initdata): self.data = initdata se

ID: 3588439 • Letter: I

Question

IN PYTHON CODE:

Class Node:

                         def __init__(self,initdata):

                               self.data = initdata

                               self.next = none

                   Class OrderedList:

                          def __init__(self):

                                self.head = None

For an ordered linked-list, write an algorithm called count which will count the number of occurrences of a specific piece of data. First, you have to create the linked list using the following input (note: this should be an ordered list - how will we do this?).

2, 5, 10, 14, 18, 23, 23, 23, 25, 26, 29, 31, 35, 37.

Remember to count the duplicates.

Explanation / Answer

import hashlib def hash_file(filename): """"This function returns the SHA-1 hash of the file passed into it""" # make a hash object h = hashlib.sha1() # open file for reading in binary mode with open(filename,'rb') as file: # loop till the end of the file chunk = 0 while chunk != b'': # read only 1024 bytes at a time chunk = file.read(1024) h.update(chunk) # return the hex representation of digest return h.hexdigest() message = hash_file("track1.mp3") print(message)