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

Hashing and five popular hashing functions, Q. Explain the term hashing? Ex...

Q. Explain the term hashing? Explain any five well known hash functions.                         Ans: Hashing method provides us the direct access of record from the f

Implementation of queue by using a single linked list, Q. Perform implement...

Q. Perform implementation of a queue using a singly linked list L. The operations INSER and DELETE should take O (1) time.

Sparse matrix, How sparse matrix stored in the memory of a computer?

How sparse matrix stored in the memory of a computer?

Standard ways of traversing a graph, Q. Which are the two standard ways of ...

Q. Which are the two standard ways of traversing a graph?  Explain them with an example of each.  Ans:   T he two ways of traversing a graph are written below

State the range of operation of abstract data type, State the range of oper...

State the range of operation of ADT Operations of the Range of T ADT includes following, where a, b ∈ T and r and s are values of Range of T: a...b-returns a range value (an

Determine the warnock algorithm, Warnock's Algorithm A divide and conqu...

Warnock's Algorithm A divide and conquer algorithm Warnock (PolyList PL, ViewPort VP) If (PL simple in VP) then Draw PL in VP, else Split VP vertically and horiz

Binary tree and binarytree parts, Q. What do you understand by the term Bin...

Q. What do you understand by the term Binary Tree? What is the maximum number of nodes which are possible in a Binary Tree of depth d. Explain the terms given below with respect to

A binary tree in which levels except possibly the last, A binary tree in wh...

A binary tree in which if all its levels except possibly the last, have the maximum number of nodes and all the nodes at the last level appear as far left as possible, is called as

Linked list, write an algorithm for multiplication of two sparse matrices u...

write an algorithm for multiplication of two sparse matrices using Linked Lists

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