[algogeeks] Question asked in Tachyon interview
Write C code to implement level order traversal of a tree. -- 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] Question asked in Tachyon interview
apply BFS -- 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] segment Tree problem
Hi. I'm new to segment tree. im solving a problem in which we have to find most frequent element in given range so for the below testcase im trying to constructing tree but i stuck. -1 -1 1 1 1 1 3 8 8 8 [i,j] is range of segment and x is the element that occur frequently and y is the count of x. [i,j]=[x,y] [0,0]=[-1,1] [1,1]=[-1,1] [0,1]=[-1,2]// because the sub tree[0,0]-x==[1,1]--x so we added value. [2,2]=[1,1] [0,2]=[-1,2]// becuase the subtree [0,1][2,2] have value [-1,2] [1,1] so first set have higher value [3,3]=[1,1] [4,4]=[1,1] [3,4]=[1,2]// same reason as [0,1] set problem occur here while updating the value of [0,4] [0,4] has 2 child [0,2]=[-1,2] [3,4]=[1,2] so updating the set we can determine which value should belongs to [0,4] and set [2,2]=[1,1] which we neglect. then how to update value [0,4] while intializing the segment tree??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/EPX4mfsu6_sJ. 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] Question asked in Tachyon interview
int mul(int a, int b) { int r=0; if (a==0|| b==0) r=0; else { for(int i=0;ib;i++) r=r+a; } return r; } On Wed, Jun 27, 2012 at 10:46 AM, Prateek Jain prateek10011...@gmail.comwrote: main(a,b,m) 02{ 03while (~scanf(%d%d,a,b)) 04{ 05 m=0; 06 while (a) 07 { 08 if (a1) 09 m+=b; 10 a=1; 11 b=1; 12 } 13 printf(%d\n,m); 14} 15} -- 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] Question asked in Tachyon interview
It can be done using Queues in O(n). -- Amitesh On Wed, Jun 27, 2012 at 3:07 PM, hary rathor harry.rat...@gmail.com wrote: apply BFS -- 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] Question asked in Tachyon interview
queue q; q.enqueue(root); while q is not empty do print :temp=dequeue(); if(temp-left) enqueue(temp-left) if(temp-right) enqueue(temp-right); end while; On Wed, Jun 27, 2012 at 2:59 PM, Gobind Kumar Hembram gobind@gmail.comwrote: Write C code to implement level order traversal of a tree. -- 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.
[algogeeks] How to get the geometry or mesh structure from the 3D Model In OSG??
Does any1 working in OSG have some idea of how to get the PRIMITIVE information from given 3D model which .. My objective is to get the primitives of the 3D model and after getting the vertices of all the primitives , I will create the Polytope from these vertices for finding the intersecting with other Polytopes ... If any1 has/had worked with models can help me with this problem ??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/fSYakxwaBBsJ. 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] Re: Question asked in Tachyon interview
@Zerocool142: See https://groups.google.com/d/msg/algogeeks/483lcb0FTY0/YoQTNbOQ3aIJ. It implements addition using bitwise operators, and then uses that addition function and more bit operations to do multiplication, handling both positive and negative (2's complement) numbers. Dave On Tuesday, June 26, 2012 11:15:36 PM UTC-5, zerocool142 wrote: How to multiply two numbers without using * operator? Hint:Use bit operators -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/lPeJnr89TNsJ. 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] Adobe interview question
@himanshu...i didnt read full question.got it now... On Mon, Jun 25, 2012 at 9:12 AM, himanshu kansal himanshukansal...@gmail.com wrote: @rahul: the ques itself says that we have to implement abstract class*without * using pure virtual function... On Sun, Jun 24, 2012 at 12:00 AM, rahul sharma rahul23111...@gmail.comwrote: yeah use pure virtual fxn.. On Fri, Jun 22, 2012 at 3:41 PM, himanshu kansal himanshukansal...@gmail.com wrote: i told the interviewer...bt he said thn the constt would not be accessible to derived class alsohe told me dt u shld make the constt. protecteddats why i ws confused... On Fri, Jun 22, 2012 at 2:38 PM, raghavan M peacelover1987...@yahoo.co.in wrote: Make all constructors private. -- *From:* himanshu kansal himanshukansal...@gmail.com *To:* Algorithm Geeks algogeeks@googlegroups.com *Sent:* Friday, 22 June 2012 1:44 PM *Subject:* [algogeeks] Adobe interview question How will u implement an abstract class in c++ w/o using pure virtual function??? will making all the constructors and assignment operators protected suffice??? i doubt since the derived classes will be able to create objects of that classand according to definition of abstract class, no object of it should be created... any other way?? -- 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. -- Regards Himanshu Kansal Msc Comp. sc. (University of Delhi) -- 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. -- Regards Himanshu Kansal Msc Comp. sc. (University of Delhi) -- 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.
[algogeeks] Fixing Up The Binary Search Tree
Suppose a Binary Search Tree which is unbalanced.is given. Write a routine to balance the Binary Search Tree. Send the Root of the BST as an argument to that routine. It has to Return the Root of the Balanced BST. Thanks In Advance. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/iYdbt5mI4BQJ. 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] [Google] Finds all the elements that appear more than n/3 times
Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more than n/3 times in the list. The algorithm should run in linear time ( n =0 ). You are expected to use comparisons and achieve linear time. No hashing/excessive space/ and don't use standard linear time deterministic selection algo. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/dtpraFWNFSEJ. 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] Adobe interview question
So, i think there is no way to implement abstract class without using pure virtual functions since 1. if we make the constructor private then derived classes cannot be instantiatedthey too become abstract class. 2. if we make constructor protected, then derived class will be able to create (instantiate ) objects of base classwhich is ofcourse we dont want any other way would be highly appreciated On Wed, Jun 27, 2012 at 11:16 PM, rahul sharma rahul23111...@gmail.comwrote: @himanshu...i didnt read full question.got it now... On Mon, Jun 25, 2012 at 9:12 AM, himanshu kansal himanshukansal...@gmail.com wrote: @rahul: the ques itself says that we have to implement abstract class*without * using pure virtual function... On Sun, Jun 24, 2012 at 12:00 AM, rahul sharma rahul23111...@gmail.comwrote: yeah use pure virtual fxn.. On Fri, Jun 22, 2012 at 3:41 PM, himanshu kansal himanshukansal...@gmail.com wrote: i told the interviewer...bt he said thn the constt would not be accessible to derived class alsohe told me dt u shld make the constt. protecteddats why i ws confused... On Fri, Jun 22, 2012 at 2:38 PM, raghavan M peacelover1987...@yahoo.co.in wrote: Make all constructors private. -- *From:* himanshu kansal himanshukansal...@gmail.com *To:* Algorithm Geeks algogeeks@googlegroups.com *Sent:* Friday, 22 June 2012 1:44 PM *Subject:* [algogeeks] Adobe interview question How will u implement an abstract class in c++ w/o using pure virtual function??? will making all the constructors and assignment operators protected suffice??? i doubt since the derived classes will be able to create objects of that classand according to definition of abstract class, no object of it should be created... any other way?? -- 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. -- Regards Himanshu Kansal Msc Comp. sc. (University of Delhi) -- 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. -- Regards Himanshu Kansal Msc Comp. sc. (University of Delhi) -- 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. -- Regards Himanshu Kansal Msc Comp. sc. (University of Delhi) -- 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.