- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 5528 个
- 通用积分
- 53.1721
- 学术水平
- 36 点
- 热心指数
- 71 点
- 信用等级
- 55 点
- 经验
- 37032 点
- 帖子
- 1047
- 精华
- 0
- 在线时间
- 687 小时
- 注册时间
- 2011-2-23
- 最后登录
- 2024-3-8
|
Listing 3.3: Node
- A Node class is used to represent the nodes that link together to form linked
- lists. A typical Node class has only its two fields, data and next, and a
- constructor, as in Listing 3.3.
- Listing 3.3: Node
- 1 public class Node {
- 2 private int data;
- 3 private Node next;
- 4
- 5 public Node(int data, Node next) {
- 6 this.data = data;
- 7 this.next = next;
- 8 }
- 9 }
- To implement a stack, we only need two linked list operations: insert and
- remove from the front of the list.
复制代码
|
-
总评分: 论坛币 + 20
查看全部评分
|