Re: [algogeeks] plz reply quickly

2011-09-23 Thread sukran dhawan
@yogesh:for linked list that will not work coz loop doesnt always mean rear->next will be front hare and tortoise rule will serve the purpose On Fri, Sep 23, 2011 at 10:15 PM, Yogesh Yadav wrote: > I am not sure about these...but i guess this will do the job > > In Linked List: > > (rear->next==

Re: [algogeeks] plz reply quickly

2011-09-23 Thread Guneesh Paul Singh
loop in a link list doesn't necessarily mean a circular link list(d one u hav assumed) eg in this case 1->2->3->4->5->3 there is a loop which in order to detect requires d use of hair & tortoise rule -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks

Re: [algogeeks] plz reply quickly

2011-09-23 Thread Yogesh Yadav
I am not sure about these...but i guess this will do the job In Linked List: (rear->next==front) In Array: after reaching the maximum size or the end of queue ...just add one more element in queue... and after addition just check (queue[front]==new_element_added) ... if yes then circular queue

Re: [algogeeks] plz reply quickly

2011-09-23 Thread Ashima .
in hair and tortoise this they will meet wen 1st pointer(tortoise) is at the end of the linked list(in 1st traverse) and 2nd pointer( hair) reaches the same node 2nd time. That means u traversed the list twice. Its better that since u hv the head of the linked list, keep on moving till the end .If

Re: [algogeeks] plz reply quickly

2011-09-23 Thread sukran dhawan
@aditya:can u explain ur array approach ? On Fri, Sep 23, 2011 at 8:43 PM, Aditya Virmani wrote: > in arrays i guess it can be simply analysed checking the last element of > array(which can be obtained by sizeof) & checking how the entries are filled > inn the array... > in linked list hair & tor

Re: [algogeeks] plz reply quickly

2011-09-23 Thread Aditya Virmani
in arrays i guess it can be simply analysed checking the last element of array(which can be obtained by sizeof) & checking how the entries are filled inn the array... in linked list hair & tortoise rule...initialize two pointers...one's step size:1, second's step size two... & run through the linke

Re: [algogeeks] plz reply quickly

2011-09-22 Thread sukran dhawan
use hair and tortoise rule for lists i don think we can do it for arrays On Thu, Sep 22, 2011 at 10:22 PM, Ishan Aggarwal < ishan.aggarwal.1...@gmail.com> wrote: > In both the cases... what would be the condition? > > > On Thu, Sep 22, 2011 at 10:19 PM, sukran dhawan wrote: > >> queue represnted

Re: [algogeeks] plz reply quickly

2011-09-22 Thread Ishan Aggarwal
In both the cases... what would be the condition? On Thu, Sep 22, 2011 at 10:19 PM, sukran dhawan wrote: > queue represnted as array or linked list ? > > > On Thu, Sep 22, 2011 at 10:08 PM, Ishan Aggarwal < > ishan.aggarwal.1...@gmail.com> wrote: > >> How will u detect if a queue is circular or n

Re: [algogeeks] plz reply quickly

2011-09-22 Thread sukran dhawan
queue represnted as array or linked list ? On Thu, Sep 22, 2011 at 10:08 PM, Ishan Aggarwal < ishan.aggarwal.1...@gmail.com> wrote: > How will u detect if a queue is circular or not?? > > -- > Kind Regards > Ishan Aggarwal > [image: Aricent Group] > Presidency Tower-A, M.G.Road,Sector-14 > Gurga