Question
In python Implement a class named SequentialStringList. In this class implement a method called add, that when given a string, it adds it to an
In python Implement a class named SequentialStringList. In this class implement a method called add, that when given a string, it adds it to an internal list object. You can use the list object from the standard python library for the internal list. Next, implement a find method that takes a string as the argument. Implement the find method using sequential search. If the string is found return it, if not, return None. Create another class called BinaryStringList, that implements the same methods but uses a binary search as the implementation for find. Create a test program called sequential_test.py. Create an instance of your SequentialStringListand add 20 strings to it. Create a timeit test using one of the words in the list and the find method and another timeit test using a word not in the list and the find method. Create another test program called binary_test.py and perform the same tests.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started