Re: [algogeeks] Odd one out
@gopi can u explain yr tree creation ? I mean u insert the element in the tree if u see it first, then u remove it from the tree if it has already been inserted?( which also means u need to find the element in the tree ?) so if an element is repeated 3 times and another 2 times what is the logic u r trying to convey? I am sorry if i got it all wrong the way I have interpreted it.. On Mon, Aug 1, 2011 at 8:43 PM, *$* wrote: > sorry abhishek , I have given wrong complexity for Q2. > > > On Mon, Aug 1, 2011 at 12:36 PM, Abhishek Gupta wrote: > >> @gopi >> inserting n elements, and then again checking each element? >> nlogn?? >> >> >> On Sun, Jul 31, 2011 at 9:04 PM, Anika Jain wrote: >> >>> @gopi: in 2nd of urs we after tree creation we will need to search each >>> element in array that will take o(nlogn) time.. is there any appraoch tht >>> reduces this? >>> >>> >>> On Sun, Jul 31, 2011 at 6:39 PM, *$* wrote: >>> Q1->Construct a binary tree , in such a way that if element occured for the first time , insert into tree , if occurs at second time , remove from the list. As all elements except the one need to find are even , at the end of the list , all the tree will contain only one element. Q2-> Construct a binary tree. similar to the above. Now again start from first element and check which element is missing in the tree. That is the required one. Thx, --Gopi On Sun, Jul 31, 2011 at 2:07 PM, Abhishek Gupta >>> > wrote: > Q1-> A large size array is given. All except one element are repeated > even no. of times and one element is repeated odd no. of times. Find that > element. Don't use X-OR > > Ans -> Is there any efficient way of finding it without using sorting > or removing duplicates or using hash tables?? > > > > Q2-> Same qn is like all except one are repeated off no. of times and > one element repeated even no. of times. find that element. (no > specification > for X-OR use given) > > Ans-> Again, I tried it using hash table. > > > -- > Abhishek Gupta > MCA > NIT Calicut > Kerela > > -- > 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. > -- Thx, --Gopi -- 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. >>> >> >> >> >> -- >> Abhishek Gupta >> MCA >> NIT Calicut >> Kerela >> >> -- >> 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. >> > > > > -- > Thx, > --Gopi > > -- > 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.
Re: [algogeeks] Odd one out
sorry abhishek , I have given wrong complexity for Q2. On Mon, Aug 1, 2011 at 12:36 PM, Abhishek Gupta wrote: > @gopi > inserting n elements, and then again checking each element? > nlogn?? > > > On Sun, Jul 31, 2011 at 9:04 PM, Anika Jain wrote: > >> @gopi: in 2nd of urs we after tree creation we will need to search each >> element in array that will take o(nlogn) time.. is there any appraoch tht >> reduces this? >> >> >> On Sun, Jul 31, 2011 at 6:39 PM, *$* wrote: >> >>> >>> >>> Q1->Construct a binary tree , in such a way that if element occured for >>> the first time , insert into tree , if occurs at second time , remove from >>> the list. >>> As all elements except the one need to find are even , at the end of the >>> list , all the tree will contain only one element. >>> >>> Q2-> Construct a binary tree. similar to the above. >>> Now again start from first element and check which element is missing in >>> the tree. That is the required one. >>> >>> >>> Thx, >>> --Gopi >>> >>> >>> On Sun, Jul 31, 2011 at 2:07 PM, Abhishek Gupta >>> wrote: >>> Q1-> A large size array is given. All except one element are repeated even no. of times and one element is repeated odd no. of times. Find that element. Don't use X-OR Ans -> Is there any efficient way of finding it without using sorting or removing duplicates or using hash tables?? Q2-> Same qn is like all except one are repeated off no. of times and one element repeated even no. of times. find that element. (no specification for X-OR use given) Ans-> Again, I tried it using hash table. -- Abhishek Gupta MCA NIT Calicut Kerela -- 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. >>> >>> >>> >>> -- >>> Thx, >>> --Gopi >>> >>> -- >>> 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. >> > > > > -- > Abhishek Gupta > MCA > NIT Calicut > Kerela > > -- > 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. > -- Thx, --Gopi -- 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.
Re: [algogeeks] Odd one out
@gopi inserting n elements, and then again checking each element? nlogn?? On Sun, Jul 31, 2011 at 9:04 PM, Anika Jain wrote: > @gopi: in 2nd of urs we after tree creation we will need to search each > element in array that will take o(nlogn) time.. is there any appraoch tht > reduces this? > > > On Sun, Jul 31, 2011 at 6:39 PM, *$* wrote: > >> >> >> Q1->Construct a binary tree , in such a way that if element occured for >> the first time , insert into tree , if occurs at second time , remove from >> the list. >> As all elements except the one need to find are even , at the end of the >> list , all the tree will contain only one element. >> >> Q2-> Construct a binary tree. similar to the above. >> Now again start from first element and check which element is missing in >> the tree. That is the required one. >> >> >> Thx, >> --Gopi >> >> >> On Sun, Jul 31, 2011 at 2:07 PM, Abhishek Gupta >> wrote: >> >>> Q1-> A large size array is given. All except one element are repeated >>> even no. of times and one element is repeated odd no. of times. Find that >>> element. Don't use X-OR >>> >>> Ans -> Is there any efficient way of finding it without using sorting or >>> removing duplicates or using hash tables?? >>> >>> >>> >>> Q2-> Same qn is like all except one are repeated off no. of times and one >>> element repeated even no. of times. find that element. (no specification for >>> X-OR use given) >>> >>> Ans-> Again, I tried it using hash table. >>> >>> >>> -- >>> Abhishek Gupta >>> MCA >>> NIT Calicut >>> Kerela >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Thx, >> --Gopi >> >> -- >> 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. > -- Abhishek Gupta MCA NIT Calicut Kerela -- 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.
Re: [algogeeks] Odd one out
@gopi: in 2nd of urs we after tree creation we will need to search each element in array that will take o(nlogn) time.. is there any appraoch tht reduces this? On Sun, Jul 31, 2011 at 6:39 PM, *$* wrote: > > > Q1->Construct a binary tree , in such a way that if element occured for the > first time , insert into tree , if occurs at second time , remove from the > list. > As all elements except the one need to find are even , at the end of the > list , all the tree will contain only one element. > > Q2-> Construct a binary tree. similar to the above. > Now again start from first element and check which element is missing in > the tree. That is the required one. > > > Thx, > --Gopi > > > On Sun, Jul 31, 2011 at 2:07 PM, Abhishek Gupta wrote: > >> Q1-> A large size array is given. All except one element are repeated even >> no. of times and one element is repeated odd no. of times. Find that >> element. Don't use X-OR >> >> Ans -> Is there any efficient way of finding it without using sorting or >> removing duplicates or using hash tables?? >> >> >> >> Q2-> Same qn is like all except one are repeated off no. of times and one >> element repeated even no. of times. find that element. (no specification for >> X-OR use given) >> >> Ans-> Again, I tried it using hash table. >> >> >> -- >> Abhishek Gupta >> MCA >> NIT Calicut >> Kerela >> >> -- >> 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. >> > > > > -- > Thx, > --Gopi > > -- > 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.
Re: [algogeeks] Odd one out
Q1->Construct a binary tree , in such a way that if element occured for the first time , insert into tree , if occurs at second time , remove from the list. As all elements except the one need to find are even , at the end of the list , all the tree will contain only one element. Q2-> Construct a binary tree. similar to the above. Now again start from first element and check which element is missing in the tree. That is the required one. Thx, --Gopi On Sun, Jul 31, 2011 at 2:07 PM, Abhishek Gupta wrote: > Q1-> A large size array is given. All except one element are repeated even > no. of times and one element is repeated odd no. of times. Find that > element. Don't use X-OR > > Ans -> Is there any efficient way of finding it without using sorting or > removing duplicates or using hash tables?? > > > > Q2-> Same qn is like all except one are repeated off no. of times and one > element repeated even no. of times. find that element. (no specification for > X-OR use given) > > Ans-> Again, I tried it using hash table. > > > -- > Abhishek Gupta > MCA > NIT Calicut > Kerela > > -- > 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. > -- Thx, --Gopi -- 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.
[algogeeks] Odd one out
Q1-> A large size array is given. All except one element are repeated even no. of times and one element is repeated odd no. of times. Find that element. Don't use X-OR Ans -> Is there any efficient way of finding it without using sorting or removing duplicates or using hash tables?? Q2-> Same qn is like all except one are repeated off no. of times and one element repeated even no. of times. find that element. (no specification for X-OR use given) Ans-> Again, I tried it using hash table. -- Abhishek Gupta MCA NIT Calicut Kerela -- 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.