File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 33 *
44 * 40/4 = 10
55 *
6- * Dd | Dr | Q | T
6+ * dividend | divisor | quotient | temp
77 * 40 | 4 | 1 | 4
88 * 40 | 4 | 2 | 8
99 * 40 | 4 | 4 | 16
1010 * 40 | 4 | 8 | 32
1111 * 40 | 4 | 16 | 64
1212 *
1313 * ===========================
14- * Dd | Dr | Q | T
14+ * dividend | divisor | quotient | temp
1515 * 40 | 4 | 8 | 32
1616 * 8 | 4 | 1 | 4
1717 * 8 | 4 | 2 | 8
1818 *
1919 * ==============
2020 *
21- * Q => 2+8
21+ * quotient => 2+8
2222 *
23- * Q + fn(Dd-T, Dr )
23+ * quotient + fn(dividend-temp, divisor )
2424 *
2525 *
2626 * Base Conditions
2727 * 0/1= return 0;
2828 * 1/0 = return -1;
29- * Dr>Dd = return 0;
30- * Dd === Dr = return 1;
29+ * divisor>dividend = return 0;
30+ * dividend === divisor = return 1;
3131 *
3232 * Runtime complexity: O(logn) since lograthmic scaling.
3333 * Runtime complexity: O(1) since iterative solution
You can’t perform that action at this time.
0 commit comments