Skip to content

Commit

Permalink
Merge pull request #54 from kaitinghh/branch-ORS
Browse files Browse the repository at this point in the history
Orthogonal Range Searching
  • Loading branch information
kaitinghh authored Mar 29, 2024
2 parents 85ff02c + 05cacf2 commit f5bc79f
Show file tree
Hide file tree
Showing 15 changed files with 1,047 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Gradle is used for development.
* [Trie](src/main/java/dataStructures/trie)
* [B-Tree](src/main/java/dataStructures/bTree)
* Red-Black Tree (Not covered in CS2040s but useful!)
* Orthogonal Range Searching (**WIP**)
* [Orthogonal Range Searching](src/main/java/algorithms/orthogonalRangeSearching)
* Interval Trees (**WIP**)
5. [Binary Heap](src/main/java/dataStructures/heap) (Max heap)
6. [Disjoint Set / Union Find](src/main/java/dataStructures/disjointSet)
Expand Down
Binary file added docs/assets/images/1DORS.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/1DORSDynamicUpdates.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/1DORSQuery.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/2DORS.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/2DORSQuery.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/2DORSTrees.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/team/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
| Name | Description/About | Website (LinkedIn/GitHub/Personal) | Contributions |
|-----------|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| Andre | Aspiring ML engineer. Developing this with wonderful ex-students. | You can find me [here](https://4ndrelim.github.io)! | Team lead |
| 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.. |
| 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.. |
| Changxian | DevOps is right up his alley! | ... | Hashing variants! BTS DevOps - configure Gradle & workflows |
| 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. |
| Junneng | Aspiring tech entrepreneur. | [LinkedIn](https://www.linkedin.com/in/soo-jun-neng/) | Binary Search variants, Minimum Spanning Trees! |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package algorithms.orthogonalRangeSearching;

/**
* This class is the node class for building a range tree.
* @param <T> Generic type of the node class
*/
public class RangeTreeNode<T> {
private T val;
private int height;
private RangeTreeNode<T> left = null;
private RangeTreeNode<T> right = null;
private RangeTreeNode<T> parent = null;
private RangeTreeNode<T> yTree = null;

public RangeTreeNode(T val) {
this.val = val;
}

/**
* Constructor for range tree node
* @param val value of node
* @param left left child of node
* @param right right child of node
*/
public RangeTreeNode(T val, RangeTreeNode<T> left, RangeTreeNode<T> right) {
this.val = val;
this.left = left;
this.right = right;
}

public T getVal() {
return this.val;
}

public int getHeight() {
return this.height;
}

public RangeTreeNode<T> getLeft() {
return this.left;
}

public RangeTreeNode<T> getRight() {
return this.right;
}

public RangeTreeNode<T> getParent() {
return this.parent;
}

public RangeTreeNode<T> getYTree() {
return this.yTree;
}

public void setVal(T val) {
this.val = val;
}

public void setLeft(RangeTreeNode<T> left) {
this.left = left;
}

public void setRight(RangeTreeNode<T> right) {
this.right = right;
}

public void setParent(RangeTreeNode<T> parent) {
this.parent = parent;
}

public void setHeight(int height) {
this.height = height;
}

public void setYTree(RangeTreeNode<T> yTree) {
this.yTree = yTree;
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof RangeTreeNode)) {
return false;
}
RangeTreeNode<T> node = (RangeTreeNode<T>) other;
return this.val == node.val;
}

@Override
public String toString() {
return String.valueOf(this.val);
}

}
Loading

0 comments on commit f5bc79f

Please sign in to comment.