[google面试题]Write a function to remove a single occurrence of an integer from a doubly linked list if it is present.
Sample Answer(inJava):void remove(Node head, int value) { Nodecur = head; while (cur != null) { if(cur.value == value) { if(curr.prev != null) cur.prev.next = cur.next; if(cur.next != null) cur.next.prev = cur.prev; break; } cur= cur.next; }}
页:
[1]