Skip to content

Jawad A.#21

Open
jivvyjams wants to merge 4 commits intoHackYourAssignment:mainfrom
jivvyjams:main
Open

Jawad A.#21
jivvyjams wants to merge 4 commits intoHackYourAssignment:mainfrom
jivvyjams:main

Conversation

@jivvyjams
Copy link

No description provided.

Copy link

@mo92othman mo92othman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Comment on lines +36 to +38
console.time("Linear Search 1M");
getTargetByLinearSearch(generateBigArray(10000000), 10540640);
console.timeEnd("Linear Search 1M");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Label says 1M, but the array size used is 10000000 (10M). The label and value do not match.

Comment on lines +54 to +56
console.time("Binary Search 1M");
getTargetByBinarySearch(generateBigArray(10000000), 10540640);
console.timeEnd("Binary Search 1M");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");

@mo92othman mo92othman self-assigned this Feb 21, 2026
@mo92othman mo92othman added the Reviewed This assignment has been reivewed by a mentor and a feedback has been provided label Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants