Push
Push is an operation that inserts an item into a collection at its defined insertion end, such as the top of a stack or the end of an array.
Fabulous Adventures in Data Structures and Algorithms
Push is a linked-list operation that adds a value to the front of a list and returns the resulting list.
- How it is used
- Uses push to construct immutable linked lists and stacks, prepend values, and build new versions without mutation.
- How deep it goes
- Defines the operation, implements it with a new head and shared tail, and connects it to reversal and covariance.
- Examples
- Uses chained integer pushes, stack versions, list reversal, and animal values pushed through a covariant stack.
- What you can do after
- Build it from scratch in C# as a constant-time immutable prepend operation returning a new list or stack.
Read how Fabulous Adventures in Data Structures and Algorithms explains push →
The Well-Grounded Rubyist, Fourth Edition
Array#push is a Ruby Array method that appends one or more objects to the end of an array.
- How it is used
- Appends objects to an array’s end, including several objects in one operation.
- How deep it goes
- Defines single- and multiple-argument use, contrasting push with << and related array-end methods.
- Examples
- Demonstrates appending one object and appending three objects to arrays containing integers.
- What you can do after
- Apply it via Ruby’s Array API to append one or several objects at an array’s end.
Read how The Well-Grounded Rubyist, Fourth Edition explains push →
Secrets of the JavaScript Ninja, Second Edition
An Array method that appends one or more elements and returns the new length.
- How it is used
- Uses push to append elements to an array’s end and demonstrates reusing it on an array-like object.
- How deep it goes
- Explains end-appending, length changes, relative performance, and borrowing via call, but leaves push’s return value unspecified.
- Examples
- Uses a ninja array to show appending and a browser-element object to demonstrate borrowing push.
- What you can do after
- Apply push to append array elements or invoke Array.prototype.push.call on an object with a length property.
Read how Secrets of the JavaScript Ninja, Second Edition explains push →
Grokking Data Structures
A push method is a stack operation that adds an element to the top of the stack.
- How it is used
- Adds elements to a stack while maintaining its top-based, last-in, first-out interface.
- How deep it goes
- Explains top insertion, linked-list delegation, and optional validation without detailing lower-level storage mechanics.
- Examples
- Uses a pile of dishes, a linked-list wrapper, and rejection of empty strings as concrete illustrations.
- What you can do after
- Build it by forwarding insertion to a linked list and adding domain-specific checks before storage.
Related concepts
- arrayuses · An array is an indexed, ordered collection of elements arranged in one or more dimensions, with elements accessed by position.
- stackpart of · A stack is a data structure that adds and removes elements at one end, following last-in, first-out order.
- concatenationcontrasts with · Concatenation is the operation of combining values or ordered sequences into a single composite, typically preserving their order.
- shiftcontrasts with · Array.prototype.shift is a JavaScript array method that removes and returns the first element, mutating the array.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



