Big O Notation exercise (Paula Bannerman) #4

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@dcartist

dcartist commented May 13, 2019

comfort level 3.5/5
completeness 5/5

@@ -3,7 +3,7 @@
What is the worst-case time complexity for the following algorithms?

#### #1

I think the code below is a linear since it's an unsorted list, and that with the higher the input the more time it would need.

This comment has been minimized.

@Zakk
#### #2
This one looks like an quadratic time algorithm because it's a loop within a loop with a conditional. It takes more to process this one fully.

This comment has been minimized.

@Zakk
@@ -35,7 +37,7 @@ function bubble_sort(list) {
```

#### #3

I think this is Factorial. I'm guessing because it's in the name, and it deals with negative integers. It goes within it's self.

This comment has been minimized.

@Zakk

Zakk May 13, 2019

Close! The name actually makes this a bit of a trick!

@@ -47,15 +49,17 @@ function factorial(n) {
```

#### #4
I think this one is a constant. Because no matter how much input it returns the same.

This comment has been minimized.

@Zakk

#### #5
I think this is a linear. because the information grows over time.

This comment has been minimized.

@Zakk
@@ -71,7 +75,7 @@ function isPalindrome(input) {
```

#### #6

I think this one is one is a logarithmic, because it's loop starting from a certain point then checking to see the results matches it.

This comment has been minimized.

@Zakk

Zakk May 13, 2019

Very close!

@@ -86,7 +90,7 @@ function sumOfDivisors(n) {
```

#### #7

I think this one is linear, because it's dealing with an unsorted array.

This comment has been minimized.

@Zakk
@@ -101,7 +105,7 @@ function printAllNumbersThenSumPairs(numArray) {
```

#### #8

I think this one is a logarithmic, because it finds a certain point then goes from there to the destination. (Old school phone book)

This comment has been minimized.

@Zakk

@Zakk Zakk closed this May 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment