You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.Rmd
+13-12Lines changed: 13 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -63,27 +63,28 @@ s$pop()
63
63
64
64
Deque
65
65
```{r}
66
-
s <- deque()
67
-
s$push(1)$pushleft(2)
68
-
s$pop()
66
+
dq <- deque()
67
+
dq$push(1)$pushleft(2)
68
+
dq$pop()
69
69
```
70
70
71
71
Priority Queue
72
72
```{r}
73
-
q <- priority_queue()
74
-
q$push("not_urgent")
75
-
q$push("urgent", priority = 2)
76
-
q$push("not_as_urgent", priority = 1)
77
-
q$pop()
78
-
q$pop()
79
-
q$pop()
73
+
pq <- priority_queue()
74
+
pq$push("not_urgent")
75
+
pq$push("urgent", priority = 2)
76
+
pq$push("not_as_urgent", priority = 1)
77
+
pq$pop()
78
+
pq$pop()
79
+
pq$pop()
80
80
```
81
81
82
82
Dictionary. Comparing to R envrionments, `dict()` does not [leak memory](https://r-lib.github.io/fastmap/#memory-leak-examples) and supports hashing functions and environments.
Copy file name to clipboardExpand all lines: README.md
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,34 +56,35 @@ s$pop()
56
56
Deque
57
57
58
58
```r
59
-
s<- deque()
60
-
s$push(1)$pushleft(2)
61
-
s$pop()
59
+
dq<- deque()
60
+
dq$push(1)$pushleft(2)
61
+
dq$pop()
62
62
#> [1] 1
63
63
```
64
64
65
65
Priority Queue
66
66
67
67
```r
68
-
q<- priority_queue()
69
-
q$push("not_urgent")
70
-
q$push("urgent", priority=2)
71
-
q$push("not_as_urgent", priority=1)
72
-
q$pop()
68
+
pq<- priority_queue()
69
+
pq$push("not_urgent")
70
+
pq$push("urgent", priority=2)
71
+
pq$push("not_as_urgent", priority=1)
72
+
pq$pop()
73
73
#> [1] "urgent"
74
-
q$pop()
74
+
pq$pop()
75
75
#> [1] "not_as_urgent"
76
-
q$pop()
76
+
pq$pop()
77
77
#> [1] "not_urgent"
78
78
```
79
79
80
80
Dictionary. Comparing to R envrionments, `dict()` does not [leak memory](https://r-lib.github.io/fastmap/#memory-leak-examples) and supports hashing functions and environments.
0 commit comments