# BigO Notation Lab (Ismail) #2

Closed
wants to merge 2 commits into
from
+18 −0

## Conversation

Projects
None yet
2 participants

### ismailshak commented May 13, 2019

 No description provided.

### ismailshak added some commits May 13, 2019

``` finished BigO exercises ```
``` 7ab99a4 ```
``` edited grammar ```
``` 00d8004 ```

### ismailshak commented May 13, 2019

 comfort 5 completeness 5

### Zakk reviewed May 13, 2019

 @@ -17,6 +17,8 @@ function wordOccurrence(word, phrase) { } ``` O(n), it goes through the whole array and checks every single element regardless of result.

👍

### Zakk reviewed May 13, 2019

 @@ -34,6 +36,8 @@ function bubble_sort(list) { } ``` O(n^2), there is a nested loop that goes through the array and swaps neighboring values to put them in order.

👍

### Zakk reviewed May 13, 2019

 @@ -46,6 +50,8 @@ function factorial(n) { } ``` O(n), it goes through the top of a given sequence of numbers and subtracts 1 all the way down to reach 0. Always going to be dependant on n.

👍

### Zakk reviewed May 13, 2019

 @@ -54,6 +60,9 @@ function bobIsFirst(people) { } ``` O(1), it only performs one check and returns a result. Regardless of where bob is, it just returns a true or false.

👍

### Zakk reviewed May 13, 2019

 @@ -70,6 +79,8 @@ function isPalindrome(input) { } ``` O(n), it still has to go through the input and push into the stack regardless of if its a palindrome or not. It loops through it again to check if its equal. At the worst case it is not a palindrome and loops through the input twice (2n, but no coefficients).

👍

### Zakk reviewed May 13, 2019

 } return result; } ``` O(n), it always goes through all the values from 1 to n.

👍

### Zakk reviewed May 13, 2019

 @@ -100,6 +114,8 @@ function printAllNumbersThenSumPairs(numArray) { } ``` O(n), it always loops through the array twice so O(n) + O(n) = O(2n). But the coefficient is dropped.

👍

### Zakk reviewed May 13, 2019

 @@ -115,3 +131,5 @@ function isPrime(num) { return true; } ``` O(n), it should takes the same amount of time to run each time its called. It checks whether the given input is a prime. However, the for loops forces the algorithm to check every value from 2 to n-1. So it would depend on the value of n.

👍

### Zakk commented May 13, 2019

 @ismailshak You got 8 out of 8! Great work!