Code Monkey home page Code Monkey logo

datastructures's People

Contributors

sardtok avatar

Watchers

 avatar

datastructures's Issues

Implement linked list in Scala

Add a linked list implementation the Scala programming language.

The list should be generic.
The list should be immutable.
The list should implement typical functions like map, for each, filter, fold, etc.

Tests similar to the Java version should be added.

Linked lists should function as double ended queues

The linked list implementations should allow removing the first element or last element, and insertion at the beginning of the list as well as the end of the list.

For Java, the list should implement the double ended queue interface: Deque.

Add unit tests for Java linked list implementation

Unit tests are needed.
There are obvious bugs in the iterator with regards to indices.

Tests that need adding:

  • Add:
    • Null cannot be added
    • Should return true
    • Size should change
    • List should contain added element
    • Element should be accessible at the index: (size - 1)
  • Get:
    • Should retrieve the correct elements
  • Contains:
    • Should return true for elements that are in the list
    • Should return false for elements that are not in the list
  • Remove by index:
    • Should return the same element as get on the same index
    • Should no longer contain element after removal (if it is the only instance)
    • Size should change
  • Remove by object reference:
    • Should return true if the element exists in the list
    • Size should change
    • Should no longer contain element (if it is the only instance)
  • Iterator:
    • Should iterate properly from start to finish
    • Should iterate properly backwards
    • Should yield the correct indices for next and previous elements
    • Should allow removing elements
    • Should allow exchanging elements

All methods should be tested, but these should make for a decent amount of early tests. More tests can be added when a method is to be implemented.

One way to perform the tests, is to compare it to the reference implementation, java.util.LinkedList, as it should perform the same actions.

Implement linked list in C

Add a linked list implementation the C programming language.

The list should be general, using void pointers.
The list should support at least some more advanced functions than simply, add and remove. Possible additions: filter, remove all, retain all.

Tests similar to the Java version should be added.

Implement linked list in JavaScript

Add a linked list implementation JavaScript/ECMAScript.

Consider writing an immutable list type.
Should be JSON serializable to a standard JSON list.
Should work similar to a standard JS list.
Should support Harmony iterators (ECMAScript 6 iterators that allow for-of loops).

Tests similar to the Java version should be added.

Consider adding support for sub-lists in Java linked list

The only part of the java.util.List interface not implemented by the current implementation is sub-lists.

Although sub-lists may be useful for simplifying or speeding up certain operations (deleting a large portion of the list), there is some added overhead due to the effects on the super-list.

List iterator in Java LinkedList mixes one and zero indexing

The list iterator in the LinkedList uses zero as the lowest index if created with an index in the first half of the list. However, if the constructor is called with an index in the last half of the list, one is used as the lowest index (i.e. the size is inclusive, instead of exclusive).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.