[algogeeks] Java Book

2011-06-13 Thread Anurag Gupta
Please suggest any good book for Java (for beginners) Thanks in advance :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Cloud Project

2011-06-13 Thread Akash Mukherjee
+1 On Mon, Jun 13, 2011 at 4:47 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: Hi All Can someone suggest a simple application that I can develop and host on Azure. I have very little web based programming experience and have some knowledge with .net but nothing major. I am

[algogeeks] [brain teaser ] Probability Riddle Loaded Revolver 13 june

2011-06-13 Thread Lavesh Rawat
*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

Re: [algogeeks] [brain teaser ] Probability Riddle Loaded Revolver 13 june

2011-06-13 Thread sunny agrawal
Pull the Trigger Again ?? On Mon, Jun 13, 2011 at 1:01 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *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

Re: [algogeeks] [brain teaser ] Probability Riddle Loaded Revolver 13 june

2011-06-13 Thread Piyush Sinha
should rotate again.. On Mon, Jun 13, 2011 at 1:12 PM, sunny agrawal sunny816.i...@gmail.comwrote: Pull the Trigger Again ?? On Mon, Jun 13, 2011 at 1:01 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Probability Riddle Loaded Revolver - 13* June * * ** *Henry has been caught

Re: [algogeeks] [brain teaser ] Probability Riddle Loaded Revolver 13 june

2011-06-13 Thread Piyush Sinha
ignore the above answerit shouldn't rotate again... On Mon, Jun 13, 2011 at 1:37 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: should rotate again.. On Mon, Jun 13, 2011 at 1:12 PM, sunny agrawal sunny816.i...@gmail.comwrote: Pull the Trigger Again ?? On Mon, Jun 13, 2011 at 1:01

Re: [algogeeks] Java Book

2011-06-13 Thread karan sachan
You can go for Thinking in Java by Bruce Eckel or books authored by Hortsman...both are equally good!! On Mon, Jun 13, 2011 at 11:35 AM, Anurag Gupta anurag.gupta...@gmail.comwrote: Please suggest any good book for Java (for beginners) Thanks in advance :) -- You received this message

[algogeeks] Re: How to remove duplicate element from array in one pass.

2011-06-13 Thread ross
@sunny agarwal: Yes, it would be considered constant space.. even if it required 1MB of space . By big oh notation of space, we mean cases where input size, 'n' tends to infinity and the space requirement of the algorithm proposed does not approach infinity. here, even if n-infinity, input size

[algogeeks] Re: Mathematical Induction

2011-06-13 Thread ross
@howtechstuffworks: Your question seems to be - why 'k+1' and not 'k+2' or 'k+3' or something else. The simple reason is that, Given that P('k') and P('k+1') is true, we can extend it for ANY value of k. (ie) k+2 , can be derived from 'k+1' by substituting k=k+1. similarly k+3 can be

Re: [algogeeks] Re: How to remove duplicate element from array in one pass.

2011-06-13 Thread sunny agrawal
@ross thanks for clarification... On Mon, Jun 13, 2011 at 2:46 PM, ross jagadish1...@gmail.com wrote: @sunny agarwal: Yes, it would be considered constant space.. even if it required 1MB of space . By big oh notation of space, we mean cases where input size, 'n' tends to infinity and

Re: [algogeeks] find error

2011-06-13 Thread kartik sachan
amit it is working fine in gcc complier and giving out too i.e 10 what's error in 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

[algogeeks] hw can argv be incremented

2011-06-13 Thread himanshu kansal
char *a[10]; a++;//lvalue reqd error.. i knw dt base address f array cnt be incremented. bt following code compiles succesfully int main(int argc, char *argv[]) { printf(%s, *++argv); } can some one xplain why this is happening similarly int foo(int *blah[10]) { int *f[10];

[algogeeks] Re: Cloud Project

2011-06-13 Thread Supraja
Hi Sorry. What does that mean ? Thanks Supraja J On Jun 13, 12:45 am, Akash Mukherjee akash...@gmail.com wrote: +1 On Mon, Jun 13, 2011 at 4:47 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: Hi All Can someone suggest a simple application that I can develop and host on

[algogeeks] Re: Topcoder Escape problem

2011-06-13 Thread Divye Kapoor
This is a standard shortest path problem. Use Dijkstras. Make a graph with edge costs based on the square's nature - Harmful or Deadly. Mark edge costs for Deadly as infinity. Find the cost of the shortest path. You can also use Bellman Ford algorithm which would be simpler to implement in this

[algogeeks] Re: Topcoder Escape problem

