WeixiangYan/CodeTransOcean huggingface dataset:
Task: First power of 2 that has leading decimal digits of 12

C: #include <math.h>
#include <stdio.h>

int p(int l, int n) {
    int test = 0;
    double logv = log(2.0) / log(10.0);
    int factor = 1;
    int loop = l;
    while (loop > 10) {
        factor *= 10;
        loop /= 10;
    }
    while (n > 0) {
        int val;

        test++;
        val = (int)(factor * pow(10.0, fmod(test * logv, 1)));
        if (val == l) {
            n--;
        }
    }
    return test;
}

void runTest(int l, int n) {
    printf("p(%d, %d) = %d\n", l, n, p(l, n));
}

int main() {
    runTest(12, 1);
    runTest(12, 2);
    runTest(123, 45);
    runTest(123, 12345);
    runTest(123, 678910);

    return 0;
}








VB: Module Module1

    Function Func(ByVal l As Integer, ByVal n As Integer) As Long
        Dim res As Long = 0, f As Long = 1
        Dim lf As Double = Math.Log10(2)
        Dim i As Integer = l

        While i > 10
            f *= 10
            i /= 10
        End While

        While n > 0
            res += 1

            If CInt((f * Math.Pow(10, res * lf Mod 1))) = l Then
                n -= 1
            End If
        End While

        Return res
    End Function

    Sub Main()
        Dim values = {Tuple.Create(12, 1), Tuple.Create(12, 2), Tuple.Create(123, 45), Tuple.Create(123, 12345), Tuple.Create(123, 678910), Tuple.Create(99, 1)}
        For Each pair In values
            Console.WriteLine("p({0,3}, {1,6}) = {2,11:n0}", pair.Item1, pair.Item2, Func(pair.Item1, pair.Item2))
        Next
    End Sub

End Module
Task: First power of 2 that has leading decimal digits of 12




Go: package main

import (
    "fmt"
    "math"
    "time"
)

const ld10 = math.Ln2 / math.Ln10

func commatize(n uint64) string {
    s := fmt.Sprintf("%d", n)
    le := len(s)
    for i := le - 3; i >= 1; i -= 3 {
        s = s[0:i] + "," + s[i:]
    }
    return s
}

func p(L, n uint64) uint64 {
    i := L
    digits := uint64(1)
    for i >= 10 {
        digits *= 10
        i /= 10
    }
    count := uint64(0)
    for i = 0; count < n; i++ {
        e := math.Exp(math.Ln10 * math.Mod(float64(i)*ld10, 1))
        if uint64(math.Trunc(e*float64(digits))) == L {
            count++            
        }
    }
    return i - 1
}

func main() {
    start := time.Now()
    params := [][2]uint64{{12, 1}, {12, 2}, {123, 45}, {123, 12345}, {123, 678910}}
    for _, param := range params {
        fmt.Printf("p(%d, %d) = %s\n", param[0], param[1], commatize(p(param[0], param[1])))
    }
    fmt.Printf("\nTook %s\n", time.Since(start))
}





VB: Module Module1

    Function Func(ByVal l As Integer, ByVal n As Integer) As Long
        Dim res As Long = 0, f As Long = 1
        Dim lf As Double = Math.Log10(2)
        Dim i As Integer = l

        While i > 10
            f *= 10
            i /= 10
        End While

        While n > 0
            res += 1

            If CInt((f * Math.Pow(10, res * lf Mod 1))) = l Then
                n -= 1
            End If
        End While

        Return res
    End Function

    Sub Main()
        Dim values = {Tuple.Create(12, 1), Tuple.Create(12, 2), Tuple.Create(123, 45), Tuple.Create(123, 12345), Tuple.Create(123, 678910), Tuple.Create(99, 1)}
        For Each pair In values
            Console.WriteLine("p({0,3}, {1,6}) = {2,11:n0}", pair.Item1, pair.Item2, Func(pair.Item1, pair.Item2))
        Next
    End Sub

End Module
Task: Null object

C: #include <stdio.h>

int main()
{
	char *object = 0;

	if (object == NULL) {
		puts("object is null");
	}
	return 0;
}


C++: #include <iostream>
#include <cstdlib>
if (object == 0) {
   std::cout << "object is null";
}
Task: Null object

