You will need your solutions from Problem Set 4.
- Write a linear search which searches the pack from Problem Set 4. Display a randomly generated pack, ask the user what they want to search, and return the Found, or Not Found. All levels of documentation must include the precondition and postcondition of your algorithm.
- Write a binary search program that looks for a number in a list of player stats. Display a list of the 6 stats, then prompt the user which one they want to search for. Your application should print out the remaining data after each pass. All levels of documentation must include the precondition and postcondition of your algorithm.
- Write an insertion sort program that places the character's numerical stats in ascending (smallest to largest) order. Your application should print out the remaining data after each pass. All levels of documentation must include the precondition and postcondition of your algorithm.
- Write a bubble sort program that places the character's numerical stats in order. Your application should print out the remaining data after each pass. All levels of documentation must include the precondition and postcondition of your algorithm.
- Using the following code snip, compare the efficiency of linear and binary searches.
from datetime import datetime
startTime = datetime.now()
#do something
print datetime.now() - startTime
1. Using the aforementioned code snip, compare the efficiency of insertion and bubble sorts.
A3.3C2.2, C2.3