链表编程:从基础到高级应用
1. 有序链表的插入与删除方法编程实践
在这个编程活动中,我们要处理一个整数的有序链表,主要任务是编写插入和删除节点的方法。
操作步骤
- 准备工作 :从相关网站将本章节“Programming Activity 2”文件夹的内容复制到计算机的文件夹中,然后打开
LinkedList.java源文件。在源文件中搜索五个星号( * ),定位到需要添加代码的部分。 - 插入方法编码 :在
insert方法中编写代码,实现将整数插入有序链表的功能。示例代码如下:
public void insert( int value )
{
// ***** Student writes the body of this method *****
// code the insert method of a linked list of ints
// the int to insert in the linked list is value
//
// Student code starts here
//
//
// End of student code, part 1
//
}
超级会员免费看
订阅专栏 解锁全文
1030

被折叠的 条评论
为什么被折叠?



