MCPcopy Create free account
hub / github.com/PengFTang/Algorithms-in-Java / divide

Method divide

Math/Divide.java:25–48  ·  view source on GitHub ↗

Key idea: keep doubling divisor till no larger than dividend, then subtract amplified divisor from dividend till dividend is small than original divisor Example: 121 / 11 11<<1 --> 22<<1 --> 44<<1 --> 88, stop because 88<<1 = 176 > 121. divisor amplified 3 times, thus add 2<<3=8 to the final result

(int dividend, int divisor)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected