[Java教程]用java实现单链表(菜鸟出征)

0 2016-03-24 14:00:06 package code;class Node{ Node next; int data; public Node(int data) { this.data=data; } }class LinkList{ Node first; //头部 public LinkList() { this.first=null; } public void addNode(Node no) { no.next=first; first=no;//在头部添加 } public void delectNode() { Node n=first.next; first=null; first=n;//在头部删除 } //删除指定位置 public int Number() { int count=1; //查看有多少元素 Node nd=first; while(nd.next!=null) { nd=nd.next; count++; } return count; } public void delectExact(int n) { //删除指定位置 if(n>1) { int count=1; Node de=first; while(count1)//添加指定位置 { int count=1; Node de=first; while(count

大一菜鸟初学,有误之处请谅解。

本文网址:http://www.shaoqun/a/205353.html

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:admin@shaoqun。

JAVA

0

更多推荐

java单链表通讯录_[Java教程]用java实现单链表(菜鸟出征)