Mastering data structures in Ruby — Stacks
29-Mar-2019 1897
Stacks are a special kind of linked lists that allow us to efficiently store retrieve data in last in, first out order (LIFO). Or in other words, elements are retrieved in the opposite order they were stored on the stack.As well as it happens with queues, stacks won’t allow us to insert/remove elements at random locations, and just like queues, they are no more than sequences of connected nodes.Stack-based virtual machines like YARV (Ruby’s virtual machine) use stacks to store and eval bytecode instructions.Let’s see the way a stack grows as we store (push) items onto it.
Mastering data structures in Ruby — Stacks #ruby #rubydeveloper #rubyonrails #Mastering #structures #Ruby — Stacks https://rubyonrails.ba/link/mastering-data-structures-in-ruby-stacks