去掉单向链表中的重复元素 with O(n) time and O(1) (转载)# JobHunting - 待字闺中
m*r
1 楼
【 以下文字转载自 Quant 讨论区 】
发信人: mitcar (mitcar), 信区: Quant
标 题: 去掉单向链表中的重复元素 with O(n) time and O(1)
发信站: BBS 未名空间站 (Mon Aug 19 21:49:27 2013, 美东)
How remove duplicated elements on a single-linked list with O(n) time and O(
1) space ?
The elements can be any characters, numbers and they are not sorted.
For example, given 8 --> 6 --> 7 --> 6 --> 5
return 8 --> 6 --> 7 --> 5
O(1) space seems to be tough ?
Any help would be appreciated !
Thanks
发信人: mitcar (mitcar), 信区: Quant
标 题: 去掉单向链表中的重复元素 with O(n) time and O(1)
发信站: BBS 未名空间站 (Mon Aug 19 21:49:27 2013, 美东)
How remove duplicated elements on a single-linked list with O(n) time and O(
1) space ?
The elements can be any characters, numbers and they are not sorted.
For example, given 8 --> 6 --> 7 --> 6 --> 5
return 8 --> 6 --> 7 --> 5
O(1) space seems to be tough ?
Any help would be appreciated !
Thanks