Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7560299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:51:55+00:00 2026-05-30T12:51:55+00:00

I am watching the Berkley Uni online lecture and stuck on the below. Problem

  • 0

I am watching the Berkley Uni online lecture and stuck on the below.

Problem: Assume you have a collection of CD that is already sorted. You want to find the list of CD with whose title starts with “Best Of.”

Solution: We will use binary search to find the first case of “Best Of” and then we print until the tile is no longer “Best Of”

Additional question: Find the complexity of this Algorithm.

Upper Bound: Binary Search Upper Bound is O(log n), so once we have found it then we print let say k title. so it is O(logn + k)

Lower Bound: Binary Search lower Bound is Omega(1) assuming we are lucky and the record title is the middle title. In this case it is Omega(k)

This is the way I analyzed it.

But in the lecture, the lecturer used best case and worst case.
I have two questions about it:

  1. Why need to use best case and worst case, aren’t big-O and Omega considered as the best and worst cases the algorithm can perform?
  2. His analysis was
    Worst Case : Theta(logn + k)
    Best Case : Theta (k)

    If I use the concept of Worst Case as referring to the data and having nothing to do with algorithm then yep, his analysis is right.
    This is because assuming the worst case (CD title in the end or not found) then the Big O and Omega is both log n there it is theta(log n +k).

    Assuming you do not do “best case” and “worst case”, then how do you analyze the algorithm? Is my analysis right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:51:56+00:00Added an answer on May 30, 2026 at 12:51 pm

    Why need to use best case and worst case, aren’t big-O and Omega considered as the best and worst cases the algorithm can perform?

    No, the Ο and Ω notations do only describe the bounds of a function that describes the asymptotic behavior of the actual behavior of the algorithm. Here’s a good

    • Ω describes the lower bound: f(n) ∈ Ω(g(n)) means the asymptotic behavior of f(n) is not less than g(n)·k for some positive k, so f(n) is always at least as much as g(n)·k.
    • Ο describes the upper bound: f(n) ∈ Ο(g(n)) means the asymptotic behavior of f(n) is not more than g(n)·k for some positive k, so f(n) is always at most as much as g(n)·k.

    These two can be applied on both the best case and the worst case for binary search:

    • best case: first element you look at is the one you are looking for
      • Ω(1): you need at least one lookup
      • Ο(1): you need at most one lookup
    • worst case: element is not present
      • Ω(log n): you need at least log n steps until you can say that the element you are looking for is not present
      • Ο(log n): you need at most log n steps until you can say that the element you are looking for is not present

    You see, the Ω and Ο values are identical. In that case you can say the tight bound for the best case is Θ(1) and for the worst case is Θ(log n).

    But often we do only want to know the upper bound or tight bound as the lower bound has not much practical information.

    Assuming you do not do “best case” and “worst case”, then how do you analyze the algorithm? Is my analysis right?

    Yes, your analysis seems correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After watching the Stanford iTunesU CS193p online course I have quick question regarding the
I'm watching this lecture: http://www.youtube.com/watch?v=Kq4FpMe6cRs // the speaker states that 'bar' is just some
Watching few examples that use repository pattern like StoreFront I couldn't figure out where
After watching Sussman's lecture http://www.infoq.com/presentations/We-Really-Dont-Know-How-To-Compute , I am inspired to give core.logic and core.match
ive been watching a tutorial that has told me to change the background color
I am watching a video about [LINQ][1] and came across a problem. In this
I have just finished watching the following videos in an attempt to understand JDO
Recently I have been watching Plural Sight ASP.NET videos on data binding, and I
I have been watching a video of a conference (See: Good JavaScript Habits for
I've been watching some documentation, and I'm still confused. I want to do a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.