1 / 8

Understanding Big O, Big Ω, and Big Θ Notations in Data Structures and Algorithms

This note explores the complexities of binary search and the definitions of Big O, Big Ω, and Big Θ notations in algorithm analysis. It provides a breakdown of the binary search algorithm, illustrating its efficiency with a time complexity of O(log n). Additionally, it discusses the significance of understanding these notations for performance evaluation and their interrelations, underscoring when certain complexities might be deemed impractical. The theoretical underpinnings are crucial for students and practitioners deepening their knowledge of data structures and algorithms.

ouida
Télécharger la présentation

Understanding Big O, Big Ω, and Big Θ Notations in Data Structures and Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 3358 Note Set 5 Data Structures and Algorithms

  2. Google Chrome http://www.google.com/googlebooks/chrome/#

  3. Complexity of Binary Search intbinarySearch(intarr[], intarrSize, int key) { int lo = 0, mid, hi = arrSize – 1; while (lo <= hi) { mid = (lo + hi) / 2; if (key < arr[mid]) hi = mid – 1; else if (arr[mid] < key) lo = mid + 1; else return mid; } return -1; }

  4. Big - O • How do I know that T(n) = n2 + 100n + log10 n + 1000is O(n2)?

  5. Issues with Big - O • Consider: • T(n) = O(n2). • When might this be essentially useless information?

  6. Big - Ω Definition: The function f(n) is Ω(g(n)) if there exist positive numbers c and N such that f(n) >= c*g(n) for all n >= N. Interconnection with Big-O: f(n) ЄΩ(g(n)) iffg(n) Є O(f(n)).

  7. Big - Θ Definition: f(n) is Θ(g(n)) if there exist positive numbers c1, c2, and N such that c1*g(n) <= f(n) <= c2*g(n) for all n >= N. Sometimes called “tight bounds”. Interconnection with Big-O and Big - Ω: f(n) ЄΘ(g(n)) ifff(n) O(g(n)).

  8. ?

More Related