Git Product home page Git Product logo

datastructures's Introduction

Data structures

Fork this repository and submit your code via pull request.

##Linked List

Requirements

Implement a singly linked list:

  • You may not use the LinkedList or ArrayList class or any other predefined Java collections
  • Your linked list must have a node inner class to represent each element
  • Your linked list must have add, remove, contains, find, size, get, copy and sort methods
  • Method definitions:
    • add -- add an element to the list
    • remove -- remove an element (specified by numeric index) from the list
    • contains -- returns true if the element is in the list, false otherwise
    • find -- returns the element's index if it is in the list, -1 otherwise
    • size -- returns the current size of the list
    • get -- returns the element at the specified index
    • copy -- returns a new linked list containing the same values (look up deep versus shallow copy)
    • sort -- sorts the list using your algorithm of choice. You must perform the sorting yourself (no fair using someone else's library)

Optional features

  • implement your linked list as a generic class that can store any type of object
  • Add a reverse method
  • Add a slice method that returns a copy of a subset of the element of the list (eg slice(2,8) returns a new linked list containing elements #2,3,4,5,6,7 -- but not 8)

datastructures's People

Contributors

davidginzberg avatar rjackson88 avatar

Watchers

James Cloos avatar

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.