Skip to content

Commit f5bc79f

Browse files
authored
Merge pull request #54 from kaitinghh/branch-ORS
Orthogonal Range Searching
2 parents 85ff02c + 05cacf2 commit f5bc79f

File tree

15 files changed

+1047
-2
lines changed

15 files changed

+1047
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Gradle is used for development.
8787
* [Trie](src/main/java/dataStructures/trie)
8888
* [B-Tree](src/main/java/dataStructures/bTree)
8989
* Red-Black Tree (Not covered in CS2040s but useful!)
90-
* Orthogonal Range Searching (**WIP**)
90+
* [Orthogonal Range Searching](src/main/java/algorithms/orthogonalRangeSearching)
9191
* Interval Trees (**WIP**)
9292
5. [Binary Heap](src/main/java/dataStructures/heap) (Max heap)
9393
6. [Disjoint Set / Union Find](src/main/java/dataStructures/disjointSet)

docs/assets/images/1DORS.jpg

112 KB
Loading
80.7 KB
Loading

docs/assets/images/1DORSQuery.jpeg

72.7 KB
Loading

docs/assets/images/2DORS.jpg

110 KB
Loading

docs/assets/images/2DORSQuery.jpg

127 KB
Loading

docs/assets/images/2DORSTrees.jpg

154 KB
Loading

docs/team/profiles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
| Name | Description/About | Website (LinkedIn/GitHub/Personal) | Contributions |
44
|-----------|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
55
| Andre | Aspiring ML engineer. Developing this with wonderful ex-students. | You can find me [here](https://4ndrelim.github.io)! | Team lead |
6-
| Kai ting | Likes algorithms and a committed TA! | [Hi](https://www.linkedin.com/in/kai-ting-ho-425181268/) | Cool sorting and obscure trees! B-Trees, ORS.. |
6+
| Kai Ting | Likes algorithms and a committed TA! | [Linkedin](https://www.linkedin.com/in/kai-ting-ho-425181268/) | Cool sorting and obscure trees! B-Trees, ORS.. |
77
| Changxian | DevOps is right up his alley! | ... | Hashing variants! BTS DevOps - configure Gradle & workflows |
88
| Shu Heng | Interested in ML, aspiring researcher. | No website but here's my [Linkedin](https://www.linkedin.com/in/yeoshuheng), please give me a job :< | CS Fundamentals! Stacks and queues! RB-tree. |
99
| Junneng | Aspiring tech entrepreneur. | [LinkedIn](https://www.linkedin.com/in/soo-jun-neng/) | Binary Search variants, Minimum Spanning Trees! |
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package algorithms.orthogonalRangeSearching;
2+
3+
/**
4+
* This class is the node class for building a range tree.
5+
* @param <T> Generic type of the node class
6+
*/
7+
public class RangeTreeNode<T> {
8+
private T val;
9+
private int height;
10+
private RangeTreeNode<T> left = null;
11+
private RangeTreeNode<T> right = null;
12+
private RangeTreeNode<T> parent = null;
13+
private RangeTreeNode<T> yTree = null;
14+
15+
public RangeTreeNode(T val) {
16+
this.val = val;
17+
}
18+
19+
/**
20+
* Constructor for range tree node
21+
* @param val value of node
22+
* @param left left child of node
23+
* @param right right child of node
24+
*/
25+
public RangeTreeNode(T val, RangeTreeNode<T> left, RangeTreeNode<T> right) {
26+
this.val = val;
27+
this.left = left;
28+
this.right = right;
29+
}
30+
31+
public T getVal() {
32+
return this.val;
33+
}
34+
35+
public int getHeight() {
36+
return this.height;
37+
}
38+
39+
public RangeTreeNode<T> getLeft() {
40+
return this.left;
41+
}
42+
43+
public RangeTreeNode<T> getRight() {
44+
return this.right;
45+
}
46+
47+
public RangeTreeNode<T> getParent() {
48+
return this.parent;
49+
}
50+
51+
public RangeTreeNode<T> getYTree() {
52+
return this.yTree;
53+
}
54+
55+
public void setVal(T val) {
56+
this.val = val;
57+
}
58+
59+
public void setLeft(RangeTreeNode<T> left) {
60+
this.left = left;
61+
}
62+
63+
public void setRight(RangeTreeNode<T> right) {
64+
this.right = right;
65+
}
66+
67+
public void setParent(RangeTreeNode<T> parent) {
68+
this.parent = parent;
69+
}
70+
71+
public void setHeight(int height) {
72+
this.height = height;
73+
}
74+
75+
public void setYTree(RangeTreeNode<T> yTree) {
76+
this.yTree = yTree;
77+
}
78+
79+
@Override
80+
public boolean equals(Object other) {
81+
if (other == this) {
82+
return true;
83+
}
84+
if (!(other instanceof RangeTreeNode)) {
85+
return false;
86+
}
87+
RangeTreeNode<T> node = (RangeTreeNode<T>) other;
88+
return this.val == node.val;
89+
}
90+
91+
@Override
92+
public String toString() {
93+
return String.valueOf(this.val);
94+
}
95+
96+
}

0 commit comments

Comments
 (0)