C: #include <stdio.h>

int main()
{
	char *object = 0;

	if (object == NULL) {
		puts("object is null");
	}
	return 0;
}




Go: package main

import "fmt"

var (
    s []int       
    p *int        
    f func()      
    i interface{} 
    m map[int]int 
    c chan int    
)

func main() {
    fmt.Println(s == nil)
    fmt.Println(p == nil)
    fmt.Println(f == nil)
    fmt.Println(i == nil)
    fmt.Println(m == nil)
    fmt.Println(c == nil)
}
Task: Null object

C: #include <stdio.h>

int main()
{
	char *object = 0;

	if (object == NULL) {
		puts("object is null");
	}
	return 0;
}





Java: module NullObject
    {
    void run()
        {
        @Inject Console console;
        console.print($"Null value={Null}, Null.toString()={Null.toString()}");

     
        String? s = Null;       
        String s2 = "test";
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");

     
        Int len = s?.size : 0;
        console.print($"len={len}");

        if (String test ?= s)
            {
            
            }
        else
            {
            s = "a non-null value";
            }

     
        s2 = s;                 
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");
        }
    }
Task: Null object

C: #include <stdio.h>

int main()
{
	char *object = 0;

	if (object == NULL) {
		puts("object is null");
	}
	return 0;
}







Python: x = None
if x is None:
  print "x is None"
else:
  print "x is not None"
Task: Null object

C: #include <stdio.h>

int main()
{
	char *object = 0;

	if (object == NULL) {
		puts("object is null");
	}
	return 0;
}








VB: Public Sub Main()
    Dim c As VBA.Collection
     
    
    Debug.Print c Is Nothing
     
    
    Set c = New VBA.Collection
    Debug.Print Not c Is Nothing
     
    
    Set c = Nothing
    Debug.Print c Is Nothing
End Sub
Task: Null object


C++: #include <iostream>
#include <cstdlib>
if (object == 0) {
   std::cout << "object is null";
}


C#: if (foo == null)
    Console.WriteLine("foo is null");
Task: Null object


C++: #include <iostream>
#include <cstdlib>
if (object == 0) {
   std::cout << "object is null";
}



Go: package main

import "fmt"

var (
    s []int       
    p *int        
    f func()      
    i interface{} 
    m map[int]int 
    c chan int    
)

func main() {
    fmt.Println(s == nil)
    fmt.Println(p == nil)
    fmt.Println(f == nil)
    fmt.Println(i == nil)
    fmt.Println(m == nil)
    fmt.Println(c == nil)
}
Task: Null object


C++: #include <iostream>
#include <cstdlib>
if (object == 0) {
   std::cout << "object is null";
}




Java: module NullObject
    {
    void run()
        {
        @Inject Console console;
        console.print($"Null value={Null}, Null.toString()={Null.toString()}");

     
        String? s = Null;       
        String s2 = "test";
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");

     
        Int len = s?.size : 0;
        console.print($"len={len}");

        if (String test ?= s)
            {
            
            }
        else
            {
            s = "a non-null value";
            }

     
        s2 = s;                 
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");
        }
    }
Task: Null object


C++: #include <iostream>
#include <cstdlib>
if (object == 0) {
   std::cout << "object is null";
}






Python: x = None
if x is None:
  print "x is None"
else:
  print "x is not None"
Task: Null object



C#: if (foo == null)
    Console.WriteLine("foo is null");


Go: package main

import "fmt"

var (
    s []int       
    p *int        
    f func()      
    i interface{} 
    m map[int]int 
    c chan int    
)

func main() {
    fmt.Println(s == nil)
    fmt.Println(p == nil)
    fmt.Println(f == nil)
    fmt.Println(i == nil)
    fmt.Println(m == nil)
    fmt.Println(c == nil)
}
Task: Null object



C#: if (foo == null)
    Console.WriteLine("foo is null");





Python: x = None
if x is None:
  print "x is None"
else:
  print "x is not None"
Task: Null object



C#: if (foo == null)
    Console.WriteLine("foo is null");






