public class Class
{
public Node
public Class (T [] value) / / the array of values written into a single linked list
{
Node
for (int i = 0; i
rear.next = new Node
rear = rear.next;
}
}
public T get (int i) / / returns a single list of values
{
if (i> 0)
{
Node
for (int j = 0; p! = null && j p = p.next;
if (p! = null)
return p.data;
}
return null;
}
public String toString ()
{
String str = "(";
Node
while (p! = null)
{
str + = p.data.toString ();
if (p.next! = null)
{
str + = ",";
p = p.next;
}
}
return str + ")";
}
public static void main (String [] args)
{
Integer value [] = new Integer [10];
for (int i = 0; i <10; i + +)
{
value [i] = (int) (Math.random () * 1000);
}
Class
System.out.println (a.toString ());
}
}
------ Solution ----------------------------------- ---------
how sent to non-technical areas of ?
------ For reference only -------------------------------------- -
is not running or can not get the results you want ? There are two types of single chain , the lead single linked list of nodes and a single linked list head pointer , if you can run , you understand these two types of single-chain to know is where the wrong.
没有评论:
发表评论