Skip to content

README.md #1024

@mychaizliao

Description

@mychaizliao

Notes

  1. Language used: Python
  2. Compilation:
    i. Make sure that VS code program has been installed and the python extension was inputted
    ii. Create a folder named CC11l_Lab01
    iii. On the same folder, create a file name "main.py"
    iv. Type the code on the file created.
  3. Running the Program: Save the file and click the "Run Python File" button on the right side of the VS code program.

Complexity Notes

  1. In a sentence, justify O(n) time for find_max and linear_search.

    O(n) time is taken on by both the find_max and linear_search because in the worst case, every cell must be examine so the running time grow linearly along with the amount of element.

  2. Is there any case they run faster than O(n) worst-case? (Hint: best-case for search if found at index 0.)

    For the find_max, there's no case that it can run faster than the worst-case because it needs to iterate all the cells in an array to provide a reliable answer. However, there is a possibility to run faster than the worst-case in linear_search as long as the number being search is not on the last cell of the array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions