Re: [algogeeks] Re: Problems on Linked List
@mohit : +1 On Sat, Aug 13, 2011 at 9:20 AM, Raghavan its...@gmail.com wrote: First question: - .Read the data from the first list and put it in a stack - Traverse the next list and compare by reading elements from the stack - This would solve it Second question: - Take an list like 1-2--3-4 - If you are given with 2, juz copy the value and reference of next node(i.e : 3) into 2 and delete the node 3 this would solve it Thanks. On Thu, Aug 11, 2011 at 10:21 AM, Abhishek gupta mailatabhishekgu...@gmail.com wrote: Q2). i think for second question it will be enough to just swap the data of current node to next node, and delete the next node. it will be like, //for swap int temp=current-data; current-data=current-next-data; current-next-data=temp; //for delete struct node *temp; temp=current-next; current-next=current-next-next; free(temp); i think it will be enough even in case of last node. correct me if i am wrong. -- 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/-/N1elA8-W-iUJ. 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. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- 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: Goldman sachs _ DCE _ 10 AUGUST
+1 ...plz upload the qs -- 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] an array question
1.scan the array and find the maximum digits of integer. lets say m.. 2.Again scan the array and pad the intergers whose digits are less that m ( m) with zero's .. copy the new integers in a new array 3.sort the new array in desc order and carry the same even for original array. 4. Now the original array contains the required output. ex: original aarray 23,8,19,9,1 max digits : 2 (for 23 as well as 19) step 2: new array 23,80,19,90,10 step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. original array contains the original output.. On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi starboy...@gmail.com wrote: int compare(int a, int b) { string s = Integer.tostring(a); string y = Integer.tostring(b); if (s +y y+s) return -1; else return 1; } use this to write quick sort , you can get the answer. On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz yasir@gmail.comwrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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/-/_lJJOlRG_ukJ. 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. -- stay hungry stay foolish Chengjie Qi -- 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] Re: Problems on Linked List
folks .. for second problem .. the mentioned algo doesn't work for last node.. I mean copying data of next node and aalso making nxt-nxt as nxt node.. and deleting the next node.. in case of last node.. how can we delete the last node being on that node? even though if we use free (node) ... the prev node-next value doesn't become NULL .. It will contains some garbage.. On Sat, Aug 13, 2011 at 11:34 AM, aditya kumar aditya.kumar130...@gmail.com wrote: @mohit : +1 On Sat, Aug 13, 2011 at 9:20 AM, Raghavan its...@gmail.com wrote: First question: - .Read the data from the first list and put it in a stack - Traverse the next list and compare by reading elements from the stack - This would solve it Second question: - Take an list like 1-2--3-4 - If you are given with 2, juz copy the value and reference of next node(i.e : 3) into 2 and delete the node 3 this would solve it Thanks. On Thu, Aug 11, 2011 at 10:21 AM, Abhishek gupta mailatabhishekgu...@gmail.com wrote: Q2). i think for second question it will be enough to just swap the data of current node to next node, and delete the next node. it will be like, //for swap int temp=current-data; current-data=current-next-data; current-next-data=temp; //for delete struct node *temp; temp=current-next; current-next=current-next-next; free(temp); i think it will be enough even in case of last node. correct me if i am wrong. -- 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/-/N1elA8-W-iUJ. 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. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- 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. -- 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] Re: need the book google resume and algorithms for interviews
+1 On 8/12/11, Mangal Dass mangaldass1...@gmail.com wrote: pls send me too algorithm for interviews book. link. On 8/12/11, sarath prasath prasathsar...@gmail.com wrote: pls do send the algorithm for interviews book to this email id.. prasat...@live.com pls... -- 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.
Re: [algogeeks] an array question
@$ did not understand how the original array is sorted to give the number! On Sat, Aug 13, 2011 at 12:50 PM, *$* gopi.komand...@gmail.com wrote: 1.scan the array and find the maximum digits of integer. lets say m.. 2.Again scan the array and pad the intergers whose digits are less that m ( m) with zero's .. copy the new integers in a new array 3.sort the new array in desc order and carry the same even for original array. 4. Now the original array contains the required output. ex: original aarray 23,8,19,9,1 max digits : 2 (for 23 as well as 19) step 2: new array 23,80,19,90,10 step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. original array contains the original output.. On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi starboy...@gmail.com wrote: int compare(int a, int b) { string s = Integer.tostring(a); string y = Integer.tostring(b); if (s +y y+s) return -1; else return 1; } use this to write quick sort , you can get the answer. On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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/-/_lJJOlRG_ukJ. 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. -- stay hungry stay foolish Chengjie Qi -- 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] an array question
@$ the ans should be 9823191 and not 98231910 On Sat, Aug 13, 2011 at 12:59 PM, Nikhil Veliath nve...@gmail.com wrote: @$ did not understand how the original array is sorted to give the number! On Sat, Aug 13, 2011 at 12:50 PM, *$* gopi.komand...@gmail.com wrote: 1.scan the array and find the maximum digits of integer. lets say m.. 2.Again scan the array and pad the intergers whose digits are less that m ( m) with zero's .. copy the new integers in a new array 3.sort the new array in desc order and carry the same even for original array. 4. Now the original array contains the required output. ex: original aarray 23,8,19,9,1 max digits : 2 (for 23 as well as 19) step 2: new array 23,80,19,90,10 step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. original array contains the original output.. On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi starboy...@gmail.com wrote: int compare(int a, int b) { string s = Integer.tostring(a); string y = Integer.tostring(b); if (s +y y+s) return -1; else return 1; } use this to write quick sort , you can get the answer. On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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/-/_lJJOlRG_ukJ. 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. -- stay hungry stay foolish Chengjie Qi -- 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] an array question
hi nikhil.. correct ... just type error.. but as per my algo .. as we need to consider the elements of original array... the last element is 1 , but not 10. On Sat, Aug 13, 2011 at 1:01 PM, Nikhil Veliath nve...@gmail.com wrote: @$ the ans should be 9823191 and not 98231910 On Sat, Aug 13, 2011 at 12:59 PM, Nikhil Veliath nve...@gmail.com wrote: @$ did not understand how the original array is sorted to give the number! On Sat, Aug 13, 2011 at 12:50 PM, *$* gopi.komand...@gmail.com wrote: 1.scan the array and find the maximum digits of integer. lets say m.. 2.Again scan the array and pad the intergers whose digits are less that m ( m) with zero's .. copy the new integers in a new array 3.sort the new array in desc order and carry the same even for original array. 4. Now the original array contains the required output. ex: original aarray 23,8,19,9,1 max digits : 2 (for 23 as well as 19) step 2: new array 23,80,19,90,10 step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. original array contains the original output.. On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi starboy...@gmail.com wrote: int compare(int a, int b) { string s = Integer.tostring(a); string y = Integer.tostring(b); if (s +y y+s) return -1; else return 1; } use this to write quick sort , you can get the answer. On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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/-/_lJJOlRG_ukJ. 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. -- stay hungry stay foolish Chengjie Qi -- 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. -- 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] an array question
import java.util.Arrays; import java.util.Comparator; public class NewSort implements ComparatorInteger { @Override public int compare(Integer o1, Integer o2) { String s1 = o1.toString(); String s2 = o2.toString(); String com1 = s1 + s2; String com2 = s2 + s1; if (com1.compareTo(com2) 0 ) { return 1; } else if (com1.compareTo(com2) == 0) { return 0; } else { return -1; } } public static void main(String[] args) { Integer[] a = new Integer[5]; a[0] = 23; a[1] = 8; a[2] = 19; a[3] = 9; a[4] = 1; Arrays.sort(a, new NewSort()); for (int i = 0; i 5; i++) { System.out.print(a[i]); } System.out.println(); } } On Sat, Aug 13, 2011 at 3:39 PM, *$* gopi.komand...@gmail.com wrote: hi nikhil.. correct ... just type error.. but as per my algo .. as we need to consider the elements of original array... the last element is 1 , but not 10. On Sat, Aug 13, 2011 at 1:01 PM, Nikhil Veliath nve...@gmail.com wrote: @$ the ans should be 9823191 and not 98231910 On Sat, Aug 13, 2011 at 12:59 PM, Nikhil Veliath nve...@gmail.com wrote: @$ did not understand how the original array is sorted to give the number! On Sat, Aug 13, 2011 at 12:50 PM, *$* gopi.komand...@gmail.com wrote: 1.scan the array and find the maximum digits of integer. lets say m.. 2.Again scan the array and pad the intergers whose digits are less that m ( m) with zero's .. copy the new integers in a new array 3.sort the new array in desc order and carry the same even for original array. 4. Now the original array contains the required output. ex: original aarray 23,8,19,9,1 max digits : 2 (for 23 as well as 19) step 2: new array 23,80,19,90,10 step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. original array contains the original output.. On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi starboy...@gmail.com wrote: int compare(int a, int b) { string s = Integer.tostring(a); string y = Integer.tostring(b); if (s +y y+s) return -1; else return 1; } use this to write quick sort , you can get the answer. On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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/-/_lJJOlRG_ukJ. 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. -- stay hungry stay foolish Chengjie Qi -- 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. -- 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. -- stay hungry stay foolish Chengjie Qi -- 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] an array question
we will sort the new array in desc order .. and we will carry the same order even to original array.. so after sorting the new arraay will be 90,80,23,19,10 .. so corresponding original array is 9823191 On Sat, Aug 13, 2011 at 12:50 PM, *$* gopi.komand...@gmail.com wrote: 1.scan the array and find the maximum digits of integer. lets say m.. 2.Again scan the array and pad the intergers whose digits are less that m ( m) with zero's .. copy the new integers in a new array 3.sort the new array in desc order and carry the same even for original array. 4. Now the original array contains the required output. ex: original aarray 23,8,19,9,1 max digits : 2 (for 23 as well as 19) step 2: new array 23,80,19,90,10 step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. original array contains the original output.. On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi starboy...@gmail.com wrote: int compare(int a, int b) { string s = Integer.tostring(a); string y = Integer.tostring(b); if (s +y y+s) return -1; else return 1; } use this to write quick sort , you can get the answer. On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz yasir@gmail.comwrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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/-/_lJJOlRG_ukJ. 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. -- stay hungry stay foolish Chengjie Qi -- 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 -- 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] Re: need the book google resume and algorithms for interviews
me too... desperately need that ramangugnani@gmail.com On 13 August 2011 00:27, arvind kumar arvindk...@gmail.com wrote: +1 On 8/12/11, Mangal Dass mangaldass1...@gmail.com wrote: pls send me too algorithm for interviews book. link. On 8/12/11, sarath prasath prasathsar...@gmail.com wrote: pls do send the algorithm for interviews book to this email id.. prasat...@live.com pls... -- 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. -- Raman Gugnani Computer Engg. Deptt. Under Graduate NIT Kurukshetra -- 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] String Question
Given a string which oly has 0's and 1's . Find the maximum largest substring which have equal no of 0's and 1's and give the length of the substring . whether it can be solved in DP ?? or any other soln ? for example : given string : 001101000 output :0101 -- 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] String questions
Given a string which has repeating pattern .Find the repeating pattern and the length of the pattern . Example: 123123123123123 output : 123 lenth is 3 1122222211 output : 112211 lenght is 6 -- 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] TREE question
Given 2 trees .Find wether second tree is the subtree of the first tree . here is my soln corect me if i m wrong: bool find(struct node * tree,struct node *subtree) { if(tree==NULL ) return ; if(tree-data==subtree-datafind(tree-left,subtree-left) find(tree-right,subtree-right) (subtree-left)!=NULL subtree-right !=NULL) { return true; } else return false find(tree-left,subtree); find(tree-right,subtree); } -- 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: an array question
@ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to take care which 100 is of 10 cos we need 10 1st...?? On Aug 13, 1:00 pm, rahul aravind rahularavin...@gmail.com wrote: awesome alogoritm dave:):) On Fri, Aug 12, 2011 at 6:48 PM, Dave dave_and_da...@juno.com wrote: @Yasir: I think the following will work. Counterexamples welcome. Find the number of digits in each of the integers, and find the max of that number, say m. Fill a second array as follows: If the ith integer has m digits, copy it into the second array. If the ith number has less than m digits, concatenate duplicates of the last digit of the integer to the right end to expand it to m digits. Examples: m = 3, 7 goes to 777; 82 goes to 822; 29 goes to 299; 0 goes to 000. Sort the second array into descending order and carry the first array along (apply the same permutations to the first array as you do to the second). Concatenate the integers in the first array to get the result. Dave On Aug 12, 7:34 am, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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: String questions
Dynamic programming would surely help but i dont know the algo :| :P -- 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/-/MD3432cto60J. 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] suffix tree and skip list
plz post the code for implementation of suffix tree and skip list in C/C++ -- 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] AMAZON written test pattern
Can anyone tell me AMAZON's written test pattern?? -- 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: Problems on Linked List
yes you are right Thank you, Siddharam On Thu, Aug 11, 2011 at 10:21 AM, Abhishek gupta mailatabhishekgu...@gmail.com wrote: Q2). i think for second question it will be enough to just swap the data of current node to next node, and delete the next node. it will be like, //for swap int temp=current-data; current-data=current-next-data; current-next-data=temp; //for delete struct node *temp; temp=current-next; current-next=current-next-next; free(temp); i think it will be enough even in case of last node. correct me if i am wrong. -- 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/-/N1elA8-W-iUJ. 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] Re: need the book google resume and algorithms for interviews
no, search the archives, you will find everything. *thread closed*** On Sat, Aug 13, 2011 at 3:00 PM, aditi garg aditi.garg.6...@gmail.comwrote: I have attached google resume wid disbt the oder one is 15 mb how shud i send it?? On Sat, Aug 13, 2011 at 1:35 PM, raman gugnani ramangugnani@gmail.com wrote: me too... desperately need that ramangugnani@gmail.com On 13 August 2011 00:27, arvind kumar arvindk...@gmail.com wrote: +1 On 8/12/11, Mangal Dass mangaldass1...@gmail.com wrote: pls send me too algorithm for interviews book. link. On 8/12/11, sarath prasath prasathsar...@gmail.com wrote: pls do send the algorithm for interviews book to this email id.. prasat...@live.com pls... -- 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. -- Raman Gugnani Computer Engg. Deptt. Under Graduate NIT Kurukshetra -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New 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.
Re: [algogeeks] Re: String questions
can be done using suffix trees.. On Sat, Aug 13, 2011 at 2:06 PM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: Dynamic programming would surely help but i dont know the algo :| :P -- 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/-/MD3432cto60J. 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] suffix tree and skip list
google it :P On Sat, Aug 13, 2011 at 2:09 PM, deepikaanand swinyanand...@gmail.comwrote: plz post the code for implementation of suffix tree and skip list in C/C++ -- 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] AMAZON written test pattern
search archives On Sat, Aug 13, 2011 at 2:10 PM, contiguous priyadee...@gmail.com wrote: Can anyone tell me AMAZON's written test pattern?? -- 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] Re: microsoft paper that i wrote today..
Yeah,it will print some garbage string,as 4 has only one character and it is pointing to 4th character(1+2). As an example: int main(){printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(1+2+I am good);return 0;} Gives output:: m good On Sat, Aug 13, 2011 at 2:59 PM, payel roy smithpa...@gmail.com wrote: 1+2+4 is basically str+3 where str is 4. So the result is a char* pointing to some address which 3 byte away from the base address of 4. On 13 August 2011 08:26, Dipankar Patro dip10c...@gmail.com wrote: @ Neeraj: 1+2+'4' will be very simple to calculate: 3+48+4 = 55 But 1+2+4 is a good question. On 13 August 2011 06:10, Neeraj Gupta neeraj.gupta...@gmail.com wrote: Ques 5 might be value of 1+2+'4' https://ideone.com/8b91t Obviously if we use , then it represents string and we can't define + operation with other operand being an integer. On Fri, Aug 12, 2011 at 11:06 PM, Anil Arya anilarya...@gmail.comwrote: Q.5 . [warning] initialization makes integer from pointer without a cast. On Fri, Aug 12, 2011 at 10:56 PM, sagar pareek sagarpar...@gmail.comwrote: well if we write the code simply as #includestdio.h int main() { 1+2+4 } it gives compilation error if like this #includestdio.h int main() { 1+2+4; } it will give warning:- no effect of code if like this #includestdio.h int main() { int a= 1+2+4; printf(%d,a); } it will give error cannot convert char* to int On Fri, Aug 12, 2011 at 10:44 PM, aditi garg aditi.garg.6...@gmail.com wrote: wats the ans to the 5th ques?? On Fri, Aug 12, 2011 at 8:54 PM, gaurav kumar mailmea...@gmail.comwrote: thanks a lot mate . On Aug 11, 4:51 pm, sindhu sindhu...@gmail.com wrote: 1. write a method to find the smallest angle between two hands when the time is given as input??? 2. given a number between 1 to 1000 convert it to words..example 235..it should print as two hundred thirty five.. 3. write test cases for elevator in a multistory building.. 4. a chessboard of size 64 blocks is given..a knight can move two n half moves at a time..how many steps will it take to cover all the 64 blocks...and change the algorithm if the knight moves three and a half moves. 5. what will be the result if you execute the following code segment: 1+2+4 -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New 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. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT 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. -- Anil Kumar Arya computer science engineering M.N.N.I.T 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. -- 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. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- 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
Re: [algogeeks] Re: String questions
maybe we can use KMP PREFIX function to find ans. On Sat, Aug 13, 2011 at 3:20 PM, *$* gopi.komand...@gmail.com wrote: can be done using suffix trees.. On Sat, Aug 13, 2011 at 2:06 PM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: Dynamic programming would surely help but i dont know the algo :| :P -- 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/-/MD3432cto60J. 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] String Question
- Keep an counter for first stuck number(0/1) - increment it, if you stuck on other number, start decrementing it - if the counter becomes zero,note that seq - finally take the longest seq Hope this could solve the problem. On Sat, Aug 13, 2011 at 1:56 PM, vicky S vickyaspir...@gmail.com wrote: Given a string which oly has 0's and 1's . Find the maximum largest substring which have equal no of 0's and 1's and give the length of the substring . whether it can be solved in DP ?? or any other soln ? for example : given string : 001101000 output :0101 -- 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. -- Thanks and Regards, Raghavan KL -- 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: logic???????????
@Yasir: Yups...I also have the same algo... Just to improvise your solution, you need not do binary search on both sides of the pivot. Just check End points (min-max) of the both sub-array to decide which side to do a binary search..This works in the case of duplicate elements too. for e.g. 2 5 8 12 45 78 91 100 101 104 k = 5 78 91 100 101 104 2 5 8 12 45 Pivot is at 2 You want to search for 12. Check end points of both the sub-array (78,104 2,45) Second range would contain 12. So no need to call binSearch on first sub-array. 2 2 5 5 7 k = 3 So new arr is 5 7 2 2 5 Pivot is first occurrence of 2 You want to search for 5 (which is in both parts) check end points to decide which sub-array to be searched. While checking end-points itself you get the answer. I hope you get it... On Fri, Aug 12, 2011 at 11:37 PM, Yasir yasir@gmail.com wrote: how abt http://ideone.com/lN2og ?? -- 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/-/pZdvFb_t2b4J. 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] Re: logic???????????
Yeah got it. Thanks :) -- 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/-/NAqtuyQmehgJ. 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] Value of base pointer VS Address of base pointer
[Quote] arr has the address to the base of an array of three int's. arr is the address of the first element of that same array. [/Quote] ^^ Found on web. check the difference by printing arr+1 and arr+1. The former will skip one element, but later will skip the whole array. On 12 August 2011 18:41, monish001 monish.gup...@gmail.com wrote: Program: int arr[] = {12, 14, 15, 23, 45}; printf(%u %u\n, arr, arr); Question: Why arr == arr ? Comments: 1. arr is a variable that stores the address of location where arr[0] resides. Complier shows arr and arr having same value. Shouldn't arr be the address where arr resides? Thanks Monish -- 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. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- 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: an array question
Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g. while comparing two unequal length strings char by char if you find chars of str1 have exhausted but not of str2, you can set index in str1 to start of the str1 and continue comparison. On Sat, Aug 13, 2011 at 2:06 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to take care which 100 is of 10 cos we need 10 1st...?? On Aug 13, 1:00 pm, rahul aravind rahularavin...@gmail.com wrote: awesome alogoritm dave:):) On Fri, Aug 12, 2011 at 6:48 PM, Dave dave_and_da...@juno.com wrote: @Yasir: I think the following will work. Counterexamples welcome. Find the number of digits in each of the integers, and find the max of that number, say m. Fill a second array as follows: If the ith integer has m digits, copy it into the second array. If the ith number has less than m digits, concatenate duplicates of the last digit of the integer to the right end to expand it to m digits. Examples: m = 3, 7 goes to 777; 82 goes to 822; 29 goes to 299; 0 goes to 000. Sort the second array into descending order and carry the first array along (apply the same permutations to the first array as you do to the second). Concatenate the integers in the first array to get the result. Dave On Aug 12, 7:34 am, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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.
[algogeeks] how to find K most significant digit of a number..???
-- 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] iocl recruitment process
they sort student according to the current cgpa or percentage in each category means general,OBC sc and st. the interview is easy ,they dont ask tough question just simply basic one.whatsoever be the interview they alway select the person with higher cgpa or percentage On Fri, Aug 12, 2011 at 7:00 PM, rajul jain rajuljain...@gmail.com wrote: If you are in top 5 in your coe branch then dont take stress and if not then dont worry about process bcoz they take only 2-3 student from top 5 each year in GEN category . On Fri, Aug 12, 2011 at 12:34 PM, coder coder i.code.program...@gmail.com wrote: iocl is coming to my college please any dceite please tell what they are asking in their interview process and what profile they are offering to the coe candidate -- 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. -- Thanks and Regards Ravi Mohan B.Tech (Information Technology) Indian Institute of Information Technology, Allahabad, INDIA Phone: +91-9807334247 Email:- ravimoha...@gmail.com , ravimo...@live.in, ravimo...@live.in *Facebook http://www.facebook.com/ravimohan.iiita%20 | Twitterhttp://twitter.com/ravimohaniiit| LinkedIn http://in.linkedin.com/in/ravimohaniiita | Blog* -- 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: c output doubt
@rohit: Cast pointer to an integer into an int to get what you are expecting. for e.g. printf(%d,(int)a[4]-(int)a[0]); This will give 16. -- 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] what is mean by %2.3d in scanf
e g: scanf(%2.4d,a); -- 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] how to find K most significant digit of a number..???
this routine will extract k msb's and will print them n is the number,, and k is the no of bits u wnt to print.. void k_msb(int n, int k) { int mask; int count=0; int r; for(int i=31;i=0;i--) { if(count==k) break; mask=1i; r=maskn; r==0?cout0:cout1; count++; } } On Sat, Aug 13, 2011 at 5:21 PM, Mohit Goel mohitgoel291...@gmail.comwrote: -- 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] what is mean by %2.3d in scanf
http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- 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. -- Gaurav Menghani -- 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] what is mean by %2.3d in scanf
wonderful :) On Sat, Aug 13, 2011 at 6:30 PM, Rahul raikra...@gmail.com wrote: lol++ Rahul On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- 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. -- Gaurav Menghani -- 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.
[algogeeks] n*n array
is printing a n*n array,spirally is same as printing it helically?? or is there any difference between the two?? -- Regards, Kamakshi kamakshi...@gmail.com -- 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] shop keeper and the buyer
anyone? On Fri, Aug 12, 2011 at 3:49 AM, cegprakash cegprak...@gmail.com wrote: there are n number of items available in the shop price[] {size n} gives the cost of each item and there are quantity[] {size n} means that there are quantity[i] number of i'th item the shop keeper provides some free items if you buy k nos of item i, you will get 1 item j for free (i may be equal to j) also there can be such offers for many items what you have to do is to buy all the items in shop with minimum expenditure. . source: own problem (i don't have the solution) -- 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] n*n array
I think they both refer to the same in case of 2-D array. helical can be seen as a movement in 3-D where it is spiral in two dimensions and linear in one left out dimension. On 13 August 2011 18:54, Kamakshii Aggarwal kamakshi...@gmail.com wrote: is printing a n*n array,spirally is same as printing it helically?? or is there any difference between the two?? -- Regards, Kamakshi kamakshi...@gmail.com -- 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. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- 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: Jumping Puzzle
@shashank acc to me the problem can be done easily using greedy approach https://ideone.com/dYbUd ( it is your non optimal greedy solution with just one line added ) couldn't find any case where the above code is giving wrong answer . if you know any case, please let me know. I wrote a dp O(n^2) solution before that but found that same can be done using greedy as well On Fri, Aug 12, 2011 at 7:57 PM, WgpShashank shashank7andr...@gmail.com wrote: A Top Down Memoization DP Algorithm Will be As Follow Step 1. Declare an array of size N say jump[N]; where ith position indicates the number of jumps requires to reach from start to this (ith) position in array . Step 2. Initialize jump[0]=0; indicates to reach oth location form starting location (3which is obviuosly 0) we don't requires any jump. Step 3. Check size of array and value at 0th location in array For first index, optimum number of jumps will be zero. Please note that if value at first index is zero, we can’t jump to any element and return infinite.so these tow cases are A.If size of array==0 means array is of zero size; B.If value at zero then we can't jump or we can't proceed to next location Step 4. Run Through Loop for remaining elements in array and Initialize jump[i] as infinite. where 1=i=N. Sub-step 4A. (Please Note j runs in inner loop until i=j+a[j] ) if jump[i]jump[j]+1 update jump[i] repeat until ji (this whole processing will happen in inner loop). e.g. for each ith element this loop will run tries to figure out optimal/minimum number of jumps required to reach this ith position from starting of array . Step 5. After running above algorithm we will return array[n-1] that will show number of jumps required to reach last elemnt in array from start. Time Complexity O(N^2) Space Complexity O(N) Hope You Can Convert it into Production Code Do Notify me via mail if i missed anything ?? Regards Shashank Mani Computer Science Is Awesome So Why I Write Code Computer Science Birla institute of Technology Mesra -- 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/-/37L_lAEKGVkJ. 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. -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- 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] String Doubt
Which of the following statements are correct about the below declarations? *char *p = Sanjay; char a[] = Sanjay;*1:There is no difference in the declarations and both serve the same purpose.2:*p* is a non-const pointer pointing to a non-const string, whereas *a* is a const pointer pointing to a non-const string.3:The pointer *p* can be modified to point to another string, whereas the individual characters within array *a* can be changed.4:In both cases the * '\0'* will be added at the end of the string Sanjay. -- 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/-/7CewyURYV1AJ. 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] shop keeper and the buyer
if k is fixed, sort the items according to their price, buy k cheapest items start taking the most expensive item fr free actually tht is nt a real lyf prblem, usually the dealers limit no. of free items on a single bill k i never constant, tht may create inconsistencies. On Sat, Aug 13, 2011 at 6:58 PM, Prakash D cegprak...@gmail.com wrote: anyone? On Fri, Aug 12, 2011 at 3:49 AM, cegprakash cegprak...@gmail.com wrote: there are n number of items available in the shop price[] {size n} gives the cost of each item and there are quantity[] {size n} means that there are quantity[i] number of i'th item the shop keeper provides some free items if you buy k nos of item i, you will get 1 item j for free (i may be equal to j) also there can be such offers for many items what you have to do is to buy all the items in shop with minimum expenditure. . source: own problem (i don't have the solution) -- 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.
Re: [algogeeks] Re: Normalised !!
@divye and abhishek : Thanks :) On Tue, Aug 9, 2011 at 11:00 PM, DK divyekap...@gmail.com wrote: Please read the specifications IEEE 754 for representation of single digit floating point numbers. http://en.wikipedia.org/wiki/Single_precision_floating-point_format http://en.wikipedia.org/wiki/IEEE_754-2008 In short, the format is: (1)(8)(23) | sign bit | exponent + 127 | mantissa | given the number is represented in base 2 format. eg. 5.375 = 101 + bin(.375) bin(.375) 0.375 x 2 = 0.75 (0) 0.75 x 2 = 1.5 (1) 0.5 x 2 = 1. therefore bin(5.375) = 101.011 Shifting decimal point = 1.01011 x 2^2 Sign bit = 0 Exponent = 127 + 2 = 129 = 1000 0001 Mantissa = 0101 1000 000 Floating point representation: 0 | 1000 0001 | 0101 1000 000| -- DK http://www.divye.in http://twitter.com/divyekapoor http://gplus.to/divyekapoor -- 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/-/GahSJFDLuF0J. 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 Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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] String Doubt
2. On Sat, Aug 13, 2011 at 7:24 PM, Raman raman.u...@gmail.com wrote: Which of the following statements are correct about the below declarations? *char *p = Sanjay; char a[] = Sanjay;*1:There is no difference in the declarations and both serve the same purpose.2:*p* is a non-const pointer pointing to a non-const string, whereas *a* is a const pointer pointing to a non-const string.3:The pointer *p* can be modified to point to another string, whereas the individual characters within array *a* can be changed.4:In both cases the *'\0'* will be added at the end of the string Sanjay. -- 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/-/7CewyURYV1AJ. 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] String Doubt
also 3,4 On Sat, Aug 13, 2011 at 7:30 PM, Rohit Srivastava access2ro...@gmail.comwrote: 2. On Sat, Aug 13, 2011 at 7:24 PM, Raman raman.u...@gmail.com wrote: Which of the following statements are correct about the below declarations? *char *p = Sanjay; char a[] = Sanjay;* 1: There is no difference in the declarations and both serve the same purpose. 2: *p* is a non-const pointer pointing to a non-const string, whereas *a* is a const pointer pointing to a non-const string. 3: The pointer *p* can be modified to point to another string, whereas the individual characters within array *a* can be changed. 4: In both cases the *'\0'* will be added at the end of the string Sanjay. -- 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/-/7CewyURYV1AJ. 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] Re: an array question
@kunal: seems fine.. tried it on some cases... On Sat, Aug 13, 2011 at 5:17 PM, Kunal Patil kp101...@gmail.com wrote: Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g. while comparing two unequal length strings char by char if you find chars of str1 have exhausted but not of str2, you can set index in str1 to start of the str1 and continue comparison. On Sat, Aug 13, 2011 at 2:06 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to take care which 100 is of 10 cos we need 10 1st...?? On Aug 13, 1:00 pm, rahul aravind rahularavin...@gmail.com wrote: awesome alogoritm dave:):) On Fri, Aug 12, 2011 at 6:48 PM, Dave dave_and_da...@juno.com wrote: @Yasir: I think the following will work. Counterexamples welcome. Find the number of digits in each of the integers, and find the max of that number, say m. Fill a second array as follows: If the ith integer has m digits, copy it into the second array. If the ith number has less than m digits, concatenate duplicates of the last digit of the integer to the right end to expand it to m digits. Examples: m = 3, 7 goes to 777; 82 goes to 822; 29 goes to 299; 0 goes to 000. Sort the second array into descending order and carry the first array along (apply the same permutations to the first array as you do to the second). Concatenate the integers in the first array to get the result. Dave On Aug 12, 7:34 am, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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.
Re: [algogeeks] String Doubt
In statement 2, isn't p pointing to const string, as we cannot modify the characters of the string. -- 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/-/FU-nrcTBpCoJ. 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] String Doubt
3,4 On Sat, Aug 13, 2011 at 7:39 PM, Raman raman.u...@gmail.com wrote: In statement 2, isn't p pointing to const string, as we cannot modify the characters of the string. -- 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/-/FU-nrcTBpCoJ. 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 Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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: TRee question...
@ashmantak: the figure of dipankar is incorrect but his point is correct.. for a tree like 4 /\ 2 10 / \ 13 successor of 3 shall be 4 not 2.. On Fri, Aug 12, 2011 at 4:48 PM, ashmantak ashman...@gmail.com wrote: @Dipankar Patro - The figure u have made isn't a BST.Read the problem. His soln. is correct. -- 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] os
How do you make sure to unlock a mutex which was locked in a thread that dies/terminates? -- Regards, Kamakshi kamakshi...@gmail.com -- 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] what is mean by %2.3d in scanf
Nice one Gaurav Menghani On 13 August 2011 18:39, shady sinv...@gmail.com wrote: wonderful :) On Sat, Aug 13, 2011 at 6:30 PM, Rahul raikra...@gmail.com wrote: lol++ Rahul On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- 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. -- Gaurav Menghani -- 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. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- 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]
1 or 2 stairs? On Sat, Aug 13, 2011 at 8:24 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: Given n stairs, how many number of ways can you climb if u use either 1 or 2 at a time? -- Regards, Kamakshi kamakshi...@gmail.com -- 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. -- --- Puneet Goyal Student of B. Tech. III Year (Software Engineering) Delhi Technological University, 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.
Re: [algogeeks]
yes On Sat, Aug 13, 2011 at 8:30 PM, Puneet Goyal puneetgoya...@gmail.comwrote: 1 or 2 stairs? On Sat, Aug 13, 2011 at 8:24 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: Given n stairs, how many number of ways can you climb if u use either 1 or 2 at a time? -- Regards, Kamakshi kamakshi...@gmail.com -- 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. -- --- Puneet Goyal Student of B. Tech. III Year (Software Engineering) Delhi Technological University, 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. -- Regards, Kamakshi kamakshi...@gmail.com -- 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]
Knapsack DP On Sat, Aug 13, 2011 at 8:35 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: yes On Sat, Aug 13, 2011 at 8:30 PM, Puneet Goyal puneetgoya...@gmail.com wrote: 1 or 2 stairs? On Sat, Aug 13, 2011 at 8:24 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: Given n stairs, how many number of ways can you climb if u use either 1 or 2 at a time? -- Regards, Kamakshi kamakshi...@gmail.com -- 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. -- --- Puneet Goyal Student of B. Tech. III Year (Software Engineering) Delhi Technological University, 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. -- Regards, Kamakshi kamakshi...@gmail.com -- 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. -- Gaurav Menghani -- 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] Adobe Interview Question
There is a river and there are n number of steps between two banks of the river to cross the river. A frog wants to cross the river with the condition that he can jump max one step. Find the number of ways he can cross the river? For e.g. if there are 3 steps in between, frog can go from paths: _123_, _2_, _13_ so there are 3 different ways frog can cross the river (in the example _ is two ends of the river) Can this question be done using Dynamic Programming ? If yes, please tell how . -- 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/-/4HJq5yRGXboJ. 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: TRee question...
It is the solution for inorder successor without having parent pointer.. node *inorder_succ(node *root, int x) { node *prev=NULL; node *p=findspcl(root,prev, x); if(p-r) { p=p-r; while(p-l) p=p-l; return p; } else { return prev; } } node *findspcl(node *root,node **prev, int x) { if(x == root-a) { return root; } else if( root-l!=NULL x root-a) { *prev=root; return findspcl(root-l,prev,x); } else if(root-r!=NULL root-a x) { return findspcl(root-r,prev,x); } else return NULL; } -- 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] logic???????????
@Sagar Dude , oh common shashank...its not that easy u told. I Hope You Understand the question properly ? or you are talking about *bitonic sequence* if not then just point the obvious or no-obvious bug in above algorithm, Same Algo is coded below by Yasir, also Kunal Also suggested some improvement to reduce the number instruction , i don't think anything wrong in the algorithm ?? Just Check The Code ,Still if anything wrong do notify me , i will seriously look at that again ? *Regards Shashank * CSE,BIT Mesra -- 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/-/XyZJK5SjreIJ. 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
dp problem, refer to dp from AFI On Sat, Aug 13, 2011 at 9:01 PM, Decipher ankurseth...@gmail.com wrote: There is a river and there are n number of steps between two banks of the river to cross the river. A frog wants to cross the river with the condition that he can jump max one step. Find the number of ways he can cross the river? For e.g. if there are 3 steps in between, frog can go from paths: _123_, _2_, _13_ so there are 3 different ways frog can cross the river (in the example _ is two ends of the river) Can this question be done using Dynamic Programming ? If yes, please tell how . -- 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/-/4HJq5yRGXboJ. 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] Re: an array question
@kunal: what is the best way to implement step 2? On Sat, Aug 13, 2011 at 7:33 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @kunal: seems fine.. tried it on some cases... On Sat, Aug 13, 2011 at 5:17 PM, Kunal Patil kp101...@gmail.com wrote: Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g. while comparing two unequal length strings char by char if you find chars of str1 have exhausted but not of str2, you can set index in str1 to start of the str1 and continue comparison. On Sat, Aug 13, 2011 at 2:06 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to take care which 100 is of 10 cos we need 10 1st...?? On Aug 13, 1:00 pm, rahul aravind rahularavin...@gmail.com wrote: awesome alogoritm dave:):) On Fri, Aug 12, 2011 at 6:48 PM, Dave dave_and_da...@juno.com wrote: @Yasir: I think the following will work. Counterexamples welcome. Find the number of digits in each of the integers, and find the max of that number, say m. Fill a second array as follows: If the ith integer has m digits, copy it into the second array. If the ith number has less than m digits, concatenate duplicates of the last digit of the integer to the right end to expand it to m digits. Examples: m = 3, 7 goes to 777; 82 goes to 822; 29 goes to 299; 0 goes to 000. Sort the second array into descending order and carry the first array along (apply the same permutations to the first array as you do to the second). Concatenate the integers in the first array to get the result. Dave On Aug 12, 7:34 am, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New 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.
[algogeeks] Need Pointers for dynamic programming concept problems
Hi! Any good source for dynamic programming problems (along with concept)?? No lmgtfy, Please. Direct links will be appreciated. Thanks -- 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/-/LTUJ9q1qTfUJ. 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] Need Pointers for dynamic programming concept problems
you can start with this http://www.topcoder.com/tc?d1=tutorialsd2=dynProgmodule=Static On Sat, Aug 13, 2011 at 9:31 PM, Yasir yasir@gmail.com wrote: Hi! Any good source for dynamic programming problems (along with concept)?? No lmgtfy, Please. Direct links will be appreciated. Thanks -- 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/-/LTUJ9q1qTfUJ. 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. -- Thanks and Regards, Raghavan KL -- 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] String Question
@raghavan: can u explain wid an example plz On Sat, Aug 13, 2011 at 4:11 PM, Raghavan its...@gmail.com wrote: - Keep an counter for first stuck number(0/1) - increment it, if you stuck on other number, start decrementing it - if the counter becomes zero,note that seq - finally take the longest seq Hope this could solve the problem. On Sat, Aug 13, 2011 at 1:56 PM, vicky S vickyaspir...@gmail.com wrote: Given a string which oly has 0's and 1's . Find the maximum largest substring which have equal no of 0's and 1's and give the length of the substring . whether it can be solved in DP ?? or any other soln ? for example : given string : 001101000 output :0101 -- 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. -- Thanks and Regards, Raghavan KL -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New 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.
[algogeeks] Array question: Detect whether a circular chain with all elements can be formed
An array of strings is given and you have to find out whether a circular chain with all character can be formed or not? Circular chain is formed in way that: if last char of a string is equal to first char of another string then it can be joined.: like ab bxc === axbbxc (Notice that it got joined at b) example {asdsb,csasaa, bc} Answer: TRUE {asdsb,csasaa, bc, bc} Answer: FALSE -- 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/-/WGN5GLyIP_QJ. 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] Need Pointers for dynamic programming concept problems
@Raghavan, Thanks man :) -- 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/-/lGIZaHYTu3cJ. 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] String Doubt
my bad only 3,4 On Sat, Aug 13, 2011 at 7:41 PM, rajeev bharshetty rajeevr...@gmail.comwrote: 3,4 On Sat, Aug 13, 2011 at 7:39 PM, Raman raman.u...@gmail.com wrote: In statement 2, isn't p pointing to const string, as we cannot modify the characters of the string. -- 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/-/FU-nrcTBpCoJ. 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 Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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] what is mean by %2.3d in scanf
@gaurav: nyc one ;) how u made this one well? On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- 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. -- Gaurav Menghani -- 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.
Re: [algogeeks] String Question
Me too didn't get Raghavan's algo... Pls explain.. It seems that above algo will find only longest sequence starting from index 0. Just a thought: Along with raghavan's algo, what if I keep and array_of_integers[string_length] and keep on storing the count in this array. Once string is traversed we have to find the max distance among two equal numbers in an array. (need to think on this problem as well) -- 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/-/gWwbzXZ_B1sJ. 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] n*n array
Hey, can anyone pls share logic/pseudo code for N*M? (When N can be less than or greater than M.) -- 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/-/3mf8oCcnMH4J. 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] Algorithms for Interviews _scan ocr_.pdf
** If you fail to see this message correctly, copy this link to your browser: http://www.fileflyer.com/view/XyBZGA8 [image: FileFlyer]Store and Send your files, fast! Hello, You can click on the following link to retrieve your file. Algorithms for Interviews _scan ocr_.pdfhttp://www.fileflyer.com/view/XyBZGA8 This email was automatically generated, please do not reply to it. If you have any questions, please email supp...@fileflyer.com. The FileFlyer Team Terms http://www.fileflyer.com/legal/terms.aspx | Privacy Policyhttp://www.speedbit.com/Legal/PRIVACY.ASP| Support http://www.fileflyer.com/feedback | DMCAhttp://www.fileflyer.com/legal/dmca.aspx -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New 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.
[algogeeks] Re: TREE question
... if(something) return true; else return false; . // few statements here . Will few statements ever execute?? -- 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/-/zTXTyMwcDGAJ. 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
The soln is nth term of fibonacci sequence...isnt it? Aseem On Sat, Aug 13, 2011 at 9:27 PM, Akash Mukherjee akash...@gmail.com wrote: dp problem, refer to dp from AFI On Sat, Aug 13, 2011 at 9:01 PM, Decipher ankurseth...@gmail.com wrote: There is a river and there are n number of steps between two banks of the river to cross the river. A frog wants to cross the river with the condition that he can jump max one step. Find the number of ways he can cross the river? For e.g. if there are 3 steps in between, frog can go from paths: _123_, _2_, _13_ so there are 3 different ways frog can cross the river (in the example _ is two ends of the river) Can this question be done using Dynamic Programming ? If yes, please tell how . -- 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/-/4HJq5yRGXboJ. 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.
Re: [algogeeks] Array question: Detect whether a circular chain with all elements can be formed
maintain an array indexed on alphabets 'a' to 'z'. now count the occurence of each character taking *last character* of each string {asdsb,csasaa, bc, bc} in this case arr[a]=1; arr[b]=1; arr[c]=2; now start with each sting let first character be first and last character be last while (strings) { if(arr[first ]==0) return false; if(arr[first]==1) { if(first==last) return false; } else{ arr[first--]; } }/*end while if at the end all elements of arr =0 then return true else return false; On Sat, Aug 13, 2011 at 9:44 PM, Yasir yasir@gmail.com wrote: An array of strings is given and you have to find out whether a circular chain with all character can be formed or not? Circular chain is formed in way that: if last char of a string is equal to first char of another string then it can be joined.: like ab bxc === axbbxc (Notice that it got joined at b) example {asdsb,csasaa, bc} Answer: TRUE {asdsb,csasaa, bc, bc} Answer: FALSE -- 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/-/WGN5GLyIP_QJ. 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, Kamakshi kamakshi...@gmail.com -- 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] Algorithms for Interviews _scan ocr_.pdf
Great work aditi. :) On Sat, Aug 13, 2011 at 10:07 PM, aditi garg aditi.garg.6...@gmail.comwrote: ** If you fail to see this message correctly, copy this link to your browser: http://www.fileflyer.com/view/XyBZGA8 [image: FileFlyer] Store and Send your files, fast! Hello, You can click on the following link to retrieve your file. Algorithms for Interviews _scan ocr_.pdfhttp://www.fileflyer.com/view/XyBZGA8 This email was automatically generated, please do not reply to it. If you have any questions, please email supp...@fileflyer.com. The FileFlyer Team Terms http://www.fileflyer.com/legal/terms.aspx | Privacy Policyhttp://www.speedbit.com/Legal/PRIVACY.ASP| Support http://www.fileflyer.com/feedback | DMCAhttp://www.fileflyer.com/legal/dmca.aspx -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New 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.
Re: [algogeeks] Array question: Detect whether a circular chain with all elements can be formed
why following? if(first==last) return false; example: axxa, ayyb, bzza === ayybbzzaaxxa -- 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/-/iONquZUgbPkJ. 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
yes nth term of fibonacci series. .t(n)=t(n-1)+t(n-2); where t(1)=1; t(2)=2; On Sat, Aug 13, 2011 at 10:11 PM, aseem garg ase.as...@gmail.com wrote: The soln is nth term of fibonacci sequence...isnt it? Aseem On Sat, Aug 13, 2011 at 9:27 PM, Akash Mukherjee akash...@gmail.comwrote: dp problem, refer to dp from AFI On Sat, Aug 13, 2011 at 9:01 PM, Decipher ankurseth...@gmail.com wrote: There is a river and there are n number of steps between two banks of the river to cross the river. A frog wants to cross the river with the condition that he can jump max one step. Find the number of ways he can cross the river? For e.g. if there are 3 steps in between, frog can go from paths: _123_, _2_, _13_ so there are 3 different ways frog can cross the river (in the example _ is two ends of the river) Can this question be done using Dynamic Programming ? If yes, please tell how . -- 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/-/4HJq5yRGXboJ. 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, Kamakshi kamakshi...@gmail.com -- 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] Algorithms for Interviews _scan ocr_.pdf
Kudos to Aditi. :D -- 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/-/gnhokgp_zV0J. 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] Array question: Detect whether a circular chain with all elements can be formed
see the following example: *a*kdhd*a* ,*b*hdgd*c*, *c*hdjd*b* On Sat, Aug 13, 2011 at 10:20 PM, Yasir yasir@gmail.com wrote: why following? if(first==last) return false; example: axxa, ayyb, bzza === ayybbzzaaxxa -- 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/-/iONquZUgbPkJ. 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, Kamakshi kamakshi...@gmail.com -- 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] Array question: Detect whether a circular chain with all elements can be formed
i got error,my sol will not work for all cases On Sat, Aug 13, 2011 at 10:22 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: see the following example: *a*kdhd*a* ,*b*hdgd*c*, *c*hdjd*b* On Sat, Aug 13, 2011 at 10:20 PM, Yasir yasir@gmail.com wrote: why following? if(first==last) return false; example: axxa, ayyb, bzza === ayybbzzaaxxa -- 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/-/iONquZUgbPkJ. 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, Kamakshi kamakshi...@gmail.com -- Regards, Kamakshi kamakshi...@gmail.com -- 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: an array question
I dont know whether this is best approach to do step 2 or not. But it's certainly good. //I will show for two strings s1 and s2 len1 = s1.length(); len2 = s2.length(); ind1 = 0; //Index in the first string ind2 = 0; //Index in the second string while( ind1len1 || ind2 len2 ) //Match until both strings exhaust or function returns { if(ind1 == len1) // String s1 has exhausted, so start over it ind1 = 0; if(ind2 == len2) // String s2 has exhausted, so start over it ind2 = 0; for(; ind1 len1 ind2 len2; ind1++,ind2++ ) // Go on comparing until any of the string exhausts or function returns { if( s1[ind1] == s2[ind2] ) //Same current char in both string so we need to match more char continue; else // mismatch return (s1[ind1] s2 [ind2] ); } } if (ind1==len1 ind2==len2) // same strings return true; //If I missed anything in the code, let me know On Sat, Aug 13, 2011 at 9:29 PM, aditi garg aditi.garg.6...@gmail.comwrote: @kunal: what is the best way to implement step 2? On Sat, Aug 13, 2011 at 7:33 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @kunal: seems fine.. tried it on some cases... On Sat, Aug 13, 2011 at 5:17 PM, Kunal Patil kp101...@gmail.com wrote: Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g. while comparing two unequal length strings char by char if you find chars of str1 have exhausted but not of str2, you can set index in str1 to start of the str1 and continue comparison. On Sat, Aug 13, 2011 at 2:06 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to take care which 100 is of 10 cos we need 10 1st...?? On Aug 13, 1:00 pm, rahul aravind rahularavin...@gmail.com wrote: awesome alogoritm dave:):) On Fri, Aug 12, 2011 at 6:48 PM, Dave dave_and_da...@juno.com wrote: @Yasir: I think the following will work. Counterexamples welcome. Find the number of digits in each of the integers, and find the max of that number, say m. Fill a second array as follows: If the ith integer has m digits, copy it into the second array. If the ith number has less than m digits, concatenate duplicates of the last digit of the integer to the right end to expand it to m digits. Examples: m = 3, 7 goes to 777; 82 goes to 822; 29 goes to 299; 0 goes to 000. Sort the second array into descending order and carry the first array along (apply the same permutations to the first array as you do to the second). Concatenate the integers in the first array to get the result. Dave On Aug 12, 7:34 am, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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
[algogeeks] differnce between malloc calloc and new
what is d basic diff between malloc calloc and new command as all are used for dynamic allocation -- Warm Regards-- Ankur Pratik Computer Science Engg Dept Undergraduate Student National Institute of Technology Durgapur India -- 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: an array question
@ kunal : arent we supposed to construct the string fr each number equal to the max length of any number... whr r v doing dat chking in dis algo? On Sat, Aug 13, 2011 at 10:25 PM, Kunal Patil kp101...@gmail.com wrote: I dont know whether this is best approach to do step 2 or not. But it's certainly good. //I will show for two strings s1 and s2 len1 = s1.length(); len2 = s2.length(); ind1 = 0; //Index in the first string ind2 = 0; //Index in the second string while( ind1len1 || ind2 len2 ) //Match until both strings exhaust or function returns { if(ind1 == len1) // String s1 has exhausted, so start over it ind1 = 0; if(ind2 == len2) // String s2 has exhausted, so start over it ind2 = 0; for(; ind1 len1 ind2 len2; ind1++,ind2++ ) // Go on comparing until any of the string exhausts or function returns { if( s1[ind1] == s2[ind2] ) //Same current char in both string so we need to match more char continue; else // mismatch return (s1[ind1] s2 [ind2] ); } } if (ind1==len1 ind2==len2) // same strings return true; //If I missed anything in the code, let me know On Sat, Aug 13, 2011 at 9:29 PM, aditi garg aditi.garg.6...@gmail.comwrote: @kunal: what is the best way to implement step 2? On Sat, Aug 13, 2011 at 7:33 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @kunal: seems fine.. tried it on some cases... On Sat, Aug 13, 2011 at 5:17 PM, Kunal Patil kp101...@gmail.com wrote: Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g. while comparing two unequal length strings char by char if you find chars of str1 have exhausted but not of str2, you can set index in str1 to start of the str1 and continue comparison. On Sat, Aug 13, 2011 at 2:06 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to take care which 100 is of 10 cos we need 10 1st...?? On Aug 13, 1:00 pm, rahul aravind rahularavin...@gmail.com wrote: awesome alogoritm dave:):) On Fri, Aug 12, 2011 at 6:48 PM, Dave dave_and_da...@juno.com wrote: @Yasir: I think the following will work. Counterexamples welcome. Find the number of digits in each of the integers, and find the max of that number, say m. Fill a second array as follows: If the ith integer has m digits, copy it into the second array. If the ith number has less than m digits, concatenate duplicates of the last digit of the integer to the right end to expand it to m digits. Examples: m = 3, 7 goes to 777; 82 goes to 822; 29 goes to 299; 0 goes to 000. Sort the second array into descending order and carry the first array along (apply the same permutations to the first array as you do to the second). Concatenate the integers in the first array to get the result. Dave On Aug 12, 7:34 am, Yasir Imteyaz yasir@gmail.com wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- 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
Re: [algogeeks] String Question
Here is my algo: 1)Replace all '0' with '1' and '1' with '-1'(.i.e, 1 0 1 --- -1 1 -1) 2)Now take an array to calculate the sum of all elements from 1 to that index, which can be calculated as sum[i]=sum[i-1]+ar[i],take 0th element as 0. 3)Now the problem becomes finding two indices (say i,j) for which, sum[i]=sum[j] and j-i is maximum (ji) (This is easy to see as,Let for substring [i,j] the number of 1s is equal to number of 0's ,then sum[i,j]=0 as per our algo, OR we can state that sum[i-1]=sum[j],now for longest substring the difference should be maximum) example:- 1 0 1 -- -1 1 -1 --- sum array :: 0 -1 0 -1 take i=1and j=2,sum[i-1]=sum[j]=-1,and substring::string[1,2]= 1 0 (Answer) 4)Now,the above step can be done quickly using hashing(using array indexes) in O(n).(If n10^6) On Sat, Aug 13, 2011 at 9:53 PM, Yasir yasir@gmail.com wrote: Me too didn't get Raghavan's algo... Pls explain.. It seems that above algo will find only longest sequence starting from index 0. Just a thought: Along with raghavan's algo, what if I keep and array_of_integers[string_length] and keep on storing the count in this array. Once string is traversed we have to find the max distance among two equal numbers in an array. (need to think on this problem as well) -- 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/-/gWwbzXZ_B1sJ. 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,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- 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] differnce between malloc calloc and new
malloc fr one element only...fr eg new node in linked listgarbage values assigned calloc can be used to dynamically allocate memory fr arrays...values assigned to 0 by default new same as malloc except dat it is used in c++ and malloc in C On Sat, Aug 13, 2011 at 10:32 PM, Ankur pratik ankurocks...@gmail.comwrote: what is d basic diff between malloc calloc and new command as all are used for dynamic allocation -- Warm Regards-- Ankur Pratik Computer Science Engg Dept Undergraduate Student National Institute of Technology Durgapur India -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New 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.
Re: [algogeeks] what is mean by %2.3d in scanf
i dont think we can set precision during scanf On Sat, Aug 13, 2011 at 9:49 PM, Anika Jain anika.jai...@gmail.com wrote: @gaurav: nyc one ;) how u made this one well? On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- 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. -- Gaurav Menghani -- 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.
Re: [algogeeks] what is mean by %2.3d in scanf
@Anika: Check out lmgtfy.com One can use this if the desired answer is provided by a google query. On Sat, Aug 13, 2011 at 9:49 PM, Anika Jain anika.jai...@gmail.com wrote: @gaurav: nyc one ;) how u made this one well? On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.com wrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- 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. -- Gaurav Menghani -- 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. -- Gaurav Menghani -- 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] Adobe Interview Question
How did you know that ? -- 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/-/GMle2k9i73wJ. 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] Array question: Detect whether a circular chain with all elements can be formed
Maybe you are looking for this:http://www.codechef.com/problems/WORDS1 On Sat, Aug 13, 2011 at 10:25 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: i got error,my sol will not work for all cases On Sat, Aug 13, 2011 at 10:22 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: see the following example: *a*kdhd*a* ,*b*hdgd*c*, *c*hdjd*b* On Sat, Aug 13, 2011 at 10:20 PM, Yasir yasir@gmail.com wrote: why following? if(first==last) return false; example: axxa, ayyb, bzza === ayybbzzaaxxa -- 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/-/iONquZUgbPkJ. 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, Kamakshi kamakshi...@gmail.com -- Regards, Kamakshi kamakshi...@gmail.com -- 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,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- 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] shop keeper and the buyer
k lets assume that there are 10 kinds of item in the shop price[]={10,20,30,40,50,60,70,80,90,100} quantity[]={5,5,5,5,5,5,5,5,5,5} say no.of items having some free discounts : 5 say p,q,r denotes buying q nos. of p we will get one r for free.. let them be 5 4 1 2 5 1 8 2 10 9 1 10 1 5 10 explain for this case.. how will u proceed? On Sat, Aug 13, 2011 at 7:25 PM, Aditya Virmani virmanisadi...@gmail.comwrote: if k is fixed, sort the items according to their price, buy k cheapest items start taking the most expensive item fr free -- 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] what is mean by %2.3d in scanf
It is just displaying the floating point in the specified precision format. The internal representation is obviously unchanged. On Sat, Aug 13, 2011 at 10:44 PM, Prakash D cegprak...@gmail.com wrote: i dont think we can set precision during scanf On Sat, Aug 13, 2011 at 9:49 PM, Anika Jain anika.jai...@gmail.com wrote: @gaurav: nyc one ;) how u made this one well? On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.com wrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- 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. -- Gaurav Menghani -- 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. -- Gaurav Menghani -- 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] Adobe Interview Question
coz i have tried a similar question like dis...also u can check it also... On Sat, Aug 13, 2011 at 10:47 PM, Decipher ankurseth...@gmail.com wrote: How did you know that ? -- 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/-/GMle2k9i73wJ. 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, Kamakshi kamakshi...@gmail.com -- 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: what is mean by %2.3d in scanf
i just used that statement and cout it.. i got junk value.. what is the input format for this? On Aug 13, 10:18 pm, Gaurav Menghani gaurav.mengh...@gmail.com wrote: It is just displaying the floating point in the specified precision format. The internal representation is obviously unchanged. On Sat, Aug 13, 2011 at 10:44 PM, Prakash D cegprak...@gmail.com wrote: i dont think we can set precision during scanf On Sat, Aug 13, 2011 at 9:49 PM, Anika Jain anika.jai...@gmail.com wrote: @gaurav: nyc one ;) how u made this one well? On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.com wrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- 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. -- Gaurav Menghani -- 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. -- Gaurav Menghani -- 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: Jumping Puzzle
I can only say that above code is wrong, check this code of mine, I have tested more cases and all are working, https://ideone.com/pEBs8 see if you can find any bug in this one . thanks. On Sat, Aug 13, 2011 at 8:03 PM, WgpShashank shashank7andr...@gmail.com wrote: @rohit , I think we will get some cases where greedy won't work check out its giving 3 jumps still https://ideone.com/6UWW1 checked in hurray , if anything wrong do send me over gmail ? Regards Shashank Mani Computer Science Is Awesome So Why I Write Code Computer Science Birla institute of Technology Mesra -- 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/-/Rerf5mzR7XcJ. 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. -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- 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] citrix rd????
can anybody please tell me what kind of questions will be asked in citrix rd???please this is my last chance.help me -- 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] Adobe Interview Question
what does step refer to in this case??? Please explain the example... On Sat, Aug 13, 2011 at 10:47 PM, Decipher ankurseth...@gmail.com wrote: How did you know that ? -- 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/-/GMle2k9i73wJ. 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,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- 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: Jumping Puzzle
ok check this, https://ideone.com/hZboG there may be bugs in coding, but I'm quite sure that algo is correct need to check more cases though but working on all the cases discussed here is there any proof that greedy won't work in this case? On Sat, Aug 13, 2011 at 11:03 PM, rohit jangid rohit.nsi...@gmail.com wrote: found some bugs , will repost it On Sat, Aug 13, 2011 at 10:55 PM, rohit jangid rohit.nsi...@gmail.com wrote: I can only say that above code is wrong, check this code of mine, I have tested more cases and all are working, https://ideone.com/pEBs8 see if you can find any bug in this one . thanks. On Sat, Aug 13, 2011 at 8:03 PM, WgpShashank shashank7andr...@gmail.com wrote: @rohit , I think we will get some cases where greedy won't work check out its giving 3 jumps still https://ideone.com/6UWW1 checked in hurray , if anything wrong do send me over gmail ? Regards Shashank Mani Computer Science Is Awesome So Why I Write Code Computer Science Birla institute of Technology Mesra -- 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/-/Rerf5mzR7XcJ. 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. -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- 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: an array question
Let me clarify. Lets take example 53 147 1471470 As per algo: sort 5353535 , 1471471 and 1471470 lexicographically to get answer. But You are not going to compare all these simultaneously. Might be you will first compare 53 and 147 for lexicographical order. In this case you are not required to calculate till max length. In fact while comparing two strings you will require only till (max(len1, len2)). (verify it !!) Comparing 53 and 1471470 doesn't even require till max length. Comparing 147 and 1471470 (co-incidentally) requires till max length. (worst case !) Consider you have only 2 strings. Then above code gives lexicographically largest of these two (This comparison is considering circular appending). You can now use this comparator function as parameter for sort() function in c++. So given set of strings as the input and this comparator function it will sort as per given criteria. I mentioned you have to append circularly till largest of all string length only for illustration purpose and to make understanding easier. Had I mentioned go on comparing each of 2 strings till max(len1,len2), It might not be grasped quickly. As you can see you will not always require string upto largest length to determine lexicographical order of 2 strings. I am bad at explaining things. So let me know whether this solved your doubt. On Sat, Aug 13, 2011 at 10:35 PM, aditi garg aditi.garg.6...@gmail.comwrote: @ kunal : arent we supposed to construct the string fr each number equal to the max length of any number... whr r v doing dat chking in dis algo? On Sat, Aug 13, 2011 at 10:25 PM, Kunal Patil kp101...@gmail.com wrote: I dont know whether this is best approach to do step 2 or not. But it's certainly good. //I will show for two strings s1 and s2 len1 = s1.length(); len2 = s2.length(); ind1 = 0; //Index in the first string ind2 = 0; //Index in the second string while( ind1len1 || ind2 len2 ) //Match until both strings exhaust or function returns { if(ind1 == len1) // String s1 has exhausted, so start over it ind1 = 0; if(ind2 == len2) // String s2 has exhausted, so start over it ind2 = 0; for(; ind1 len1 ind2 len2; ind1++,ind2++ ) // Go on comparing until any of the string exhausts or function returns { if( s1[ind1] == s2[ind2] ) //Same current char in both string so we need to match more char continue; else // mismatch return (s1[ind1] s2 [ind2] ); } } if (ind1==len1 ind2==len2) // same strings return true; //If I missed anything in the code, let me know On Sat, Aug 13, 2011 at 9:29 PM, aditi garg aditi.garg.6...@gmail.comwrote: @kunal: what is the best way to implement step 2? On Sat, Aug 13, 2011 at 7:33 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @kunal: seems fine.. tried it on some cases... On Sat, Aug 13, 2011 at 5:17 PM, Kunal Patil kp101...@gmail.comwrote: Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g. while comparing two unequal length strings char by char if you find chars of str1 have exhausted but not of str2, you can set index in str1 to start of the str1 and continue comparison. On Sat, Aug 13, 2011 at 2:06 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to take care which 100 is of 10 cos we need 10 1st...?? On Aug 13, 1:00 pm, rahul aravind rahularavin...@gmail.com wrote: awesome alogoritm dave:):) On Fri, Aug 12, 2011 at 6:48 PM, Dave dave_and_da...@juno.com wrote: @Yasir: I think the following will work. Counterexamples welcome. Find the number of digits in each of the integers, and find the max of that number, say m. Fill a second array as follows: If the ith integer has m digits, copy it into the second array. If the ith number has less than m digits, concatenate duplicates of the last digit of the integer to the right end to expand it to m digits. Examples: m = 3, 7 goes to 777; 82 goes to 822; 29 goes to 299; 0 goes to 000. Sort
Re: [algogeeks] Algorithms for Interviews _scan ocr_.pdf
The link doesnt seem to work. Can somebody mail it again? On Sat, Aug 13, 2011 at 10:22 PM, Yasir yasir@gmail.com wrote: Kudos to Aditi. :D -- 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/-/gnhokgp_zV0J. 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] Algorithms for Interviews _scan ocr_.pdf
It does work! -- 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: TRee question...
see WgpShashank second point carefully it say successor is parent of left node so solution of you BST is parent of 2 which is 4 On Sat, Aug 13, 2011 at 7:50 PM, Anika Jain anika.jai...@gmail.com wrote: @ashmantak: the figure of dipankar is incorrect but his point is correct.. for a tree like 4 /\ 2 10 / \ 13 successor of 3 shall be 4 not 2.. On Fri, Aug 12, 2011 at 4:48 PM, ashmantak ashman...@gmail.com wrote: @Dipankar Patro - The figure u have made isn't a BST.Read the problem. His soln. is correct. -- 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.