Learn R Programming

rstackdeque (version 1.1.1)

peek_front: Return the data element at the front of an rdeque

Description

Simply returns the data element sitting at the front of the deque, leaving the deque alone.

Usage

peek_front(x, ...)

Arguments

x
rdeque to look at.
...
additional arguments to be passed to or from methods (ignored).

Value

data element at the front of the rdeque.

Details

Runs in $O(1)$ worst-case time.

Examples

Run this code
d <- rdeque()
d <- insert_front(d, "a")
d <- insert_back(d, "b")
e <- peek_front(d)
print(e)
print(d)

Run the code above in your browser using DataLab