2011-06-13 Thread Divye Kapoor
You could also use a priority queue based search (A*) where you explore all vertices with cost 0 before exploring all vertices with cost 1 etc. Essentially, that is the same as Dijkstra's in this case. -- DK -- You received this message because you are subscribed to the Google Groups

[algogeeks] MS Question

2011-06-13 Thread Supraja Jayakumar
Question: An array is of size N with integers between 0 and 1024(repetitions allowed). Another array of integers is of size M with no constraints on the numbers. Find which elements of first array are present in the second array. (If you are using extra memory, think of minimizing that still,

[algogeeks] Re: MS Question

2011-06-13 Thread Divye Kapoor
Use a hash table of size 1025 with bits per table entry = 2. 1. Go through the N sized array and set bit 0 of the hash table entry to 1 if it is present in the first array. 2. Go through the M sized array and set bit 1 of the hash table entry to 1 if the element belongs to 0 to 1024. 3. Go

[algogeeks] Re: Cloud Project

2011-06-13 Thread Divye Kapoor
It means that he's supporting your motion. -- DK Follow me on Twitter: http://twitter.com/divyekapoor -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Re: MS Question

2011-06-13 Thread sunny agrawal
why do we need 2 bits at all ?? i think single bit per table entry will do. say table is T[1025], and array is A[M] 1. Go through the N sized array and set bit 0 of the hash table entry to 1 if it is present in the first array. 2. Go through the M sized array and if T[a[i]] is set then this

Re: [algogeeks] Re: Cloud Project

2011-06-13 Thread karan sachan
Friends..read more about *SaaS* aka Software as a Service...where you can host your software on cloud as a service.It's better to start making a small SaaS app...hosting is a cake walk!! On Mon, Jun 13, 2011 at 5:29 PM, Divye Kapoor divyekap...@gmail.com wrote: It means that he's supporting

[algogeeks] help

2011-06-13 Thread sahil
can sme body tell me..? 1) #include stdio.h int main() { int i= -3, j=2 ,k=0, m; m= ++i ++j || ++k; printf(%d %d %d %d\n,i,j,k,m); return 0; } output: -2 3 0 1 2)#include stdio.h int main() { int i= -3, j=2 ,k=0, m; m= ++i || ++j ++k; printf(%d %d %d %d\n,i,j,k,m); return 0; }

[algogeeks] Re: Java Book

2011-06-13 Thread naivenow
The Complete Reference By Herbert Shildt is comprehensive. You can also look up some tutorials on youtube :) On Jun 13, 11:05 am, Anurag Gupta anurag.gupta...@gmail.com wrote: Please suggest any good book for Java (for beginners) Thanks in advance :) -- You received this message because you

[algogeeks] How better way to make a controller class ?

2011-06-13 Thread Luciano Junior
Your boss asks you to do a program that maintains the database of customers updated. You need to dotNet using MVC. For you, what may be the best way to create a control class to access and update data from customers? Luciano Pinheiro. -- You received this message because you are subscribed to

Re: [algogeeks] Re: MS Question

2011-06-13 Thread Arpit Sood
we can take care of the duplicate entries, but then that would cost more space(int), as of now we are working with bool On Mon, Jun 13, 2011 at 5:51 PM, sunny agrawal sunny816.i...@gmail.comwrote: that will report duplicate entries multiple times :( On Mon, Jun 13, 2011 at 5:38 PM, sunny

Re: [algogeeks] help

2011-06-13 Thread prateek gupta
the expression involving and and or operator is evaluated from left to right uptill the point from where the value of the expression can be determined. On Mon, Jun 13, 2011 at 6:17 PM, Shachindra A C sachindr...@gmail.comwrote: || and operators are called short circuit operators and need not

Re: [algogeeks] Re: MS Question

2011-06-13 Thread sunny agrawal
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

Re: [algogeeks] MS Interview

2011-06-13 Thread 李峰
A1.bitmap. A2.xor. On Thu, Jun 09, 2011 at 02:45:48AM -0700, Dumanshu wrote: Q1. I have a file in which there are supposed to be 4 billion numbers, starting from 1 to 4,000,000,000 but unfortunately one number is missing, i.e there are only 3,999,999,999 numbers, I need to find the

Re: [algogeeks] Re: MS Interview

2011-06-13 Thread Ashish Goel
suppose numbers are 11,12,13,15 then you get some xor_val for xor of all these numbers after this for (int i=11;i=15;i++) xor_val ^=i; now xor_val is 14 Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sun, Jun 12, 2011 at 9:24 PM, Supraja

Re: [algogeeks] Re: Java Book

2011-06-13 Thread monty 1987
The best book is effective java ...but it is not for beginners but SCJP java book is marvellous !!! On Mon, Jun 13, 2011 at 5:59 AM, naivenow black.b...@gmail.com wrote: The Complete Reference By Herbert Shildt is comprehensive. You can also look up some tutorials on youtube :) On Jun

