cs1501-fall-08-test-1

# cs1501-fall-08-test-1 - CS1501 Fall 2008 Test-1...

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

CS1501 Fall 2008 — Test-1 Instructions: Complete your work on this test booklet and put your fnal answers on the answer sheet. Put your name and email on both the test booklet and the answer sheet and hand them to the instructor. Only the answer sheet will be graded. You may separate the answer sheet From the test. Name: Email:

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

View Full Document
Problem 1, Complexity, 20 Points A. How many comparisons does Selection Sort require in the worst case? B. How many comparisons does Mergesort require in the worst case? C. How many comparisons does Quicksort require in the worst case? D. How many times will foo be (recursively) called in the following method when foo(n) is executed? public static int foo(int n) { if ( n==0 ) return 1 ; else return ( foo(n-1) + foo(n-1) ) ; } Choose the best answers from O (1), O ( n ), O (log n ), O ( n ), O ( n log n ), O ( n 2 ), O ( n 3 ), O (2 n ). Problem 2, AVL Tree, 20 Points Draw the following AVL tree after inserting 5: 300 100 50 200 10 150 Problem 3, Radix Search Trie, 20 Points
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/27/2010 for the course CS 1501 taught by Professor Staff during the Fall '08 term at Pittsburgh.

### Page1 / 3

cs1501-fall-08-test-1 - CS1501 Fall 2008 Test-1...

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

View Full Document
Ask a homework question - tutors are online