all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,34 @@
class Node
{
const Int value
Node? successor // can be null, for end of series
new make (Int value, Node? successor := null)
{
this.value = value
this.successor = successor
}
// insert method for this problem
public Void insert (Node newNode)
{
newNode.successor = this.successor
this.successor = newNode
}
}
// simple class to test putting 'c' between 'a' and 'b'
class Main
{
public static Void main ()
{
c := Node (2)
b := Node (3)
a := Node (1, b)
a.insert (c)
echo (a.value)
echo (a.successor.value)
echo (a.successor.successor.value)
}
}