Cterm在W7 64下字符不清楚# Hardware - 计算机硬件
a*x
1 楼
We are given a singly-linked list A. The nodes of A consists of usual data
and next pointer. Along with these there is another pointer random which
points to a random node of A. We are supposed to make a new linked list B
which is copy of A as far as the structure is concerned but all its nodes
are newly allocated. Develop an algorithm such that its time complexity is O
(n).
似乎是小尾羊同学刚才的题目
我的问题就是这个linkedlist不可以直接一次loop,
for each node in original LL:
allocate new node
copy data
copy next poi
and next pointer. Along with these there is another pointer random which
points to a random node of A. We are supposed to make a new linked list B
which is copy of A as far as the structure is concerned but all its nodes
are newly allocated. Develop an algorithm such that its time complexity is O
(n).
似乎是小尾羊同学刚才的题目
我的问题就是这个linkedlist不可以直接一次loop,
for each node in original LL:
allocate new node
copy data
copy next poi