VB: Public Sub Main()
    Dim c As VBA.Collection
     
    
    Debug.Print c Is Nothing
     
    
    Set c = New VBA.Collection
    Debug.Print Not c Is Nothing
     
    
    Set c = Nothing
    Debug.Print c Is Nothing
End Sub
Task: Null object




Go: package main

import "fmt"

var (
    s []int       
    p *int        
    f func()      
    i interface{} 
    m map[int]int 
    c chan int    
)

func main() {
    fmt.Println(s == nil)
    fmt.Println(p == nil)
    fmt.Println(f == nil)
    fmt.Println(i == nil)
    fmt.Println(m == nil)
    fmt.Println(c == nil)
}


Java: module NullObject
    {
    void run()
        {
        @Inject Console console;
        console.print($"Null value={Null}, Null.toString()={Null.toString()}");

     
        String? s = Null;       
        String s2 = "test";
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");

     
        Int len = s?.size : 0;
        console.print($"len={len}");

        if (String test ?= s)
            {
            
            }
        else
            {
            s = "a non-null value";
            }

     
        s2 = s;                 
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");
        }
    }
Task: Null object





Java: module NullObject
    {
    void run()
        {
        @Inject Console console;
        console.print($"Null value={Null}, Null.toString()={Null.toString()}");

     
        String? s = Null;       
        String s2 = "test";
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");

     
        Int len = s?.size : 0;
        console.print($"len={len}");

        if (String test ?= s)
            {
            
            }
        else
            {
            s = "a non-null value";
            }

     
        s2 = s;                 
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");
        }
    }



Python: x = None
if x is None:
  print "x is None"
else:
  print "x is not None"
Task: Null object





Java: module NullObject
    {
    void run()
        {
        @Inject Console console;
        console.print($"Null value={Null}, Null.toString()={Null.toString()}");

     
        String? s = Null;       
        String s2 = "test";
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");

     
        Int len = s?.size : 0;
        console.print($"len={len}");

        if (String test ?= s)
            {
            
            }
        else
            {
            s = "a non-null value";
            }

     
        s2 = s;                 
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");
        }
    }




VB: Public Sub Main()
    Dim c As VBA.Collection
     
    
    Debug.Print c Is Nothing
     
    
    Set c = New VBA.Collection
    Debug.Print Not c Is Nothing
     
    
    Set c = Nothing
    Debug.Print c Is Nothing
End Sub
Task: Null object




Go: package main

import "fmt"

var (
    s []int       
    p *int        
    f func()      
    i interface{} 
    m map[int]int 
    c chan int    
)

func main() {
    fmt.Println(s == nil)
    fmt.Println(p == nil)
    fmt.Println(f == nil)
    fmt.Println(i == nil)
    fmt.Println(m == nil)
    fmt.Println(c == nil)
}




Python: x = None
if x is None:
  print "x is None"
else:
  print "x is not None"
Task: Null object




Go: package main

import "fmt"

var (
    s []int       
    p *int        
    f func()      
    i interface{} 
    m map[int]int 
    c chan int    
)

func main() {
    fmt.Println(s == nil)
    fmt.Println(p == nil)
    fmt.Println(f == nil)
    fmt.Println(i == nil)
    fmt.Println(m == nil)
    fmt.Println(c == nil)
}





VB: Public Sub Main()
    Dim c As VBA.Collection
     
    
    Debug.Print c Is Nothing
     
    
    Set c = New VBA.Collection
    Debug.Print Not c Is Nothing
     
    
    Set c = Nothing
    Debug.Print c Is Nothing
End Sub
Task: Null object







Python: x = None
if x is None:
  print "x is None"
else:
  print "x is not None"


VB: Public Sub Main()
    Dim c As VBA.Collection
     
    
    Debug.Print c Is Nothing
     
    
    Set c = New VBA.Collection
    Debug.Print Not c Is Nothing
     
    
    Set c = Nothing
    Debug.Print c Is Nothing
End Sub
Task: Null object

C: #include <stdio.h>

int main()
{
	char *object = 0;

	if (object == NULL) {
		puts("object is null");
	}
	return 0;
}



C#: if (foo == null)
    Console.WriteLine("foo is null");
Task: Null object



C#: if (foo == null)
    Console.WriteLine("foo is null");



