Real-world algorithm practice

Concetti di Informatica

Pritesh Patel

Computer Scientist & Data Scientist for over 20 years

Commonly used algorithms: sorting & searching

Sorting

Used when you need to order things

Real world problems:

  1. Online Shopping: Sorting by price, rating, popularity.
  2. Calendar Sorting: Sorting events by date & time.

Searching

Used when you need to search for things

Real world problems:

  1. Online Shopping: Searching for book title.
  2. Customer Support: Searching for previous tickets by customer name.
Concetti di Informatica

Sorting algorithms: bubble sort vs quick sort

Bubble Sort An animation that shows how bubble sort works

  • Bubble Sort: Compare, swap, repeat, pass.
  • Time complexity: $O(n^2)$.
  • Imagine Online Shopping with Millions of items to sort - Grows exponentially as catalog grows.

Quick Sort An animation that shows how quick sort works

  • Quick Sort: Divide, pivot, sort, merge.
  • Time complexity: O(n log n).
  • Imagine Online Shopping with Millions of items to sort - More sustainable as catalog grows.
Concetti di Informatica

Searching algorithms: linear search vs binary search

Linear Search An animation that shows how linear search works

  • Time complexity: $O(n)$.
  • Simple, checks each element one by one.
  • Linear Search: Scan, compare, find, stop.

Binary Search An animation that shows how binary search works

  • Time complexity: $O(log\,n)$.
  • Efficient, but requires a sorted list.
  • Binary Search: Divide, compare, eliminate, repeat.
Concetti di Informatica

Conclusion

  • Bubble sort, quick sort, binary search, linear search
  • Quick Sort and Binary Search are more efficient for large datasets.
  • Now you should have an intuition why efficiency in algorithms can make or break an experience with technology.
Concetti di Informatica

Let's practice!

Concetti di Informatica

Preparing Video For Download...