Write a procedure that produces independent stack, Data Structure & Algorithms

Write a procedure (make-stack) that produces independent stack

objects, using a message-passing style, e.g.

(define stack1 (make-stack)) 

(define stack2 (make-stack))

Write procedures to manipulate stacks, e.g.

(stack1 'empty?)  ==>  boolean

(stack1 'push! item)  ==> pushes item on top of stack

(stack1 'top)  ==> returns top element of stack,

leaves stack unchanged

(stack1 'pop!) ==> throws away top element of stack

(stack1 'print) ==> prints some representation of the

stack from top to bottom, enclosed in brackets

etc....

Your tests should include making several stacks, pushing on one what is popped from the other, attempts to pop from an empty stack etc.

Also write a procedure to reverse a list by using two stacks.

Posted Date: 3/30/2013 3:39:31 AM | Location : United States







Related Discussions:- Write a procedure that produces independent stack, Assignment Help, Ask Question on Write a procedure that produces independent stack, Get Answer, Expert's Help, Write a procedure that produces independent stack Discussions

Write discussion on Write a procedure that produces independent stack
Your posts are moderated
Related Questions
Program for Linear Search. Program: Linear Search /*Program for Linear Search*/ /*Header Files*/ #include #include /*Global Variables*/ int search; int

implement multiple stacks ina single dimensional array. write algorithams for various stack operation for them.

write an algorithm to insert an element at the beginning of a circular linked list?

Explain about Franklin Algorithm We mentioned how the number of possible comparisons of polygons grows as the square of the number of polygons in the scene. Many of the hidden-

Simulation is the process of making an abstract model of a real world situation in order to be aware of the effect of modifications and alterations and the effect of introducing nu

The maximum degree of any vertex in a simple graph with n vertices is (n-1) is the maximum degree of the vertex in a simple graph.


human resource management project work in c++

state difference between linear and non linear data structure. give one example scenario of each

While BFS is applied, the vertices of the graph are divided into two categories. The vertices, that are visited as part of the search & those vertices that are not visited as part