View the step-by-step solution to:

Need help with this Computer Science programming problem

Need help with this Computer Science programming problem

Background image of page 1

Top Answer

b) 1    3 b) 1000      0 c) worst... View the full answer

  • Numbering was incorrect. The corrected numbering is a) 1 3 b) 1000 0 c) worst case time complexity O(n) best case time complexity O(n)
    • freakypri
    • Mar 05, 2016 at 12:36am
  • Could you explain how you got the answers?
    • dlsdbsdk123
    • Mar 05, 2016 at 1:14am
  • a) this program is trying to find the minimum number with its position .The first set the value to a large number so that all numbers are less than that to here the minimum number is 1 at position 3 so value =1 and pos = 3.. b) as all the numbers in the array are greater than 1000 so the minimum remains the first value thats 1000 and pos was initialised as 0 so pos =0. c) the time complexity of a while loop is O(n) the loop here can in no way have a best/optimised case so both best case and worst case time complexities are O(n)
    • freakypri
    • Mar 05, 2016 at 1:20am

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online