{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

quiz4-questions - EE 322C Data Structures Spring 2009 Dr...

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

View Full Document Right Arrow Icon
EE 322C Data Structures Spring 2009 Dr. Ramesh Yerraballi Quiz 4 Points : 100 Due Date: Monday 4/6 In class NAME (First, Middle, Last):_______________________________________________ Instructions: Please be specific in your answers. If any of the questions is ambiguous, make reasonable assumptions and document them along with your answers. Please type up or write down your final answers in this word document with prefix “Answer:” after each question. Before you begin , indicate your name above. 1. Give the worst case and best case complexities of the following code snippets using the BigOh notation (in terms of input size marked n). ( 4 + 4 + 6) = 14 points a) for( int i = 0 ; i < 10 ; i++ ) { .. } Answer: b) int[] arr = initialize(); // returns an Integer array of size 'n' for(int i = 0 ; i < arr.length ; i ++) { if(arr[i] >= arr[arr.length]) break; } Answer:
Image of page 1

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

View Full Document Right Arrow Icon
c) int[] arr = initialize(); // returns an Integer array of size 'n' for(int i=0 ; i < arr.length ; i++) { boolean yes = true; for(int j=0 ; j < arr.length; j++) { if(arr[i] < arr[j]) yes = false; } if(yes) break; } Answer: 2. Give the worst case complexity of the following code snippet in terms of the Big Oh notation
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