big o exercise(Jung Park) #1

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@jung341416

jung341416 commented May 13, 2019

complete :4
comfort : 2.8
i wasnt so sure.

@@ -16,7 +16,7 @@ function wordOccurrence(word, phrase) {
return result;
}
```

this function runs O(2n) worst case scenario for this function is it loops throught at the end and return result.

This comment has been minimized.

@Zakk
@@ -33,6 +33,7 @@ function bubble_sort(list) {
return list;
}
```
-this function runs O(n)**2(quadratic time). worst case scenario would be its gonna loop throught at the end because input list fits the condition and return the result.

This comment has been minimized.

@Zakk
@@ -45,14 +46,15 @@ function factorial(n) {
}
}
```

this function runs O(1) constant wosrt case scenario would be if n is not equal to 0

This comment has been minimized.

@Zakk
#### #4
```javascript
function bobIsFirst(people) {
return people[0] == "bob";
}
```
- the function runs in 0(1)time worst case scenairo would be if people[0] is not equal to bob.

This comment has been minimized.

@Zakk
@@ -69,7 +71,7 @@ function isPalindrome(input) {
return output == input;
}
```

this function runs O(N)(linear) worst case senario would be larger input array.

This comment has been minimized.

@Zakk
@@ -84,6 +86,7 @@ function sumOfDivisors(n) {
return result;
}
```
this function runs O(N) worst case scenario would be n is larger number.

This comment has been minimized.

@Zakk
@@ -99,6 +102,7 @@ function printAllNumbersThenSumPairs(numArray) {
});
}
```
-the function runs in O(2*n)time(linear time) worst case scenario would be larger num Array and index input is smaller.

This comment has been minimized.

@Zakk
@@ -115,3 +119,4 @@ function isPrime(num) {
return true;
}
```
this function O(n)(linear) worse case secnario would be number is larger number and loop throught at the end.

This comment has been minimized.

@Zakk
@Zakk

This comment has been minimized.

Zakk commented May 13, 2019

@jung341416 You got 4 out of 8. We'll mark this as incomplete for now, giving you a week to resubmit it. Can you complete 2-3 of these? When you do, slack Hamamd or I so we know to regrade it!

@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