Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👾 Aimee - 🔥 Fire #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

👾 Aimee - 🔥 Fire #1

wants to merge 7 commits into from

Conversation

marks214
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Nice work Aimee, you hit the learning goals here. Well done!

Comment on lines +23 to 26
Time Complexity: O(1), there are no loops
Space Complexity: O(1), created one node and moved the head.
*/
addFirst(value) {

Choose a reason for hiding this comment

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

👍

Comment on lines +42 to 46
Time Complexity*: O(n), n nodes to iterate through
Space Complexity*: O(1), space required is constant
* Search calls on the length method (outside the for loop) which has O(n) time complexity and O(1) space complexity
*/
search(value) {

Choose a reason for hiding this comment

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

👍

Comment on lines +63 to 67
Time Complexity*: O(n), for loop will iterate over n nodes
Space Complexity*: O(1), space required is constant
* findMax invokes the length method (outside the for loop) which has O(n) time complexity and O(1) space complexity
*/
findMax() {

Choose a reason for hiding this comment

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

👍

*/
findMax() {
throw new Error("This method hasn't been implemented yet!");
let max = -Infinity;

Choose a reason for hiding this comment

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

Good use of -Infinity

Comment on lines +87 to 91
Time Complexity*: O(n), for loop will iterate over n nodes
Space Complexity*: O(1), space required is constant
* findMin invokes the length method (outside the for loop) which has O(n) time complexity and O(1) space complexity
*/
findMin() {

Choose a reason for hiding this comment

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

👍

Comment on lines +237 to 240
Time Complexity: O(n), the length and getAtIndex methods are invoked separately. These each have an O(n) time complexity
Space Complexity: O(1), space required is constant
*/
findNthFromEnd(n) {

Choose a reason for hiding this comment

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

👍 Another good use of getAtIndex

Comment on lines +250 to 253
Time Complexity: O(n), there is one while loop and it has an order of n iterations
Space Complexity: O(n), the Set object will be of length n, we don't know how many nodes are in the linked list
*/
hasCycle() {

Choose a reason for hiding this comment

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

👍

Comment on lines +287 to 290
Time Complexity: O(n), n nodes to iterate through
Space Complexity: O(1), space required is constant
*/
addLast(value) {

Choose a reason for hiding this comment

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

👍

Comment on lines +315 to 318
Time Complexity: O(n), n nodes to iterate through
Space Complexity: O(1), space required is constant
*/
getLast() {

Choose a reason for hiding this comment

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

👍

Comment on lines +338 to 342
Time Complexity*: O(n), n nodes to iterate through
Space Complexity*: O(1), space required is constant
*This method calls on the findMin, findMax, addFirst, and addLast methods - this won't change the overall space/time complexity.
*/
insertAscending(value) {

Choose a reason for hiding this comment

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

👍 Good use of existing methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants