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

Assignment Help:

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.


Related Discussions:- Write a procedure that produces independent stack

State flowchart that take temperature input using pseudocode, Write an algo...

Write an algorithm using pseudocode which takes temperatures input over a 100 day period (once per day) and output the number of days when the temperature was below 20C and the num

Psedocodes, write a pseudocode to input the top speed (in km''s/hours) of 5...

write a pseudocode to input the top speed (in km''s/hours) of 5000 cars output the fastest speed and the slowest speed output the average (mean) speed of all the 5000 cars answers

Illustrate an example of algorithm, Illustrate an example of algorithm ...

Illustrate an example of algorithm Consider that an algorithm is a sequence of steps, not a program. You might use the same algorithm in different programs, or express same alg

Doubly linked list, How does operations like insertion, deletion occur?

How does operations like insertion, deletion occur?

Diophantine Equations, Implement algorithm to solve 5-1 fifth order equati...

Implement algorithm to solve 5-1 fifth order equation given.

Tic Tac Toe game , Book to refer: Introduction to Algorithms, 3rd Ed, by Cl...

Book to refer: Introduction to Algorithms, 3rd Ed, by Clifford Stein, Thomas H. Cormen, Ronald Rivest, Charles E. Leiserson Question: Tic Tac Toe game -Design a GUI and implement

Demonstration of polynomial using linked list, Demonstration of Polynomial ...

Demonstration of Polynomial using Linked List # include # include Struct link { Char sign; intcoef; int expo; struct link *next; }; Typedefstruct link

What are stored and derived attributes, What are stored and derived attribu...

What are stored and derived attributes?  Stored attributes: The attributes kept in a data base are called stored attributes.  Derived attributes: The attributes that are

Bst created in pre- order, Q. Make a BST for the given sequence of numbe...

Q. Make a BST for the given sequence of numbers. 45,32,90,34,68,72,15,24,30,66,11,50,10 Traverse the BST formed in  Pre- order, Inorder and Postorder.

Road transport booking system, what algorithms can i use for the above titl...

what algorithms can i use for the above title in my project desing and implmentation of road transport booking system

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd