![]() Intuitively, peek returns the same value as pop, but does not change the data. The name "peak" is also occasionally found, in the sense of "top, summit", though this also occurs as a spelling error for the verb "peek". Operations on deques have varied names, often "front" and "back" or "first" and "last". "Peek" or "top" are common for stacks, while for queues "front" is common. Double-ended types, such as deques, admit two peeks, one at each end. Single-ended types, such as stack, generally only admit a single peek, at the end that is modified. ![]() Sequential types for which peek is often implemented include: ![]() However, since it is a useful operation and generally easily implemented, it is frequently included in practices, and in some definitions peek is included as basic, with pop (or analog) defined in terms of peek see abstract definition. Peek is generally considered an inessential operation, compared with the more basic operations of adding and removing data, and as such is not included in the basic definition of these data types. The name "peek" is similar to the basic "push" and "pop" operations on a stack, but the name for this operation varies depending on data type and language. It thus returns the same value as operations such as "pop" or "dequeue", but does not modify the data. In computer science, peek is an operation on certain abstract data types, specifically sequential collections such as stacks and queues, which returns the value of the top ("front") of the collection without removing the element from the collection.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |