#asymptotic notation confusion

1 messages · Page 1 of 1 (latest)

sage pawn
#

Hi,

Big O notation (O) describes the upper bound of the algorithm's time complexity. It represents the maximum amount of time an algorithm will take to run in relation to the input size.

Big Omega notation (Ω) on the other hand, describes the lower bound of the algorithm's time complexity. It represents the minimum amount of time an algorithm will take to run in relation to the input size.

Big Theta notation (Θ) represents the tight bound of an algorithm's time complexity, providing both upper and lower bounds.

Note: The asymptotic notation is not related to the best/worst case of an algorithm. Most people think Big-O is used for the upper bound so it is for the worst case, Omega is for the lower bound so it is for the best case, NO. Any notation can be used for best/worst-case scenarios in an algorithm.

So if we look at the Linear search algorithm we can say to find a key element, the best case takes minimum time while the worst case would take maximum time.
Best case - the searching key element present at the first index
Best case Time - 1 constant time O(1) or Ω(1) or Θ(1). All are correct.

Worst case - the searching key element present at the last element
Worst case time - n O(n) or Ω(n) or Θ(n). All are correct.

Average case - All possible case time / no of cases
Average case time - (n + 1)/2 . it also belongs to n class. O(n) or Ω(n) or Θ(n). All are correct

#

You can watch this if you need more clarity on what I explained,

In this first link he discussed the asymptotic notation,
https://youtu.be/A03oI0znAoc?si=Lmse8jKzjC2ERhap

While in this second link he discussed the best, worst and average case analysis.
https://youtu.be/lj3E24nnPjI?si=k_fVJ4_KcuixUyrM

This third link is a playlist to where both videos are and its on Algorithm. He made understanding algorithm easier.
https://www.youtube.com/watch?v=0IAPZzGSbME&list=PLDN4rrl48XKpZkf03iYFl-O29szjTrs_O

Case Analysis Discussed in this video

  1. Best
  2. Worst
    3.Average

Examples Taken

  1. Linear Search
  2. Binary Search Tree

Min time in Worst Case
Max time in Worst Case
are also discussed.

PATREON : https://www.patreon.com/bePatron?u=20475192

Courses on Udemy

Java Programming
https://www.udemy.com/course/java-se-programming/...

▶ Play video

Introduction to Algorithms

Introduction to course.

Why we write Algorithm?
Who writes Algorithm?
When Algorithms are written?

Differences between Algorithms and Programs

PATREON : https://www.patreon.com/bePatron?u=20475192

Courses on Udemy

Java Programming
https://www.udemy.com/course/java-se-programming/?referralCode=C71B...

▶ Play video
sage pawn
#

I'm glad my response helped, you're welcome ✨