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

Method main

java/Chapter 3/Question3_6/Question.java:72–91  ·  view source on GitHub ↗
(String [] args)

Source from the content-addressed store, hash-verified

70 }
71
72 public static void main(String [] args) {
73 for (int k = 1; k < 100; k++) {
74 c = 0;
75 Stack<Integer> s = new Stack<Integer>();
76 for (int i = 0; i < 10 * k; i++) {
77 int r = AssortedMethods.randomIntInRange(0, 1000);
78 s.push(r);
79 }
80 s = mergesort(s);
81 int last = Integer.MAX_VALUE;
82 while(!s.isEmpty()) {
83 int curr = s.pop();
84 if (curr > last) {
85 System.out.println("Error: " + last + " " + curr);
86 }
87 last = curr;
88 }
89 System.out.println(c);
90 }
91 }
92}

Callers

nothing calls this directly

Calls 5

randomIntInRangeMethod · 0.95
pushMethod · 0.95
mergesortMethod · 0.95
isEmptyMethod · 0.95
popMethod · 0.95

Tested by

no test coverage detected