Re: [algogeeks] a doubt..
wont recursion will also be resource (time) intensive because of the multiple function call which is not observed in iterative procedures. On Tue, Jun 14, 2011 at 7:30 AM, Navneet Gupta navneetn...@gmail.comwrote: Recursion is the best way to write compact programs for what might seem as tedious tasks to do. Dynamic Programming is an alternate to recursion when problems possess characteristics like suboptimal substructures and overlapping subproblems. Dynamic Programming is a iterative way of doing tasks which can also be done with recursion but they are generally less time intensive. Recursion is space intensive because it takes space for storing activation blocks of recursive function calls On Tue, Jun 14, 2011 at 2:18 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: Is it right to say iteration is resource(time) intensive and recursion is not. On the other hand, recursion is space intensive (with stacks) and iteration is not ? Thanks On Mon, Jun 13, 2011 at 2:08 PM, ADITYA KUMAR aditya...@gmail.com wrote: its always better to have iterative program than recursive since iterative program doesn't rely on system stack.. but recursive program are easy to write and gives a clear view of program On Tue, Jun 14, 2011 at 1:13 AM, snehi jain snehijai...@gmail.com wrote: hi, we try to implement many programs using Recursion and its said that this is better than iterative procedure. if i am right then i cant understand why is it so? can anybody explain ... and are there situations when iterative procedure is better than recursion. Snehi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Aditya Kumar B-tech 3rd year Computer Science Engg. MNNIT, Allahabad. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] solve
http://www.freepuzzles.com/puzzles/PuzzlePage.asp?PuzzleNumber=Geom003CategoryID=1 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] a doubt..
Not really, time to push and pop functions from stack is not included in algorithm analysis because it would ultimately be compiler/machine dependent Also running time of algorithms is very much a theoritical concept which works for most practical purposes. On Tue, Jun 14, 2011 at 11:31 AM, snehi jain snehijai...@gmail.com wrote: wont recursion will also be resource (time) intensive because of the multiple function call which is not observed in iterative procedures. On Tue, Jun 14, 2011 at 7:30 AM, Navneet Gupta navneetn...@gmail.comwrote: Recursion is the best way to write compact programs for what might seem as tedious tasks to do. Dynamic Programming is an alternate to recursion when problems possess characteristics like suboptimal substructures and overlapping subproblems. Dynamic Programming is a iterative way of doing tasks which can also be done with recursion but they are generally less time intensive. Recursion is space intensive because it takes space for storing activation blocks of recursive function calls On Tue, Jun 14, 2011 at 2:18 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: Is it right to say iteration is resource(time) intensive and recursion is not. On the other hand, recursion is space intensive (with stacks) and iteration is not ? Thanks On Mon, Jun 13, 2011 at 2:08 PM, ADITYA KUMAR aditya...@gmail.com wrote: its always better to have iterative program than recursive since iterative program doesn't rely on system stack.. but recursive program are easy to write and gives a clear view of program On Tue, Jun 14, 2011 at 1:13 AM, snehi jain snehijai...@gmail.com wrote: hi, we try to implement many programs using Recursion and its said that this is better than iterative procedure. if i am right then i cant understand why is it so? can anybody explain ... and are there situations when iterative procedure is better than recursion. Snehi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Aditya Kumar B-tech 3rd year Computer Science Engg. MNNIT, Allahabad. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Intuitive Understanding of XOR Operation
hi, the way XOR operation works i.e 0 for duplicates is used the most. A practical application that i know is , XOR is used for Forward Error correction for packet loss over a network. It works on the same principle like the duplicate problem. Another application that i know is for Error detection of transmitted packets (which again works on the principle of duplicates). i hope it helps. Snehi On Tue, Jun 14, 2011 at 7:48 AM, Navneet Gupta navneetn...@gmail.comwrote: Hello, I would really appreciate if someone can help me get an intuitive understanding of XOR over a range of numbers. I have seen it's usage is a couple of problems where duplicates are involved and though ultimately i can see how it is solving the problem, i still feel like checking the correctness of the solution whenever i come across such solutions. Also would be good if someone can throw some light on what other kinds of problems they have seen which are difficult(time complexity wise) but using XOR gives an elegant and time efficient solution. --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] a doubt..
Navneet can you point to some resources ? Iterative procedures are generally faster than recursion unless it is not required to fill the table completely. On Tue, Jun 14, 2011 at 11:39 AM, Navneet Gupta navneetn...@gmail.comwrote: Not really, time to push and pop functions from stack is not included in algorithm analysis because it would ultimately be compiler/machine dependent Also running time of algorithms is very much a theoritical concept which works for most practical purposes. On Tue, Jun 14, 2011 at 11:31 AM, snehi jain snehijai...@gmail.comwrote: wont recursion will also be resource (time) intensive because of the multiple function call which is not observed in iterative procedures. On Tue, Jun 14, 2011 at 7:30 AM, Navneet Gupta navneetn...@gmail.comwrote: Recursion is the best way to write compact programs for what might seem as tedious tasks to do. Dynamic Programming is an alternate to recursion when problems possess characteristics like suboptimal substructures and overlapping subproblems. Dynamic Programming is a iterative way of doing tasks which can also be done with recursion but they are generally less time intensive. Recursion is space intensive because it takes space for storing activation blocks of recursive function calls On Tue, Jun 14, 2011 at 2:18 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: Is it right to say iteration is resource(time) intensive and recursion is not. On the other hand, recursion is space intensive (with stacks) and iteration is not ? Thanks On Mon, Jun 13, 2011 at 2:08 PM, ADITYA KUMAR aditya...@gmail.com wrote: its always better to have iterative program than recursive since iterative program doesn't rely on system stack.. but recursive program are easy to write and gives a clear view of program On Tue, Jun 14, 2011 at 1:13 AM, snehi jain snehijai...@gmail.com wrote: hi, we try to implement many programs using Recursion and its said that this is better than iterative procedure. if i am right then i cant understand why is it so? can anybody explain ... and are there situations when iterative procedure is better than recursion. Snehi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Aditya Kumar B-tech 3rd year Computer Science Engg. MNNIT, Allahabad. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Arpit Sood -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Intuitive Understanding of XOR Operation
Another use of XOR is to generate some random numbers And XOR is extensively used in the field of CryptoGraphy !!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] [brain teaser ] Sign Puzzle
*Sign Puzzle - 14 june * * * *As the school year was progressing, a teacher was distressed that more and more of her students were beginning to tease and make fun of one another. She decided to do something about it. When they returned to the classroom after Spring Break, they saw a mirror on the wall with a sign next to it.* * When one of the students came to her crying about the names she had been called at recess, she sent the girl to the mirror with these directions: Read that sign quietly to yourself. Repeat it over and over, gradually running the sounds together. Each time, look at yourself in the mirror. Soon you will be smiling. Sure enough, when the student followed these directions, she came away smiling. Each time a student would come to the teacher feeling low, she would give them the same directions. Sometimes they would have difficulty, so she would go over to read the sign with them. Eventually, each one would come away smiling. This is what the sign said: I.Y.Q.Y.Q.R. Why did this little exercise help her students feel better about themselves * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/sign-puzzle.html?lavesh=lavesh Solution: Will be updated after 1 day -- 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.
[algogeeks] MS
Design an elevator system for a 100 story building. Address all issues, like number of elevators, speed of each (Not numerically), waiting times etc. There would be 100-200 people living/working on each floor. (You don't need to discuss the traffic patterns.) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] [brain teaser ] Sign Puzzle
I LIKE YOU LIKE YOU ARE On Tue, Jun 14, 2011 at 12:09 AM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Sign Puzzle - 14 june * * * *As the school year was progressing, a teacher was distressed that more and more of her students were beginning to tease and make fun of one another. She decided to do something about it. When they returned to the classroom after Spring Break, they saw a mirror on the wall with a sign next to it.* * When one of the students came to her crying about the names she had been called at recess, she sent the girl to the mirror with these directions: Read that sign quietly to yourself. Repeat it over and over, gradually running the sounds together. Each time, look at yourself in the mirror. Soon you will be smiling. Sure enough, when the student followed these directions, she came away smiling. Each time a student would come to the teacher feeling low, she would give them the same directions. Sometimes they would have difficulty, so she would go over to read the sign with them. Eventually, each one would come away smiling. This is what the sign said: I.Y.Q.Y.Q.R. Why did this little exercise help her students feel better about themselves * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/sign-puzzle.html?lavesh=lavesh Solution: Will be updated after 1 day -- 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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] help
What about precedence order then. http://www.difranco.net/cop2220/op-prec.htm i mean acc. to precedence order should be evaluated before || in the second exampleresult should be k=1,j=3 and i= -2 On Mon, Jun 13, 2011 at 11:41 AM, udit sharma sharmaudit...@gmail.comwrote: hmm. Sry yr... Got it.. Thanx.. :) :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Hi
Hi All I tried going through the code here for constructing suffix tires - http://marknelson.us/1996/08/01/suffix-trees/ But I am not sure I get it well. If its ok, can we discuss this implementation. Thanks Supraja J -- U -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Suffix Trees Discussion
Hey Supraja, Just a request, since this is a high volume mailing list, you should make your subject very informative. Hi isn't very descriptive you know. :) I'm changing the subject to Suffix Trees Discussion and reposting your question. Hope people are more interested in following the thread then. :) I tried going through the code here for constructing suffix tires - http://marknelson.us/1996/08/01/suffix-trees/ But I am not sure I get it well. If its ok, can we discuss this implementation. -- DK http://twitter.com/divyekapoor http://www.divye.in On Tuesday, 14 June 2011 17:01:36 UTC+5:30, Supraja wrote: Hi All I tried going through the code here for constructing suffix tires - http://marknelson.us/1996/08/01/suffix-trees/ But I am not sure I get it well. If its ok, can we discuss this implementation. Thanks Supraja J -- U -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Rq12wJ54fiIJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] [brain teaser ] Sign Puzzle
it means that time has come for you to get banned. Very bad puzzle. Oh, sorry, it was a joke. On Tue, Jun 14, 2011 at 12:39 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Sign Puzzle - 14 june * * * *As the school year was progressing, a teacher was distressed that more and more of her students were beginning to tease and make fun of one another. She decided to do something about it. When they returned to the classroom after Spring Break, they saw a mirror on the wall with a sign next to it.* * When one of the students came to her crying about the names she had been called at recess, she sent the girl to the mirror with these directions: Read that sign quietly to yourself. Repeat it over and over, gradually running the sounds together. Each time, look at yourself in the mirror. Soon you will be smiling. Sure enough, when the student followed these directions, she came away smiling. Each time a student would come to the teacher feeling low, she would give them the same directions. Sometimes they would have difficulty, so she would go over to read the sign with them. Eventually, each one would come away smiling. This is what the sign said: I.Y.Q.Y.Q.R. Why did this little exercise help her students feel better about themselves * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/sign-puzzle.html?lavesh=lavesh Solution: Will be updated after 1 day -- 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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 shortest path in 4-ary tree
Hi, How to find the shortest path in a 4-ary tree in an optimal way? Node tree{ Node *left,*right,*top,*bottom; int val; }; Let the above given be the tree structure. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Finding shortest path in 4-ary tree
Did you mean Shortest path from one node to another Use BFS i think we can find the shortest path On Tue, Jun 14, 2011 at 5:37 PM, Raghavan its...@gmail.com wrote: Hi, How to find the shortest path in a 4-ary tree in an optimal way? Node tree{ Node *left,*right,*top,*bottom; int val; }; Let the above given be the tree structure. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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.
[algogeeks] Re: Finding shortest path in 4-ary tree
Sorry, i confused val with weight of the edge. BFS would be a better option. On Jun 14, 5:31 pm, L prnk.bhatna...@gmail.com wrote: Any graph algorithm would work. If val is positive then use Dijkstra's algorithm, otherwise use Bellman Ford. On Jun 14, 5:07 pm, Raghavan its...@gmail.com wrote: Hi, How to find the shortest path in a 4-ary tree in an optimal way? Node tree{ Node *left,*right,*top,*bottom; int val; }; Let the above given be the tree structure. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Finding shortest path in 4-ary tree
same as left right or top u can consider as each node as a cell of grid type of thing for easy understanding On Tue, Jun 14, 2011 at 5:59 PM, vaibhav agarwal vibhu.bitspil...@gmail.com wrote: What actually is meant by bottom pointer On Tue, Jun 14, 2011 at 5:57 PM, sunny agrawal sunny816.i...@gmail.comwrote: Did you mean Shortest path from one node to another Use BFS i think we can find the shortest path On Tue, Jun 14, 2011 at 5:37 PM, Raghavan its...@gmail.com wrote: Hi, How to find the shortest path in a 4-ary tree in an optimal way? Node tree{ Node *left,*right,*top,*bottom; int val; }; Let the above given be the tree structure. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Finding shortest path in 4-ary tree
What actually is meant by bottom pointer On Tue, Jun 14, 2011 at 5:57 PM, sunny agrawal sunny816.i...@gmail.comwrote: Did you mean Shortest path from one node to another Use BFS i think we can find the shortest path On Tue, Jun 14, 2011 at 5:37 PM, Raghavan its...@gmail.com wrote: Hi, How to find the shortest path in a 4-ary tree in an optimal way? Node tree{ Node *left,*right,*top,*bottom; int val; }; Let the above given be the tree structure. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 shortest path in 4-ary tree
Any graph algorithm would work. If val is positive then use Dijkstra's algorithm, otherwise use Bellman Ford. On Jun 14, 5:07 pm, Raghavan its...@gmail.com wrote: Hi, How to find the shortest path in a 4-ary tree in an optimal way? Node tree{ Node *left,*right,*top,*bottom; int val; }; Let the above given be the tree structure. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Finding shortest path in 4-ary tree
Ok lemme add some more details to it. See it is a kind of n-ary tree having n=4 and each pointer is represented as left, right,top and bottom compare it to the four directions. So the shortest path starting from the root node to the leaf node where the val = 1000, taken into consideration there will be only one node which has the val =1000 needs to discovered. On Tue, Jun 14, 2011 at 6:06 PM, sunny agrawal sunny816.i...@gmail.comwrote: same as left right or top u can consider as each node as a cell of grid type of thing for easy understanding On Tue, Jun 14, 2011 at 5:59 PM, vaibhav agarwal vibhu.bitspil...@gmail.com wrote: What actually is meant by bottom pointer On Tue, Jun 14, 2011 at 5:57 PM, sunny agrawal sunny816.i...@gmail.comwrote: Did you mean Shortest path from one node to another Use BFS i think we can find the shortest path On Tue, Jun 14, 2011 at 5:37 PM, Raghavan its...@gmail.com wrote: Hi, How to find the shortest path in a 4-ary tree in an optimal way? Node tree{ Node *left,*right,*top,*bottom; int val; }; Let the above given be the tree structure. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- Thanks and regards, Raghavan.K.L http://in.linkedin.com/in/raghavankl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Find shortest substring that is only occurring once. in Given String
I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples: s=aabbabbaab gives either bab or baa s= gives My Approaches Generate All Possible SubStrings O(N^2) puts all substrings into hashtable keep incrementing counter for each substring , return substring with counter 1 memory O(N) Not efficient Create Suffix Tree Seems to be Efficient Solution Only You Need to do Create Tree then we can find the shortest substring that is only occurring once. in O(n) time PS: let me other approaches,suggestion Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: MS Question
Good one! That halved the memory requirement. :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/N6mbMaJHO64J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Interview Question: Puzzle: Probability
Folks, This question was asked during a screening process of a product based company. Please answer. http://exploreriddles.blogspot.com/2011/06/interview-questions-puzzle.html Thanks Regards Vishal Jain 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.* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Find shortest substring that is only occurring once. in Given String
This looks like a good problem. Could you confirm if string contains only two characters as you mentioned in both examples or it is a general string with any characters. On Tue, Jun 14, 2011 at 6:33 PM, bittu shashank7andr...@gmail.com wrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples: s=aabbabbaab gives either bab or baa s= gives My Approaches Generate All Possible SubStrings O(N^2) puts all substrings into hashtable keep incrementing counter for each substring , return substring with counter 1 memory O(N) Not efficient Create Suffix Tree Seems to be Efficient Solution Only You Need to do Create Tree then we can find the shortest substring that is only occurring once. in O(n) time PS: let me other approaches,suggestion Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Find shortest substring that is only occurring once. in Given String
it must be any general string Suffix tree approach seems best both in time and space complexity On Tue, Jun 14, 2011 at 7:36 PM, Navneet Gupta navneetn...@gmail.comwrote: This looks like a good problem. Could you confirm if string contains only two characters as you mentioned in both examples or it is a general string with any characters. On Tue, Jun 14, 2011 at 6:33 PM, bittu shashank7andr...@gmail.com wrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples: s=aabbabbaab gives either bab or baa s= gives My Approaches Generate All Possible SubStrings O(N^2) puts all substrings into hashtable keep incrementing counter for each substring , return substring with counter 1 memory O(N) Not efficient Create Suffix Tree Seems to be Efficient Solution Only You Need to do Create Tree then we can find the shortest substring that is only occurring once. in O(n) time PS: let me other approaches,suggestion Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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] Interview Question: Puzzle: Probability
Put one red ball in one jar and rest 99 balls in other jar. Probability in that case is 1/2*1 + 1/2*49//99 On Tue, Jun 14, 2011 at 7:45 PM, Vishal Jain jainv...@gmail.com wrote: Folks, This question was asked during a screening process of a product based company. Please answer. http://exploreriddles.blogspot.com/2011/06/interview-questions-puzzle.html Thanks Regards Vishal Jain 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.* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] is it correct??
is such a declaration correct: cinx; int a[x]; -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] is it correct??
no the no of elements in an array should be known to compiler before execution of the program. On Tue, Jun 14, 2011 at 8:09 PM, amit amitthecoo...@gmail.com wrote: is such a declaration correct: cinx; int a[x]; -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: is it correct??
One line or the other is not correct. The size of an array must be a constant, and you can't read into a const. If you want to do something like this, use malloc: cin x; int *a = (int *)malloc(x*sizeof(int)); You can now use a as if it is an array of size x. Be sure to free the memory before a goes out of scope. Don On Jun 14, 9:39 am, amit amitthecoo...@gmail.com wrote: is such a declaration correct: cinx; int a[x]; -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: is it correct??
but such a declaration is working correctly in g++ On Tue, Jun 14, 2011 at 8:22 PM, Don dondod...@gmail.com wrote: One line or the other is not correct. The size of an array must be a constant, and you can't read into a const. If you want to do something like this, use malloc: cin x; int *a = (int *)malloc(x*sizeof(int)); You can now use a as if it is an array of size x. Be sure to free the memory before a goes out of scope. Don On Jun 14, 9:39 am, amit amitthecoo...@gmail.com wrote: is such a declaration correct: cinx; int a[x]; -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: is it correct??
it is correct ...in c++ 4.3.2 compiler -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] help
anybody having idea about preference order ?? On Tue, Jun 14, 2011 at 4:20 AM, nicks crazy.logic.k...@gmail.com wrote: What about precedence order then. http://www.difranco.net/cop2220/op-prec.htm i mean acc. to precedence order should be evaluated before || in the second exampleresult should be k=1,j=3 and i= -2 On Mon, Jun 13, 2011 at 11:41 AM, udit sharma sharmaudit...@gmail.comwrote: hmm. Sry yr... Got it.. Thanx.. :) :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Intuitive Understanding of XOR Operation
It is important to remember that xor is a bitwise operator, so x ^= y affects the individual bits of x based on the bits in y. Think of xor as a bitwise not-equal operator. The expression a = x ^ y Will set the bits of a to true if the corresponding bits of x and y are not equal. Thus the xor operator is a good way to toggle selected bits in a value. If I want to toggle the 1, 4, and 8 bit in x, I can write x ^= 13. A nice property of xor is that it is self-reversing: a ^= b; // Toggle the bits set in b a ^= b; // Reverse the operation After those two operations, a has the same value it had before. That doesn't seem useful, but imagine that you are writing an application where you allow the user to select a region in an image by clicking on one corner and then drawing a rubber band box which follows the mouse to select the other corner. If you just draw a white line, you obliterate the image, so you would need to copy the pixels which are covered by the box. But if you xor the pixels by some value to draw the box, and xor the pixels again with the same value you end up with the original value of the pixel. The same thing can be used to encrypt data. If you xor each byte by a byte produced by a stream generator based on a secret key, the recipient can repeat the process and get the original data back. Don On Jun 13, 9:18 pm, Navneet Gupta navneetn...@gmail.com wrote: Hello, I would really appreciate if someone can help me get an intuitive understanding of XOR over a range of numbers. I have seen it's usage is a couple of problems where duplicates are involved and though ultimately i can see how it is solving the problem, i still feel like checking the correctness of the solution whenever i come across such solutions. Also would be good if someone can throw some light on what other kinds of problems they have seen which are difficult(time complexity wise) but using XOR gives an elegant and time efficient solution. --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: is it correct??
Its not a standard, it is one of the gcc extension i.e variable length arrays. Memory allocation is done dynamically from stack in such case. On Tue, Jun 14, 2011 at 8:27 PM, kartik sachan kartik.sac...@gmail.comwrote: it is correct ...in c++ 4.3.2 compiler -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Vipul -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Find shortest substring that is only occurring once. in Given String
But generating a suffix tree itself is O(n2) . On Tue, Jun 14, 2011 at 7:54 PM, sunny agrawal sunny816.i...@gmail.comwrote: it must be any general string Suffix tree approach seems best both in time and space complexity On Tue, Jun 14, 2011 at 7:36 PM, Navneet Gupta navneetn...@gmail.comwrote: This looks like a good problem. Could you confirm if string contains only two characters as you mentioned in both examples or it is a general string with any characters. On Tue, Jun 14, 2011 at 6:33 PM, bittu shashank7andr...@gmail.comwrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples: s=aabbabbaab gives either bab or baa s= gives My Approaches Generate All Possible SubStrings O(N^2) puts all substrings into hashtable keep incrementing counter for each substring , return substring with counter 1 memory O(N) Not efficient Create Suffix Tree Seems to be Efficient Solution Only You Need to do Create Tree then we can find the shortest substring that is only occurring once. in O(n) time PS: let me other approaches,suggestion Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] help
according to precedence m= ++i || ++j ++k will become m = ++i || (++j ++k);NOT this m = (++i || ++j) ++k; first i gets incremented and since that gives a non-zero value the rest of the statement is not executed. On Tue, Jun 14, 2011 at 8:41 PM, nicks crazy.logic.k...@gmail.com wrote: anybody having idea about preference order ?? On Tue, Jun 14, 2011 at 4:20 AM, nicks crazy.logic.k...@gmail.com wrote: What about precedence order then. http://www.difranco.net/cop2220/op-prec.htm i mean acc. to precedence order should be evaluated before || in the second exampleresult should be k=1,j=3 and i= -2 On Mon, Jun 13, 2011 at 11:41 AM, udit sharma sharmaudit...@gmail.comwrote: hmm. Sry yr... Got it.. Thanx.. :) :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] help
bt increment operator has the higher precedence than || and so all the variables should be incremented first then and then || should be evaluated then how it is happening.plz explain rahul dixit Du-Mca -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] help
hmm...someone explain...me too confused :( On Tue, Jun 14, 2011 at 9:14 AM, rahul dixit dixit.rahu...@gmail.comwrote: bt increment operator has the higher precedence than || and so all the variables should be incremented first then and then || should be evaluated then how it is happening.plz explain rahul dixit Du-Mca -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] spoj NKTM
https://www.spoj.pl/problems/NTKM/ my code is : # includeiostream # includecstdio # includealgorithm using namespace std; int main() { long long int n; while(1) { long long int a[1]={0},i; if(scanf(%lld,n)==EOF) break; for(i=0;in;i++) scanf(%lld,a[i]); sort(a,a+n); long long int sum=0,sum1=0; sum=a[0]+a[1]; sum1=sum; for(i=2;in;i++) { sum=sum+a[i]; sum1+=sum; } printf(%lld\n,sum1); } return 0; } plzz tell me test cases where my code fails as i am getting 0 plzz help me out and tell me error... -- *WITH REGARDS,* * * *KARTIK SACHAN* *B.TECH 2ND YEAR* *COMPUTER SCIENCE AND ENGINEERING* *NIT ALLAHABAD* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] help
that is what is happening here m = ++i || (++j ++k); in C if P = Q || R; first it checks Q if that is NOT true then it computes C else it doesn't. ++ is a unary operator so before the || and operations can happen increment will take place. This justifies the higher precedence of ++ operator. in the above example i gets incremented to -2 first and then || operation is executed. i has a non-zero value therefore no computation is done for (++j ++k); . keep initial value of i to -1 then after m = ++i || (++j ++k); statement i = 0 , j = 3 , k =1 and m =1 On Tue, Jun 14, 2011 at 10:02 PM, nicks crazy.logic.k...@gmail.com wrote: hmm...someone explain...me too confused :( On Tue, Jun 14, 2011 at 9:14 AM, rahul dixit dixit.rahu...@gmail.comwrote: bt increment operator has the higher precedence than || and so all the variables should be incremented first then and then || should be evaluated then how it is happening.plz explain rahul dixit Du-Mca -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] help
first it checks Q if that is NOT true then it computes R else it doesn't. this is the correct line . On Tue, Jun 14, 2011 at 10:21 PM, snehi jain snehijai...@gmail.com wrote: that is what is happening here m = ++i || (++j ++k); in C if P = Q || R; first it checks Q if that is NOT true then it computes C else it doesn't. ++ is a unary operator so before the || and operations can happen increment will take place. This justifies the higher precedence of ++ operator. in the above example i gets incremented to -2 first and then || operation is executed. i has a non-zero value therefore no computation is done for (++j ++k); . keep initial value of i to -1 then after m = ++i || (++j ++k); statement i = 0 , j = 3 , k =1 and m =1 On Tue, Jun 14, 2011 at 10:02 PM, nicks crazy.logic.k...@gmail.comwrote: hmm...someone explain...me too confused :( On Tue, Jun 14, 2011 at 9:14 AM, rahul dixit dixit.rahu...@gmail.comwrote: bt increment operator has the higher precedence than || and so all the variables should be incremented first then and then || should be evaluated then how it is happening.plz explain rahul dixit Du-Mca -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: spoj NKTM
got AC silliy mistake i am sorting array only one time.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: spoj NKTM
case like 5 1 2 3 45 got worng ans -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Swapping two variables without using a temporary variable
@sunny... yeah sorry, m stupid..:) thanx On Tue, Jun 14, 2011 at 10:52 AM, sunny agrawal sunny816.i...@gmail.comwrote: @tech rascal 10 = 01010 20 = 10100 -- xor = 0 = 30 why r u getting 1 ?? On Tue, Jun 14, 2011 at 2:28 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: @Wladimir: Can you kindly explain the overflow and underflow you mentioned. Thanks Supraja J On Fri, Jun 10, 2011 at 9:58 PM, Wladimir Tavares wladimir...@gmail.comwrote: Swapping two variables without using a temporary variable using the + and -: x = a; y = b; x = x + y / / x = a + b; y = x - y / / y = a + b-b = a; x = x - y / / x = a + b-a = b; y = b; x = a; Problems with this approach: 1) It can cause overflow in the operation (+) 2) It can cause underflow on operation (-) Swapping two variables without using variables Temporary using XOR: x = a; y = b; x = x ^ y; y = x ^ y / / y = (x xor y) xor y = x xor (y xor y) xor x = 0 = x x = x ^ y / / x = (x xor y) xor x = (x xor y) xor y xor x = (x xor x) = y xor y = 0 Note that we use some properties of XOR: 1) Associativity 2) Commutativity 3) X = X 0 XOR We have no problems neither underflow nor overflow! Wladimir Araujo Tavares *Federal University of Ceará * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: MS Question
@Sunny: what if the number is repeated multiple times? u seem to consider only the duplicates(2 times). On Jun 13, 7:36 pm, sunny agrawal sunny816.i...@gmail.com wrote: no we can take care of duplicates without any extra memory modify 2nd step of my previous solution as follows if T[a[i]] is set then this element is there in second array so report this element and Reset T[a[i]]. now no duplicates will be reported. and only 1025 bits will be required. any failures ?? -- 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.
[algogeeks] Java Developer Needed in PA -- F2F required -- Rate: $45/hr on C2C
Hello Associate, Please go through the below requirement and let me know if you have any consultants for the below position. Job Title: Java Developer Location: Pittsburgh, PA Duration: 2-3 Months Rate: $45/hour C2C Description: The candidate should be well versed with the following technologies, tools versions: Java / J2EE / XML / Database Concepts (DB2-UDB) / SQL / Application Servers (WebLogic/JBoss/Tomcat) Experience server-side development using following technologies: Java, Java Script, SQL, DB2-UDB, TCF Framework, EJB, Servlets, JSP, JDBC, JNDI, JSSE, JMS, Struts, RMI, UDDI, WSDL, SOAP, AJAX, JAXP, JAXB, XML/XSL, HTML, XML Schemas and deployed on J2EE/XML platforms Experience in Design, Development of Java Web Services using XML, SOAP, WSDL Proficient in using TCF Framework and experience with RAD Tool Very Strong OOAD concepts Extensive experience in Object Oriented software development life cycle analysis, design, development, implementation, testing and maintenance of Internet based web applications Experience with Teradata a plus Teradata Relationship Management Teradata Reporting Thanks, Leon Parker - l...@panzersolutions.com 203-983-9475 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: MS Question
i meant if N = { 1, 1, 1, 2, 12} and M = { 1, 1, 3, 12} then answer should be = {1, 1, 12} On Mon, Jun 13, 2011 at 8:06 PM, sunny agrawal sunny816.i...@gmail.comwrote: no we can take care of duplicates without any extra memory modify 2nd step of my previous solution as follows if T[a[i]] is set then this element is there in second array so report this element and Reset T[a[i]]. now no duplicates will be reported. and only 1025 bits will be required. any failures ?? -- 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. -- Regards, Arpit Sood -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] [brain teaser ] Probability Riddle Loaded Revolver 13 june
henry will give the answer that will favour to save him.. so if rotated then probab. of getting safe is 2/3=0.666 and if not rotated then probab. of getting safe is 3/4=0.75 so its better to not to rotate.. On Tue, Jun 14, 2011 at 12:36 AM, Arpit Sood soodfi...@gmail.com wrote: +1 to Kunal's post i think if you rotate again prob. of getting shot is 1/3 and not 1/2 On Mon, Jun 13, 2011 at 11:56 PM, sunny agrawal sunny816.i...@gmail.comwrote: @Douglas i don't understand your probablity analysis but still for Rotate again as in your analysis 2/6+1/6 = 1/2 pull the triiger again is still better although my thinking was same as kunal explained On Mon, Jun 13, 2011 at 11:20 PM, Douglas Diniz dgdi...@gmail.comwrote: Six-chambered revolver, so 2 bullets in sequence is the same as 1 bullet in Five-chambered. So, pull the trigger again = 1/5 + 1/5 = 2/5 (to die) Rotate again = 2/6 + 1/6 = 1/3 (to die) So, is better to rotate again On Mon, Jun 13, 2011 at 2:35 PM, Kunal Patil kp101...@gmail.com wrote: Assuming everything is unbiased: probability of the next slot to contain a bullet (given, first was empty) would be (1/4) = 0.25 After spinning: prob(bullet) = (2/6) = 0.334... We want to minimize the probability... thus answer should be just to pull the trigger again.. On Mon, Jun 13, 2011 at 1:40 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: ignore the above answerit shouldn't rotate again... On Mon, Jun 13, 2011 at 1:37 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: should rotate again.. On Mon, Jun 13, 2011 at 1:12 PM, sunny agrawal sunny816.i...@gmail.com wrote: Pull the Trigger Again ?? On Mon, Jun 13, 2011 at 1:01 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: Probability Riddle Loaded Revolver - 13 June Henry has been caught stealing cattle, and is brought into town for justice. The judge is his ex-wife Gretchen, who wants to show him some sympathy, but the law clearly calls for two shots to be taken at Henry from close range. To make things a little better for Henry, Gretchen tells him she will place two bullets into a six-chambered revolver in successive order. She will spin the chamber, close it, and take one shot. If Henry is still alive, she will then either take another shot, or spin the chamber again before shooting. Henry is a bit incredulous that his own ex-wife would carry out the punishment, and a bit sad that she was always such a rule follower. He steels himself as Gretchen loads the chambers, spins the revolver, and pulls the trigger. Whew! It was blank. Then Gretchen asks, 'Do you want me to pull the trigger again, or should I spin the chamber a second time before pulling the trigger?' What should Henry choose? Update Your Answers at : Click Here Solution: Will be updated after 1 day -- 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. -- 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. -- Piyush Sinha IIIT, Allahabad +91-8792136657 +91-7483122727 https://www.facebook.com/profile.php?id=10655377926 -- 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. -- --- Douglas Gameiro Diniz Engenheiro de Computação - 2003 - UNICAMP Mobile: (19) 92158777 Gtalk: dgdiniz
[algogeeks] Re: Find shortest substring that is only occurring once. in Given String
@Akshay Suffix tree construction is O(n) On Jun 14, 8:58 pm, Akshay Rastogi akr...@gmail.com wrote: But generating a suffix tree itself is O(n2) . On Tue, Jun 14, 2011 at 7:54 PM, sunny agrawal sunny816.i...@gmail.comwrote: it must be any general string Suffix tree approach seems best both in time and space complexity On Tue, Jun 14, 2011 at 7:36 PM, Navneet Gupta navneetn...@gmail.comwrote: This looks like a good problem. Could you confirm if string contains only two characters as you mentioned in both examples or it is a general string with any characters. On Tue, Jun 14, 2011 at 6:33 PM, bittu shashank7andr...@gmail.comwrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples: s=aabbabbaab gives either bab or baa s= gives My Approaches Generate All Possible SubStrings O(N^2) puts all substrings into hashtable keep incrementing counter for each substring , return substring with counter 1 memory O(N) Not efficient Create Suffix Tree Seems to be Efficient Solution Only You Need to do Create Tree then we can find the shortest substring that is only occurring once. in O(n) time PS: let me other approaches,suggestion Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Find shortest substring that is only occurring once. in Given String
@bittu How can u find the shortest substring from the tree in 0(n). Can u please elaborate a bit ? On Jun 14, 6:03 pm, bittu shashank7andr...@gmail.com wrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples: s=aabbabbaab gives either bab or baa s= gives My Approaches Generate All Possible SubStrings O(N^2) puts all substrings into hashtable keep incrementing counter for each substring , return substring with counter 1 memory O(N) Not efficient Create Suffix Tree Seems to be Efficient Solution Only You Need to do Create Tree then we can find the shortest substring that is only occurring once. in O(n) time PS: let me other approaches,suggestion Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Swapping two variables without using a temporary variable
Have you tested your claim regarding overflow/underflow and proved it is indeed a problem, or you just thought that it won't work? Using two's complement, it should still work. On Friday, June 10, 2011, Wladimir Tavares wladimir...@gmail.com wrote: Swapping two variables without using a temporary variable using the + and -: x = a; y = b; x = x + y / / x = a + b; y = x - y / / y = a + b-b = a; x = x - y / / x = a + b-a = b; y = b; x = a; Problems with this approach: 1) It can cause overflow in the operation (+) 2) It can cause underflow on operation (-) Swapping two variables without using variables Temporary using XOR: x = a; y = b; x = x ^ y; y = x ^ y / / y = (x xor y) xor y = x xor (y xor y) xor x = 0 = x x = x ^ y / / x = (x xor y) xor x = -- Fear of the LORD is the beginning of knowledge (Proverbs 1:7) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: FOR ALL INDIANS PLZ READ IT
Hi buddy, nominate me as a group member my id is: the.um...@gmail.com On Mon, Jun 13, 2011 at 12:03 AM, shady sinv...@gmail.com wrote: Vishwakarma deok...@gmail.com Arpit Sood soodfi...@gmail.com @kartik could have given your name had you read the post carefully. Shady. On Mon, Jun 13, 2011 at 12:22 AM, kartik sachan kartik.sac...@gmail.comwrote: hey dude nominate me as a group moderator kartik.sac...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Umer -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: FOR ALL INDIANS PLZ READ IT
+1 I really like this group ... but sometimes people get rude and show prejudice attitude towards me. I hope the admin takes notice of one of the comment posted above :) On Mon, Jun 13, 2011 at 12:30 AM, Divye Kapoor divyekap...@gmail.comwrote: While you're on this - could we have a policy that the first time someone uses obscene language against another member of the group, he's warned by an admin and a second violation will lead to a banning from the group? We're a civil bunch of people, let's hope to remain so. :) Please +1 if you support the motion. (Also, post other admin candidates). Thanks, DK On Jun 13, 12:07 am, Rahul Sharma royaltours...@gmail.com wrote: Balaji.S balaji.ceg...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Umer -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 doubt..
On Jun 13, 11:43 am, snehi jain snehijai...@gmail.com wrote: hi, we try to implement many programs using Recursion and its said that this is better than iterative procedure. if i am right then i cant understand why is it so? can anybody explain ... and are there situations when iterative procedure is better than recursion. Snehi Don't believe everything that you hear or read. ;-) If your instructor tells you simply that, recursion is better than iteration, you may want to go find a better (or more experienced) instructor. If your instructor tells you simply that, iteration is better than recursion, you may want to go find a better (or more experienced) instructor. You often see small factorial algorithms used as a demonstration of recursion. Does that mean that recursion is the way to go to do factorials? I'd consider the following four points before going with recursion or iteration: Code readability and complexity ( or simplicity ) Execution time Resource management ( memory usage, etc ) The language you're using and it's strengths/weaknesses QuickSort is usually demonstrated using recursion. But... non- recursive QuickSort is blazingly fast and isn't as likely to plow through your resources. I've seen a LOT of quicksort algorithms on the net. But... I don't recall seeing one yet that I would consider in a production code that had to sort large data sets. I'm not saying that one doesn't exist. But... I've not yet run across it. Just my opinion, Dan :-) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Find shortest substring that is only occurring once. in Given String
Traversal the suffix tree is enough. All substrings from root to leaf (including at least 1 character of leaf node) occur only once. Choose the shortest among them. On 2011-6-15 5:28, T3rminal wrote: @bittu How can u find the shortest substring from the tree in 0(n). Can u please elaborate a bit ? On Jun 14, 6:03 pm, bittushashank7andr...@gmail.com wrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples: s=aabbabbaab gives either bab or baa s= gives My Approaches Generate All Possible SubStrings O(N^2) puts all substrings into hashtable keep incrementing counter for each substring , return substring with counter 1 memory O(N) Not efficient Create Suffix Tree Seems to be Efficient Solution Only You Need to do Create Tree then we can find the shortest substring that is only occurring once. in O(n) time PS: let me other approaches,suggestion Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: remove duplicate chars in a string without using extra memory
@akash:can u please explain your code...? On Mon, Jun 13, 2011 at 2:27 AM, Divye Kapoor divyekap...@gmail.com wrote: No extra memory except input buffer: O(n log n) time O(n) space (can't do better than this). https://github.com/swagatata/ds_and_algos/blob/master/cpp/trivia/remove_duplicates_without_extra_memory.cpp If O(1) extra memory is allowed: O(n) time and O(1) space. https://github.com/swagatata/ds_and_algos/blob/master/cpp/trivia/remove_duplicates_one_pass.cpp The code is terse but completely correct. Will leave you guys to figure it out by googling. :) -- DK -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/D9CL-Juk0ycJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Puzzles....NOT Spam
I am not able to logincan u help me... On Mon, Jun 13, 2011 at 12:17 AM, ADITYA KUMAR aditya...@gmail.com wrote: http://www.freepuzzles.com This is the best site for quality puzzles, But solutions are not given... so i request members ,try to solve these puzzles and post their solutions to this thread -- Regards Aditya Kumar B-tech 3rd year Computer Science Engg. MNNIT, Allahabad. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
RE: [algogeeks] Swapping two variables without using a temporary variable
Adding two huge no will cross the integer or what's its range will fall under overflow categories same case goes to negative which fall under underflow .. In both the case numbers will change.. For example no range is -10 to 10 so if x =5 and y=7 then addition will produce the result -9 so u can see we r loosing number this is a overflow same for negative number will produce underflow Thanks Umesh Sent from my Windows Phone -- From: Supraja Jayakumar Sent: Tuesday, June 14, 2011 2:28 AM To: algogeeks@googlegroups.com Subject: Re: [algogeeks] Swapping two variables without using a temporary variable @Wladimir: Can you kindly explain the overflow and underflow you mentioned. Thanks Supraja J On Fri, Jun 10, 2011 at 9:58 PM, Wladimir Tavares wladimir...@gmail.comwrote: Swapping two variables without using a temporary variable using the + and -: x = a; y = b; x = x + y / / x = a + b; y = x - y / / y = a + b-b = a; x = x - y / / x = a + b-a = b; y = b; x = a; Problems with this approach: 1) It can cause overflow in the operation (+) 2) It can cause underflow on operation (-) Swapping two variables without using variables Temporary using XOR: x = a; y = b; x = x ^ y; y = x ^ y / / y = (x xor y) xor y = x xor (y xor y) xor x = 0 = x x = x ^ y / / x = (x xor y) xor x = (x xor y) xor y xor x = (x xor x) = y xor y = 0 Note that we use some properties of XOR: 1) Associativity 2) Commutativity 3) X = X 0 XOR We have no problems neither underflow nor overflow! Wladimir Araujo Tavares *Federal University of Ceará * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] output
int a,c=5; a=c++ + ++c + c++ + ++c; printf(%d\n,a); c=5; a=c++ + ++c + c++; printf(%d\n,a); c=5; a=++c + ++c; printf(%d\n,a); c=5; a=++c + ++c + ++c; printf(%d\n,a); compiled with gcc and the outputs are 25 18 14 22 can anyone plz explain these outputs -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Find shortest substring that is only occurring once. in Given String
@t3rminal: k On Wed, Jun 15, 2011 at 7:05 AM, Terence technic@gmail.com wrote: Traversal the suffix tree is enough. All substrings from root to leaf (including at least 1 character of leaf node) occur only once. Choose the shortest among them. On 2011-6-15 5:28, T3rminal wrote: @bittu How can u find the shortest substring from the tree in 0(n). Can u please elaborate a bit ? On Jun 14, 6:03 pm, bittushashank7andr...@gmail.com wrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples: s=aabbabbaab gives either bab or baa s= gives My Approaches Generate All Possible SubStrings O(N^2) puts all substrings into hashtable keep incrementing counter for each substring , return substring with counter 1 memory O(N) Not efficient Create Suffix Tree Seems to be Efficient Solution Only You Need to do Create Tree then we can find the shortest substring that is only occurring once. in O(n) time PS: let me other approaches,suggestion Thanks Shashank CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: FOR ALL INDIANS PLZ READ IT
Vas happening forum ?? On Mon, Jun 13, 2011 at 5:59 PM, Umer Farooq the.um...@gmail.com wrote: +1 I really like this group ... but sometimes people get rude and show prejudice attitude towards me. I hope the admin takes notice of one of the comment posted above :) On Mon, Jun 13, 2011 at 12:30 AM, Divye Kapoor divyekap...@gmail.comwrote: While you're on this - could we have a policy that the first time someone uses obscene language against another member of the group, he's warned by an admin and a second violation will lead to a banning from the group? We're a civil bunch of people, let's hope to remain so. :) Please +1 if you support the motion. (Also, post other admin candidates). Thanks, DK On Jun 13, 12:07 am, Rahul Sharma royaltours...@gmail.com wrote: Balaji.S balaji.ceg...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Umer -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: HASHIT
You can check the modified code at http://ideone.com/7NFTd and got AC at spoj Thanks Rahul Singal Computer Science Department BITS PILANI -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: FOR ALL INDIANS PLZ READ IT
Hi Sharad, Just see the active members in the recent past and those who have done the maximum post recently. And add that to the moderator list. We don't want many moderators here 2 active ones will do it. I think one of them can be dave don't know his id. On Wed, Jun 15, 2011 at 10:28 AM, Akshay Rastogi akr...@gmail.com wrote: Vas happening forum ?? On Mon, Jun 13, 2011 at 5:59 PM, Umer Farooq the.um...@gmail.com wrote: +1 I really like this group ... but sometimes people get rude and show prejudice attitude towards me. I hope the admin takes notice of one of the comment posted above :) On Mon, Jun 13, 2011 at 12:30 AM, Divye Kapoor divyekap...@gmail.comwrote: While you're on this - could we have a policy that the first time someone uses obscene language against another member of the group, he's warned by an admin and a second violation will lead to a banning from the group? We're a civil bunch of people, let's hope to remain so. :) Please +1 if you support the motion. (Also, post other admin candidates). Thanks, DK On Jun 13, 12:07 am, Rahul Sharma royaltours...@gmail.com wrote: Balaji.S balaji.ceg...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Umer -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Cheers Naveen Kumar -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] output
Google sequence points. The C Standard states that between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. So, expressions like i++ + ++i can produces different results on different compilers. Its not a standard expression a per Standard. On Wed, Jun 15, 2011 at 9:47 AM, Bhavesh agrawal agr.bhav...@gmail.comwrote: int a,c=5; a=c++ + ++c + c++ + ++c; printf(%d\n,a); c=5; a=c++ + ++c + c++; printf(%d\n,a); c=5; a=++c + ++c; printf(%d\n,a); c=5; a=++c + ++c + ++c; printf(%d\n,a); compiled with gcc and the outputs are 25 18 14 22 can anyone plz explain these outputs -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Harshal Choudhary, III Year B.Tech CSE, NIT Surathkal, Karnataka, India. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Java Developer Needed in PA -- F2F required -- Rate: $45/hr on C2C
moderators, please ban leon.pan...@gmail.com On Wed, Jun 15, 2011 at 1:00 AM, Leon Parker leon.pan...@gmail.com wrote: Hello Associate, Please go through the below requirement and let me know if you have any consultants for the below position. Job Title: Java Developer Location: Pittsburgh, PA Duration: 2-3 Months Rate: $45/hour C2C Description: The candidate should be well versed with the following technologies, tools versions: Java / J2EE / XML / Database Concepts (DB2-UDB) / SQL / Application Servers (WebLogic/JBoss/Tomcat) Experience server-side development using following technologies: Java, Java Script, SQL, DB2-UDB, TCF Framework, EJB, Servlets, JSP, JDBC, JNDI, JSSE, JMS, Struts, RMI, UDDI, WSDL, SOAP, AJAX, JAXP, JAXB, XML/XSL, HTML, XML Schemas and deployed on J2EE/XML platforms Experience in Design, Development of Java Web Services using XML, SOAP, WSDL Proficient in using TCF Framework and experience with RAD Tool Very Strong OOAD concepts Extensive experience in Object Oriented software development life cycle analysis, design, development, implementation, testing and maintenance of Internet based web applications Experience with Teradata a plus Teradata Relationship Management Teradata Reporting Thanks, Leon Parker - l...@panzersolutions.com 203-983-9475 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Harshal Choudhary, III Year B.Tech CSE, NIT Surathkal, Karnataka, India. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] output
@ Harshal, you are absolutely right. Again, this kind of code is highly discouraged when used in real life projects. And there is no need to go into details of how to evaluate such expressions, which are not complying to standards. On Wed, Jun 15, 2011 at 10:49 AM, Harshal hc4...@gmail.com wrote: Google sequence points. The C Standard states that between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. So, expressions like i++ + ++i can produces different results on different compilers. Its not a standard expression a per Standard. On Wed, Jun 15, 2011 at 9:47 AM, Bhavesh agrawal agr.bhav...@gmail.com wrote: int a,c=5; a=c++ + ++c + c++ + ++c; printf(%d\n,a); c=5; a=c++ + ++c + c++; printf(%d\n,a); c=5; a=++c + ++c; printf(%d\n,a); c=5; a=++c + ++c + ++c; printf(%d\n,a); compiled with gcc and the outputs are 25 18 14 22 can anyone plz explain these outputs -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Harshal Choudhary, III Year B.Tech CSE, NIT Surathkal, Karnataka, India. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: MS Question
Nice Confusion... :) Consider the following case A[M] = {1,1,3,12}; B[N] = {1,2,12} here again i think answer should be {1,1,12} , why are u binding one occurrence of 1 in array A with one in B. Question is which elements of first array is present in second array. so for this case A[0], A[1], A[3] are present so answer should be still {1,1,12} whether or not it occurs multiple times in B. now the question remains is whether to report duplicate entries or not. both have been handled above with same time and space complexity. Any Questions are Welcome :) On Wed, Jun 15, 2011 at 1:08 AM, Arpit Sood soodfi...@gmail.com wrote: i meant if N = { 1, 1, 1, 2, 12} and M = { 1, 1, 3, 12} then answer should be = {1, 1, 12} On Mon, Jun 13, 2011 at 8:06 PM, sunny agrawal sunny816.i...@gmail.comwrote: no we can take care of duplicates without any extra memory modify 2nd step of my previous solution as follows if T[a[i]] is set then this element is there in second array so report this element and Reset T[a[i]]. now no duplicates will be reported. and only 1025 bits will be required. any failures ?? -- 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. -- Regards, Arpit Sood -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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.