File tree Expand file tree Collapse file tree 3 files changed +67
-33
lines changed Expand file tree Collapse file tree 3 files changed +67
-33
lines changed Original file line number Diff line number Diff line change 1+ package com .ctci .treesandgraphs ;
2+
3+ /**
4+ * @author rampatra
5+ * @since 2019-03-21
6+ */
7+ public class GraphNode {
8+ }
Original file line number Diff line number Diff line change 1+ package com .ctci .treesandgraphs ;
2+
3+ /**
4+ * @author rampatra
5+ * @since 2019-03-21
6+ */
7+ public class RouteBetweenNodes {
8+ }
Original file line number Diff line number Diff line change 22
33### Basic Operators
44
5- AND:
6- | x | y | x & y |
7- -----------------
8- | 0 | 0 | 0 |
9- | 0 | 1 | 0 |
10- | 1 | 0 | 0 |
11- | 1 | 1 | 1 |
12-
13- OR:
14- | x | y | x | y |
15- -----------------
16- | 0 | 0 | 0 |
17- | 0 | 1 | 1 |
18- | 1 | 0 | 1 |
19- | 1 | 1 | 1 |
20-
21- XOR:
22- | x | y | x ^ y |
23- -----------------
24- | 0 | 0 | 0 |
25- | 0 | 1 | 1 |
26- | 1 | 0 | 1 |
27- | 1 | 1 | 0 |
5+ ** AND:**
6+
7+ | x | y | x ` & ` y |
8+ ----|---|---------|
9+ | 0 | 0 | 0 |
10+ | 0 | 1 | 0 |
11+ | 1 | 0 | 0 |
12+ | 1 | 1 | 1 |
13+
14+ ** OR:**
15+
16+ | x | y | x `| ` y |
17+ | ---| ---| ---------|
18+ | 0 | 0 | 0 |
19+ | 0 | 1 | 1 |
20+ | 1 | 0 | 1 |
21+ | 1 | 1 | 1 |
22+
23+ ** XOR:**
24+
25+ | x | y | x ` ^ ` y |
26+ | ---| ---| ---------|
27+ | 0 | 0 | 0 |
28+ | 0 | 1 | 1 |
29+ | 1 | 0 | 1 |
30+ | 1 | 1 | 0 |
2831
2932
3033### Shifts
3134
32- 1 . Left Shift (<<):
35+ #### 1. Left Shift (<<):
36+
37+ 1 << 3 = 8
38+
39+ > 00000001 << 3 = 00001000 (only showing 8 bits)
40+
41+ ### 2. Right Shift:
42+
43+ ** Two types:**
44+
45+ ** a. Signed Right Shift (>>):**
46+
47+ 64 >> 2 = 16
48+
49+ > 001000000 >> 2 = 00010000
50+
51+ -64 >> 2 = -16
52+
53+ 111000000 >> 2 = 11110000
54+
55+ ** b. Unsigned Right Shift (>>>):**
3356
34- 1 << 3 = 8
57+ 64 >>> 2 = 16
3558
36- 00000001 << 3 = 00001000 (only showing 8 bits)
59+ 001000000 >>> 2 = 00010000
3760
38- 2 . Right Shift:
61+ -64 >>> 2 =
3962
40- Two types:
41-
42- a. Signed Right Shift (>>):
43-
44- b. Unsigned Right Shift (>>>):
45-
63+ 111000000 >>> 2 = 00010000
4664
You can’t perform that action at this time.
0 commit comments