Mike
BAN USERNIT Jal
Correct !!
Another way i can think of is,
to have a stack and a Queue of linked list.
create a stack and a Queue of linked list.
insert each character both into the stack and the queue.
have count of length
now for half the length match each character from both Q to corresponding stack character
(pop from stack and get from stack and get front from Q)
if it does not match at any point
return false
return true;
space complexty 2O(n) ~ O(n)
Time Complexity O(n)
is int a requiered as an argument?
the value assigned to it is r.data which is also available while it is getting returned: Instead of a we could return r.data itself
int func(Node r) {
if (r == null) return r.data;
r.data += func(r.right);
return func(r.left);
}
its more readable now
I think this could be done. While you should also have diagonal pointers.
- Mike November 09, 2012So, in effect there should be 8 pointers for all ajoining cells. giving the complexty of (4n)^2