See setup instructions, in the Code 301 Setup Guide.
Under the data-structures-and-algorithms
repository, at the top level is a folder called code-challenges
Each day, you'll add one new file to this folder to do your work for the day's assigned code challenge
- Please follow the instructions specific to your 401 language, which can be found in the directory below, matching your course.
Implementation: Singly Linked Lists
- Create a Node class that has properties for the value stored in the Node, and a pointer to the next Node.
- Within your LinkedList class, include a head property. Upon instantiation, an empty Linked List should be created.
- Define a method called insert which takes any value as an argument and adds a new node with that value to the head of the list with an O(1) Time performance.
- Define a method called includes which takes any value as an argument and returns a boolean result depending on whether that value exists as a Node’s value somewhere within the list.
- Define a method called toString (or str in Python) which takes in no arguments and returns a string representing all the values in the Linked List, formatted as: "{ a } -> { b } -> { c } -> NULL"
- Any exceptions or errors that come from your code should be semantic, capturable errors. For example, rather than a default error thrown by your language, your code * * should raise/throw a custom, semantic error that describes what went wrong in calling the methods you wrote for this lab.
- Be sure to follow your language/frameworks standard naming conventions (e.g. C# uses PascalCasing for all method and class names).
- insert method => Big O = 1
- incloudes => Big O = n
- toString method => Big O = n