Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
mxthu313 committed Mar 30, 2020
2 parents 909c1e3 + 1678753 commit 9745f88
Show file tree
Hide file tree
Showing 1,032 changed files with 20,080 additions and 23,557 deletions.
1 change: 1 addition & 0 deletions .gitbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root: ./docs/
13 changes: 0 additions & 13 deletions .github/ISSUE_TEMPLATE/activity-lab-issue-template 2.md

This file was deleted.

13 changes: 0 additions & 13 deletions .github/ISSUE_TEMPLATE/activity-lab-issue-template 3.md

This file was deleted.

13 changes: 0 additions & 13 deletions .github/ISSUE_TEMPLATE/activity-lab-issue-template 4.md

This file was deleted.

13 changes: 0 additions & 13 deletions .github/ISSUE_TEMPLATE/activity-lab-issue-template 5.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/technical-writing-template 2.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/technical-writing-template 3.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/technical-writing-template 4.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/technical-writing-template 5.md

This file was deleted.

18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/weekly-manager-checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Weekly Manager Checklist
about: A weekly list of tasks that each manager of a team should complete every week
title: "[Weekly Sync] *insert manager name* Week of */**"
labels: manager-sync
assignees: ''

---

- [ ] Review developers' work and provide a review according to the "First Draft" Pull Request Checklist
- [ ] Ensure "first draft" pull requests are in by Friday
- [ ] "Final draft" pull request to master should be in by Sunday
- [ ] Generate issues for the project based on feedback received and progress made the week prior
- [ ] Ensure issues are made and set-up for next week's tasks
- [ ] Designate two issues not being solved to be "first timer only" issues
- [ ] Milestone should be set-up
- [ ] Adjust long-term plan and epic points for each module epic based on feedback and progress
- [ ] Adjust timeline in Zenhub Calendar
33 changes: 0 additions & 33 deletions .github/workflows/nodejs.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

Module4_Labs/.DS_Store
Module4_Labs/Lab2_Doubly_Linked_List/.DS_Store
Module4_Labs/Lab3_File_System/.DS_Store
Module4_Labs/Lab3_File_System/.DS_Store
Module4.3_Search_and_Sorting_Algorithms/activities/.DS_Store
.DS_Store
Module4.3_Search_and_Sorting_Algorithms/activities/.DS_Store
.DS_Store
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# github_id
1

# name
Time and Space Complexity

# description
Learn about the different rates at which algorithm's memory usage and runtime increase

# summary
Algorithms require an input to run. As the input grows, learn about what happens to the memory usage and space usage. Learn about how to describe this rate.

# difficulty
Easy

# image
<img src="images/Time.jpg">

# image_folder
Data-Structures-and-Algos-Topic/Module1-Intro-to-Data-Structures-and-Algos/Activity1_TimeAndSpaceComplexity/

# cards

## 1

### name
Time Complexity

### order
1

### gems
15

## 2

### name
Looking at Value Sum

### order
2

### gems
15

## 3

### name
Complexity from a function

### order
3

### gems
20

## 4

### name
Space Complexity

### order
4

### gems
15

## 5

### name
Big O Notation

### order
5

### gems
20

## 6

### name
Big O Notation Continued

### order
6

### gems
20

## 7

### name
Time Complexity Interview Question

### order
7

### gems
15

## 8

### name
Space Complexity Interview Question

### order
8

### gems
15
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!--title={Time Complexity}-->

**Time complexity** allows us to describe **how the time taken to run a function grows as the size of the input of the function grows.**

In other words, in the function:
Expand All @@ -17,19 +15,19 @@ The amount of time this function takes to run will grow as the number of element

Time complexity answers the question: "At what rate does the time increase for a function as the input increases". **However**, it does not answer the question, "How long does it take for a function to compute?", because the answer relies on hardware, language, etc..

The rate of a function's growth can be described as **constant**, **linear**, **quadratic**, and so on (as depicted in the graph below).
The rate of a function's growth can be described as **constant**, **linear**, **quadratic**, and so on.

