insert_back.rpqueue {rstackdeque} | R Documentation |
Returns a version of the queue with the new element in the back position.
## S3 method for class 'rpqueue' insert_back(x, e, ...)
x |
rpqueue to insert onto. |
e |
element to insert. |
... |
additional arguments to be passed to or from methods (ignored). |
Runs in O(1) time worst-case. Does not modify the original.
modified version of the rpqueue.
Okasaki, Chris. Purely Functional Data Structures. Cambridge University Press, 1999.
q <- rpqueue() q <- insert_back(q, "a") q <- insert_back(q, "b") print(q) q2 <- insert_back(q, "c") print(q2) print(q)