[Solved] Comp3521 Assignment 1 Binary-Search

$25

File Name: Comp3521_Assignment_1__Binary-Search.zip
File Size: 339.12 KB

SKU: [Solved] Comp3521 Assignment 1 – Binary-Search Category: Tag:
5/5 - (1 vote)

Submit source code and running instructions to EAS[1]. Submit the textual component as a block comment at the top of your code. Do it in Java. Do not use javas search methods! Place textual responses for 2 and 3 in block comments in your code.

Grade: 5%

  1. You have the following array 1,5,17,22,33,37, known to be sorted. Write a program that demonstrates a (log(n)) time or better (in the average case) algorithm to determine if the value 5 is in that array.
    • Make sure your program allows as input on the command-line a comma-separated (free of spaces) list of integers (the above being just an example).
    • As output to stdout, each step along the way, on a single line, indicate what value you checked, followed by the symbol <, > or =. e.g. The last line for this example would be 5= (without the quotes)
    • If the searched for value is not found, the last line should simply be a ! (without the quotes)
  2. In clear, natural language, give the name of your algorithm and explain in a generalized step-wise manner how it can be applied to an arbitrary array when searching for an arbitrary value.
    • This textual response should be no more than 5 lines / 50 words.
  3. In clear, natural language, describe how you would change your algorithm to search over Strings instead of integers.
    • This textual response should be no more than 4 lines / 40 words.

1

[1] https://fis.encs.concordia.ca/eas/

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Comp3521 Assignment 1 Binary-Search
$25