Assignment 3 Problems

# Assignment 3 Problems - Assignment #3 Due Date: Saturday,...

This preview shows pages 1–3. Sign up to view the full content.

Sheet1 Page 1 Assignment #3 Due Date: Saturday, February 14 at 11:59pm Submit: WebCT Late Policy: -1 point per minute late Instructions: This is an individual assignment. Answers should be your own work. Chapter 3 4 points 1. Explain these data structures: array, linked list, stack, queue. 8 points 2. What is the Big-O running time of the following code fragment? public static int countPositive( List<Integer> lst, int N ) { int count = 0 for ( int i=0 if (lst.get(i) > 0) sum += lst.get(i) return sum } a. If an ArrayList is passed. Explain your answer. b. If a LinkedList is passed. Explain your answer. 8 points 3. What is the Big-O running time of the following code fragment? public static int Count( List<Integer> lst1, List<Integer> lst2) { Iterator<Integer> itr1 = lst1.iterator() int count=0 while ( itr1.hasNext() ) { Integer x = itr1.next() Iterator<Integer> itr2 = lst2.iterator() while ( itr2.hasNext() ) if ( x.equals( itr2.next()) ) count++ }

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

View Full Document
Sheet1 Page 2 return count } a. If an ArrayList is passed for lst1 and lst2. Explain your answer.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 09/16/2009 for the course CS 3345 taught by Professor Ozbirn during the Spring '08 term at University of Texas at Dallas, Richardson.

### Page1 / 6

Assignment 3 Problems - Assignment #3 Due Date: Saturday,...

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

View Full Document
Ask a homework question - tutors are online