assignment1

assignment1 - Fall 2011 CMSC 420 Samet ASSIGNMENT NUMBER 1...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Fall 2011 CMSC 420 Samet ASSIGNMENT NUMBER 1 1. In the lecture we showed how two stacks can be made to share one segment of memory when using sequential allocation. Can you do the same for two queues, or a queue and a stack? If not, explain why. 2. Give all the possible ways of topologically sorting the set of relations A<B , F<B , D<B , G<F , G<E , E<D , F<D , E<C , D<C , B<C . 3. The algorithm we described in class for implementing the topological sort makes use of a queue to keep track of the nodes whose PRED COUNT field has become zero and hence are ready to be output. Recall that these are the nodes whose direct successors have not yet been output. Can you use a stack instead of a queue? Give such an algorithm using pseudocode. 4. Suppose that ptr1 and ptr2 point to the last elements of disjoint circular lists l 1 and l 2 , respectively. The lists l 1 and l 2 are interpreted as having their elements to the left of ptr1 and ptr2 , respectively. In other words, NEXT(ptr1) and NEXT(ptr2)...
View Full Document

Page1 / 2

assignment1 - Fall 2011 CMSC 420 Samet ASSIGNMENT NUMBER 1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online