[go: up one dir, main page]

Skip to content

Efficient Data Structure for the Piet Programming Language, Rollable Stack

License

Notifications You must be signed in to change notification settings

primenumber/piet-rollable-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PietRollableStack

An Efficient Data Structure for the Piet Programming Language

Overview

PietStack supports these ordinal stack operations(see: Stack (abstract data type) - Wikipedia)

  • push(element), which adds an element to the collection
  • pop, which removes the most recently added element that was not yet removed

In addition to that, it supports special operation for Piet programming language:

  • roll(depth, count), which repeats the following operaion count times: burying the top value on the stack depth deep and bringing all values above it up by 1 place
    • Note: when count is negative, which repeats the reverse operation abs(count) times.

Computational Cost

N: length of the stack

operation cost
push amortized O(1)
pop amortized O(1)
roll O(log N)

About

Efficient Data Structure for the Piet Programming Language, Rollable Stack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages