Double-Ended Stack
Prof. David Stotts
gave the students in his
COMP 290-059
(spring 2002) course an
assignment
to implement a double-ended stack abstract data type in Java using
Extreme Programming
(XP) methodology, particularly pair programming and the
JUnit unit testing tool.
I wrote an implementation in Haskell and
tested it using HUnit, an
adaptation of JUnit for Haskell that I also wrote.
- DES.hs - module defining double-ended stacks
- DESTest.hs - module testing double-ended
stacks
My double-ended stack data type is pure (stateless), as befits a pure
functional programming language such as Haskell.
Yet, O(1) amortized time cost per operation is achieved (with O(n)
overall space cost) without stateful updating.
2002/01/31
Dean Herington
(heringto@cs.unc.edu)