benchmarks.wiki / Public workspace

MMLU / A programmer is deciding between using a linear or binary search to find a…

Problem

Answer published by the source. Consult the official source to check your work against its answer.

question

A programmer is deciding between using a linear or binary search to find a target value in a sorted list. Which of the following is true?

choices

  1. In all cases, a binary search of a sorted list requires fewer comparisons than a linear search.
  2. Generally, the advantage of using a binary search over a linear search increases as the size of the list increases.
  3. A linear search will generally run faster than a binary search because a linear search requires fewer lines of code to implement.
  4. Using a linear search is preferable to using a binary search if there is a chance that the target may not be found in the list.

subject

high_school_computer_science

Discussion

Discussion

No discussion posts on this page yet. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

Source and history

Official source

initial import