cs1501-fall-08-test-1

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

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

View Full Document Right Arrow Icon
CS1501 Fall 2008 — Test-1 Instructions: Complete your work on this test booklet and put your final 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:
Image of page 1

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

View Full Document Right Arrow Icon
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 Construct the radix search trie that results from the insertions A=00001 , B=00010 , R=10010
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern