Course Hero Logo

CC2103-MOD-3-ACTIVITY-2.docx - Direction: Answer the...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 3 out of 3 pages.

Direction:Answer the following items (Malik & Nair, 2012).1. Mark the following statements as true or false.a. A linear search of a list assumes that the list is in ascending order.
b. A binary search of a list assumes that the list is sorted.
c. A binary search is faster on ordered lists and slower on unordered lists.
2. Consider the following list:63 45 32 98 46 57 28 100Using the linear search as described in this module, how many comparisons are required to findwhether the following items are in the list? (By comparison, we mean item comparisons)
b. 57 -SIX COMPARISONSc. 63 -ONE COMPARISON
3. Consider the following list:21017454955688592Using the detailed code for binary search as described in this module, how many comparisons arerequired to find whether the following items are in the list? Show the values of left, right and mid andthe number of comparisons after each iteration of the loop.a. 15981109811049
Number not in the listNo. of Iteration: 3b. 49Array = 210174549556885
End of preview. Want to read all 3 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
Aaron Lington
Tags
Harshad number, Green Line, linear search of a list, binary search of a list

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture