quiz5-questions - EE 322C Data Structures Spring 2009 Quiz...

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

View Full Document Right Arrow Icon
Spring 2009 Quiz 5 Instructor: Ramesh Yerraballi Grader: Vinoth Chandar Due : Wednesday 4/29 in class Total : 100 points 1) Collections.sort(List<T>) method takes any list and sorts it according to the type of objects held in the list. For example, Strings are sorted alphabetically, Integers are sorted by value and Date objects chronologically. [15 points ] a) How is this behavior implemented? b) List<Integer> lst = new ArrayList<Integer>(); Write java code to provide you a sorted list of integers, lst, in the descending order, using the Collections.sort method. [you cannot use the Collections.reverse method] 2) Implement a generic queue class , MyQueue<T> using two stacks [Stack class in the Collections API]. The class should have a default constructor, enqueue method that takes an element as argument and adds it to the end of the queue and dequeue method that removes an element from the front of the queue. [30 points ] An example usage is given below. MyQueue<Integer>
Background image of page 1

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

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

Page1 / 5

quiz5-questions - EE 322C Data Structures Spring 2009 Quiz...

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