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

Interface Implementation for Doubly Linked List #48

Closed
ashikka opened this issue Oct 3, 2021 · 6 comments
Closed

Interface Implementation for Doubly Linked List #48

ashikka opened this issue Oct 3, 2021 · 6 comments

Comments

@ashikka
Copy link
Contributor

ashikka commented Oct 3, 2021

First step

Search, read, and understand information about doubly linked lists and how they are implemented.

Second step

You have to share a code snippet in markdown with an interface proposal for this data structure. Below you can find an interface example of a hypothetical data structure:

class MyDataStructure<E> {

    fun add(element: E) {
        TODO("Not yet implemented")
    }

    fun get(index: Int): E {
        TODO("Not yet implemented")
    }
}

Third step

After @code-sherpas/kollections-maintainers approve your interface proposal, open a pull request with the data structure implementation, and wait for comments.

Minimum acceptance criteria

  • The implementation must be well documented with proper Javadoc at Class and function levels.
  • The implementation must be tested with automatic tests that cover all relevant cases and situations.
  • The implementation must be generic.
  • The implementation must have the expected time complexity according to Computer Science. Here you can find a very helpful cheat sheet.
@ashikka ashikka added this to the Doubly Linked List milestone Oct 3, 2021
@bhaveesarna
Copy link

Hey @ashikka could you please assign this to me?

@bhaveesarna
Copy link

Does this work @ashikka ?

package main

class DoublyLinkedList<E> {

    //Return element at the head of the Doubly Linked List
    fun head(): E{
        TODO()
    }

    //Return element at the tail of the Doubly Linked List
    fun tail(): E{
        TODO()
    }

    //Insert element at the beginning of the Doubly Linked List
    fun insertAtBeginning(element:E){
        TODO()
    }

    //Insert element at the end of the Doubly Linked List
    fun insertAtEnd(element:E){
        TODO()
    }

    //Insert element at specified index of the Doubly Linked List
    fun insertAtIndex(index:Integer){
        TODO()
    }
    
    //Return element at specified index of the Doubly Linked List
    fun get(index:Integer): E{
        TODO()
    }

    //Delete the node at specified index of the Doubly Linked List
    fun deleteNode(index:Integer){
        TODO()
    }

    //Delete the node at the head of the Doubly Linked List
    fun deleteFirst(){
        TODO()
    }

    //Delete the node at the tail of the Doubly Linked List
    fun deleteLast(){
        TODO()
    }
}

@ashikka
Copy link
Contributor Author

ashikka commented Oct 4, 2021

Looks good to me @bhaveesarna! Could you request a review from @dgraciac also?

@bhaveesarna
Copy link

@dgraciac could you please review the interface proposal?

@dgraciac
Copy link
Member

dgraciac commented Oct 4, 2021

@bhaveesarna I would remove

    //Return element at the tail of the Doubly Linked List
    fun tail(): E{
        TODO()
    }

because it is a bit more complex than other operations. We can include this operation in future issues.

Other operations are fine IMO. Go ahead.

@ashikka
Copy link
Contributor Author

ashikka commented Oct 13, 2021

Good work @bhaveesarna 🚀! I"ll be closing this issue now.

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

No branches or pull requests

3 participants