Java: module NullObject
    {
    void run()
        {
        @Inject Console console;
        console.print($"Null value={Null}, Null.toString()={Null.toString()}");

     
        String? s = Null;       
        String s2 = "test";
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");

     
        Int len = s?.size : 0;
        console.print($"len={len}");

        if (String test ?= s)
            {
            
            }
        else
            {
            s = "a non-null value";
            }

     
        s2 = s;                 
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");
        }
    }
Task: Null object


C++: #include <iostream>
#include <cstdlib>
if (object == 0) {
   std::cout << "object is null";
}







VB: Public Sub Main()
    Dim c As VBA.Collection
     
    
    Debug.Print c Is Nothing
     
    
    Set c = New VBA.Collection
    Debug.Print Not c Is Nothing
     
    
    Set c = Nothing
    Debug.Print c Is Nothing
End Sub
Task: Null object

C: #include <stdio.h>

int main()
{
	char *object = 0;

	if (object == NULL) {
		puts("object is null");
	}
	return 0;
}






PHP: $x = NULL;
if (is_null($x))
  echo "\$x is null\n";
Task: Null object



C#: if (foo == null)
    Console.WriteLine("foo is null");




PHP: $x = NULL;
if (is_null($x))
  echo "\$x is null\n";
Task: Null object


C++: #include <iostream>
#include <cstdlib>
if (object == 0) {
   std::cout << "object is null";
}





PHP: $x = NULL;
if (is_null($x))
  echo "\$x is null\n";
Task: Null object




Go: package main

import "fmt"

var (
    s []int       
    p *int        
    f func()      
    i interface{} 
    m map[int]int 
    c chan int    
)

func main() {
    fmt.Println(s == nil)
    fmt.Println(p == nil)
    fmt.Println(f == nil)
    fmt.Println(i == nil)
    fmt.Println(m == nil)
    fmt.Println(c == nil)
}



PHP: $x = NULL;
if (is_null($x))
  echo "\$x is null\n";
Task: Null object





Java: module NullObject
    {
    void run()
        {
        @Inject Console console;
        console.print($"Null value={Null}, Null.toString()={Null.toString()}");

     
        String? s = Null;       
        String s2 = "test";
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");

     
        Int len = s?.size : 0;
        console.print($"len={len}");

        if (String test ?= s)
            {
            
            }
        else
            {
            s = "a non-null value";
            }

     
        s2 = s;                 
        console.print($"s={s}, s2={s2}, (s==s2)={s==s2}");
        }
    }


PHP: $x = NULL;
if (is_null($x))
  echo "\$x is null\n";
Task: Null object






PHP: $x = NULL;
if (is_null($x))
  echo "\$x is null\n";


Python: x = None
if x is None:
  print "x is None"
else:
  print "x is not None"
Task: Null object






PHP: $x = NULL;
if (is_null($x))
  echo "\$x is null\n";



VB: Public Sub Main()
    Dim c As VBA.Collection
     
    
    Debug.Print c Is Nothing
     
    
    Set c = New VBA.Collection
    Debug.Print Not c Is Nothing
     
    
    Set c = Nothing
    Debug.Print c Is Nothing
End Sub
Task: Abelian sandpile model


C++: #include <iostream>
#include "xtensor/xarray.hpp"
#include "xtensor/xio.hpp"
#include "xtensor-io/ximage.hpp"

xt::xarray<int> init_grid (unsigned long x_dim, unsigned long y_dim)
{
    xt::xarray<int>::shape_type shape = { x_dim, y_dim };
    xt::xarray<int> grid(shape);

    grid(x_dim/2, y_dim/2) = 64000;
    
    return grid;
}

int print_grid(xt::xarray<int>& grid)
{
    
    
    

    
    xt::dump_image("grid.jpg", grid);

    return 0;
}

bool iterate_grid(xt::xarray<int>& grid, const unsigned long& x_dim, const unsigned long& y_dim)
{
    bool changed = false;

    for (unsigned long i=0; i < x_dim; ++i)
    {
        for (unsigned long j=0; j < y_dim; ++j)
        {
            if ( grid(i, j) >= 4 )
            {
                grid(i, j) -= 4;
                changed = true;
                try
                {
                    grid.at(i-1, j) += 1;
                    grid.at(i+1, j) += 1;
                    grid.at(i, j-1) += 1;
                    grid.at(i, j+1) += 1;
                }
                catch (const std::out_of_range& oor)
                {
                }
            }
        }
    }

    return changed;
}

