[algogeeks] Re: Finding Blocks in a matrix
@anshu mishra: Hi, kindly clarify on this small doubt of mine. Your algo is while (!q.empty()) { x = q.top(); q.pop(); if(node notvisited already && adjacent to x && value = x) add to queue } For the graph, 1 1 2 1 3 1 2 3 4 first, queue = 1 (at 0,0) then you would add the 2 1s at (0,1) and (1,0) to the queue. So far, i can understand. now, if you start to pop elements, you ll see that there s no element with *equal value as 1* adjacent to the popped elements and the queue would be empty. . How does the algo proceed from here and keep track of count? . On May 30, 10:22 am, anshu mishra wrote: > @ross no, a particular element has to read only 5 times maximum. > > 1 reading (i,j) (if its flag is already false skip) > 2 read by top element > 3. read by bottom element > 4 read by left element > 5 read by right element > > coz atleast one of the this operation its flag will be unset(false), then we > have to just skip it. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: A Graph Problem
No, won't work. :( On Sun, May 29, 2011 at 11:39 PM, Aakash Johari wrote: > Can this solution work? > > Create adjacency matrix where adj[i][j] representing person i doesnt like >> person j. Now toggle the relations (means now the adj[i][j] will represent >> person i and person j can live with each other) and find the no. of >> connected components. No. of connected components will be the number of >> rooms required. >> > > > On Sun, May 29, 2011 at 11:29 PM, Aakash Johari wrote: > >> yes, sorry.. i misunderstood the problem. >> >> >> On Sun, May 29, 2011 at 11:24 PM, anshu mishra > > wrote: >> >>> biaprtie graph is special case when we can color the whole graph just by >>> two colors. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> -Aakash Johari >> (IIIT Allahabad) >> >> >> >> >> > > > -- > -Aakash Johari > (IIIT Allahabad) > > > > > -- -Aakash Johari (IIIT Allahabad) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: A Graph Problem
Can this solution work? Create adjacency matrix where adj[i][j] representing person i doesnt like > person j. Now toggle the relations (means now the adj[i][j] will represent > person i and person j can live with each other) and find the no. of > connected components. No. of connected components will be the number of > rooms required. > On Sun, May 29, 2011 at 11:29 PM, Aakash Johari wrote: > yes, sorry.. i misunderstood the problem. > > > On Sun, May 29, 2011 at 11:24 PM, anshu mishra > wrote: > >> biaprtie graph is special case when we can color the whole graph just by >> two colors. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > -Aakash Johari > (IIIT Allahabad) > > > > > -- -Aakash Johari (IIIT Allahabad) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: A Graph Problem
yes, sorry.. i misunderstood the problem. On Sun, May 29, 2011 at 11:24 PM, anshu mishra wrote: > biaprtie graph is special case when we can color the whole graph just by > two colors. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- -Aakash Johari (IIIT Allahabad) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: A Graph Problem
biaprtie graph is special case when we can color the whole graph just by two colors. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Finding Blocks in a matrix
@ross no, a particular element has to read only 5 times maximum. 1 reading (i,j) (if its flag is already false skip) 2 read by top element 3. read by bottom element 4 read by left element 5 read by right element coz atleast one of the this operation its flag will be unset(false), then we have to just skip it. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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
but ,when the arr is 78 3 to add 0 78 30 sort: 30 78 ans:378? 2011/5/27 Logic King > i agree with piyush...can't find the countercase...satisfied with the algo. > > > On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha wrote: > >> how about adding zeroes at the end of integers to make to equal to the >> integer with maximum number of digits and sort them... >> >> ex- >> 101 10 >> >> adding zeroes.. >> 101 100 >> >> sort 100 101 >> >> therefore make number as 10110 >> >> 100 1 >> >> adding zeroes >> 100 100 >> >> therefore number is 1100 >> >> I am not sure of the method.if there is any counter case please do >> suggest... >> >> On 5/27/11, wujin chen wrote: >> > @radha, i think your solution is wrong. >> > for this case: 101,10 >> > in your solution , the ans is 10101,but the max ans is 10110. >> > >> > 2011/5/27 radha krishnan >> > >> >> 10100 is max ans >> >> okay >> >> convert the numbers to strings and sort based on the first character >> >> !!! >> >> if equal do that recursively and then if length is less give that >> >> preference !! >> >> i think this solution .. >> >> may be this is wrong !! >> >> >> >> On Fri, May 27, 2011 at 7:07 PM, wujin chen > >wrote: >> >> >> >>> @Piyush, how to deal with this case :100 , 10 >> >>> >> >>> >> >>> 2011/5/27 Piyush Sinha >> >>> >> we can work out if we sort according to the leftmost integer >> >> On 5/27/11, adityasir...@gmail.com wrote: >> > are you kidding me. Just simple sort wont work. >> > >> > On Fri, May 27, 2011 at 9:31 AM, radha krishnan < >> > radhakrishnance...@gmail.com> wrote: >> > >> >> sort :) >> >> >> >> >> >> On Fri, May 27, 2011 at 6:57 PM, ross >> wrote: >> >> >> >>> Hi all, >> >>> >> >>> Given an array of elements find the largest possible number that >> can >> >>> be formed by using the elements of the array. >> >>> >> >>> eg: 10 9 >> >>> ans: 910 >> >>> >> >>> 2 3 5 78 >> >>> >> >>> ans: 78532 >> >>> >> >>> 100 9 >> >>> >> >>> ans: 9100 >> >>> >> >>> -- >> >>> You received this message because you are subscribed to the >> Google >> Groups >> >>> "Algorithm Geeks" group. >> >>> To post to this group, send email to algogeeks@googlegroups.com. >> >>> To unsubscribe from 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. >> > >> > >> >> >> -- >> *Piyush Sinha* >> *IIIT, Allahabad* >> *+91-8792136657* >> *+91-7483122727* >> *https://www.facebook.com/profile.php?id=10655377926 * >> >> -- >> You received this message because you are subscribed to the Google >> Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from 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 >>
Re: [algogeeks] Re: Finding Blocks in a matrix
@ross : * if their flag is true and their value is equal to x* On Sun, May 29, 2011 at 11:07 PM, ross wrote: > @Anshu > If you do > " add top bottom, left right element to the popped element in qeuue " > should you need to do it for each element in the matrix. > So, will that not be O(n3)?? > > Clarify if i am wrong. > > On May 30, 9:52 am, Aakash Johari wrote: > > At the each level, traversed by BFS, you will have to check whether the > > vertex in this level has the element same as it found in the previous > level. > > If it is different, then count it. > > > > On Sun, May 29, 2011 at 10:43 PM, anshu mishra < > anshumishra6...@gmail.com>wrote: > > > > > > > > > > > > > > > > > > > > > @piyush > > > > > void bfs(int mat[][n], bool flag[][n], int i, int j) > > > { > > > queue.push(mat[i][j]); > > > while (!q.empty()) > > > { > > > x = q.top(); > > > q.pop(); > > > add top bottom, left right element in qeuue if their flag is true and > their > > > value is equal to x and mark their flag false; > > > } > > > } > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Algorithm Geeks" group. > > > To post to this group, send email to algogeeks@googlegroups.com. > > > To unsubscribe from this group, send email to > > > algogeeks+unsubscr...@googlegroups.com. > > > For more options, visit this group at > > >http://groups.google.com/group/algogeeks?hl=en. > > > > -- > > -Aakash Johari > > (IIIT 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. > > -- -Aakash Johari (IIIT 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.
[algogeeks] Re: Finding Blocks in a matrix
@Anshu If you do " add top bottom, left right element to the popped element in qeuue " should you need to do it for each element in the matrix. So, will that not be O(n3)?? Clarify if i am wrong. On May 30, 9:52 am, Aakash Johari wrote: > At the each level, traversed by BFS, you will have to check whether the > vertex in this level has the element same as it found in the previous level. > If it is different, then count it. > > On Sun, May 29, 2011 at 10:43 PM, anshu mishra > wrote: > > > > > > > > > > > @piyush > > > void bfs(int mat[][n], bool flag[][n], int i, int j) > > { > > queue.push(mat[i][j]); > > while (!q.empty()) > > { > > x = q.top(); > > q.pop(); > > add top bottom, left right element in qeuue if their flag is true and their > > value is equal to x and mark their flag false; > > } > > } > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > -- > -Aakash Johari > (IIIT Allahabad) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Finding Blocks in a matrix
@anshuman sir: yes, I know you have completed the solution. I have just added :) On Sun, May 29, 2011 at 11:02 PM, anshu mishra wrote: > @ akash > > solution is complete. :P > first try to understand 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. > -- -Aakash Johari (IIIT Allahabad) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: A Graph Problem
Bipartite Graph.. On Sun, May 29, 2011 at 9:42 PM, ross wrote: > @anshu mishra: > Yeah. Thanks! :) > > On May 30, 8:26 am, anshu mishra wrote: > > it is exactly a graph coloring problem. so it has no polynomial order > > 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. > > -- -Aakash Johari (IIIT Allahabad) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Finding Blocks in a matrix
@ akash solution is complete. :P first try to understand 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.
Re: [algogeeks] Re: Finding Blocks in a matrix
At the each level, traversed by BFS, you will have to check whether the vertex in this level has the element same as it found in the previous level. If it is different, then count it. On Sun, May 29, 2011 at 10:43 PM, anshu mishra wrote: > @piyush > > void bfs(int mat[][n], bool flag[][n], int i, int j) > { > queue.push(mat[i][j]); > while (!q.empty()) > { > x = q.top(); > q.pop(); > add top bottom, left right element in qeuue if their flag is true and their > value is equal to x and mark their flag false; > } > } > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- -Aakash Johari (IIIT Allahabad) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C Output
Thank u guys :) :) On Mon, May 30, 2011 at 10:40 AM, arjoo kumar <2009ar...@gmail.com> wrote: > when u store 0.08 on the float variable a then it does not store exactly > 0.08 on 'a' > actually it store 0.7999 > that's why after comparition it make less quantity with 0.08 > i.e 'if ' condition is true and print it HELLO > > On Sun, May 29, 2011 at 9:21 AM, Ankit Agarwal wrote: > >> #include >> >> int main(void) >> { >> float a=0.08; >> if(a<0.08) >> printf("Hello\n"); >> else >> printf("Hii\n"); >> return 0; >> } >> >> The o/p is: *Hello * why >> >> -- >> Ankit Agarwal >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from 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. > -- Ankit Agarwal -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Finding Blocks in a matrix
@piyush void bfs(int mat[][n], bool flag[][n], int i, int j) { queue.push(mat[i][j]); while (!q.empty()) { x = q.top(); q.pop(); add top bottom, left right element in qeuue if their flag is true and their value is equal to x and mark their flag false; } } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] snake and ladder
Made snake and ladder in c using graphics some time ago. Maybe it could help http://algoritmus.in/blog/2011/03/snakes-and-ladder-in-cgraphics/ On Sat, May 28, 2011 at 2:58 PM, utkarsh srivastav wrote: > sorry snake and ladder > > > On Sat, May 28, 2011 at 2:27 AM, Dilogical King wrote: > >> what are the apllication of anake and ladder algo in 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. > -- Regards Kunal Yadav (http://algoritmus.in/) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Finding Blocks in a matrix
@anshu, i got you. my bad!! On Mon, May 30, 2011 at 10:49 AM, anshu mishra wrote: > @vishal ur sol wil give wrong answer for this > 1 1 2 > 1 3 1 > 2 3 4 > answer should be 6 but ur sol wil give 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. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Finding Blocks in a matrix
@anshucan u plz elaborate ur solution for a particular case?? On Mon, May 30, 2011 at 10:49 AM, anshu mishra wrote: > @vishal ur sol wil give wrong answer for this > 1 1 2 > 1 3 1 > 2 3 4 > answer should be 6 but ur sol wil give 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. > -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Finding Blocks in a matrix
@vishal ur sol wil give wrong answer for this 1 1 2 1 3 1 2 3 4 answer should be 6 but ur sol wil give 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.
Re: [algogeeks] Re: Finding Blocks in a matrix
it is a simple graph problem. travese the whole matrix using BFS. it will be O(n^2). for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (flag[i][[j]) { bfs(mat, flag, i, j); count++; } } } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Finding Blocks in a matrix
@ross... I have adoubt regarding this question... what should be output if the matrix is like this.. 1 1 2 1 3 1 2 3 4 U reply I will tell you then what doubt I have. On Mon, May 30, 2011 at 10:36 AM, Vishal Thanki wrote: > Okay, i thought it this way: iterate through the whole matrix, and > take the value as a "key" to a hash table. and the value > corresponding to the key would be the "count". increment the count > everytime you encounter the same key. it is very easy to implement > this in python (using dictionary) but i am not sure what will be the > most efficient data structure to implement this in c/c++. > > Vishal > > On Mon, May 30, 2011 at 10:31 AM, ross wrote: > > @vishal > > Hi, > > I do not get you. > > Can you please elaborate a little more how you ll use hash? > > > > On May 30, 8:50 am, Vishal Thanki wrote: > >> what about using a hash function? > >> > >> > >> > >> > >> > >> > >> > >> On Mon, May 30, 2011 at 10:18 AM, ross wrote: > >> > Given a matrix, you need to find the number of blocks in it. > >> > A block has the same numbers. > >> > EG: > >> > 1 1 3 > >> > 1 2 3 > >> > 2 2 4 > >> > has 4 blocks namely, > >> > 1 1 > >> > 1 > >> > 2 > >> > 2 2 > >> > >> > 3 > >> > 3 > >> > >> > 4 > >> > >> > 1 2 3 > >> > 4 5 6 > >> > 7 8 9 > >> > has 9 blocks > >> > >> > 1 1 1 > >> > 1 1 3 > >> > 4 4 5 > >> > has 4 blocks, > >> > 1 1 1 > >> > 1 1 > >> > >> > 3 > >> > >> > 5 > >> > >> > 4 4 > >> > >> > I used an algorithm as follows, > >> > for each element[i,j] in the matrix, > >> > enqueue adjacent indices into a queue if they contain the same > >> > element. > >> > else > >> > incremt blockcount; > >> > >> > return blockcount; > >> > >> > But, this complexity is O(n^3) any better solution exists? > >> > >> > -- > >> > You received this message because you are subscribed to the Google > Groups "Algorithm Geeks" group. > >> > To post to this group, send email to algogeeks@googlegroups.com. > >> > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > >> > For more options, visit this group athttp:// > 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. > > -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * @ross -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] C Output
when u store 0.08 on the float variable a then it does not store exactly 0.08 on 'a' actually it store 0.7999 that's why after comparition it make less quantity with 0.08 i.e 'if ' condition is true and print it HELLO On Sun, May 29, 2011 at 9:21 AM, Ankit Agarwal wrote: > #include > > int main(void) > { > float a=0.08; > if(a<0.08) > printf("Hello\n"); > else > printf("Hii\n"); > return 0; > } > > The o/p is: *Hello * why > > -- > Ankit Agarwal > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from 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: Finding Blocks in a matrix
Okay, i thought it this way: iterate through the whole matrix, and take the value as a "key" to a hash table. and the value corresponding to the key would be the "count". increment the count everytime you encounter the same key. it is very easy to implement this in python (using dictionary) but i am not sure what will be the most efficient data structure to implement this in c/c++. Vishal On Mon, May 30, 2011 at 10:31 AM, ross wrote: > @vishal > Hi, > I do not get you. > Can you please elaborate a little more how you ll use hash? > > On May 30, 8:50 am, Vishal Thanki wrote: >> what about using a hash function? >> >> >> >> >> >> >> >> On Mon, May 30, 2011 at 10:18 AM, ross wrote: >> > Given a matrix, you need to find the number of blocks in it. >> > A block has the same numbers. >> > EG: >> > 1 1 3 >> > 1 2 3 >> > 2 2 4 >> > has 4 blocks namely, >> > 1 1 >> > 1 >> > 2 >> > 2 2 >> >> > 3 >> > 3 >> >> > 4 >> >> > 1 2 3 >> > 4 5 6 >> > 7 8 9 >> > has 9 blocks >> >> > 1 1 1 >> > 1 1 3 >> > 4 4 5 >> > has 4 blocks, >> > 1 1 1 >> > 1 1 >> >> > 3 >> >> > 5 >> >> > 4 4 >> >> > I used an algorithm as follows, >> > for each element[i,j] in the matrix, >> > enqueue adjacent indices into a queue if they contain the same >> > element. >> > else >> > incremt blockcount; >> >> > return blockcount; >> >> > But, this complexity is O(n^3) any better solution exists? >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "Algorithm Geeks" group. >> > To post to this group, send email to algogeeks@googlegroups.com. >> > To unsubscribe from this group, send email to >> > algogeeks+unsubscr...@googlegroups.com. >> > For more options, visit this group >> > athttp://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] Re: Finding Blocks in a matrix
@vishal Hi, I do not get you. Can you please elaborate a little more how you ll use hash? On May 30, 8:50 am, Vishal Thanki wrote: > what about using a hash function? > > > > > > > > On Mon, May 30, 2011 at 10:18 AM, ross wrote: > > Given a matrix, you need to find the number of blocks in it. > > A block has the same numbers. > > EG: > > 1 1 3 > > 1 2 3 > > 2 2 4 > > has 4 blocks namely, > > 1 1 > > 1 > > 2 > > 2 2 > > > 3 > > 3 > > > 4 > > > 1 2 3 > > 4 5 6 > > 7 8 9 > > has 9 blocks > > > 1 1 1 > > 1 1 3 > > 4 4 5 > > has 4 blocks, > > 1 1 1 > > 1 1 > > > 3 > > > 5 > > > 4 4 > > > I used an algorithm as follows, > > for each element[i,j] in the matrix, > > enqueue adjacent indices into a queue if they contain the same > > element. > > else > > incremt blockcount; > > > return blockcount; > > > But, this complexity is O(n^3) any better solution exists? > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://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: posix threads
PS dont forget to bind ith thread with ith processor -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: posix threads
write these three lines in ur function, it will bind that particular thread to (id)th processor wher void func(int id) { unsigned long mask; mask = 1
Re: [algogeeks] Finding Blocks in a matrix
what about using a hash function? On Mon, May 30, 2011 at 10:18 AM, ross wrote: > Given a matrix, you need to find the number of blocks in it. > A block has the same numbers. > EG: > 1 1 3 > 1 2 3 > 2 2 4 > has 4 blocks namely, > 1 1 > 1 > 2 > 2 2 > > 3 > 3 > > 4 > > 1 2 3 > 4 5 6 > 7 8 9 > has 9 blocks > > > > 1 1 1 > 1 1 3 > 4 4 5 > has 4 blocks, > 1 1 1 > 1 1 > > 3 > > 5 > > 4 4 > > I used an algorithm as follows, > for each element[i,j] in the matrix, > enqueue adjacent indices into a queue if they contain the same > element. > else > incremt blockcount; > > return blockcount; > > But, this complexity is O(n^3) any better solution exists? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from 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] Finding Blocks in a matrix
Given a matrix, you need to find the number of blocks in it. A block has the same numbers. EG: 1 1 3 1 2 3 2 2 4 has 4 blocks namely, 1 1 1 2 2 2 3 3 4 1 2 3 4 5 6 7 8 9 has 9 blocks 1 1 1 1 1 3 4 4 5 has 4 blocks, 1 1 1 1 1 3 5 4 4 I used an algorithm as follows, for each element[i,j] in the matrix, enqueue adjacent indices into a queue if they contain the same element. else incremt blockcount; return blockcount; But, this complexity is O(n^3) any better solution exists? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: A Graph Problem
@anshu mishra: Yeah. Thanks! :) On May 30, 8:26 am, anshu mishra wrote: > it is exactly a graph coloring problem. so it has no polynomial order > 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.
Re: [algogeeks] C Output
you may want to check how the floats and doubles are stored into memory using ieee notation. i tried to print 0.08 and 0.08f in hex format and got the following result. vishal@ubuntu:~/progs/c\ 10:03:56 AM >$ cat fl.c #include int main() { float f=0.08; if (f < 0.08f) printf("hi\n"); else printf("hello\n"); printf ("%x %x\n",0.08, 0.08f); return 0; } vishal@ubuntu:~/progs/c\ 10:04:06 AM >$ gcc fl.c fl.c: In function ‘main’: fl.c:10: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘double’ fl.c:10: warning: format ‘%x’ expects type ‘unsigned int’, but argument 3 has type ‘double’ vishal@ubuntu:~/progs/c\ 10:04:11 AM >$ ./a.out hello 47ae147b 3fb47ae1 vishal@ubuntu:~/progs/c\ 10:04:14 AM >$ ps: please ignore the warning in the code. On Sun, May 29, 2011 at 10:23 PM, sravanreddy001 wrote: > and, I read it long time back that.. the value of 0.8 alone will be stored > as 0.7995 (not sure on the number of 9's but.. the last digit in the > precision will be a 5) > that could be a reason. > may be what "vishal" said 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.
Re: [algogeeks] A Graph Problem
it is exactly a graph coloring problem. so it has no polynomial order 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.
Re: [algogeeks] Re: Google Interview Question
@sravanreddy001 i don't find any cases for which my algo fails and its O(nlgn) i may be missing something can you tell any case where it fails On Sun, May 29, 2011 at 10:15 PM, sravanreddy001 wrote: > @vishal,Sanjeev.. > for the inputs 18,187.. apply ur method.. > 18 -- 188 > 187-- 187 > > 18187 -> ur method > > 18718 -> actual > > @Sunny... > i agree that your algorithm takes the *O(N logN)* time.. but again.. > the problem is it* doesn't get* the exact solution. > > Do we really have a polynomial solution for this one? > I think this falls under the NP category. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C Output
and, I read it long time back that.. the value of 0.8 alone will be stored as 0.7995 (not sure on the number of 9's but.. the last digit in the precision will be a 5) that could be a reason. may be what "vishal" said 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.
Re: [algogeeks] Re: Google Interview Question
@vishal,Sanjeev.. for the inputs 18,187.. apply ur method.. 18 -- 188 187-- 187 18187 -> ur method 18718 -> actual @Sunny... i agree that your algorithm takes the *O(N logN)* time.. but again.. the problem is it* doesn't get* the exact solution. Do we really have a polynomial solution for this one? I think this falls under the NP category. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] C Output
"a < 0.08f" will make it compare to float. by default 0.08 is considered as double. On Sun, May 29, 2011 at 9:51 PM, Ankit Agarwal wrote: > #include > > int main(void) > { > float a=0.08; > if(a<0.08) > printf("Hello\n"); > else > printf("Hii\n"); > return 0; > } > > The o/p is: Hello why > > -- > Ankit Agarwal > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from 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] C Output
#include int main(void) { float a=0.08; if(a<0.08) printf("Hello\n"); else printf("Hii\n"); return 0; } The o/p is: *Hello * why -- Ankit Agarwal -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 Graph Problem
There are n persons. You are provided with a list of ppl which each person does not like. Determine the minm no. of houses required such that, in no house 2 people should dislike each other. Is there a polynomial time solution exist for this? Or is this not solvable at all? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: spoj--two squares problem
use long long int instead of int for X and all except t.and type cast the sqrt returned value to integer..like int(sqrt(X)) On Sun, May 29, 2011 at 1:55 PM, Vishal Jain wrote: > Hi Saurabh, > > Can you try it for 10? Could not really understand, what are you gonna > communicate? > > 10 = 2*5 (2^2 + 1^2 )*(1*2 + 1^2)... If with this logic you are saying 10 > is prime then all numbers divisible by 5 should be prime. > > Could you elaborate your answer more? > > Thanks & Regards > Vishal Jain > MNo: +91-9540611889 > Tweet @jainvis > Blog @ jainvish.blogspot.com > Success taste better when target achieved is bigger. > > P *We have a responsibility to the environment.* > > *Before printing this e-mail or any other document, let's ask ourselves > whether we need a hard copy.* > > > > > On Sun, May 29, 2011 at 6:46 AM, saurabh singh wrote: > >> In fact we can...though not directly..SInce every number can be broken >> down as facotrs of primeUse that property >> >> >> On Sun, May 29, 2011 at 1:12 AM, Tushar Bindal wrote: >> >>> that theorem is for odd primes >>> 9 is not an odd prime >>> so we can;t apply this theorem >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from 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.
[algogeeks] Re: Sudoku verification problem
oh yeah... now it works. thanx a lot! On May 29, 5:20 pm, Vishal Thanki wrote: > sorry, i made a mistake in explaining. when you are solving the gird, > you will have the matrix[][] array partially filled. the bitmap used > for solving the grid is different than the one being used for > verifying. in case of verifying, you will have a completely blank > bitmap, with not bits set. you will iterate through the matrix array > and set the bits in bitmap accordingly. so the if condition will > evaluate to true for all the conditions till you have the correct > values for cells in grid. as soon as you get a duplicate value for a > cell, the condition will become false. i hope that is clear. > > hope that helps. > > PS: just ignore the fill_bitmap() routine, it is only used at the > starting of solving the grid, and not for verifying. if you observe > the verify() routine, the bitmap[] array is a local array and > initialized to 0 before use. > > > > > > > > On Sun, May 29, 2011 at 5:40 PM, Dumanshu wrote: > > no... what i mean to say is you have filled the bitmap in the process > > of solving the grid. The way you are filling the bitmap is -> you are > > taking values from the matrix and placing them in the bitmaps using bi > > bj bk. > > > now in the verification you are checking the same matrix value against > > the same bitmap field. it will "always" evaluate out to be false for > > your if. > > your if statement is checking whether the matrix value and the bitmap > > value is same or not. you have used the matrix value to fill the > > bitmap so obviously they will be same. > > > see in fill bitmap funciton u did for some i,j -> > > > bmp[bi] |= 1 << matrix[i][j]; > > bmp[bj] |= 1 << matrix[i][j]; > > bmp[bk] |= 1 << matrix[i][j]; > > that is for some particular i,j say 5,4 > > u took value matrix[5][4] =8 and set the bit in bitmap after > > calculating bi,bj,bk - these values are bi ==5, bj== 13 and bk == 10 > > so now in bmp[5], bmp[10] and bmp[13] u have set the 8th bit. > > > now in verify function > > > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && > > (((bitmap[bj] >> matrix[i][j]) > > & 0x1) == 0x0) && > > (((bitmap[bk] >> matrix[i][j]) > > & 0x1) == 0x0)) { > > bitmap[bi] |= 1 << matrix[i][j]; > > bitmap[bj] |= 1 << matrix[i][j]; > > bitmap[bk] |= 1 << matrix[i][j]; > > > here during the loop when i==5 and j==4, the if condition will always > > evaluate to false. > > > same thing will happen for every value in the matrix because the > > corresponding bit has been set earlier. > > > so how is ur verification function working??? > > > On May 29, 3:35 pm, Vishal Thanki wrote: > >> yes, you are right. bitmap will be filled in the process of solving > >> the grid. in verify routine, if the expression evaluates to false, it > >> mean an element is encountered which is already present in row, col > >> and 3x3 cube. this way you an tell that the solution is wrong. > > >> hope that helps. > > >> On Sun, May 29, 2011 at 2:01 PM, Dumanshu wrote: > >> > here in this part > >> > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && > >> > (((bitmap[bj] >> matrix[i][j]) & 0x1) == 0x0) && > >> > (((bitmap[bk] >> matrix[i][j]) > >> > & 0x1) == 0x0)) { > >> > bitmap[bi] |= 1 << matrix[i][j]; > >> > bitmap[bj] |= 1 << matrix[i][j]; > >> > bitmap[bk] |= 1 << matrix[i][j]; > > >> > I think you are checking the same values which u have already set in > >> > the bitmap using the fill_bitmap function. like suppose the 1st cell > >> > of the matrix has value 5. then using fill bitmap u have the set > >> > corresponding 5th bit in all 3 places(row col 3by3 cell) using bi bj > >> > and bk. > >> > now in the verify function u checking the same bit against that matrix > >> > value which u have already set. so everytime ur if statement will > >> > evaluate to false. > > >> > I may be wrong... plz help. > > >> > On May 28, 9:15 pm, Vishal Thanki wrote: > >> >> here is the code.. > > >> >> #define bi (i) > >> >> #define bj (GRID_SIZE+j) > >> >> #define bk (int)((GRID_SIZE*2)+(glb_sqrt*(i/glb_sqrt)+(j/glb_sqrt))) > > >> >> /*glb_sqrt should be the square root of grid_size (i.e. 3 if its a 9x9 > >> >> sudoku). */ > > >> >> /* #define bk (int)((GRID_SIZE*2)+(5*(i/5)+(j/5))) */ > > >> >> /* > >> >> * This function will verify solved grid. It will start with each > >> >> element > >> >> * in grid and update the bitmap step by step. As soon as it encounters > >> >> an > >> >> * element which is already present in bitmap, it will return error. > >> >> * > >> >> */ > > >> >> int verify() > >> >> { > >> >> int i, j, k; > >> >>
[algogeeks] Re: Google Interview Question
for eg 10, 9 most signifacnt digit of 10 is 1 and 9 is 9 so after sorting based on most significant digit is 10,9 output 910 2nd ex 2,3,5,78 most significant digit is 2,3,5,7 so out put is 78532 On May 29, 12:59 am, Vishal Jain wrote: > Can this work... > > Lets say I have following numbers > 8 9 7 4 2 121 23 21 24 27 35 79 2334 6785 > > Now repeat the last number to make all the number of equal length... > 1211 2333 2111 2444 2777 3555 7999 2334 6785 > > Sort the following numbers in descending order. > 7999 6785 ... > > Now merge the numbers based on their actual value. > 987976785.. > > I have not testing this entirely, but after seeing solution(Multiplying by > 10) at top, I though this might work better. > > Thanks & Regards > Vishal Jain > MNo: +91-9540611889 > Tweet @jainvis > Blog @ jainvish.blogspot.com > Success taste better when target achieved is bigger. > > P *We have a responsibility to the environment.* > > *Before printing this e-mail or any other document, let's ask > ourselves whether we need a hard copy.* > > > > > > > > On Sun, May 29, 2011 at 12:58 PM, Ashish Goel wrote: > > Radix/bucket sort.. > > > won't that help? > > > Best Regards > > Ashish Goel > > "Think positive and find fuel in failure" > > +919985813081 > > +919966006652 > > > On Fri, May 27, 2011 at 7:15 PM, wrote: > > >> how about this case: > > >> 9, 100 -> 9100 > >> 100 9 > >> 9100 > > >> 2, 3, 9, 78 --> > >> 78 9 3 2 > >> 9 78 3 2 > > >> I guess solution should be:- > >> sort the array of numbers in an ascending order and then check for the > >> first element in the array, if there is any other element greater than it, > >> shift all the elements one right and place that element in the left most > >> space. > > >> On Fri, May 27, 2011 at 9:37 AM, wujin chen wrote: > > >>> @Piyush, how to deal with this case :100 , 10 > > >>> 2011/5/27 Piyush Sinha > > we can work out if we sort according to the leftmost integer > > On 5/27/11, adityasir...@gmail.com wrote: > > are you kidding me. Just simple sort wont work. > > > On Fri, May 27, 2011 at 9:31 AM, radha krishnan < > > radhakrishnance...@gmail.com> wrote: > > >> sort :) > > >> On Fri, May 27, 2011 at 6:57 PM, ross > wrote: > > >>> Hi all, > > >>> Given an array of elements find the largest possible number that can > >>> be formed by using the elements of the array. > > >>> eg: 10 9 > >>> ans: 910 > > >>> 2 3 5 78 > > >>> ans: 78532 > > >>> 100 9 > > >>> ans: 9100 > > >>> -- > >>> You received this message because you are subscribed to the Google > Groups > >>> "Algorithm Geeks" group. > >>> To post to this group, send email to algogeeks@googlegroups.com. > >>> To unsubscribe from 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. > > -- > *Piyush Sinha* > *IIIT, Allahabad* > *+91-8792136657* > *+91-7483122727* > *https://www.facebook.com/profile.php?id=10655377926* > > -- > You received this message because you are subscribed to the Google > Groups "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from 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 ema
Re: [algogeeks] Re: Sudoku verification problem
what i understood from your problem is, when the configuration is given by user, it can be directly stored into matrix[][] array. that will solve your problem in o(n^2), where n=9. On Sun, May 29, 2011 at 5:50 PM, Dumanshu wrote: > I think ur verification function is correct but it works only if user > is entering the values one by one. as soon as he enters a duplicate > value it will show a error. It will work for the case of ur solver as > ur code itself is generating the values. > But here in this verification problem u r given a configuration from a > user. i.e. all values at once not one by one. > > So one thing that can be done is use ur fillbitmap function and then > check if any of the 9 Least significant bits of the 27 values in ur > bmp array is not set. If thats the case then sukoku isn't correct. > but then this code would take O(n^2) = (3*n*n) time here n is 9. > > On May 29, 5:10 pm, Dumanshu wrote: >> no... what i mean to say is you have filled the bitmap in the process >> of solving the grid. The way you are filling the bitmap is -> you are >> taking values from the matrix and placing them in the bitmaps using bi >> bj bk. >> >> now in the verification you are checking the same matrix value against >> the same bitmap field. it will "always" evaluate out to be false for >> your if. >> your if statement is checking whether the matrix value and the bitmap >> value is same or not. you have used the matrix value to fill the >> bitmap so obviously they will be same. >> >> see in fill bitmap funciton u did for some i,j -> >> >> bmp[bi] |= 1 << matrix[i][j]; >> bmp[bj] |= 1 << matrix[i][j]; >> bmp[bk] |= 1 << matrix[i][j]; >> that is for some particular i,j say 5,4 >> u took value matrix[5][4] =8 and set the bit in bitmap after >> calculating bi,bj,bk - these values are bi ==5, bj== 13 and bk == 10 >> so now in bmp[5], bmp[10] and bmp[13] u have set the 8th bit. >> >> now in verify function >> >> if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && >> (((bitmap[bj] >> matrix[i][j]) >> & 0x1) == 0x0) && >> (((bitmap[bk] >> matrix[i][j]) >> & 0x1) == 0x0)) { >> bitmap[bi] |= 1 << matrix[i][j]; >> bitmap[bj] |= 1 << matrix[i][j]; >> bitmap[bk] |= 1 << matrix[i][j]; >> >> here during the loop when i==5 and j==4, the if condition will always >> evaluate to false. >> >> same thing will happen for every value in the matrix because the >> corresponding bit has been set earlier. >> >> so how is ur verification function working??? >> >> On May 29, 3:35 pm, Vishal Thanki wrote: >> >> >> >> >> >> >> >> > yes, you are right. bitmap will be filled in the process of solving >> > the grid. in verify routine, if the expression evaluates to false, it >> > mean an element is encountered which is already present in row, col >> > and 3x3 cube. this way you an tell that the solution is wrong. >> >> > hope that helps. >> >> > On Sun, May 29, 2011 at 2:01 PM, Dumanshu wrote: >> > > here in this part >> > > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && >> > > (((bitmap[bj] >> matrix[i][j]) & 0x1) == 0x0) && >> > > (((bitmap[bk] >> matrix[i][j]) >> > > & 0x1) == 0x0)) { >> > > bitmap[bi] |= 1 << matrix[i][j]; >> > > bitmap[bj] |= 1 << matrix[i][j]; >> > > bitmap[bk] |= 1 << matrix[i][j]; >> >> > > I think you are checking the same values which u have already set in >> > > the bitmap using the fill_bitmap function. like suppose the 1st cell >> > > of the matrix has value 5. then using fill bitmap u have the set >> > > corresponding 5th bit in all 3 places(row col 3by3 cell) using bi bj >> > > and bk. >> > > now in the verify function u checking the same bit against that matrix >> > > value which u have already set. so everytime ur if statement will >> > > evaluate to false. >> >> > > I may be wrong... plz help. >> >> > > On May 28, 9:15 pm, Vishal Thanki wrote: >> > >> here is the code.. >> >> > >> #define bi (i) >> > >> #define bj (GRID_SIZE+j) >> > >> #define bk (int)((GRID_SIZE*2)+(glb_sqrt*(i/glb_sqrt)+(j/glb_sqrt))) >> >> > >> /*glb_sqrt should be the square root of grid_size (i.e. 3 if its a 9x9 >> > >> sudoku). */ >> >> > >> /* #define bk (int)((GRID_SIZE*2)+(5*(i/5)+(j/5))) */ >> >> > >> /* >> > >> * This function will verify solved grid. It will start with each >> > >> element >> > >> * in grid and update the bitmap step by step. As soon as it encounters >> > >> an >> > >> * element which is already present in bitmap, it will return error. >> > >> * >> > >> */ >> >> > >> int verify() >> > >> { >> > >> int i, j, k; >> > >> int bitmap[GRID_SIZE*3] = {0}; >> > >> int bmp_idx; >> > >>
Re: [algogeeks] Re: Sudoku verification problem
sorry, i made a mistake in explaining. when you are solving the gird, you will have the matrix[][] array partially filled. the bitmap used for solving the grid is different than the one being used for verifying. in case of verifying, you will have a completely blank bitmap, with not bits set. you will iterate through the matrix array and set the bits in bitmap accordingly. so the if condition will evaluate to true for all the conditions till you have the correct values for cells in grid. as soon as you get a duplicate value for a cell, the condition will become false. i hope that is clear. hope that helps. PS: just ignore the fill_bitmap() routine, it is only used at the starting of solving the grid, and not for verifying. if you observe the verify() routine, the bitmap[] array is a local array and initialized to 0 before use. On Sun, May 29, 2011 at 5:40 PM, Dumanshu wrote: > no... what i mean to say is you have filled the bitmap in the process > of solving the grid. The way you are filling the bitmap is -> you are > taking values from the matrix and placing them in the bitmaps using bi > bj bk. > > now in the verification you are checking the same matrix value against > the same bitmap field. it will "always" evaluate out to be false for > your if. > your if statement is checking whether the matrix value and the bitmap > value is same or not. you have used the matrix value to fill the > bitmap so obviously they will be same. > > see in fill bitmap funciton u did for some i,j -> > > bmp[bi] |= 1 << matrix[i][j]; > bmp[bj] |= 1 << matrix[i][j]; > bmp[bk] |= 1 << matrix[i][j]; > that is for some particular i,j say 5,4 > u took value matrix[5][4] =8 and set the bit in bitmap after > calculating bi,bj,bk - these values are bi ==5, bj== 13 and bk == 10 > so now in bmp[5], bmp[10] and bmp[13] u have set the 8th bit. > > now in verify function > > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && > (((bitmap[bj] >> matrix[i][j]) > & 0x1) == 0x0) && > (((bitmap[bk] >> matrix[i][j]) > & 0x1) == 0x0)) { > bitmap[bi] |= 1 << matrix[i][j]; > bitmap[bj] |= 1 << matrix[i][j]; > bitmap[bk] |= 1 << matrix[i][j]; > > here during the loop when i==5 and j==4, the if condition will always > evaluate to false. > > same thing will happen for every value in the matrix because the > corresponding bit has been set earlier. > > so how is ur verification function working??? > > > > On May 29, 3:35 pm, Vishal Thanki wrote: >> yes, you are right. bitmap will be filled in the process of solving >> the grid. in verify routine, if the expression evaluates to false, it >> mean an element is encountered which is already present in row, col >> and 3x3 cube. this way you an tell that the solution is wrong. >> >> hope that helps. >> >> >> >> >> >> >> >> On Sun, May 29, 2011 at 2:01 PM, Dumanshu wrote: >> > here in this part >> > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && >> > (((bitmap[bj] >> matrix[i][j]) & 0x1) == 0x0) && >> > (((bitmap[bk] >> matrix[i][j]) >> > & 0x1) == 0x0)) { >> > bitmap[bi] |= 1 << matrix[i][j]; >> > bitmap[bj] |= 1 << matrix[i][j]; >> > bitmap[bk] |= 1 << matrix[i][j]; >> >> > I think you are checking the same values which u have already set in >> > the bitmap using the fill_bitmap function. like suppose the 1st cell >> > of the matrix has value 5. then using fill bitmap u have the set >> > corresponding 5th bit in all 3 places(row col 3by3 cell) using bi bj >> > and bk. >> > now in the verify function u checking the same bit against that matrix >> > value which u have already set. so everytime ur if statement will >> > evaluate to false. >> >> > I may be wrong... plz help. >> >> > On May 28, 9:15 pm, Vishal Thanki wrote: >> >> here is the code.. >> >> >> #define bi (i) >> >> #define bj (GRID_SIZE+j) >> >> #define bk (int)((GRID_SIZE*2)+(glb_sqrt*(i/glb_sqrt)+(j/glb_sqrt))) >> >> >> /*glb_sqrt should be the square root of grid_size (i.e. 3 if its a 9x9 >> >> sudoku). */ >> >> >> /* #define bk (int)((GRID_SIZE*2)+(5*(i/5)+(j/5))) */ >> >> >> /* >> >> * This function will verify solved grid. It will start with each element >> >> * in grid and update the bitmap step by step. As soon as it encounters an >> >> * element which is already present in bitmap, it will return error. >> >> * >> >> */ >> >> >> int verify() >> >> { >> >> int i, j, k; >> >> int bitmap[GRID_SIZE*3] = {0}; >> >> int bmp_idx; >> >> for (i = 0; i < GRID_SIZE; i++) { >> >> for (j = 0; j < GRID_SIZE; j++) { >> >> if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) >> >> && >
[algogeeks] Re: Sudoku verification problem
I think ur verification function is correct but it works only if user is entering the values one by one. as soon as he enters a duplicate value it will show a error. It will work for the case of ur solver as ur code itself is generating the values. But here in this verification problem u r given a configuration from a user. i.e. all values at once not one by one. So one thing that can be done is use ur fillbitmap function and then check if any of the 9 Least significant bits of the 27 values in ur bmp array is not set. If thats the case then sukoku isn't correct. but then this code would take O(n^2) = (3*n*n) time here n is 9. On May 29, 5:10 pm, Dumanshu wrote: > no... what i mean to say is you have filled the bitmap in the process > of solving the grid. The way you are filling the bitmap is -> you are > taking values from the matrix and placing them in the bitmaps using bi > bj bk. > > now in the verification you are checking the same matrix value against > the same bitmap field. it will "always" evaluate out to be false for > your if. > your if statement is checking whether the matrix value and the bitmap > value is same or not. you have used the matrix value to fill the > bitmap so obviously they will be same. > > see in fill bitmap funciton u did for some i,j -> > > bmp[bi] |= 1 << matrix[i][j]; > bmp[bj] |= 1 << matrix[i][j]; > bmp[bk] |= 1 << matrix[i][j]; > that is for some particular i,j say 5,4 > u took value matrix[5][4] =8 and set the bit in bitmap after > calculating bi,bj,bk - these values are bi ==5, bj== 13 and bk == 10 > so now in bmp[5], bmp[10] and bmp[13] u have set the 8th bit. > > now in verify function > > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && > (((bitmap[bj] >> matrix[i][j]) > & 0x1) == 0x0) && > (((bitmap[bk] >> matrix[i][j]) > & 0x1) == 0x0)) { > bitmap[bi] |= 1 << matrix[i][j]; > bitmap[bj] |= 1 << matrix[i][j]; > bitmap[bk] |= 1 << matrix[i][j]; > > here during the loop when i==5 and j==4, the if condition will always > evaluate to false. > > same thing will happen for every value in the matrix because the > corresponding bit has been set earlier. > > so how is ur verification function working??? > > On May 29, 3:35 pm, Vishal Thanki wrote: > > > > > > > > > yes, you are right. bitmap will be filled in the process of solving > > the grid. in verify routine, if the expression evaluates to false, it > > mean an element is encountered which is already present in row, col > > and 3x3 cube. this way you an tell that the solution is wrong. > > > hope that helps. > > > On Sun, May 29, 2011 at 2:01 PM, Dumanshu wrote: > > > here in this part > > > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && > > > (((bitmap[bj] >> matrix[i][j]) & 0x1) == 0x0) && > > > (((bitmap[bk] >> matrix[i][j]) > > > & 0x1) == 0x0)) { > > > bitmap[bi] |= 1 << matrix[i][j]; > > > bitmap[bj] |= 1 << matrix[i][j]; > > > bitmap[bk] |= 1 << matrix[i][j]; > > > > I think you are checking the same values which u have already set in > > > the bitmap using the fill_bitmap function. like suppose the 1st cell > > > of the matrix has value 5. then using fill bitmap u have the set > > > corresponding 5th bit in all 3 places(row col 3by3 cell) using bi bj > > > and bk. > > > now in the verify function u checking the same bit against that matrix > > > value which u have already set. so everytime ur if statement will > > > evaluate to false. > > > > I may be wrong... plz help. > > > > On May 28, 9:15 pm, Vishal Thanki wrote: > > >> here is the code.. > > > >> #define bi (i) > > >> #define bj (GRID_SIZE+j) > > >> #define bk (int)((GRID_SIZE*2)+(glb_sqrt*(i/glb_sqrt)+(j/glb_sqrt))) > > > >> /*glb_sqrt should be the square root of grid_size (i.e. 3 if its a 9x9 > > >> sudoku). */ > > > >> /* #define bk (int)((GRID_SIZE*2)+(5*(i/5)+(j/5))) */ > > > >> /* > > >> * This function will verify solved grid. It will start with each element > > >> * in grid and update the bitmap step by step. As soon as it encounters > > >> an > > >> * element which is already present in bitmap, it will return error. > > >> * > > >> */ > > > >> int verify() > > >> { > > >> int i, j, k; > > >> int bitmap[GRID_SIZE*3] = {0}; > > >> int bmp_idx; > > >> for (i = 0; i < GRID_SIZE; i++) { > > >> for (j = 0; j < GRID_SIZE; j++) { > > >> if bitmap[bi] >> matrix[i][j]) & 0x1) == > > >> 0x0) && > > >> (((bitmap[bj] >> matrix[i][j]) & > > >> 0x1) == 0x0) && > > >> (((bitmap[bk] >> matrix[i
[algogeeks] Re: Sudoku verification problem
no... what i mean to say is you have filled the bitmap in the process of solving the grid. The way you are filling the bitmap is -> you are taking values from the matrix and placing them in the bitmaps using bi bj bk. now in the verification you are checking the same matrix value against the same bitmap field. it will "always" evaluate out to be false for your if. your if statement is checking whether the matrix value and the bitmap value is same or not. you have used the matrix value to fill the bitmap so obviously they will be same. see in fill bitmap funciton u did for some i,j -> bmp[bi] |= 1 << matrix[i][j]; bmp[bj] |= 1 << matrix[i][j]; bmp[bk] |= 1 << matrix[i][j]; that is for some particular i,j say 5,4 u took value matrix[5][4] =8 and set the bit in bitmap after calculating bi,bj,bk - these values are bi ==5, bj== 13 and bk == 10 so now in bmp[5], bmp[10] and bmp[13] u have set the 8th bit. now in verify function if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && (((bitmap[bj] >> matrix[i][j]) & 0x1) == 0x0) && (((bitmap[bk] >> matrix[i][j]) & 0x1) == 0x0)) { bitmap[bi] |= 1 << matrix[i][j]; bitmap[bj] |= 1 << matrix[i][j]; bitmap[bk] |= 1 << matrix[i][j]; here during the loop when i==5 and j==4, the if condition will always evaluate to false. same thing will happen for every value in the matrix because the corresponding bit has been set earlier. so how is ur verification function working??? On May 29, 3:35 pm, Vishal Thanki wrote: > yes, you are right. bitmap will be filled in the process of solving > the grid. in verify routine, if the expression evaluates to false, it > mean an element is encountered which is already present in row, col > and 3x3 cube. this way you an tell that the solution is wrong. > > hope that helps. > > > > > > > > On Sun, May 29, 2011 at 2:01 PM, Dumanshu wrote: > > here in this part > > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && > > (((bitmap[bj] >> matrix[i][j]) & 0x1) == 0x0) && > > (((bitmap[bk] >> matrix[i][j]) > > & 0x1) == 0x0)) { > > bitmap[bi] |= 1 << matrix[i][j]; > > bitmap[bj] |= 1 << matrix[i][j]; > > bitmap[bk] |= 1 << matrix[i][j]; > > > I think you are checking the same values which u have already set in > > the bitmap using the fill_bitmap function. like suppose the 1st cell > > of the matrix has value 5. then using fill bitmap u have the set > > corresponding 5th bit in all 3 places(row col 3by3 cell) using bi bj > > and bk. > > now in the verify function u checking the same bit against that matrix > > value which u have already set. so everytime ur if statement will > > evaluate to false. > > > I may be wrong... plz help. > > > On May 28, 9:15 pm, Vishal Thanki wrote: > >> here is the code.. > > >> #define bi (i) > >> #define bj (GRID_SIZE+j) > >> #define bk (int)((GRID_SIZE*2)+(glb_sqrt*(i/glb_sqrt)+(j/glb_sqrt))) > > >> /*glb_sqrt should be the square root of grid_size (i.e. 3 if its a 9x9 > >> sudoku). */ > > >> /* #define bk (int)((GRID_SIZE*2)+(5*(i/5)+(j/5))) */ > > >> /* > >> * This function will verify solved grid. It will start with each element > >> * in grid and update the bitmap step by step. As soon as it encounters an > >> * element which is already present in bitmap, it will return error. > >> * > >> */ > > >> int verify() > >> { > >> int i, j, k; > >> int bitmap[GRID_SIZE*3] = {0}; > >> int bmp_idx; > >> for (i = 0; i < GRID_SIZE; i++) { > >> for (j = 0; j < GRID_SIZE; j++) { > >> if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) > >> && > >> (((bitmap[bj] >> matrix[i][j]) & > >> 0x1) == 0x0) && > >> (((bitmap[bk] >> matrix[i][j]) & > >> 0x1) == 0x0)) { > >> bitmap[bi] |= 1 << matrix[i][j]; > >> bitmap[bj] |= 1 << matrix[i][j]; > >> bitmap[bk] |= 1 << matrix[i][j]; > >> } else { > >> printf("Sudoku Error: i = %d, j = %d\n", > >> i, j); > >> return -1; > >> } > > >> } > >> } > >> return 0; > > >> } > >> On Sat, May 28, 2011 at 11:53 AM, Dumanshu wrote: > >> > Given a n by n matrix. Suggest an algorithm to verify its correctness > >> > given a configuration. User can enter numbers only between 1 to n. > >> > I need this in 2 ways - > >> > 1. for the n by n matrix, suggest an elegant way for validating it. > >> > 2. suggest a dat
Re: [algogeeks] Re: Sudoku verification problem
yes, you are right. bitmap will be filled in the process of solving the grid. in verify routine, if the expression evaluates to false, it mean an element is encountered which is already present in row, col and 3x3 cube. this way you an tell that the solution is wrong. hope that helps. On Sun, May 29, 2011 at 2:01 PM, Dumanshu wrote: > here in this part > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && > (((bitmap[bj] >> matrix[i][j]) & 0x1) == 0x0) && > (((bitmap[bk] >> matrix[i][j]) > & 0x1) == 0x0)) { > bitmap[bi] |= 1 << matrix[i][j]; > bitmap[bj] |= 1 << matrix[i][j]; > bitmap[bk] |= 1 << matrix[i][j]; > > I think you are checking the same values which u have already set in > the bitmap using the fill_bitmap function. like suppose the 1st cell > of the matrix has value 5. then using fill bitmap u have the set > corresponding 5th bit in all 3 places(row col 3by3 cell) using bi bj > and bk. > now in the verify function u checking the same bit against that matrix > value which u have already set. so everytime ur if statement will > evaluate to false. > > I may be wrong... plz help. > > On May 28, 9:15 pm, Vishal Thanki wrote: >> here is the code.. >> >> #define bi (i) >> #define bj (GRID_SIZE+j) >> #define bk (int)((GRID_SIZE*2)+(glb_sqrt*(i/glb_sqrt)+(j/glb_sqrt))) >> >> /*glb_sqrt should be the square root of grid_size (i.e. 3 if its a 9x9 >> sudoku). */ >> >> /* #define bk (int)((GRID_SIZE*2)+(5*(i/5)+(j/5))) */ >> >> /* >> * This function will verify solved grid. It will start with each element >> * in grid and update the bitmap step by step. As soon as it encounters an >> * element which is already present in bitmap, it will return error. >> * >> */ >> >> int verify() >> { >> int i, j, k; >> int bitmap[GRID_SIZE*3] = {0}; >> int bmp_idx; >> for (i = 0; i < GRID_SIZE; i++) { >> for (j = 0; j < GRID_SIZE; j++) { >> if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && >> (((bitmap[bj] >> matrix[i][j]) & >> 0x1) == 0x0) && >> (((bitmap[bk] >> matrix[i][j]) & >> 0x1) == 0x0)) { >> bitmap[bi] |= 1 << matrix[i][j]; >> bitmap[bj] |= 1 << matrix[i][j]; >> bitmap[bk] |= 1 << matrix[i][j]; >> } else { >> printf("Sudoku Error: i = %d, j = %d\n", i, >> j); >> return -1; >> } >> >> } >> } >> return 0; >> >> >> >> >> >> >> >> } >> On Sat, May 28, 2011 at 11:53 AM, Dumanshu wrote: >> > Given a n by n matrix. Suggest an algorithm to verify its correctness >> > given a configuration. User can enter numbers only between 1 to n. >> > I need this in 2 ways - >> > 1. for the n by n matrix, suggest an elegant way for validating it. >> > 2. suggest a data structure for this sudoku so that the structure aids >> > in its verification. >> >> > thnx for the help. >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "Algorithm Geeks" group. >> > To post to this group, send email to algogeeks@googlegroups.com. >> > To unsubscribe from this group, send email to >> > algogeeks+unsubscr...@googlegroups.com. >> > For more options, visit this group >> > athttp://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] Re: Sudoku verification problem
here in this part if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && (((bitmap[bj] >> matrix[i][j]) & 0x1) == 0x0) && (((bitmap[bk] >> matrix[i][j]) & 0x1) == 0x0)) { bitmap[bi] |= 1 << matrix[i][j]; bitmap[bj] |= 1 << matrix[i][j]; bitmap[bk] |= 1 << matrix[i][j]; I think you are checking the same values which u have already set in the bitmap using the fill_bitmap function. like suppose the 1st cell of the matrix has value 5. then using fill bitmap u have the set corresponding 5th bit in all 3 places(row col 3by3 cell) using bi bj and bk. now in the verify function u checking the same bit against that matrix value which u have already set. so everytime ur if statement will evaluate to false. I may be wrong... plz help. On May 28, 9:15 pm, Vishal Thanki wrote: > here is the code.. > > #define bi (i) > #define bj (GRID_SIZE+j) > #define bk (int)((GRID_SIZE*2)+(glb_sqrt*(i/glb_sqrt)+(j/glb_sqrt))) > > /*glb_sqrt should be the square root of grid_size (i.e. 3 if its a 9x9 > sudoku). */ > > /* #define bk (int)((GRID_SIZE*2)+(5*(i/5)+(j/5))) */ > > /* > * This function will verify solved grid. It will start with each element > * in grid and update the bitmap step by step. As soon as it encounters an > * element which is already present in bitmap, it will return error. > * > */ > > int verify() > { > int i, j, k; > int bitmap[GRID_SIZE*3] = {0}; > int bmp_idx; > for (i = 0; i < GRID_SIZE; i++) { > for (j = 0; j < GRID_SIZE; j++) { > if bitmap[bi] >> matrix[i][j]) & 0x1) == 0x0) && > (((bitmap[bj] >> matrix[i][j]) & 0x1) > == 0x0) && > (((bitmap[bk] >> matrix[i][j]) & 0x1) > == 0x0)) { > bitmap[bi] |= 1 << matrix[i][j]; > bitmap[bj] |= 1 << matrix[i][j]; > bitmap[bk] |= 1 << matrix[i][j]; > } else { > printf("Sudoku Error: i = %d, j = %d\n", i, > j); > return -1; > } > > } > } > return 0; > > > > > > > > } > On Sat, May 28, 2011 at 11:53 AM, Dumanshu wrote: > > Given a n by n matrix. Suggest an algorithm to verify its correctness > > given a configuration. User can enter numbers only between 1 to n. > > I need this in 2 ways - > > 1. for the n by n matrix, suggest an elegant way for validating it. > > 2. suggest a data structure for this sudoku so that the structure aids > > in its verification. > > > thnx for the help. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://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: spoj--two squares problem
Hi Saurabh, Can you try it for 10? Could not really understand, what are you gonna communicate? 10 = 2*5 (2^2 + 1^2 )*(1*2 + 1^2)... If with this logic you are saying 10 is prime then all numbers divisible by 5 should be prime. Could you elaborate your answer more? Thanks & Regards Vishal Jain MNo: +91-9540611889 Tweet @jainvis Blog @ jainvish.blogspot.com Success taste better when target achieved is bigger. P *We have a responsibility to the environment.* *Before printing this e-mail or any other document, let's ask ourselves whether we need a hard copy.* On Sun, May 29, 2011 at 6:46 AM, saurabh singh wrote: > In fact we can...though not directly..SInce every number can be broken down > as facotrs of primeUse that property > > > On Sun, May 29, 2011 at 1:12 AM, Tushar Bindal wrote: > >> that theorem is for odd primes >> 9 is not an odd prime >> so we can;t apply this theorem >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from 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] one constructor problem
check this sol frends #include using namespace std; class A { private: int a; public: A(int m) { a=m; } }; int main() { cout<<"Enter no of objects in array"<>n; cout<<"Enter value of a for first object of array"<>p; static A obj[]={A(p)}; for(int i=0;i>p; obj[++i]=A(p); } return 0; } On Fri, May 27, 2011 at 8:07 PM, Logic King wrote: > @D.N. I Think if you removes default constructor and give only parametrized > constructor...then it i going to give any errorit should work fine.. > > > On Fri, May 27, 2011 at 4:40 AM, Aakash Johari wrote: > >> Provide some default value to the parameterized constructor. >> * >> A(int m = 0) { >> a = m; >> } * >> >> On Fri, May 27, 2011 at 4:36 AM, D.N.Vishwakarma@IITR >> wrote: >> >>> without default constructor what will be solution >>> >>> On Wed, May 25, 2011 at 10:56 AM, Aakash Johari >>> wrote: >>> This way you can do: #include using namespace std; class A { public: int a; A(int m) { a = m; } A() { } }; int main() { int i; A *obj[32]; for ( i = 0; i <= 31; i++ ) { obj[i] = new A(i); } for ( i = 0; i <= 31; i++ ) { cout << obj[i]->a << endl; } return 0; } On Tue, May 24, 2011 at 9:38 PM, immanuel kingston < kingston.imman...@gmail.com> wrote: > > http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm > > > http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectswithoutreferencingtheconstructordirectly.htm > > Thanks, > Immanuel > > > > On Wed, May 25, 2011 at 7:34 AM, D.N.Vishwakarma@IITR < > deok...@gmail.com> wrote: > >> There is a class A which contains just one parameterized constructor >> A(int a). How would you initialize an array of objects of this class. >> >> -- >> **With Regards >> Deoki Nandan Vishwakarma >> IITR MCA >> Mathematics Department* >> * >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from 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. > -- -Aakash Johari (IIIT 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. >>> >>> >>> >>> -- >>> **With Regards >>> Deoki Nandan Vishwakarma >>> IITR MCA >>> Mathematics Department* >>> * >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> -Aakash Johari >> (IIIT 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. > -- **With Regards Deoki Nandan Vishwakarma IITR MCA Ma
Re: [algogeeks] Google Interview Question
Can this work... Lets say I have following numbers 8 9 7 4 2 121 23 21 24 27 35 79 2334 6785 Now repeat the last number to make all the number of equal length... 1211 2333 2111 2444 2777 3555 7999 2334 6785 Sort the following numbers in descending order. 7999 6785 ... Now merge the numbers based on their actual value. 987976785.. I have not testing this entirely, but after seeing solution(Multiplying by 10) at top, I though this might work better. Thanks & Regards Vishal Jain MNo: +91-9540611889 Tweet @jainvis Blog @ jainvish.blogspot.com Success taste better when target achieved is bigger. P *We have a responsibility to the environment.* *Before printing this e-mail or any other document, let's ask ourselves whether we need a hard copy.* On Sun, May 29, 2011 at 12:58 PM, Ashish Goel wrote: > Radix/bucket sort.. > > won't that help? > > Best Regards > Ashish Goel > "Think positive and find fuel in failure" > +919985813081 > +919966006652 > > > > On Fri, May 27, 2011 at 7:15 PM, wrote: > >> how about this case: >> >> 9, 100 -> 9100 >> 100 9 >> 9100 >> >> 2, 3, 9, 78 --> >> 78 9 3 2 >> 9 78 3 2 >> >> I guess solution should be:- >> sort the array of numbers in an ascending order and then check for the >> first element in the array, if there is any other element greater than it, >> shift all the elements one right and place that element in the left most >> space. >> >> >> On Fri, May 27, 2011 at 9:37 AM, wujin chen wrote: >> >>> @Piyush, how to deal with this case :100 , 10 >>> >>> >>> 2011/5/27 Piyush Sinha >>> we can work out if we sort according to the leftmost integer On 5/27/11, adityasir...@gmail.com wrote: > are you kidding me. Just simple sort wont work. > > On Fri, May 27, 2011 at 9:31 AM, radha krishnan < > radhakrishnance...@gmail.com> wrote: > >> sort :) >> >> >> On Fri, May 27, 2011 at 6:57 PM, ross wrote: >> >>> Hi all, >>> >>> Given an array of elements find the largest possible number that can >>> be formed by using the elements of the array. >>> >>> eg: 10 9 >>> ans: 910 >>> >>> 2 3 5 78 >>> >>> ans: 78532 >>> >>> 100 9 >>> >>> ans: 9100 >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from 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. > > -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 >
Re: [algogeeks] Google Interview Question
Radix/bucket sort.. won't that help? Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Fri, May 27, 2011 at 7:15 PM, wrote: > how about this case: > > 9, 100 -> 9100 > 100 9 > 9100 > > 2, 3, 9, 78 --> > 78 9 3 2 > 9 78 3 2 > > I guess solution should be:- > sort the array of numbers in an ascending order and then check for the > first element in the array, if there is any other element greater than it, > shift all the elements one right and place that element in the left most > space. > > > On Fri, May 27, 2011 at 9:37 AM, wujin chen wrote: > >> @Piyush, how to deal with this case :100 , 10 >> >> >> 2011/5/27 Piyush Sinha >> >>> we can work out if we sort according to the leftmost integer >>> >>> On 5/27/11, adityasir...@gmail.com wrote: >>> > are you kidding me. Just simple sort wont work. >>> > >>> > On Fri, May 27, 2011 at 9:31 AM, radha krishnan < >>> > radhakrishnance...@gmail.com> wrote: >>> > >>> >> sort :) >>> >> >>> >> >>> >> On Fri, May 27, 2011 at 6:57 PM, ross wrote: >>> >> >>> >>> Hi all, >>> >>> >>> >>> Given an array of elements find the largest possible number that can >>> >>> be formed by using the elements of the array. >>> >>> >>> >>> eg: 10 9 >>> >>> ans: 910 >>> >>> >>> >>> 2 3 5 78 >>> >>> >>> >>> ans: 78532 >>> >>> >>> >>> 100 9 >>> >>> >>> >>> ans: 9100 >>> >>> >>> >>> -- >>> >>> You received this message because you are subscribed to the Google >>> Groups >>> >>> "Algorithm Geeks" group. >>> >>> To post to this group, send email to algogeeks@googlegroups.com. >>> >>> To unsubscribe from 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. >>> > >>> > >>> >>> >>> -- >>> *Piyush Sinha* >>> *IIIT, Allahabad* >>> *+91-8792136657* >>> *+91-7483122727* >>> *https://www.facebook.com/profile.php?id=10655377926 * >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from 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] Popular Puzzle of the week
*Hi,* * * *Based on most comments, The popular puzzle of the last week is* * * * http://dailybrainteaser.blogspot.com/2011/05/murder-mystery-puzzle-23-may.html?lavesh=lavesh * * * *Please subscribe and follow this blog to show your liking to the blog.* * * *-- * "Never explain yourself. Your friends don’t need it and your enemies won’t believe it" . -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.