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

C16 - Cedar - Afina #5

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

Conversation

afinawalton
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 Afina, good use of additional fields like tail and length. You even got a few of the extra methods. Well done!

Comment on lines +15 to 21
constructor(head = null, tail = null, length = 0) {
// The # before the variable name indicates
// a private variable.
this.#head = null;
this.#head = head;
this.tail = tail;
this.#length = length;
}

Choose a reason for hiding this comment

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

I like these fields!

Time Complexity: O(1)
Space Complexity: O(1)
*/
getFirst() {
throw new Error('This method has\'t been implemented yet!')

Choose a reason for hiding this comment

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

👍

Comment on lines +36 to 39
Time Complexity: O(1)
Space Complexity: O(1)
*/
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 +55 to 58
Time Complexity: O(N)
Space Complexity: O(1)
*/
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 +76 to 79
Time Complexity: O(1)
Space Complexity: O(1)
*/
length() {

Choose a reason for hiding this comment

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

👍 Niiice

Comment on lines +139 to 142
Time Complexity: O(N)
Space Complexity: O(1)
*/
findMax() {

Choose a reason for hiding this comment

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

👍

Comment on lines +161 to 164
Time Complexity: O(N)
Space Complexity: O(1)
*/
delete(value) {

Choose a reason for hiding this comment

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

👍 Nicely done. I do want to note that this becomes a bit easier with a doubly linked list (you don't need the previous reference).

Comment on lines +202 to 205
Time Complexity: O(N)
Space Complexity: O(N)
*/
visit() {

Choose a reason for hiding this comment

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

👍

Comment on lines +221 to 224
Time Complexity: O(N)
Space Complexity: O(N)
*/
reverse() {

Choose a reason for hiding this comment

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

👍 However the space complexity is O(1)

Comment on lines +246 to 249
Time Complexity: O(N)
Space Complexity: O(1)
*/
findMiddleValue() {

Choose a reason for hiding this comment

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

👍 Nice reuse of the length field

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