-
Notifications
You must be signed in to change notification settings - Fork 0
/
plots.R
42 lines (36 loc) · 1.6 KB
/
plots.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
library(xtable)
options(scipen = 999)
y_avl_i = c(1, 16, 231, 349, 520, 785, 987, 1220, 1446, 1726, 1996, 2195)
y_rb_i = c(0, 6, 84, 192, 354, 430, 567, 708, 837, 1000, 1125, 1311)
y_splay_i = c(4, 21, 220, 466, 807, 1036, 1346, 1644, 1957, 2296, 2615, 2962)
x_i = c(1000, 10000, 1:10 * 100000)
jpeg('insertion_plot.jpg')
plot(x_i, y_avl_i, ylim=c(0, 3000), xlab = "nº of insertions", ylab = "time(ms)")
points(x_i, y_avl_i, col='Blue', pch = 1)
points(x_i, y_rb_i, col='Red', pch = 2)
points(x_i, y_splay_i, col='Green', pch = 3)
dev.off()
y_avl_l = c(0, 2, 35, 77, 195, 279, 393, 513)
y_rb_l = c(0, 2, 32, 72, 168, 266, 372, 497)
y_splay_l = c(0, 2, 41, 99, 212, 355, 506, 672)
x_l = c(500, 5000, 50000, 1:5 * 100000)
jpeg('lookup_plot.jpg')
plot(x_l, y_avl_l, ylim=c(0, 1000), xlab = "nº of lookups", ylab = "time(ms)")
points(x_l, y_avl_l, col='Blue', pch = 1)
points(x_l, y_rb_l, col='Red', pch = 2)
points(x_l, y_splay_l, col='Green', pch = 3)
dev.off()
y_avl_r = c(0, 4, 82, 191, 430, 724, 999, 1272)
y_rb_r = c(0, 6, 57, 111, 243, 380, 544, 706)
y_splay_r = c(0, 12, 155, 334, 746, 1196, 1664, 2172)
x_r = c(500, 5000, 50000, 100000, 200000, 300000, 400000, 500000)
jpeg('removal_plot.jpg')
plot(x_r, y_avl_r, ylim=c(0, 3000), xlab = "nº of removals", ylab = "time(ms)")
points(x_r, y_avl_r, col='Blue', pch = 1)
points(x_r, y_rb_r, col='Red', pch = 2)
points(x_r, y_splay_r, col='Green', pch = 3)
dev.off()
ratios <- matrix(c(1.090, 1.424, 1.217, 1.077, 1.547, 1.218, 1.292, 3.450, 2.481),ncol=3,byrow=TRUE)
colnames(ratios) <- c("Min", "Max", "AVG")
rownames(ratios) <- c("AVL", "RB", "Splay")
ratios <- as.table(ratios)