length.rpqueue {rstackdeque} | R Documentation |
Returns the number of elements in an rpqueue.
## S3 method for class 'rpqueue' length(x)
x |
rpqueue to get the length of. |
Runs in O(1) time, as this information is stored seperately and updated on every insert/remove.
a vector of length 1 with the number of elements.
empty
for checking whether an rpqueue is empty.
q <- rpqueue() q <- insert_back(q, "a") print(length(q)) # 1 q <- insert_back(q, "b") print(length(q)) # 2