Q2) get to n/2 nodes
Reverse link list after n/2 nodes
Now check from 1st node and n/2 node for equality
Can make the checking for equality function recursive

Sent from my iPhone 4


On 26-Aug-2012, at 12:41 AM, Ashish Goel <ashg...@gmail.com> wrote:

> Q1. Design a data structure for the following operations:
> 
> I.                Enqueue
> 
> II.               Dequeue
> 
> III.              Delete a given number(if it is present in the queue, else 
> do nothing)
> 
> IV.               isNumberPresent
> 
> All these operations should take O(1) time.
> 
> 
> 
> Q2. Check if a linked list (each char is a node) is palindrome, recursively.
> 
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to 
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to