int main(int argc, char* argv[])
{
    const unsigned long x_dim { 200 };
    const unsigned long y_dim { 200 };

    xt::xarray<int> grid = init_grid(x_dim, y_dim);
    bool changed { true };

    iterate_grid(grid, x_dim, y_dim);

    while (changed == true)
    {
        changed = iterate_grid(grid, x_dim, y_dim);
    }
    print_grid(grid);

    return 0;
}






Python: import numpy as np
import matplotlib.pyplot as plt


def iterate(grid):
    changed = False
    for ii, arr in enumerate(grid):
        for jj, val in enumerate(arr):
            if val > 3:
                grid[ii, jj] -= 4
                if ii > 0:
                    grid[ii - 1, jj] += 1
                if ii < len(grid)-1:
                    grid[ii + 1, jj] += 1
                if jj > 0:
                    grid[ii, jj - 1] += 1
                if jj < len(grid)-1:
                    grid[ii, jj + 1] += 1
                changed = True
    return grid, changed


def simulate(grid):
    while True:
        grid, changed = iterate(grid)
        if not changed:
            return grid


if __name__ == '__main__':
    start_grid = np.zeros((10, 10))
    start_grid[4:5, 4:5] = 64
    final_grid = simulate(start_grid.copy())
    plt.figure()
    plt.gray()
    plt.imshow(start_grid)
    plt.figure()
    plt.gray()
    plt.imshow(final_grid)
Task: Abelian sandpile model




Go: package main

import (
    "fmt"
    "log"
    "os"
    "strings"
)

const dim = 16 

func check(err error) {
    if err != nil {
        log.Fatal(err)
    }
}


func drawPile(pile [][]uint) {
    chars:= []rune(" ░▓█")
    for _, row := range pile {
        line := make([]rune, len(row))
        for i, elem := range row {
            if elem > 3 { 
                elem = 3
            }
            line[i] = chars[elem]
        }
        fmt.Println(string(line))
    }
}



func writePile(pile [][]uint) {
    file, err := os.Create("output.ppm")
    check(err)
    defer file.Close()
    
    fmt.Fprintf(file, "P3\n%d %d\n255\n", dim, dim)
    bcolors := []string{"125 0 25 ", "125 80 0 ", "186 118 0 ", "224 142 0 "}
    var line strings.Builder
    for _, row := range pile {        
        for _, elem := range row {
            line.WriteString(bcolors[elem])
        }
        file.WriteString(line.String() + "\n")
        line.Reset() 
    }
}


func handlePile(x, y uint, pile [][]uint) {
    if pile[y][x] >= 4 {
        pile[y][x] -= 4
        
        
        if y > 0 {
            pile[y-1][x]++
            if pile[y-1][x] >= 4 {
                handlePile(x, y-1, pile)
            }
        }
        if x > 0 {
            pile[y][x-1]++
            if pile[y][x-1] >= 4 {
                handlePile(x-1, y, pile)
            }
        }
        if y < dim-1 {
            pile[y+1][x]++
            if pile[y+1][x] >= 4 {
                handlePile(x, y+1, pile)
            }
        }
        if x < dim-1 {
            pile[y][x+1]++
            if pile[y][x+1] >= 4 {
                handlePile(x+1, y, pile)
            }
        }

        
        
        

        
        
        handlePile(x, y, pile)
    }
}

func main() {
    
    pile := make([][]uint, dim)
    for i := 0; i < dim; i++ {
        pile[i] = make([]uint, dim)
    }

    
    hdim := uint(dim/2 - 1)
    pile[hdim][hdim] = 16
    handlePile(hdim, hdim, pile)
    drawPile(pile)

    
    
    
}




Python: import numpy as np
import matplotlib.pyplot as plt


