From the course: Python: Programming Efficiently
Unlock the full course today
Join today to access over 23,300 courses taught by industry experts.
Algorithm complexity - Python Tutorial
From the course: Python: Programming Efficiently
Algorithm complexity
- Let's talk about the complexity of algorithms and how it affects their run time. So far, we have discussed how we can optimize the implementation of a given algorithm for the Mandelbrot set. We had NamPy and number take care of the complex arithmetic instead of doing it in pure Python where every individual operation is slower. In some cases, we may have a choice among multiple algorithms that give the same output by use of different number of operations. The classic examples, are the algorithms to sort a list. A simple Insertion sort grows a sorted list of elements by inserting them one by one in the right spot for a list of length, n we need n squared operations. So we'd say that the algorithm has ordered n squared time complexity or its big goal n squared. Smarter algorithms such as Quicksort require a number of operations proportional to n times the logarithm of n So that algorithm has order n times log n time…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Computer architecture and optimization techniques1m 38s
-
(Locked)
Time profiling8m 19s
-
(Locked)
Memory profiling6m 42s
-
(Locked)
Algorithm complexity3m 24s
-
(Locked)
Introduction to parallel programming3m 49s
-
(Locked)
Challenge: Inverted index2m 18s
-
(Locked)
Solution: Inverted index1m 39s
-
(Locked)
-