Conversation
mo92othman
left a comment
There was a problem hiding this comment.
Hey @jivvyjams ,
Good job working on this week’s assignment!
You show a solid understanding of the core concepts.
There are a few issues in Task 4 related to the experiment setup, I’ve left some comments there for you to review.
And for task 2 it's always good to run the tests yourself!
Overall, well done 👏
| console.log("---"); | ||
|
|
||
| console.time("Binary Search 1k"); | ||
| getTargetByBinarySearch(getTargetByBinarySearch(1000), 10540640); |
There was a problem hiding this comment.
getTargetByBinarySearch(getTargetByBinarySearch(1000), 10540640) is wrong.
First argument must be an array, but here it calls binary search with 1000 instead of generateBigArray(1000). It shuld be:
getTargetByBinarySearch(generateBigArray(1000), 10540640);| console.time("Linear Search 1M"); | ||
| getTargetByLinearSearch(generateBigArray(10000000), 10540640); | ||
| console.timeEnd("Linear Search 1M"); |
There was a problem hiding this comment.
Label says 1M, but the array size used is 10000000 (10M). The label and value do not match.
| console.time("Binary Search 1M"); | ||
| getTargetByBinarySearch(generateBigArray(10000000), 10540640); | ||
| console.timeEnd("Binary Search 1M"); |
There was a problem hiding this comment.
Same here: Label says 1M, but the array size used is 10000000 (10M). The label and value do not match.
| } | ||
|
|
||
| console.time("Linear Search 1k"); | ||
| getTargetByLinearSearch(generateBigArray(1000), 10540640); |
There was a problem hiding this comment.
Array creation is included in the timing, this is wrong. Right now you are doing this:
getTargetByLinearSearch(generateBigArray(1000), 10540640);This means you are measuring: Array creation time + Search time. You should create the array first, then measure only the search:
const arr1k = generateBigArray(1000);
console.time("Linear Search 1k");
getTargetByLinearSearch(arr1k, 10540640);
console.timeEnd("Linear Search 1k");
No description provided.