Skip to content

Instantly share code, notes, and snippets.

@joe-crick
Created April 12, 2018 08:45
Show Gist options
  • Save joe-crick/e3b65a2ea035a1672b79f4fe9d5e8c08 to your computer and use it in GitHub Desktop.
Save joe-crick/e3b65a2ea035a1672b79f4fe9d5e8c08 to your computer and use it in GitHub Desktop.
mounted() {
this.segmentTree = new SegmentTree(this.items, true, "bid");
},
methods: {
getSmallestBidFromRange() {
const start = parseInt(this.start);
const end = parseInt(this.end);
this.smallestValue = this.segmentTree.rangeMinQuery(start, end);
},
getSumFromRange() {
const start = parseInt(this.start);
const end = parseInt(this.end);
this.sum = this.segmentTree.rangeSumQuery(start, end).toFixed(2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment