Question: Imagine, CCSF started students' IDs beginning 1 0 0 0 0 . In other words, CCSF gave her very first student the ID , 1
Imagine, CCSF started students' IDs beginning In other words, CCSF gave her very first student the ID and the next student and so on CCSF stores this student data sequentially in a table as more and more students enroll. Given a single column table of CCSF students IDs as a list, and a given student ID to search, write an algorithm to search for the record row number of the record of a student with a given ID
Do the following:
For simplicity, assume CCSF stores all the ID data sequentially in a list
Workout few examples with a list with few earliest students
Thrive to derive the most efficient algorithm
Write your algorithm as a numbered list as code comments in your program points
Analyze your algorithm for both the running time and the space memory Write your analysis as code comments. You may assume list index access operation takes a constant amount of time. Express your analysis as a function of the length, n of the list. Write it as a code comment in your program. Please watch these videos for how we can do this points
Implement your algorithm as a Python function named searchid and test it out for the idlist for looking up the id in the main program points # Below is the standard way we write complete applications in Python. Notice the major components. Please follow inline instructions.
# Below is the standard way we write complete applications in Python. Notice the major components. Please follow inline instructions.
# Import random module below
# Your plan algorithm should go below
def searchid: # You must pass the correct inputs as parameters. Make sure to collect those parameters in your main
Write your function Docstring here' # Function docstring says what it does.
# Make sure to return your result, don't print
# We use main program to use, test our solution. Sometimes we call it the client or the driver program.
def main:
# collect the input here from the user not from the function.
# Make sure to use a while loop appropriately to call your function as long as user needs
# Code below simply runs the main Don't worry we will soon learn about this syntax.
if namemain:
# call main here
# A copy of your output goes below
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
