16. Graph Implementation
16
Conclusion : Adjacency List
When stretching the edge from A to B :
Array[A].add(B)
※Add…Methods to add the right element to the list on the left
21. What is a Segment-Tree ?
21
Parent
ChildChild
A graph in which all of the
formulas 1 and 2 are satisfied!
22. What is a Segment-Tree ?
22
Example
3 48 1
11 5
16
Sum
SumSum
23. What is a Segment-Tree ?
23
Example
3 48 1
11 5
16
intervals
Fast calculation of total intervals.
8 + 3 + 4 = 11 + 4
O(N) -> O(log N)
(N := number of elements)
O(x) ... Bachmann-Landau O-notation
Sum
SumSum
25. Compare - Condition
25
computer performance
CPU 3.1 GHz dual core Intel Core i5
Memory 8 GB 2133 MHz LPDDR3
user function
normal Coding with the stupid way.
segTree Coding with the Segment-Tree.
assertion Checking the output.
measurement program
testcase https://judgedat.u-aizu.ac.jp/testcases/DSL_2_B/20/in
28. Conclusion
▰ All events are on the graph.
▰ Graphs can be easily handled
on a computer.
▰ It is possible to speed up certain
operations with a graph.
28
29. Conclusion
▰ All events are on the graph.
▰ Graphs can be easily handled
on a computer.
▰ It is possible to speed up certain
operations with a graph.
29
30. Conclusion
▰ All events are on the graph.
▰ Graphs can be easily handled
on a computer.
▰ It is possible to speed up certain
operations with a graph.
30
That's all, Thanks!