tutorial07

tutorial07 - CSC2100B CSC2100B DataStructures Tutorial7...

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

View Full Document Right Arrow Icon
CSC 2100B CSC 2100B Data Structures Data Structures Tutorial 7 Tutorial 7  2007 Carmen Lam Email:  kmlam@cse.cuhk.edu.hk Office: SHB 1026
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Q.1 Q.1 Stack: first-in-last-out/last-in-first-out Queue: first-in-first-out s = new Stack_v1(); q = new Queue_v1(); s q
Background image of page 2
3 Q.1 Q.1 Stack: first-in-last-out/last-in-first-out Queue: first-in-first-out s.push(a); s q A
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Q.1 Q.1 Stack: first-in-last-out/last-in-first-out Queue: first-in-first-out s.push(b); s q A B
Background image of page 4
5 Q.1 Q.1 Stack: first-in-last-out/last-in-first-out Queue: first-in-first-out q.enqueue(a); s q A B A
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 Q.1 Q.1 Stack: first-in-last-out/last-in-first-out Queue: first-in-first-out q.enqueue(b); s q A B A B
Background image of page 6
7 Q.1 Q.1 Stack: first-in-last-out/last-in-first-out Queue: first-in-first-out a = s.pop(); s q A A B a = B
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 Q.1 Q.1 Stack: first-in-last-out/last-in-first-out Queue: first-in-first-out b = q.dequeue(); s q A B a = B b = A
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 20

tutorial07 - CSC2100B CSC2100B DataStructures Tutorial7...

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

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