MCPcopy Index your code
hub / github.com/careercup/ctci / main

Method main

java/Chapter 5/Question5_7/Question.java:54–67  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

52 }
53
54 public static void main(String[] args) {
55 Random rand = new Random();
56 int n = rand.nextInt(300000) + 1;
57 int missing = rand.nextInt(n+1);
58 ArrayList<BitInteger> array = initialize(n, missing);
59 System.out.println("The array contains all numbers but one from 0 to " + n + ", except for " + missing);
60
61 int result = findMissing(array);
62 if (result != missing) {
63 System.out.println("Error in the algorithm!\n" + "The missing number is " + missing + ", but the algorithm reported " + result);
64 } else {
65 System.out.println("The missing number is " + result);
66 }
67 }
68}

Callers

nothing calls this directly

Calls 2

initializeMethod · 0.95
findMissingMethod · 0.95

Tested by

no test coverage detected