[algogeeks] OPengl implementation of dijiktras algorithm
hi all Any one has the OPengl implementation of dijiktras algorithm.or any idea how to implement it.. With regards Naveen -- 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] Re: Maximize Subsquare
@ Chunyuan Ge *have u checked ur solution . ur solution is to find the submatrix all filled with 1 , but the question say that 1 can be at boundaries. * On Wed, Nov 23, 2011 at 3:00 PM, kumar raja rajkumar.cs...@gmail.comwrote: @Dark prince : what is meant by Allones(i,0.k) what subsquare he is considering here?? On 22 November 2011 23:57, DarkPrince darkprince...@gmail.com wrote: It means that the Borders of the mavximum rectangle should hav all 1s irrespective the elements inside the rectangles , it can be either 0 or 1 . -- 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 Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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* *The Coder* *Life is a Game. The more u play, the more u win, the more u win , the more successfully u play* -- 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] Any one
i think edit distance algorithm can not be used here because in edit distance problem we have a target string and a source string. Here we dont have any target word. I think trie can be used with some preprocessing. On Thu, Nov 24, 2011 at 11:59 PM, atul anand atul.87fri...@gmail.comwrote: http://blog.notdot.net/2007/4/Damn-Cool-Algorithms-Part-1-BK-Trees this would help. On Thu, Nov 24, 2011 at 9:49 PM, Vijay Meena vijay...@gmail.com wrote: Can you please elaborate... On Thu, Nov 24, 2011 at 12:14 AM, atul anand atul.87fri...@gmail.comwrote: yes levenshtein distance and BK tree can be used to solve this. where edge weight between nodes is equal to levenshtein distance. On Wed, Nov 23, 2011 at 7:14 PM, abhishek kumar afs.abhis...@gmail.comwrote: You are given a word and a dictionary. Now propose an algorithm edit the word (insert / delete characters) minimally to get a word that also exists in the dictionary. Cost of insertion and deletion is same. Write pseudocode for it. Seems like minimum edit distance problem but some modification is needed. -- Abhishek Kumar B.Tech(IT) Graduate Allahabad Contact no-+919663082731 -- 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. -- 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* *The Coder* *Life is a Game. The more u play, the more u win, the more u win , the more successfully u play* -- 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] Re: Any one
this is well known problem, use the BFS traversal / Backtracking On Nov 26, 3:54 pm, tech coder techcoderonw...@gmail.com wrote: i think edit distance algorithm can not be used here because in edit distance problem we have a target string and a source string. Here we dont have any target word. I think trie can be used with some preprocessing. On Thu, Nov 24, 2011 at 11:59 PM, atul anand atul.87fri...@gmail.comwrote: http://blog.notdot.net/2007/4/Damn-Cool-Algorithms-Part-1-BK-Trees this would help. On Thu, Nov 24, 2011 at 9:49 PM, Vijay Meena vijay...@gmail.com wrote: Can you please elaborate... On Thu, Nov 24, 2011 at 12:14 AM, atul anand atul.87fri...@gmail.comwrote: yes levenshtein distance and BK tree can be used to solve this. where edge weight between nodes is equal to levenshtein distance. On Wed, Nov 23, 2011 at 7:14 PM, abhishek kumar afs.abhis...@gmail.comwrote: You are given a word and a dictionary. Now propose an algorithm edit the word (insert / delete characters) minimally to get a word that also exists in the dictionary. Cost of insertion and deletion is same. Write pseudocode for it. Seems like minimum edit distance problem but some modification is needed. -- Abhishek Kumar B.Tech(IT) Graduate Allahabad Contact no-+919663082731 -- 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. -- 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* *The Coder* *Life is a Game. The more u play, the more u win, the more u win , the more successfully u play* -- 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] Re: Maximize Subsquare
allOnes(row, column, len) so allone(i, 0, k) will check if A[i][0] to A[i][k] has all the ones similarly another allone should check for all column values. so algo is if you come across any i, j which is '1' , then check for sq ending at i-1, j-1 and all the borders , if all are ones, store the length of sq at A[i][j] On Nov 26, 3:44 pm, tech coder techcoderonw...@gmail.com wrote: @ Chunyuan Ge *have u checked ur solution . ur solution is to find the submatrix all filled with 1 , but the question say that 1 can be at boundaries. * On Wed, Nov 23, 2011 at 3:00 PM, kumar raja rajkumar.cs...@gmail.comwrote: @Dark prince : what is meant by Allones(i,0.k) what subsquare he is considering here?? On 22 November 2011 23:57, DarkPrince darkprince...@gmail.com wrote: It means that the Borders of the mavximum rectangle should hav all 1s irrespective the elements inside the rectangles , it can be either 0 or 1 . -- 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 Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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* *The Coder* *Life is a Game. The more u play, the more u win, the more u win , the more successfully u play* -- 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] Re: Any one
@vikas : to do BFS ..first you have to create tree . so what basis will you create a tree ? a dictionary can contains thousandss of word , just by taking arbitrary word from the dictionary and creating tree i guess will take lot of time. @tech coder : target will be the words from the dictionary . On Sat, Nov 26, 2011 at 6:19 PM, vikas vikas.rastogi2...@gmail.com wrote: this is well known problem, use the BFS traversal / Backtracking On Nov 26, 3:54 pm, tech coder techcoderonw...@gmail.com wrote: i think edit distance algorithm can not be used here because in edit distance problem we have a target string and a source string. Here we dont have any target word. I think trie can be used with some preprocessing. On Thu, Nov 24, 2011 at 11:59 PM, atul anand atul.87fri...@gmail.com wrote: http://blog.notdot.net/2007/4/Damn-Cool-Algorithms-Part-1-BK-Trees this would help. On Thu, Nov 24, 2011 at 9:49 PM, Vijay Meena vijay...@gmail.com wrote: Can you please elaborate... On Thu, Nov 24, 2011 at 12:14 AM, atul anand atul.87fri...@gmail.com wrote: yes levenshtein distance and BK tree can be used to solve this. where edge weight between nodes is equal to levenshtein distance. On Wed, Nov 23, 2011 at 7:14 PM, abhishek kumar afs.abhis...@gmail.comwrote: You are given a word and a dictionary. Now propose an algorithm edit the word (insert / delete characters) minimally to get a word that also exists in the dictionary. Cost of insertion and deletion is same. Write pseudocode for it. Seems like minimum edit distance problem but some modification is needed. -- Abhishek Kumar B.Tech(IT) Graduate Allahabad Contact no-+919663082731 -- 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. -- 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* *The Coder* *Life is a Game. The more u play, the more u win, the more u win , the more successfully u play* -- 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] Modular Arithmetic and Number Theory
Given a, n, P find the value of a^(nth Fibonacci number) % P where a and P are *not* Co-prime -- Sunny Aggrawal B.Tech. V year,CSI Indian Institute Of Technology,Roorkee -- 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] Re: Any one
@vikas will u please elaborate ur answer. @atul yeah thats true, target will be the words from the dictionary but we dont have a specific target, here it will be brute force if we check newly form word with each of the word in dictionary. On Sat, Nov 26, 2011 at 9:15 PM, atul anand atul.87fri...@gmail.com wrote: @vikas : to do BFS ..first you have to create tree . so what basis will you create a tree ? a dictionary can contains thousandss of word , just by taking arbitrary word from the dictionary and creating tree i guess will take lot of time. @tech coder : target will be the words from the dictionary . On Sat, Nov 26, 2011 at 6:19 PM, vikas vikas.rastogi2...@gmail.comwrote: this is well known problem, use the BFS traversal / Backtracking On Nov 26, 3:54 pm, tech coder techcoderonw...@gmail.com wrote: i think edit distance algorithm can not be used here because in edit distance problem we have a target string and a source string. Here we dont have any target word. I think trie can be used with some preprocessing. On Thu, Nov 24, 2011 at 11:59 PM, atul anand atul.87fri...@gmail.com wrote: http://blog.notdot.net/2007/4/Damn-Cool-Algorithms-Part-1-BK-Trees this would help. On Thu, Nov 24, 2011 at 9:49 PM, Vijay Meena vijay...@gmail.com wrote: Can you please elaborate... On Thu, Nov 24, 2011 at 12:14 AM, atul anand atul.87fri...@gmail.comwrote: yes levenshtein distance and BK tree can be used to solve this. where edge weight between nodes is equal to levenshtein distance. On Wed, Nov 23, 2011 at 7:14 PM, abhishek kumar afs.abhis...@gmail.comwrote: You are given a word and a dictionary. Now propose an algorithm edit the word (insert / delete characters) minimally to get a word that also exists in the dictionary. Cost of insertion and deletion is same. Write pseudocode for it. Seems like minimum edit distance problem but some modification is needed. -- Abhishek Kumar B.Tech(IT) Graduate Allahabad Contact no-+919663082731 -- 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. -- 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* *The Coder* *Life is a Game. The more u play, the more u win, the more u win , the more successfully u play* -- 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* *The Coder* *Life is a Game. The more u play, the more u win, the more u win , the more successfully u play* -- 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] Re: OPengl implementation of dijiktras algorithm
opengl is graphics spec , what hell it has to do with dijkstra ? On Nov 26, 1:49 pm, naveen ms naveenms...@gmail.com wrote: hi all Any one has the OPengl implementation of dijiktras algorithm.or any idea how to implement it.. With regards Naveen -- 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] Re: Binary Tree problem - careercup book que4.8
Hey Swathi, The problem does mention any path but refers to straight paths along a root to leaf path. Therefore, a path need not necessarily start from the root or end with a leaf but should be along the path from the root to a leaf. On Nov 25, 4:05 am, Swathi chukka.swa...@gmail.com wrote: Career cup book question 4.8 - You are given a binary tree in which each node contains a value. Design an algorithm to print all paths which sum up to that value. Note that it can be any path in the tree - it does not have to start at the root. Answer given in career cup book - Let’s approach this problem by simplifying it. What if the path had to start at the root? In that case, we would have a much easier problem: Start from the root and branch left and right, computing the sum thus far on each path. When we find the sum, we print the current path. Note that we don’t stop just because we found the sum. Why? Because we could have the following path (assume we are looking for the sum 5): 2 + 3 + –4 + 3 + 1 + 2. If we stopped once we hit 2 + 3, we’d miss several paths (2 + 3 + -4 + 3 + 1 and 3 + -4 + 3 + 1 + 2). So, we keep going along every possible path. Now, what if the path can start anywhere? In that case, we make a small modification. On every node, we look “up” to see if we’ve found the sum. That is—rather than asking “does this node start a path with the sum?,” we ask “does this node complete a path with the sum?” 1 void findSum(TreeNode head, int sum, ArrayListInteger buffer, 2 int level) { 3 if (head == null) return; 4 int tmp = sum; 5 buffer.add(head.data); 6 for (int i = level;i - 1; i--){ 7 tmp -= buffer.get(i); 8 if (tmp == 0) print(buffer, i, level); 9 } 10 ArrayListInteger c1 = (ArrayListInteger) buffer.clone(); 11 ArrayListInteger c2 = (ArrayListInteger) buffer.clone(); 12 findSum(head.left, sum, c1, level + 1); 13 findSum(head.right, sum, c2, level + 1); 14 } 15 16 void print(ArrayListInteger buffer, int level, int i2) { 17 for (int i = level; i = i2; i++) { 18 System.out.print(buffer.get(i) + “ ”); 19 } 20 System.out.println(); 21 } My question - I think the algorithm needs some changes. If we consider the following simple tree ---1 -2--3 If i want to search for path whose sum is 6 then it will not work because at for right child we are not passing the value of left child? Can some one explain me how this is going to work and what changes we need for the algorithm mentioned above. Thanks in advance. -- 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] Finding the repeated element
*Assumptions*: - All positive elements in the array - All elements in array are in range 0 to (n-1) [ n - # of elements] 1) Scan the array. For every element A[i], negate the value stored in A[A[i]]. 2) If you encounter an element already negated, then that represents the duplicate element. On Thu, Nov 24, 2011 at 12:02 AM, kumar raja rajkumar.cs...@gmail.comwrote: In the given array all the elements occur single time except one element which occurs 2 times find it in O(n) time and O(1) space. e.g. 2 3 4 9 3 7 output :3 If such a solution exist can we extend the logic to find All the repeated elements in an array in O(n) time and O(1) space -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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] Re: Finding the repeated element
Isn't this overkill? If you're already using a set, just check the set before you insert each new element, and you'll discover the duplicates: S = empty while i = input item existss if i in S output i has a duplicate; insert i in S end XOR is generally useful only for detecting a single item that's included in a list an odd number of times rather than an even number of times. On Nov 24, 3:56 pm, Ankur Garg ankurga...@gmail.com wrote: ^^+1..how matrix formed ?? But as Gene said we can use a set to store all the unique elements Now we xor all the set elements and then xor them with the elements of the array . This wud give us the repeating element as all the elements coming once will be 0(xored twice) and repeating element wud be xored twice . To code it as follows int FindSingle(int a[],int n){ setints; s.insert(a,a+n); setint::iterator it; it = s.begin(); int XOR= *it; it++; while(it!=s.end()){ XOR =XOR^*it; it++;} for(int i=0;in;i++) XOR=XOR^a[i]; return XOR; } On Fri, Nov 25, 2011 at 1:03 AM, kumar raja rajkumar.cs...@gmail.comwrote: @Anup: Atleast u tell me how the M has formed??? On 24 November 2011 11:21, Anup Ghatage ghat...@gmail.com wrote: @kunzmilan Nice idea, how do you decide the row-size or column-size of the matrix? On Thu, Nov 24, 2011 at 8:00 PM, kumar raja rajkumar.cs...@gmail.comwrote: @kunzmilan : Can u please maintain the clarity ?? How did u find the M if the list is 4 2 8 9 5 1 9 how M looks like ?? please elaborate it... On 24 November 2011 06:15, kunzmize an kunzmi...@atlas.cz wrote: On 24 lis, 09:09, kumar raja rajkumar.cs...@gmail.com wrote: @kunzmilan : i did not get u, once explain with example... On 23 November 2011 23:47, kunzmilan kunzmi...@atlas.cz wrote: Matrix M 0 1 0 0 1 0 1 0 0 multiplied with M(T) 0 0 1 1 1 0 0 0 0 gives 1 0 0 0 2 0 0 0 0. On its diagonal are numbers of repeated elements. kunzmilan On 24 lis, 07:02, kumar raja rajkumar.cs...@gmail.com wrote: In the given array all the elements occur single time except one element which occurs 2 times find it in O(n) time and O(1) space. e.g. 2 3 4 9 3 7 output :3 If such a solution exist can we extend the logic to find All the repeated elements in an array in O(n) time and O(1) space -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in Write the list in the form of a matrix M, e.g. 0 1 0 0... 0 0 1 0... 0 0 0 1... ..etc., and its quadratic form M(T)M shows, how many times each element repeats. kunzmilan -- 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 Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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 Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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. -- Anup Ghatage -- 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 Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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] Linear time Binary tree re-construction
Given the in-order and pre-order traversals, can anyone think of a linear time re-construction of the binary tree? The brute force method is O(n^2). -- 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] Google interview question
Hi Guys I saw this question http://stackoverflow.com/questions/8189334/google-combinatorial-optimization-interview-problm But couldn't get the solution which has been accepted, nor could work out one on my own. Please help! -- Nitin Garg Personality can open doors, but only Character can keep them open -- 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] One small doubt??
Can someone explain the following terms and their differences clearly? 1) Array and List 2) Ordered array and Unordered Array 3) Ordered List and Unordered List -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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] One small doubt??
ans 1) Array is a *contigous elements.*The elements of a list need not be contigous. ans 2)Ordered array is one in which the position of elements in array is constrained by some property.For example a sorted array where the property is relative magnitude of the element.In an unordered array the position of elements in the array is not constrained by anything i.e. given the position of an element in the array you cant say anything about it with reference to other elements.same goes for list. On Sun, Nov 27, 2011 at 10:07 AM, kumar raja rajkumar.cs...@gmail.comwrote: Can someone explain the following terms and their differences clearly? 1) Array and List 2) Ordered array and Unordered Array 3) Ordered List and Unordered List -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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] structure padding query
http://www.geeksforgeeks.org/archives/9705 On Fri, Nov 25, 2011 at 12:36 AM, rahul sharma rahul23111...@gmail.comwrote: struct abc { int g; float f; double gj; }; like in this int takes 4 bytes and we want align in 8 bytes so i wana know that whether the float should put with int as 4 bytes are there to complete 8 or float should be int+4 bytes padding and then store the float.. acc to o/p float is stores after int -- 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] One small doubt??
So does list can be a linked list or similar data structure , right?? On 27 November 2011 11:17, saurabh singh saurab...@gmail.com wrote: ans 1) Array is a *contigous elements.*The elements of a list need not be contigous. ans 2)Ordered array is one in which the position of elements in array is constrained by some property.For example a sorted array where the property is relative magnitude of the element.In an unordered array the position of elements in the array is not constrained by anything i.e. given the position of an element in the array you cant say anything about it with reference to other elements.same goes for list. On Sun, Nov 27, 2011 at 10:07 AM, kumar raja rajkumar.cs...@gmail.comwrote: Can someone explain the following terms and their differences clearly? 1) Array and List 2) Ordered array and Unordered Array 3) Ordered List and Unordered List -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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 Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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.