[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Algorithms Design :)

Posted on 2004-11-29
Medium Priority
766 Views
How can we modify almost any algorithm to have a good best-case running time?
0
• 2
• 2

LVL 3

Accepted Solution

baboo_ earned 80 total points
ID: 12694895
Uhh...  "Best-case" running time would be with a dataset of the size of 0, in which case the running time would be constant.  So you wouldn't have to.

Typically, algorithm analysis is performed for average- or worst- case.  The best-case situation for *any* algorithm is when it doesn't have any data on which to be run.

Did you mean "worst-case" running time?  I'm not trying to be flip here, but I'm making sure I understand the question...

baboo_
0

LVL 5

Author Comment

ID: 12695104
I mean best - case!
0

LVL 5

Author Comment

ID: 12695108
There is always input , for example n integers, if we measure in number of items.
0

LVL 22

Expert Comment

ID: 12700583

as baboo mentioned, the best case running time is always going to be a constant.  If you prefer to use big-O notation, then best case scenarios will always be 1-O

Case in point:

Suppose we are looking at sorting algorithms.  The Bubble sort is the most basic and has the absolute worst "worst case" scenario.  Conversly, the bubble sort also has the best performance if all of the items are already in order.

Quick sort (the most common advanced algorithm), overall has one of the best "worst-case" scenarios and a best case (already sorted) that comes very close to that the bubble sort.

Finally there is the shear-sort.  For very large datasets that are radically out of sync, this is the absolute best sorting method.  But as it turns out, the efficiency does not change much at all if the data is already pre-sorted.  This makes the "best-case" rather weak.

In summary, I believe what you are looking for is really minimizing the "worst case" algorithms.  Doing an analysis in this direction will always give you some kind of results.  Only optimizing for best-case will not yield accurate quatitative results.
0

LVL 22

Expert Comment

ID: 12700587

I suggest you like into Big O (Big-oh) notation.   I think you'll have more success with what you are looking for
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
###### Suggested Courses
Course of the Month19 days, 9 hours left to enroll