文件名称:SinglyLinkedList
介绍说明--下载内容均来自于网络,请自行研究使用
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
................\.project
................\src\SinglyLinkedList$Node.class
................\...\SinglyLinkedList.class
................\bin
................\src
SinglyLinkedList