文件名称:SinglyLinkedList
-
所属分类:
- 标签属性:
- 上传时间:2015-02-02
-
文件大小:2.73kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
The newly added method should work as follow:
1. Takes two input objects L1 & L2 of type SinglyLinkedList,
2. L1 & L2 represents two Integer list in ascending order,
3. Returns an object L3 with the sorted merge value of L1 & L2
4. For example: L1= {1, 7, 12, 13, 20} and L2= {2, 3, 6, 9, 25},
5. Then: L3= {1, 2, 3, 6, 7, 9, 12, 13, 20, 25}
Idea of Working
While L1 is not empty and L2 is not empty:
If first element of L1 < first element of L2:
Remove first element L1
Insert element into L3
End if
Else:
Remove first element L2
Insert element into L3
End while
If L1 is not empty and L2 is empty:
Insert the rest of elements L1 into L3
If L2 is not empty and L1 is empty:
Insert the rest of elements L2 into L3-The newly added method should work as follow:
1. Takes two input objects L1 & L2 of type SinglyLinkedList,
2. L1 & L2 represents two Integer list in ascending order,
3. Returns an object L3 with the sorted merge value of L1 & L2
4. For example: L1= {1, 7, 12, 13, 20} and L2= {2, 3, 6, 9, 25},
5. Then: L3= {1, 2, 3, 6, 7, 9, 12, 13, 20, 25}
Idea of Working
While L1 is not empty and L2 is not empty:
If first element of L1 < first element of L2:
Remove first element L1
Insert element into L3
End if
Else:
Remove first element L2
Insert element into L3
End while
If L1 is not empty and L2 is empty:
Insert the rest of elements L1 into L3
If L2 is not empty and L1 is empty:
Insert the rest of elements L2 into L3
1. Takes two input objects L1 & L2 of type SinglyLinkedList,
2. L1 & L2 represents two Integer list in ascending order,
3. Returns an object L3 with the sorted merge value of L1 & L2
4. For example: L1= {1, 7, 12, 13, 20} and L2= {2, 3, 6, 9, 25},
5. Then: L3= {1, 2, 3, 6, 7, 9, 12, 13, 20, 25}
Idea of Working
While L1 is not empty and L2 is not empty:
If first element of L1 < first element of L2:
Remove first element L1
Insert element into L3
End if
Else:
Remove first element L2
Insert element into L3
End while
If L1 is not empty and L2 is empty:
Insert the rest of elements L1 into L3
If L2 is not empty and L1 is empty:
Insert the rest of elements L2 into L3-The newly added method should work as follow:
1. Takes two input objects L1 & L2 of type SinglyLinkedList,
2. L1 & L2 represents two Integer list in ascending order,
3. Returns an object L3 with the sorted merge value of L1 & L2
4. For example: L1= {1, 7, 12, 13, 20} and L2= {2, 3, 6, 9, 25},
5. Then: L3= {1, 2, 3, 6, 7, 9, 12, 13, 20, 25}
Idea of Working
While L1 is not empty and L2 is not empty:
If first element of L1 < first element of L2:
Remove first element L1
Insert element into L3
End if
Else:
Remove first element L2
Insert element into L3
End while
If L1 is not empty and L2 is empty:
Insert the rest of elements L1 into L3
If L2 is not empty and L1 is empty:
Insert the rest of elements L2 into L3
(系统自动生成,下载前可以参看下载内容)
下载文件列表
SinglyLinkedList/.classpath
SinglyLinkedList/.project
SinglyLinkedList/src/SinglyLinkedList$Node.class
SinglyLinkedList/src/SinglyLinkedList.class
SinglyLinkedList/bin
SinglyLinkedList/src
SinglyLinkedList
SinglyLinkedList/.project
SinglyLinkedList/src/SinglyLinkedList$Node.class
SinglyLinkedList/src/SinglyLinkedList.class
SinglyLinkedList/bin
SinglyLinkedList/src
SinglyLinkedList
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.