Software Development and Project Management

After a firmware version known to work correctly there are 1,000 commits, and the latest commit has a bug. The bug was introduced by one commit and occurs in every commit after it. When the culprit commit is identified by binary search, as with git bisect, what is the maximum number of times the firmware must be built and tested?

  1. A3
  2. B10
  3. C500
Show answer and explanation

Answer: B. 10

The culprit is one of the 1,000 commits, and each test of the middle commit halves the candidates. Since 2¹⁰ = 1,024 ≥ 1,000, at most 10 tests identify it. Testing one commit at a time from the oldest would take 999 tests in the worst case and about 500 on average, so binary search makes a big difference. To use this method, it is important not to put broken commits on shared branches, so that every commit can be built and tested.

  • A. This uses a base-10 logarithm because 1,000 = 10³. Each test only halves the candidates, so the base is 2.
  • B. Correct. Since 2¹⁰ = 1,024 ≥ 1,000, 10 tests are enough.
  • C. This is close to the average when testing one commit at a time from the oldest; binary search needs far fewer.
Practice this topic Back to topic

Related calculators

Books on Software Development and Project Management Ad

As an Amazon Associate I earn from qualifying purchases.

More Software Development and Project Management questions

  1. In a WBS, which breaks down a project's deliverables and work hierarchically, what is the element at the lowest level, used as the unit for estimating duration and cost and assigning people?
  2. In an arrow diagram with nodes ① to ⑥, the activities, written as 'name: start node → end node, duration', are A: ① → ②, 6 days; B: ① → ③, 4 days; C: ② → ④, 4 days; D: ③ → ⑤, 4 days; E: ④ → ⑥, 2 days; F: ⑤ → ⑥, 3 days; and a dummy activity: ② → ③ (duration 0). What is the shortest duration of the whole project?
  3. A project has the following activities, durations and predecessors: A: 4 days (no predecessor); B: 2 days (none); C: 3 days (A); D: 2 days (B); E: 5 days (C); F: 4 days (C and D); G: 2 days (F). If all other activities start as early as possible, what is the maximum number of days by which the start of activity B can be delayed without extending the total project duration?
  4. A project has the following activities, durations and predecessors: A: 6 days (none); B: 4 days (none); C: 4 days (A); D: 4 days (A and B); E: 2 days (C); F: 3 days (D), and its total duration is 13 days. The extra cost of shortening each activity by one day is ¥300,000 for A, ¥50,000 for B, ¥100,000 for C, ¥200,000 for D, ¥80,000 for E and ¥250,000 for F. Which is the cheapest way to shorten the total project duration by one day?
  5. A three-point estimate of an activity's duration gives an optimistic value of 4 days, a most likely value of 7 days and a pessimistic value of 16 days. What is the expected duration given by the PERT formula?