Re: [algogeeks] help

2011-06-13 Thread sahil sharma
ok i got the values of i ,j ,k ,.in all the 3 codes but can u please explain me how we get the value of m =1 in all the 3 program.? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] help

2011-06-13 Thread sunny agrawal
because in all expression is evaluated to true. On Mon, Jun 13, 2011 at 10:02 PM, sahil sharma sahil18...@gmail.com wrote: ok i got the values of i ,j ,k ,.in all the 3 codes but can u please explain me how we get the value of m =1 in all the 3 program.? -- You received

Re: [algogeeks] Re: Java Book

2011-06-13 Thread Puneet Ginoria
Java in 60 Minutes A Day.. by Rich Raposa.. its a good book for begginers... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] [brain teaser ] Probability Riddle Loaded Revolver 13 june

2011-06-13 Thread Kunal Patil
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

Re: [algogeeks] [brain teaser ] Probability Riddle Loaded Revolver 13 june

2011-06-13 Thread Douglas Diniz
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:

Re: [algogeeks] Re: Print 1 to n without loops

2011-06-13 Thread Kunal Patil
@Divye Kapoor : It was interesting...use of inheritance concept to print that... On Mon, Jun 13, 2011 at 12:09 AM, Divye Kapoor divyekap...@gmail.comwrote: This will probably be the best solution yet ;) Compile time template metaprogramming: templateint N class X : public XN-1 { public:

Re: [algogeeks] help

2011-06-13 Thread udit sharma
Bt y k=0, in 2nd code??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options,

Re: [algogeeks] help

2011-06-13 Thread sunny agrawal
m= ++i || ++j ++k; ++i will evauate to 3 and which is true so as next is || so next part will not be evaluated and m = true On Mon, Jun 13, 2011 at 11:34 PM, udit sharma sharmaudit...@gmail.comwrote: Bt y k=0, in 2nd code??? -- You received this message because you are subscribed to the

Re: [algogeeks] help

2011-06-13 Thread udit sharma
@Sunny: Thn y k=1 in 2nd code??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] help

2011-06-13 Thread udit sharma
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

Re: [algogeeks] [brain teaser ] Probability Riddle Loaded Revolver 13 june

2011-06-13 Thread Arpit Sood
+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

Re: [algogeeks] Re: Java Book

2011-06-13 Thread snehi jain
sams teach yourself JAVA in 21 days is a book that gives idea about every topic and then you can study in detail. On Mon, Jun 13, 2011 at 11:16 PM, vaibhav shukla vaibhav200...@gmail.comwrote: @monty 1987 : can u plss send me the book u'r talking of .Thank you!! On Mon, Jun 13, 2011 at

[algogeeks] A good one if you are not aware of... ( why % operator is costly)

2011-06-13 Thread HowTechStuffWorks
http://geeksforgeeks.org/?p=9057 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more

[algogeeks] a doubt..

2011-06-13 Thread snehi jain
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

Re: [algogeeks] a doubt..

2011-06-13 Thread ADITYA KUMAR
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

Re: [algogeeks] Re: Swapping two variables without using a temporary variable

2011-06-13 Thread tech rascal
just a small doubt. if x=10 and y=20 thn wht wud b the value of (x ^ y)? acc to meit has to be 1 bt if the value is 1 , thn how wud the method using XOR operations work?.plz xplain On Mon, Jun 13, 2011 at 3:18 AM, KK kunalkapadi...@gmail.com wrote: @kunal Actually its not same

Re: [algogeeks] Re: Swapping two variables without using a temporary variable

2011-06-13 Thread Felipe Ferreri Tonello
On 06/13/2011 05:22 PM, tech rascal wrote: just a small doubt. if x=10 and y=20 thn wht wud b the value of (x ^ y)? acc to meit has to be 1 bt if the value is 1 , thn how wud the method using XOR operations work?.plz xplain On Mon, Jun 13, 2011 at 3:18 AM, KK

Re: [algogeeks] a doubt..

2011-06-13 Thread Supraja Jayakumar
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

Re: [algogeeks] Swapping two variables without using a temporary variable

2011-06-13 Thread Supraja Jayakumar
@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;

Re: [algogeeks] a doubt..

2011-06-13 Thread Navneet Gupta
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

[algogeeks] Intuitive Understanding of XOR Operation

2011-06-13 Thread Navneet Gupta
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

Re: [algogeeks] Swapping two variables without using a temporary variable

2011-06-13 Thread sunny agrawal
@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,