[//]: # "insert 'timecomplexity' image"


<img src="https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/Screen+Shot+2020-02-21+at+5.27.32+PM.png">
<img src="https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/TimeSpace1.jpeg">


In our function, `valueSum()`, this is how the function's growth would look like.

n is the number of elements in the array values. Note that, as `n` grows, so does the execution time in a linear fashion.

For time complexity, functions can grow in **constant time**, **linear time**, **quadratic time**, and so on.
Let's look at this function a little more closely.



Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!--title={In what time does a function grow?}-->

Going back to our function `valueSum`:

```python
Expand Down Expand Up @@ -51,7 +49,7 @@ Hence, we predict that `three()` grows in **constant time**.

As shown in the image below, for any number of elements in `value`, `valueSum()` always takes about 0.001 milliseconds to run.

<img src = "https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/Screen+Shot+2020-02-21+at+5.30.01+PM.png">
<img src = "https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/TimeSpace3.png">


Our prediction is true. Since both lines take constant time, adding them up is also still constant time, and our graph looks like a straight line.
Expand Down Expand Up @@ -87,7 +85,7 @@ Since our function has a line that repeats itself n^2 times, we predict that thi
If we graph this out, it will look like the graph below:


<img src = "https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/Screen+Shot+2020-02-21+at+5.30.07+PM.png">
<img src = "https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/TimeSpace2.png">

Looking at the graph, we see our prediction is indeed correct. Quadratic runtime starts growing quite quickly in comparison to a linear runtime. Something else to note is that the equation for a quadratic equation is **a*n^2*+b*n*+c** where a, b and c are constants.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!--title={Time as a Function}-->

To summarize briefly so far, the time of an algorithm or function's run time will be the sum of the time it takes for all the lines in the code of the algorithm to run. This runtime growth can be written as a function.

Remember that elementary functions such as `+, -, *, \, =` always take a constant amount of time to run. **Thus, when we see these functions, we assign them the value *c* time.**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!--title={Space Complexity}-->

Similar to time complexity, as functions' input grows very large, they will take up an increasing amount of memory; this is **space complexity**. In fact, these functions' memory usage also grows in a similar fashion to time complexity and we describe the growth in the same way. We describe it as *linear*, *quadratic*, etc. time.

For example:
Expand All @@ -22,9 +20,9 @@ Let's look at `keypad`

```python
keypad = [[1, 2, 3],
[4, 5, 6]
[7, 8, 9]
[0]]
[4, 5, 6]
[7, 8, 9]
[0]]
```

We have an array filled with elements that are always arrays. Similar to time complexity, the amount of memory `keypad` will need is **c1 * n * n**. In other words, **c1 * n^2** where **c1** is the amount of the memory an element uses.
Expand Down Expand Up @@ -53,9 +51,9 @@ We have a complex data structure, `value = [1, 2, 3, 4, 5]`, so we know that the

Our Space(Input) equation should look like:

$$
Space(Input) = c1 + c2 + c3*n
$$

> Space(Input) = c1 + c2 + c3*n
Our equation represented by the dominant (fastest growing) term would simply be **c3 * n**.

**Lets look at another familiar function, `listInList`**
Expand All @@ -80,9 +78,9 @@ Each element in `keypad` will require **c3** amount of memory. We can conclude t

The Space(Input) equation for `keypad` looks something like this.

$$
Space(Input) = c1 + c2 + c3*n^2
$$

> Space(Input) = c1 + c2 + c3*n^2
Our equation represented by the dominant term would be **c3 * n^2**

## Optimize Time or Optimize Memory?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!--title={Big-O Notationn}-->

Now that we have an understanding of *time complexity* and *space complexity* and how to express them as functions of time, we can elaborate on the way we express these functions. **Big-O Notation** is a common way to express these functions.

Instead of using terms like *Linear Time*, *Quadratic Time*, *Logarithmic Time*, etc., we can write these terms in **Big-O Notation**. Depending on what time the function increases by, we assign it a **Big-O** value. **Big-O** notation is incredibly important because it allows us to take a more mathematical and calculated approach to understanding the way functions and algorithms grow.
Expand Down
Loading

0 comments on commit 9745f88

Please sign in to comment.