def iterate(grid):
    changed = False
    for ii, arr in enumerate(grid):
        for jj, val in enumerate(arr):
            if val > 3:
                grid[ii, jj] -= 4
                if ii > 0:
                    grid[ii - 1, jj] += 1
                if ii < len(grid)-1:
                    grid[ii + 1, jj] += 1
                if jj > 0:
                    grid[ii, jj - 1] += 1
                if jj < len(grid)-1:
                    grid[ii, jj + 1] += 1
                changed = True
    return grid, changed


def simulate(grid):
    while True:
        grid, changed = iterate(grid)
        if not changed:
            return grid


if __name__ == '__main__':
    start_grid = np.zeros((10, 10))
    start_grid[4:5, 4:5] = 64
    final_grid = simulate(start_grid.copy())
    plt.figure()
    plt.gray()
    plt.imshow(start_grid)
    plt.figure()
    plt.gray()
    plt.imshow(final_grid)
Task: Doubly-linked list_Element definition

C: struct Node 
{
  struct Node *next;
  struct Node *prev;
  void  *data;
};


C++: template <typename T>
struct Node
{
    Node* next;
    Node* prev;
    T data;
};
Task: Doubly-linked list_Element definition

C: struct Node 
{
  struct Node *next;
  struct Node *prev;
  void  *data;
};




Go: type dlNode struct {
    string
    next, prev *dlNode
}
Task: Doubly-linked list_Element definition

C: struct Node 
{
  struct Node *next;
  struct Node *prev;
  void  *data;
};





Java: public class Node<T> {
   private T element;
   private Node<T> next, prev;

   public Node<T>(){
      next = prev = element = null;
   }

   public Node<T>(Node<T> n, Node<T> p, T elem){
      next = n;
      prev = p;
      element = elem;
   }

   public void setNext(Node<T> n){
      next = n;
   }

   public Node<T> getNext(){
      return next;
   }

   public void setElem(T elem){
      element = elem;
   }

   public T getElem(){
      return element;
   }

   public void setNext(Node<T> n){
      next = n;
   }

   public Node<T> setPrev(Node<T> p){
      prev = p;
   }

   public getPrev(){
      return prev;
   }
}
Task: Doubly-linked list_Element definition

C: struct Node 
{
  struct Node *next;
  struct Node *prev;
  void  *data;
};







Python: class Node(object):
     def __init__(self, data = None, prev = None, next = None):
         self.prev = prev
         self.next = next
         self.data = data
     def __str__(self):
         return str(self.data)
     def __repr__(self):
         return repr(self.data)
     def iter_forward(self):
         c = self
         while c != None:
             yield c
             c = c.next
     def iter_backward(self):
         c = self
         while c != None:
             yield c
             c = c.prev
Task: Doubly-linked list_Element definition

C: struct Node 
{
  struct Node *next;
  struct Node *prev;
  void  *data;
};








VB: Public Class Node(Of T)
   Public Value As T
   Public [Next] As Node(Of T)
   Public Previous As Node(Of T)
End Class
Task: Doubly-linked list_Element definition


C++: template <typename T>
struct Node
{
    Node* next;
    Node* prev;
    T data;
};


C#: class Link
{
    public int Item { get; set; }
    public Link Prev { get; set; }
    public Link Next { get; set; }

    
    public Link(int item, Link prev = null, Link next = null) {
        Item = item;
        Prev = prev;
        Next = next;
    }
}
Task: Doubly-linked list_Element definition


C++: template <typename T>
struct Node
{
    Node* next;
    Node* prev;
    T data;
};



Go: type dlNode struct {
    string
    next, prev *dlNode
}
Task: Doubly-linked list_Element definition


C++: template <typename T>
struct Node
{
    Node* next;
    Node* prev;
    T data;
};




Java: public class Node<T> {
   private T element;
   private Node<T> next, prev;

   public Node<T>(){
      next = prev = element = null;
   }

   public Node<T>(Node<T> n, Node<T> p, T elem){
      next = n;
      prev = p;
      element = elem;
   }

   public void setNext(Node<T> n){
      next = n;
   }

   public Node<T> getNext(){
      return next;
   }

   public void setElem(T elem){
      element = elem;
   }

   public T getElem(){
      return element;
   }

   public void setNext(Node<T> n){
      next = n;
   }

   public Node<T> setPrev(Node<T> p){
      prev = p;
   }

   public getPrev(){
      return prev;
   }
}