From 687c347940ae079855a6a5f597214a1cd45d60af Mon Sep 17 00:00:00 2001 From: "Ruthie (they/them)" <102179075+mx-ruthie@users.noreply.github.com> Date: Fri, 27 Jan 2023 11:35:25 -0600 Subject: [PATCH] Update runtime-complexity.md removes projected time, removes dead link, basic edits --- runtime-complexity/runtime-complexity.md | 47 ++++++++++-------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/runtime-complexity/runtime-complexity.md b/runtime-complexity/runtime-complexity.md index b613d86ef..a646a42a8 100644 --- a/runtime-complexity/runtime-complexity.md +++ b/runtime-complexity/runtime-complexity.md @@ -1,12 +1,11 @@ # Runtime Complexity -### Projected Time +### Week 3 Keywords and Questions -About 3 hours +- What is runtime complexity? +- How do we talk about runtime complexity? +- What are examples of each the following run times: Constant, linear, O(n^2) -- 1 hour for Lesson -- 70 minutes for Independent Practice -- 20 minutes for Group Practice ### Prerequisites @@ -15,6 +14,7 @@ About 3 hours ### Motivation While computers are lightning fast, some code can run faster than other code. When computer programs get larger and larger, a slow runtime can be noticeable to the user. Luckily, code can be written in efficient ways. + Understanding runtime complexity is important for multiple reasons: - It will help you write fast code @@ -33,19 +33,6 @@ Google also has written extensively on the [importance of runtime](https://devel - Know the runtime of array and object functions - Determine time complexity for simple functions and algorithms -### Materials - -- [How is Big-O runtime used in industry?](https://softwareengineering.stackexchange.com/questions/20832/is-big-o-really-that-relevant-when-working-in-industry/20834) (Recommended reading time: 5 min) -- [Big O Notation — Simply explained with illustrations and video](https://medium.freecodecamp.org/big-o-notation-simply-explained-with-illustrations-and-video-87d5a71c0174) (15 min read) -- [Big O Notation](https://www.interviewcake.com/article/python/big-o-notation-time-and-space-complexity?) - this Interview Cake article is available for free. (15 min read) -- [Practical Java Examples of the Big O Notation (10 min read)](https://www.baeldung.com/java-algorithm-complexity) - -### Supplemental Resources - -- [Efficiency: Determining Big O (15 min video)](https://www.youtube.com/watch?v=3GKpkJ2pr-0&=&t=454s) -- [Explanations of the different common runtimes](https://www.cpp.edu/~ftang/courses/CS240/lectures/analysis.htm) -- [Explanations and code examples of common runtimes](https://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/) (10 min read) - ### Lesson - [Runtime Complexity Lecture Slides](https://docs.google.com/presentation/d/1ZcOdekB_aP59huZdp4X0u6EfUJKgxzK7y8LqCmzSLC8) @@ -80,17 +67,28 @@ There are several common runtimes that you should understand: - Growth rate analysis - Computational complexity +### Additional Materials and Resources + +- [How is Big-O runtime used in industry?](https://softwareengineering.stackexchange.com/questions/20832/is-big-o-really-that-relevant-when-working-in-industry/20834) (Recommended reading time: 5 min) +- [Big O Notation — Simply explained with illustrations and video](https://medium.freecodecamp.org/big-o-notation-simply-explained-with-illustrations-and-video-87d5a71c0174) (15 min read) +- [Big O Notation](https://www.interviewcake.com/article/python/big-o-notation-time-and-space-complexity?) - this Interview Cake article is available for free. (15 min read) +- [Practical Java Examples of the Big O Notation (10 min read)](https://www.baeldung.com/java-algorithm-complexity) +- [Efficiency: Determining Big O (15 min video)](https://www.youtube.com/watch?v=3GKpkJ2pr-0&=&t=454s) +- [Explanations and code examples of common runtimes](https://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/) (10 min read) + + + ### Things we'll cover later These things are not covered in this lesson, but they are related and important to know. -- Different data structures let you do different things quickly. So far you've learned about two data structures: arrays and objects. Later, you'll learn about more data structures, including linked lists, trees, stacks, and queues. You'll learn about the runtime complexity of doing different operations with these data structures. +- (After Interviews! Don't rabbit hole this.) - Different data structures let you do different things quickly. So far you've learned about two data structures: arrays and objects. Later, you'll learn about more data structures, including linked lists, trees, stacks, and queues. You'll learn about the runtime complexity of doing different operations with these data structures. - Space complexity. Similar to time complexity, algorithms can use differing amounts of memory - Runtime complexity is related to (but not the same!) as the total amount of time it takes to run a piece of code. A piece of O(n^2) code could run faster than a piece of O(n) code. -### Independent Practice +### Independent Practice if time permits **Runtime Complexity Exercise 1: Reading code and analyzing runtime** @@ -110,15 +108,8 @@ Compare multiple pieces of code that do the same thing, and figure out the runti How would you solve these problems [runtime3-solving.md](runtime3-solving.md)? Can you think of an O(n^2), O(n log n), O(n) solution? -### Group Practice - -Discuss with the group and an instructor: - -- Which runtimes/concepts were the hardest to guess/understand? -- Which ones were the easiest? -- Do you still have things you don't understand? -### Challenge +### Advanced Extension - Try to implement the problems in [runtime3-solving.md](runtime3-solving.md). Run your solutions on multiple input sizes. Does it match your expectations?