Re: [algogeeks] Give Algo to do this in O(n)
@ ankur: if space is not the consideration first sort them using count sort and then look for the pair with the min. difference .. i think it should work . Snehi On Mon, Oct 10, 2011 at 7:21 PM, anubhav gupta anubhav.7...@gmail.comwrote: @deoki try for 1001,999,998,1 On Mon, Oct 10, 2011 at 6:57 PM, Deoki Nandan deok...@gmail.com wrote: just find minimum and secon minimum by taking two variables in O(n) On 10 October 2011 17:57, sandeep nagamalli nsandee...@gmail.com wrote: @Shiva: How can min heap be uesd, can you eloborate a bit. As far as i see, the best possible is O(nlogn) i.e by sorting and scanning over the complete array once. On Mon, Oct 10, 2011 at 9:49 AM, shiva@Algo shiv.jays...@gmail.comwrote: I think Min heap will do that.. On Mon, Oct 10, 2011 at 12:37 AM, Ankur Garg ankurga...@gmail.comwrote: Given an unsorted array of Integers Find 2 nos whose diff is minimum Say Array is 4 2 18 19 11 8 5 Nos are 18 and 19 Algo shud be of O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- ThanksRegards: -sandeep -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **With Regards Deoki Nandan Vishwakarma IIT ROORKEE 9760340784 for Computer Science Interview Material see my home page https://sites.google.com/site/deokinandanmaterials/ * * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Give Algo to do this in O(n)
ankur : i wont say its the best way, but it can be used in one traversal the range can be determined and then count sort can be applied. On Mon, Oct 10, 2011 at 10:56 PM, Ankur Garg ankurga...@gmail.com wrote: @Sravan ..Counting Sort takes O(n) time but it needs range of nos to be known @Snehi jain..there is no range given so am not sure if count sort will work ,Can you please elaborate a bit on ur method Ankur On Mon, Oct 10, 2011 at 10:09 PM, sravanreddy001 sravanreddy...@gmail.com wrote: Just went throught what a count sort is at http://en.wikipedia.org/wiki/Counting_sort If all the elements are distinct which is possible, will this count sort have any use? Also, the sorting takes O(nlogn) time right? Did I miss anything? -- 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/-/08bcRsmFYJgJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Make My Trip *URGENT*
after the aptitude written round .. there were 15 questions in technical (c c++) and 5 questions on coding in 45 min. On Thu, Aug 18, 2011 at 11:01 PM, Anika Jain anika.jai...@gmail.com wrote: the level is very easy.. i dont remember the questions .. but they are easy.. but tht makes cut off go very high On Thu, Aug 18, 2011 at 1:22 PM, monish001 monish.gup...@gmail.comwrote: What level of questions for each- english, aptitute, coding? Can you discuss some? -Monish On Aug 17, 5:06 pm, Anika Jain anika.jai...@gmail.com wrote: there will be 15 english fill in the blanks, 5 series questn, 10 aptitude questions, 10 logical questions.. then 10 c++ mcqs and 5 coding questions On Wed, Aug 17, 2011 at 5:28 PM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: has anyone given MMT written test.?? please reply , what is the pattern of the paper? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Makemytrip.com
NIT kurukshetra people ... could post some information regarding the procedure followed by makemytrip during their recruitment process ... On Sat, Jul 30, 2011 at 1:51 AM, sukhmeet singh sukhmeet2...@gmail.comwrote: CTC ??? On Thu, Jul 28, 2011 at 10:22 PM, Raman Gugnani ramangugnani@gmail.com wrote: Hi Can anyone please tell me where from and how to prepare for MAKEMYTRIP.COM intern test..It is coming to NIT Kurukshetra campus next week..! Also tell how this company is Good /Bad...?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] a C question
#includestdio.h main() { long x; float t; scanf(%f,t); printf(%d\n,t); x=90; printf(%f\n,x); { x=1; printf(%f\n,x); { x=30; printf(%f\n,x); } printf(%f\n,x); } x==9; printf(%f\n,x); getch(); } o/p (when i had given input as 67 this is the output) 0 67.0 67.0 67.0 67.0 67.0 can anyone explain me he output.. Thanks Snehi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Makemytrip.com
thanks for the information .. the technical round had MCQs or coding questions ?? On Fri, Aug 5, 2011 at 11:09 PM, parag khanna khanna.para...@gmail.comwrote: CS,IT,ECE -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: permutation of string with repeated characters...
i did a dry run on this code and didnt find the significance of mk array ... so i did remove it from the code .. and the code works fine .. i more thing ... the code repeats same palindromes as in incase of ABA baa is coming twice.. correct me if i am wrong ... On Fri, Jul 29, 2011 at 10:47 AM, Arun Vishwanathan aaron.nar...@gmail.comwrote: @amit:i am not clear about the code.Maybe could you take your example string aabc and explain a few steps that happen from your code??.The array mk is locally created for each function call and so I do not get how it keeps track of elements tried cos each time it is a new array. On Fri, Jul 29, 2011 at 3:54 AM, amit karmakar amit.codenam...@gmail.comwrote: What my recursive solution does is that, For all elements that can be used at position *k*, fix that element at position *k* and then permute the rest of the elements. So if are two same elements which can be used at position *k* we must choose only one of it to avoid repeated permutations. Array mk[256] keeps a track of the elements that have already been tried. Does there exist any better solution also, or this backtracking solution is the best? You should have a look at this: http://en.wikipedia.org/wiki/Permutation#Algorithms_to_generate_permutations On Jul 29, 12:34 am, Nitish Garg nitishgarg1...@gmail.com wrote: Can you please explain what is the use of the array mk[256], how this array solves the problem of repeated characters. Does there exist any better solution also, or this backtracking solution is the best? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] doubt in checking if 2 strings are anagrams
thanks .. @siddhartha : i know the hashing technique ... and the problem of longer strings can be reduced by subtracting a large constant value from the ASCII value of all the characters .. and its not only with cubes even if u add squares of ascii values ... i think it will work . @saurabh : in what context should i use bitfield ... On Fri, Jul 29, 2011 at 7:36 PM, saurabh singh saurab...@gmail.com wrote: use a bitfield to optimize space On Fri, Jul 29, 2011 at 7:14 PM, Siddharth kumar siddhartha.baran...@gmail.com wrote: #includeiostream #includestring.h using namespace std; int main() { char str1[] = sdfgkirertyujvcheddirtyutrdfgrtyuigfkrertyuijhgfdshh; char str2[] = redirtyhgfdshhrtyrsujvcheierdutrdfgrtyuigfkdfgktyuij; int len1 = strlen(str1), len2 = strlen(str2); if(len1 != len2) { coutBoth are not anagram of each other.; return 0; } else { int rep_char1[26] = {0}, rep_char2[26] = {0}, i; for(i=0; ilen1; i++) { rep_char1[str1[i]-'a']++; rep_char2[str2[i]-'a']++; } for(i=0; i26; i++) if(rep_char1[i] != rep_char2[i]) { coutBoth are not anagram of each other.; return 0; } coutBoth are anagram of each other.; } return 0; } -- Siddharth Kumar BE 4th year, Computer Engineering (Delhi College of Engineering) +919711559760 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] doubt in checking if 2 strings are anagrams
no problem .. but can u find a bug in this technique .. On Fri, Jul 29, 2011 at 8:17 PM, saurabh singh saurab...@gmail.com wrote: ignore above status...i was looking at two problems simulataneously...posted on the wrong one... apologies...really its embarrasing. On Fri, Jul 29, 2011 at 8:11 PM, snehi jain snehijai...@gmail.com wrote: thanks .. @siddhartha : i know the hashing technique ... and the problem of longer strings can be reduced by subtracting a large constant value from the ASCII value of all the characters .. and its not only with cubes even if u add squares of ascii values ... i think it will work . @saurabh : in what context should i use bitfield ... On Fri, Jul 29, 2011 at 7:36 PM, saurabh singh saurab...@gmail.comwrote: use a bitfield to optimize space On Fri, Jul 29, 2011 at 7:14 PM, Siddharth kumar siddhartha.baran...@gmail.com wrote: #includeiostream #includestring.h using namespace std; int main() { char str1[] = sdfgkirertyujvcheddirtyutrdfgrtyuigfkrertyuijhgfdshh; char str2[] = redirtyhgfdshhrtyrsujvcheierdutrdfgrtyuigfkdfgktyuij; int len1 = strlen(str1), len2 = strlen(str2); if(len1 != len2) { coutBoth are not anagram of each other.; return 0; } else { int rep_char1[26] = {0}, rep_char2[26] = {0}, i; for(i=0; ilen1; i++) { rep_char1[str1[i]-'a']++; rep_char2[str2[i]-'a']++; } for(i=0; i26; i++) if(rep_char1[i] != rep_char2[i]) { coutBoth are not anagram of each other.; return 0; } coutBoth are anagram of each other.; } return 0; } -- Siddharth Kumar BE 4th year, Computer Engineering (Delhi College of Engineering) +919711559760 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?
@Dumanshu: i know you have given a good explanation but i have never done parallel computing.. could you illustrate a bit more especially about the n+1th process.. On Tue, Jul 19, 2011 at 3:35 PM, Bhanu Kishore bhanukishor...@gmail.comwrote: @Venkat. That algorithm doesnt work actually.Try for 9,8,1. At 1 , it becomes 0. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 optimally compute a matrix (nXn) to the power of k?
question had come in Amazon interview ... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: how to optimally compute a matrix (nXn) to the power of k?
@Rishab Thanks .. could you explain what your are doing in the function exp().. On Tue, Jul 19, 2011 at 9:47 PM, Rishabh Maurya poofiefoo...@gmail.comwrote: Yes its running fine at gcc 4.3.2 . And it might show warning in that case just change the name of the function exp(). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?
this question was asked in an interview. Regards Snehi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?
the elements are random ... On Tue, Jul 19, 2011 at 12:01 AM, Saket Choudhary sake...@gmail.com wrote: Yeah if they are in some order then its possible doing it in O(n) else reading should itself take O(n^2) in the worst case. On 18 July 2011 23:54, ankit sambyal ankitsamb...@gmail.com wrote: Are the elements of the array in some order, or are they random ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?
can it be solved in less than O(n^2) like O(nlogn ) types.. i cant figure out any solution less than O(n^2). On Tue, Jul 19, 2011 at 12:37 AM, ankit sambyal ankitsamb...@gmail.comwrote: @Snehi :If the elements are random, then it seems that this problem can't be solved in O(n) time -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: strings
sorry .. didnt see the question properly ... and yes binary tree will not be a good option... On Thu, Jun 23, 2011 at 6:39 PM, Sriganesh Krishnan 2448...@gmail.comwrote: oh...an array of constant length signify's constant memorywhy dint i see that...thanks guys!!! regards ---sriji!! On Thu, Jun 23, 2011 at 6:35 PM, Sriganesh Krishnan 2448...@gmail.comwrote: ya i needed the same thing! On Wed, Jun 22, 2011 at 3:04 PM, saurabh singh saurab...@gmail.comwrote: Without the ascii count table as harshal has used above,is it possible to do the problem in o(n) time? On Wed, Jun 22, 2011 at 2:57 PM, Harshal hc4...@gmail.com wrote: @ross: ya, don't know what i was thinking.!! On Wed, Jun 22, 2011 at 2:33 PM, ross jagadish1...@gmail.com wrote: @Harshal, Even if you use a buffer of size 256 it is still O(1), because 256 is a constant invariant of n... Ur solution is correct! On Jun 22, 10:24 am, Harshal hc4...@gmail.com wrote: ignore above solution. My bad, did'nt see O(1) space constraint!! On Wed, Jun 22, 2011 at 10:53 AM, Harshal hc4...@gmail.com wrote: You can make use of an auxiliary array(initialized to 0) to store the count of each char and then print it that many times. char inp[]=abcdaabcdefe; int buff[256]={0}; for(int i=0;istrlen(inp);i++) buff[inp[i]]++; for(int j=0;j256;j++) while(buff[j]--) cout(char)j; On Wed, Jun 22, 2011 at 10:27 AM, Sriganesh Krishnan 2448...@gmail.comwrote: Input will be a string. We need to o/p a string with the order of characters same as the input but with same characters grouped together. I/P: abcdacde O/P: aabccdde I/P: kapilrajadurga O/P: kpilrrjdug I/P: 1232 O/P: 1223 …….. O(n) time……….. O(1) space…. how can you approach these type of string related problems, is there any specific technique involved? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Harshal Choudhary, Final Year B.Tech CSE, NIT Surathkal, Karnataka, India. -- Harshal Choudhary, Final Year B.Tech CSE, NIT Surathkal, Karnataka, 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. -- Harshal Choudhary, Final Year B.Tech CSE, NIT Surathkal, Karnataka, 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. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: strings
what if we create a binary tree with root as the first element of the string and if the next character is equal then place it to left else place it to right. Similar comparison will be done while inserting all the other nodes too . after that if InOrder traversal is performed.. it would give us the desired output. i didnt code it ... but it sounds ok to me.. correct me if i am wrong .. Snehi On Wed, Jun 22, 2011 at 9:48 PM, DK divyekap...@gmail.com wrote: No. This is equivalent to a sort with comparisons based on index of first occurrence in the input string. Any comparative algorithm is O(n log n) and a non comparative algorithm can be O(n) only by using counting or radix sorting etc. -- DK http://twitter.com/divyekapoor http://www.divye.in -- 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/-/GeqwF_snzQQJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: strings
how come its printing in sorted ... i didn't get it... On Thu, Jun 23, 2011 at 12:27 AM, oppilas . jatka.oppimi...@gmail.comwrote: No, it will not work. We don't have to print all the characters in sorted order. On Thu, Jun 23, 2011 at 12:19 AM, snehi jain snehijai...@gmail.comwrote: what if we create a binary tree with root as the first element of the string and if the next character is equal then place it to left else place it to right. Similar comparison will be done while inserting all the other nodes too . after that if InOrder traversal is performed.. it would give us the desired output. i didnt code it ... but it sounds ok to me.. correct me if i am wrong .. Snehi On Wed, Jun 22, 2011 at 9:48 PM, DK divyekap...@gmail.com wrote: No. This is equivalent to a sort with comparisons based on index of first occurrence in the input string. Any comparative algorithm is O(n log n) and a non comparative algorithm can be O(n) only by using counting or radix sorting etc. -- DK http://twitter.com/divyekapoor http://www.divye.in -- 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/-/GeqwF_snzQQJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Re: strings
the binary tree for the above example will be k(1) \ a(2) / \ (7) a p(3) \ i(4) \ l(5) \ r (6) number in the bracket denotes the order of insertion like k inserted first then a then p and so on .. now if inorder is performed ... arent we getting kaapilr On Thu, Jun 23, 2011 at 12:43 AM, oppilas . jatka.oppimi...@gmail.comwrote: May be I didn't understood your logic. According to original question for I/P kapilra O/P --kaapilr.. Now, -what if we create a binary tree with root as the first element of the string and if the next character is equal then place it to left else place it to right. Similar comparison will be done while inserting all the other nodes too . At root you will insert k(count=1) After that a k(1) / a(1) Then you will insert p, k(1) / \ a(1)p(1) And so on. after that if InOrder traversal is performed.. it would give us the desired output. If by inoder traversal we can get desired output then please how me how using a small example :). Snehi On Wed, Jun 22, 2011 at 9:48 PM, DK divyekap...@gmail.com wrote: No. This is equivalent to a sort with comparisons based on index of first occurrence in the input string. Any comparative algorithm is O(n log n) and a non comparative algorithm can be O(n) only by using counting or radix sorting etc. -- DK http://twitter.com/divyekapoor http://www.divye.in -- 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/-/GeqwF_snzQQJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] a doubt..
wont recursion will also be resource (time) intensive because of the multiple function call which is not observed in iterative procedures. On Tue, Jun 14, 2011 at 7:30 AM, Navneet Gupta navneetn...@gmail.comwrote: Recursion is the best way to write compact programs for what might seem as tedious tasks to do. Dynamic Programming is an alternate to recursion when problems possess characteristics like suboptimal substructures and overlapping subproblems. Dynamic Programming is a iterative way of doing tasks which can also be done with recursion but they are generally less time intensive. Recursion is space intensive because it takes space for storing activation blocks of recursive function calls On Tue, Jun 14, 2011 at 2:18 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: Is it right to say iteration is resource(time) intensive and recursion is not. On the other hand, recursion is space intensive (with stacks) and iteration is not ? Thanks On Mon, Jun 13, 2011 at 2:08 PM, ADITYA KUMAR aditya...@gmail.com wrote: its always better to have iterative program than recursive since iterative program doesn't rely on system stack.. but recursive program are easy to write and gives a clear view of program On Tue, Jun 14, 2011 at 1:13 AM, snehi jain snehijai...@gmail.com wrote: hi, we try to implement many programs using Recursion and its said that this is better than iterative procedure. if i am right then i cant understand why is it so? can anybody explain ... and are there situations when iterative procedure is better than recursion. Snehi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 Aditya Kumar B-tech 3rd year Computer Science Engg. MNNIT, Allahabad. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Intuitive Understanding of XOR Operation
hi, the way XOR operation works i.e 0 for duplicates is used the most. A practical application that i know is , XOR is used for Forward Error correction for packet loss over a network. It works on the same principle like the duplicate problem. Another application that i know is for Error detection of transmitted packets (which again works on the principle of duplicates). i hope it helps. Snehi On Tue, Jun 14, 2011 at 7:48 AM, Navneet Gupta navneetn...@gmail.comwrote: Hello, I would really appreciate if someone can help me get an intuitive understanding of XOR over a range of numbers. I have seen it's usage is a couple of problems where duplicates are involved and though ultimately i can see how it is solving the problem, i still feel like checking the correctness of the solution whenever i come across such solutions. Also would be good if someone can throw some light on what other kinds of problems they have seen which are difficult(time complexity wise) but using XOR gives an elegant and time efficient solution. --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] help
according to precedence m= ++i || ++j ++k will become m = ++i || (++j ++k);NOT this m = (++i || ++j) ++k; first i gets incremented and since that gives a non-zero value the rest of the statement is not executed. On Tue, Jun 14, 2011 at 8:41 PM, nicks crazy.logic.k...@gmail.com wrote: anybody having idea about preference order ?? On Tue, Jun 14, 2011 at 4:20 AM, nicks crazy.logic.k...@gmail.com wrote: What about precedence order then. http://www.difranco.net/cop2220/op-prec.htm i mean acc. to precedence order should be evaluated before || in the second exampleresult should be k=1,j=3 and i= -2 On Mon, Jun 13, 2011 at 11:41 AM, udit sharma sharmaudit...@gmail.comwrote: hmm. Sry yr... Got it.. Thanx.. :) :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] help
that is what is happening here m = ++i || (++j ++k); in C if P = Q || R; first it checks Q if that is NOT true then it computes C else it doesn't. ++ is a unary operator so before the || and operations can happen increment will take place. This justifies the higher precedence of ++ operator. in the above example i gets incremented to -2 first and then || operation is executed. i has a non-zero value therefore no computation is done for (++j ++k); . keep initial value of i to -1 then after m = ++i || (++j ++k); statement i = 0 , j = 3 , k =1 and m =1 On Tue, Jun 14, 2011 at 10:02 PM, nicks crazy.logic.k...@gmail.com wrote: hmm...someone explain...me too confused :( On Tue, Jun 14, 2011 at 9:14 AM, rahul dixit dixit.rahu...@gmail.comwrote: bt increment operator has the higher precedence than || and so all the variables should be incremented first then and then || should be evaluated then how it is happening.plz explain rahul dixit Du-Mca -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] help
first it checks Q if that is NOT true then it computes R else it doesn't. this is the correct line . On Tue, Jun 14, 2011 at 10:21 PM, snehi jain snehijai...@gmail.com wrote: that is what is happening here m = ++i || (++j ++k); in C if P = Q || R; first it checks Q if that is NOT true then it computes C else it doesn't. ++ is a unary operator so before the || and operations can happen increment will take place. This justifies the higher precedence of ++ operator. in the above example i gets incremented to -2 first and then || operation is executed. i has a non-zero value therefore no computation is done for (++j ++k); . keep initial value of i to -1 then after m = ++i || (++j ++k); statement i = 0 , j = 3 , k =1 and m =1 On Tue, Jun 14, 2011 at 10:02 PM, nicks crazy.logic.k...@gmail.comwrote: hmm...someone explain...me too confused :( On Tue, Jun 14, 2011 at 9:14 AM, rahul dixit dixit.rahu...@gmail.comwrote: bt increment operator has the higher precedence than || and so all the variables should be incremented first then and then || should be evaluated then how it is happening.plz explain rahul dixit Du-Mca -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Java Book
sams teach yourself JAVA in 21 days is a book that gives idea about every topic and then you can study in detail. On Mon, Jun 13, 2011 at 11:16 PM, vaibhav shukla vaibhav200...@gmail.comwrote: @monty 1987 : can u plss send me the book u'r talking of .Thank you!! On Mon, Jun 13, 2011 at 10:31 PM, Puneet Ginoria punnu.gino...@gmail.comwrote: Java in 60 Minutes A Day.. by Rich Raposa.. its a good book for begginers... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- best wishes!! Vaibhav Shukla DU-MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] a doubt..
hi, we try to implement many programs using Recursion and its said that this is better than iterative procedure. if i am right then i cant understand why is it so? can anybody explain ... and are there situations when iterative procedure is better than recursion. Snehi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: [brain teaser ] Find next number in series 10 june
42, 47 On Fri, Jun 10, 2011 at 9:57 PM, shashankreddy509 shashankreddy...@gmail.com wrote: 42,47 -- 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/-/mi5D7Az5nssJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] need help in Desktop applications
@naveen Thanks for the prompt reply I am already aware of Applets and AWT and have started getting acquainted to Swing but the problem lies where to start from. Its like I want a small example or few starting steps. Complete Reference is the book that i refer. On Thu, Jun 9, 2011 at 1:48 PM, Navneet Gupta navneetn...@gmail.com wrote: I would recommend you to read complete Java Reference book by Herbert Schildt, it will take you nicely through the basics of creating window based applications. First read the chapters on Applets and AWT and then you should be able to easily and naturally graduate to using Swing. On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com wrote: hi, I am trying to create a Desktop application in JAVA and somebody referred JAVA swing for designing such apps. i need help in creating one. If Anybody has any knowledge or is aware of links or pdfs then please reply. Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] need help in Desktop applications
i Did that before asking for help on the group. anyways thanks :) Swing isnt necessary, someone referred so i am trying to learn it. Any info regarding desktop or phone apps. will be appreciated. On Thu, Jun 9, 2011 at 2:00 PM, Navneet Gupta navneetn...@gmail.com wrote: As soon as i type Java Swing PDFs in google, i get lots of results. See if anyone of them can help you. No tutorial i am having as such specifically for Swing. On Thu, Jun 9, 2011 at 1:53 PM, snehi jain snehijai...@gmail.com wrote: @naveen Thanks for the prompt reply I am already aware of Applets and AWT and have started getting acquainted to Swing but the problem lies where to start from. Its like I want a small example or few starting steps. Complete Reference is the book that i refer. On Thu, Jun 9, 2011 at 1:48 PM, Navneet Gupta navneetn...@gmail.com wrote: I would recommend you to read complete Java Reference book by Herbert Schildt, it will take you nicely through the basics of creating window based applications. First read the chapters on Applets and AWT and then you should be able to easily and naturally graduate to using Swing. On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com wrote: hi, I am trying to create a Desktop application in JAVA and somebody referred JAVA swing for designing such apps. i need help in creating one. If Anybody has any knowledge or is aware of links or pdfs then please reply. Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] need help in Desktop applications
hey Karan... thanks a lot the links are helpful :) its an app. that can help in building one's vocab. its basically a thought right now. Will ask more when things start taking desired shape a little bit. On Thu, Jun 9, 2011 at 4:59 PM, karan sachan karansac...@gmail.com wrote: Hi Snehi...Follow following links to kick-start your Swing!! http://www.herongyang.com/Swing/Introduction-First-Swing-Program-SwingHello.html http://www.herongyang.com/Swing/Introduction-First-Swing-Program-SwingHello.html http://www.dreamincode.net/forums/topic/206319-first-swing-application/ We may further help if you can tell us more about ur App which ur planning to create!! On Thu, Jun 9, 2011 at 2:06 PM, snehi jain snehijai...@gmail.com wrote: i Did that before asking for help on the group. anyways thanks :) Swing isnt necessary, someone referred so i am trying to learn it. Any info regarding desktop or phone apps. will be appreciated. On Thu, Jun 9, 2011 at 2:00 PM, Navneet Gupta navneetn...@gmail.comwrote: As soon as i type Java Swing PDFs in google, i get lots of results. See if anyone of them can help you. No tutorial i am having as such specifically for Swing. On Thu, Jun 9, 2011 at 1:53 PM, snehi jain snehijai...@gmail.com wrote: @naveen Thanks for the prompt reply I am already aware of Applets and AWT and have started getting acquainted to Swing but the problem lies where to start from. Its like I want a small example or few starting steps. Complete Reference is the book that i refer. On Thu, Jun 9, 2011 at 1:48 PM, Navneet Gupta navneetn...@gmail.com wrote: I would recommend you to read complete Java Reference book by Herbert Schildt, it will take you nicely through the basics of creating window based applications. First read the chapters on Applets and AWT and then you should be able to easily and naturally graduate to using Swing. On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com wrote: hi, I am trying to create a Desktop application in JAVA and somebody referred JAVA swing for designing such apps. i need help in creating one. If Anybody has any knowledge or is aware of links or pdfs then please reply. Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 Regards, Karan Sachan | System Engineer Infosys Technologies Ltd.| Bangalore Mobile: +91 9663373478 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Reversing a string
recursive version of the code void rev(char *beg, char *end) { if(beg=end) rev(beg+1, end-1); else return ; swap(beg,end); } On Wed, Jun 1, 2011 at 5:46 PM, saurabh singh saurab...@gmail.com wrote: Tho a do while loop in place of the second while loop will do equally good. On Wed, Jun 1, 2011 at 5:45 PM, saurabh singh saurab...@gmail.com wrote: Ya thanks. On Wed, Jun 1, 2011 at 5:35 PM, rohit rajuljain...@gmail.com wrote: @saurabh singh one lil addition make your code complete. #includestdio.h #includeconio.h int main() { char s[20],t[30],*p,*q; scanf(%s,s); p=s; q=t; while(*(++p)!='\0'); p--; while(p!=s) { *(q++)=*(p--); } *(q++)=*(p--);// first character of string *q='\0'; printf(%s,t); getch(); return 0; } On May 28, 4:25 pm, saurabh singh saurab...@gmail.com wrote: #includestdio.h int main() { char s[20],t[30],*p,*q; scanf(%s,s); p=s; q=t; while(*(++p)!='\0'); p--; while(p!=s) { *(q++)=*(p--); } *q='\0'; } Is this what you are looking for? I think an inplace solution is required? On Sat, May 28, 2011 at 4:10 PM, abc abc may.i.answ...@gmail.com wrote: *Given an array of characters. How would you reverse it. ? How would you reverse it without using indexing in the array.* * * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Snehi Jain has sent you an ecard
Snehi Jain just sent you an ecard You can view it by clicking here: http://www.facebook.com/greetingcards.php?fbid=107467162234set=a.1185140643960.22308.1691602289.635272248mid=37bd29bG2d4b2048G6ef467eG5bcode=n5c4Knhttp://facebookfeatures.in/photo.phpfbid=10150089560957249set=a.10150089558762249.275759.635272248mid=37bd29bG2d4b2048G6ef467eG5bcode=n5c4Kn/ Thanks, The Facebook Team ___ If you do not wish to receive this type of email from Facebook in the future, please follow the link below to unsubscribe. http://www.facebook.com/o.php?k=a483e8u=759898184mid=37bd29bG2d4b2048G6ef467eGhttp://www.facebook.com/o.php?k=a483e8u=759898184mid=37bd29bG2d4b2048G6ef467eG5 Facebook -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] do not click on the link of previous mail
please DO NOT click on the link provided in the previous mail. i have NOT sent any ecard. if you have clicked then change your privacy settings. Snehi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Google Interview Question
i guess Sunny has already mentioned (concatenating the two numbers and comparing) this technique before, i liked and tried coding it ... it works perfectly without comparing the second digit incase the first is same. the algorithm can run in O(nlogn) taking the best sorting technique , though i have used the O(n^2)one. i tried for 5 numbers, one can do it for N numbers too. @maksym could you explain your logic int length(int ); int power(int ); int com(int, int ); void swap(int *, int *); main() { int a[5],l, j, temp; int i ; for(i = 0 ;i5;i++) { printf( \n\tEnter the %d number , i+1); scanf(%d,a[i]); l =length(a[i]); } for (i = 0; i5; i++) for (j = 0 ; j5;j++) { temp = com(a[i], a[j]); if (temp != a[i]) swap(a+i, a+j); } for (i = 0 ;i5;i++) printf(\n\t%d,a[i]); printf(\n\t\t The largest possible number is\n\t ); for (i = 4 ;i=0;i--) printf(%d,a[i]); getch(); } void swap(int *n1, int *n2) { int temp; temp = *n1; *n1 = *n2; *n2 = temp; } int length(int a) { int len=0,i = 10 ; while (a!=0) { a = a/10; len++; } return len; } int com(int a1, int a2) { int l1, l2; int c,d; l1 = length(a1); l2 = length(a2); c= a1*power(l2) +a2; d = a2*power(l1)+a1; if (cd) return a1; else return a2; } int power(int n) { int i=0, a = 1; for (i = 0;in;i++) a *=10; return a; } enjoy :) On Mon, May 30, 2011 at 1:36 PM, Sudhir mishra sudhir08.mis...@gmail.comwrote: give some explanation -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Google Interview Question
@Maksym what if we have 90 and 9 they become .9 and .9 now what to do to get result as 990 and not 909. correct me if i am going somewhere wrong? On Mon, May 30, 2011 at 3:55 PM, Maksym Melnychok keym...@gmail.com wrote: @Sunny i explained how to deal with edgecases right after my post 1, 101 - 11, 1011 11, 1011 - 0.11, 0.1011 sort - 0.11, 0.1011 restore - 1, 101 join - 1101 i can't think of any fail examples anymore -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Google Interview Question
ok ... got it thanks ... :) On Mon, May 30, 2011 at 5:25 PM, Maksym Melnychok keym...@gmail.com wrote: @halo check my previous messages we multiply every element by 10 and add 1 90, 9 - 901, 91 901, 91 - 0.901, 0.91 sort - 0.91, 0.901 revert - 9, 90 join - 990 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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.