Skip to content

Conversation

@thamaranth
Copy link
Owner

check out this data

tannerwelsh and others added 28 commits December 31, 2016 11:09
added several stack functions with tests
renamed test files and added in Queue function
* WIP for PQueue

* WIP for PQueue

* set WIP

* WIP for Set

* Linked List
added work for several structures
finished double linked list
Copy link

@mantinone mantinone left a comment

Choose a reason for hiding this comment

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

Sorry I ran out of time! I can review your tests later if you like.

insertAfter(item, data) {
const newNode = new Node(data)

if (this.find(item) === this.tail {

Choose a reason for hiding this comment

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

There was a syntax error here that had to be fixed before tests could be run. (the if statement is not enclosed)

Choose a reason for hiding this comment

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

Also, you left a couple console logs in here.

return count
}

}

Choose a reason for hiding this comment

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

Looks good! I would try using your own length function instead of the built in length property, just for the heck of it.

forEach(func) {
this.elements = this.elements.map(func)
return this.elements
}

Choose a reason for hiding this comment

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

I feel like this should be implemented differently for learning purposes. You have essentially used Map to implement Map.

return count
}

}

Choose a reason for hiding this comment

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

.

return index == self.indexOf(element);
})
return unique
}

Choose a reason for hiding this comment

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

This is a pretty clever way of doing it.

}
return null
}

Choose a reason for hiding this comment

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

You're repeating this "Find the max" "Find the min" code a few times here. It would be a good idea to break these out into helper functions so they don't have to be repeated, and it helps make the code more easily readable, too.

return this.find(item) !== -1
}

}

Choose a reason for hiding this comment

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

Looks good.

contains(item) {
return this.find(item) !== -1
}
}

Choose a reason for hiding this comment

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

Looks Good

Copy link

@jaredatron jaredatron left a comment

Choose a reason for hiding this comment

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

wow this was a long review.

@@ -1 +1,3 @@
node_modules/
lib/
.gitignore

Choose a reason for hiding this comment

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

I'm not even sure you can ignore the .gitignore from within the .gitignore itself. That seems paradoxical :p

_Provide a brief, high-level overview of what the final product (artifact) of this goal is. Include any relevant resources or dependencies here._

Base repository for the [Core Data Structures](https://github.com/GuildCrafts/web-development-js/issues/127) goal.
Write tests and implementations for common data structures.

Choose a reason for hiding this comment

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

why change the readme?

@@ -0,0 +1,156 @@
'use strict';

Choose a reason for hiding this comment

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

it looks like you've checked in a transpiled version of one of your source files. These generally are not committed.

@@ -1 +1,3 @@
node_modules/
lib/

Choose a reason for hiding this comment

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

lib is in your git ignore but you are still tracking files within lib. git rm -df lib/* and then commit the removal of these files from tracking

expect(doubleLinkedList.contains('foo'))
.to.be.true
expect(doubleLinkedList.contains('tap'))
.to.equal(false)

Choose a reason for hiding this comment

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

.to.be.false ?

return true
}
return false

Choose a reason for hiding this comment

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

remove whitespace


}

contains(value) {

Choose a reason for hiding this comment

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

contains(value) {
  return this.elements.indexOf(value) !== -1
}


remove(value) {
if (this.elements.indexOf(value) > 0) {
return this.elements.splice(this.elements.indexOf(value),1)

Choose a reason for hiding this comment

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

remove(value) {
  if (this.contains(value)) return false
  this.elements = this.elements.filter(member => member !== value)
  return true
}

}

forEach(func) {
this.elements = this.elements.map(func)

Choose a reason for hiding this comment

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

this would be better

forEach(iterator) {
  this.elements.forEach(iterator)
  return this
}

This would be better for your learning

forEach(iterator) {
  for (let i = this.length - 1; i >= 0; i--) {
    iterator(this.elements[i], i)
  }
  return this
}

}

size() {
let count = 0

Choose a reason for hiding this comment

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

for this exercise you should be tracking size so you don't have to rely on the elements array to calculate it

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.

6 participants