Author: Nguyen Anh Tuan (gsdt) MIT License
- Supported: add, subtract, multiply, power
- Operator () overloaded, ex: M(1,2) = 12
- Get distance to another point
- Create new circle from three points
- Get center and radius
There are two version:
Usage:
- Contructor: input an matrix to solve.
solve()
: Solve equation
add(pos, value)
: add some value to positionpos
.set(pos, value)
: set a value to positionpos
.sumToPosition(pos)
: get sum from first position topos
.sumOfRage(start_pos, end_pos)
: get sum fromstart_pos
toend_pos
.- operator
[]
: for get data, not for set data. clear()
: remove all data from tree.size()
: get number of element in tree.
Disjoin Set Union (updated: 09:22AM 18/05/2019)
unionSets(a, b)
: join two set has elementa
andb
.findSet(a)
: find root of seta
.isSameSet(a, b)
: test if seta
and setb
is same.getSetSize(a)
: number of element in seta
.
SegmentTree(n)
: create segment tree to managen
element.update(l, r, v)
: increasing value froml
tor
by valuev
.query(l,r)
: query sum froml
tor
.
AdjacencyListGraph(n)
: create graph with n+1 vertex: from 0 to n.addDirectedEdge(startVertex, endVertex, weight = 1)
: add an weighted directed edge.addUndirectedEdge(firstVertex, secondVertex, weight = 1)
: add an weighted undirected edge.showGraph()
: show current graph.shortest(startVertex, endVertext)
: using Dijkstra alogrithm find shortest path between to vertex. Return shorted path and direction. This implementation passed SPOJ