# 什么是链表，多谢各位！（终于可以给高分了，呵呵~）

www.MyException.Cn  网友分享于：2013-03-07  浏览：14次

顺便问下：我今天刚刚注册，是朋友推荐的。怎么我在发帖时的“帖子问题点数”这一栏只能给“0”分呢？我明明有200可用分呀。

------解决方案--------------------

------解决方案--------------------

....
....

------解决方案--------------------

http://xiaoerlanglaile.blog.sohu.com/120427163.html
------解决方案--------------------

------解决方案--------------------
Java code
```import java.util.*;

class Node
{
static int num = 1;
double data;
Node next;
Node prep;
Node(double ddata,Node nnext,Node pprep)
{
data = ddata;
next = nnext;
prep = pprep;
}
Node(double ddata,Node k,int sign) //0为前，1为后
{
data = ddata;
if(sign == 0)
{
this.prep = k;
k.next = this;
this.next = null;
k = Listoper.MoveNodeNex(k);
}
else
{
this.next = k;
k.prep = this;
this.next = null;
k = Listoper.MoveNodePre(k);
}
}
Node(double ddata)
{
data = ddata;
next = null;
prep = null;
}
Node()
{
data = 0;
next = null;
prep = null;
}
static boolean MakeEmpty(Node Me)
{
Me.data = 0;
Me.next = null;
Me.prep = null;
Me = null;

if(Me == null)
return true;
return false;
}

void display()
{
System.out.println("节点"+num+"的值为:"+"["+data+"]");
num++;
}
}
class Listoper
{
static void InsertNode(Node ListLoc,Node WorkNode)  //将节点WorkNode 插入在节点ListLoc前面。
{
WorkNode = ListLoc.prep.next;
WorkNode.prep = ListLoc.prep;
ListLoc.prep = WorkNode;
WorkNode.next = ListLoc;
}
static boolean DeleteNode(Node ListHead,int ddata) //将和ddata相同数据项的节点在链表中删除
{
{
}
{
return false;
}
Node p = new Node();
p.prep.next = p.next;
p.next.prep = p.prep;

if(Node.MakeEmpty(p) == true)
System.gc();
else
{
System.out.println("memory error!");
}
return true;
}
static void DisplayList(Node Llist)    //打印出链表中各个节点
{
while(Llist != null)
{
Llist.display();
Llist = Llist.next;
}
}
static Node MoveNodePre(Node p)         //对链表中当前节点进行前后移位的操作
{
return p.prep;
}
static Node MoveNodeNex(Node p)
{
return p.next;
}
}

public class ABC
{
public static void main(String[] args)
{
int i;
Random Rdata = new Random();
for(i = 2; i < 10; i++)
{
p = new Node(Rdata.nextDouble()*10000,p,0);
}