Re: [algogeeks] MS test

2011-08-07 Thread sukran dhawan
a On Sun, Aug 7, 2011 at 11:07 AM, programming love love.for.programm...@gmail.com wrote: What is the answer for 3rd one?? 4th is 5. -- 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] MS test

2011-08-07 Thread programming love
Why can't it be option b for 3rd one?? On Sun, Aug 7, 2011 at 11:30 AM, sukran dhawan sukrandha...@gmail.comwrote: a On Sun, Aug 7, 2011 at 11:07 AM, programming love love.for.programm...@gmail.com wrote: What is the answer for 3rd one?? 4th is 5. -- You received this message because

Re: [algogeeks] Paypal interview Questions

2011-08-07 Thread programming love
So is q 1 a C++ question?? On Sun, Aug 7, 2011 at 11:27 AM, hary rathor harry.rat...@gmail.com wrote: no c doesn't -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To

[algogeeks] MS written test qs

2011-08-07 Thread deepikaanand
can any1 plz gv the solution of the following problem ;- You have to make a package library which will do the calculation of (a^b)mod(c), where a, b, c are very large size of 1 digits. (^- power). Design a data structure for the numbers' storage and suggest what functions will you be providing

Re: [algogeeks] MS test

2011-08-07 Thread ankit sambyal
@programming love : 6.5 can be represented accurately in binary -- You received this message because you are subscribed to the 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] MS test

2011-08-07 Thread programming love
Why is it so and y can't 0.1 be represented accurately in binary?? And what about the last option?? On Sun, Aug 7, 2011 at 11:43 AM, ankit sambyal ankitsamb...@gmail.comwrote: @programming love : 6.5 can be represented accurately in binary -- You received this message because you are

Re: [algogeeks] MS test

2011-08-07 Thread ankit sambyal
@programming love : 0.1 can't be represented accurately in binary. If u try to convert it into binary, it will not terminate. Try it !! But 6.5 can be converted. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] MS written test qs

2011-08-07 Thread Ravinder Kumar
Method 1 : Use character array to store large number . Define addition subtraction function for the following representation of number . Using addition subtraction number u can write another operation for the library e.g. multiplication , division , modulus etc . Method 2 : Use Linked list to

[algogeeks] Re: Directi Question

2011-08-07 Thread Nitish Garg
@Dave - Can you please explain how did you generate the series? Shouldn't it be : 1/2 + 2(1/4) + 3(1/8) and so on? -- 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] MS test

2011-08-07 Thread programming love
And the last option?? Will that terminate too?? On Sun, Aug 7, 2011 at 11:48 AM, ankit sambyal ankitsamb...@gmail.comwrote: @programming love : 0.1 can't be represented accurately in binary. If u try to convert it into binary, it will not terminate. Try it !! But 6.5 can be converted. --

Re: [algogeeks] Re: Microsoft :)

2011-08-07 Thread programming love
@harshal: What was your score in the written round?? -- You received this message because you are subscribed to the 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] Re: Directi Question

2011-08-07 Thread shady
Dave shouldn't it be :: E(x) = Summation( xp(x) ) thus it should be 1*1/2 + 2*(1/2 * 1/2) + 3*(1/2 * 1/2 * 1/2) . On Sun, Aug 7, 2011 at 11:55 AM, Nitish Garg nitishgarg1...@gmail.comwrote: @Dave - Can you please explain how did you generate the series? Shouldn't it be : 1/2 +

Re: [algogeeks] Paypal interview Questions

2011-08-07 Thread Amol Sharma
@raghvan: take care of space complexityyou are using extra space that too O(n) in worst case... can be done in O(nlogn) else it can be done in O(n) if the given array is sorted in two traversals !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On

Re: [algogeeks] xplanation plz

2011-08-07 Thread Amol Sharma
nice :) -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Aug 7, 2011 at 8:16 AM, saurabh singh saurab...@gmail.com wrote: Yup it was due to compiler optimization.check this link now,,, http://ideone.com/f7keg On Sun, Aug 7, 2011 at 8:02 AM,

Re: [algogeeks] xplanation plz

2011-08-07 Thread Kunal Patil
@Saurabh: +1 for your second code. On Sun, Aug 7, 2011 at 12:17 PM, Amol Sharma amolsharm...@gmail.com wrote: nice :) -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Aug 7, 2011 at 8:16 AM, saurabh singh saurab...@gmail.com wrote: Yup it

Re: [algogeeks] Re: finding triplets

2011-08-07 Thread programming love
http://stackoverflow.com/questions/2032153/how-to-find-pythagorean-triplets-in-an-array-faster-than-on2 It provides a perfect solution -- 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] size -------

2011-08-07 Thread SANDEEP CHUGH
@all : In any case , it sets the padding bytes according to the alignment of largest sized element in structure on dev c++ double aligns on 8 bytes boundary .. (so output 24 bytes) whereas double aligns on 4 bytes boundary using gcc on linux... (so output 16 bytes) these are for 32 bit

Re: [algogeeks] Re: Directi question-centre of the tree

2011-08-07 Thread programming love
Traverse the tree inorder. Store the values in an array. Find the element in the middle of the array. On Sun, Aug 7, 2011 at 8:57 AM, subramania jeeva subramaniaje...@gmail.comwrote: 5 /\ 6 7 / 8 Here the centre is both 5 and 6 . we need to find both of them..:)

Re: [algogeeks] Re: Microsoft :)

2011-08-07 Thread Akshata Sharma
congrats harshal :) I screwed up my MS interview :(( On Sun, Aug 7, 2011 at 12:00 PM, programming love love.for.programm...@gmail.com wrote: @harshal: What was your score in the written round?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: GS on campus

2011-08-07 Thread Shashank Jain
what kind of puzzles? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 12:34 PM, saurabh singh saurab...@gmail.com wrote: I said also,.that is during the interviews puzzles were asked I am telling the experiences of my friends.I

Re: [algogeeks] Re: GS on campus

2011-08-07 Thread Tushar Bindal
you were not given any essay during the written round? and if you can get your friends to tell us what kind of puzzles were asked? just a bit of info on that. -- 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] Re: Directi Question

2011-08-07 Thread Kunal Patil
Probability of getting an even sum in one roll is 1/2.. Thus, expected number of rolls required to get even sum is inverse of that i.e. 2. Alternatively, Going by basics... Let P(x) be probability of getting Even sum in x rolls. P(1) = 1/2(Even) P(2) = (1/2) * (1/2) (Odd + Odd) P(3) = (1/2)

Re: [algogeeks] Re: Microsoft :)

2011-08-07 Thread Anil Arya
congooo!! Now it's time for treat..:) On Sun, Aug 7, 2011 at 12:46 PM, Akshata Sharma akshatasharm...@gmail.comwrote: congrats harshal :) I screwed up my MS interview :(( On Sun, Aug 7, 2011 at 12:00 PM, programming love love.for.programm...@gmail.com wrote: @harshal: What was

[algogeeks] Re: Microsoft :)

2011-08-07 Thread souptik sen
Congrats!! On Aug 6, 11:45 am, Harshal hc4...@gmail.com wrote: Algogeeks is really awesome and very informative. I got a job in microsoft, and this group has played vital role in building concepts. So I just want to thank this group and the people here.. keep it up guys! All the best :) --

[algogeeks] Sum from array

2011-08-07 Thread swetha rahul
Given an array find all the set which form the given sum in O(n) i/p: a[]={1,2,3,5,7,6,8,10} sum=9 o/p should be {1,3,5} {2,7} {3,6},{1,8} -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Re: SPOJ ABCD

2011-08-07 Thread amit karmakar
@amol I got accepted using the similar approach. But i performed backtracking. In each step of backtracking i chose the next option as you done. So, there can be cases where this approach fails. Runtime error may occur because,

[algogeeks] Re: Sum from array

2011-08-07 Thread amit karmakar
It can be reduced to subset sum problem. So I cannot see O(n) being possible here. Even the dynamic programming approach(provided there are some more constraints for this problem) is O(n*m) where m is related to the range of values of sum. On Aug 7, 2:10 pm, swetha rahul swetharahu...@gmail.com

[algogeeks] Prob wid BST find min and find max...

2011-08-07 Thread Indrajeet Khater
this is the code for findmin and findmax and it shows an error that.. C:\Dev-Cpp\include\Bst.cpp expected constructor, destructor, or type conversion before '*' token C:\Dev-Cpp\include\Bst.cpp expected `;' before '*' token C:\Dev-Cpp\include\Bst.cpp expected constructor, destructor, or type

Re: [algogeeks] nlogn, in-place, iterative mergesort?

2011-08-07 Thread DK
I thought someone would have answered this by now: Please see this paper: http://j.mp/rtNp4W -- DK http://gplus.to/divyekapoor http://twitter.com/divyekapoor http://www.divye.in -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this

[algogeeks] Re: nlogn, in-place, iterative mergesort?

2011-08-07 Thread amit karmakar
The best thing is that you don't need explicit stacks for removing recursion. A couple of loops can do the job. On Aug 6, 9:57 pm, immanuel kingston kingston.imman...@gmail.com wrote: Yes. just remove the recursive part using 2 stacks. Thanks, Immanuel On Fri, Aug 5, 2011 at 6:51 PM, Nitin

Re: [algogeeks] Re: Directi Question

2011-08-07 Thread nEvEr sMiLe bUt kEEp lAuGhIn'
@kunal patil: how can u say Probability of getting an even sum in one roll is 1/2 if tht is the case..can u find the ans in one go if the dice is having *5 faces*?? i mean the numbers on dice are 1 2 3 4 5 ...and it is unbiased... what will be the *Probability of getting an even sum in one

Re: [algogeeks] Re: probablity

2011-08-07 Thread Kunal Yadav
Agree with puneet completely. After first blue pen, only possible outcomes are blue or black and hence 1/2. On Sat, Aug 6, 2011 at 12:28 AM, Puneet Goyal puneetgoya...@gmail.comwrote: @shiv : you are considering the case when you need to know the probability of both pens being blue, but in

Re: [algogeeks] Re: Directi Question

2011-08-07 Thread shady
@kunal patil expected number of rolls required to get even sum is inverse of that i.e. 2 can we say like this all the time ? i have understood the alternative method, thanks :D On Sun, Aug 7, 2011 at 1:33 PM, Kunal Patil kp101...@gmail.com wrote: Probability of getting an even sum in one roll

[algogeeks] Re: nlogn, in-place, iterative mergesort?

2011-08-07 Thread DK
@Amit and @Immanuel: You're not getting the point. Merge sort is not in-place because it requires an extra O(N) array during the merge step. The problem asks not to remove the recursive nature of the merge-sort but to remove the non-in-place nature of merge sort by removing the need for that

[algogeeks] Re: nlogn, in-place, iterative mergesort?

2011-08-07 Thread amit karmakar
@DK Hmm, i do understand what you said. Maybe, i should make it clear that i just wanted to tell that implementing a non-recursive merge-sort will not require explicit stacks and is actually easier to implement. This was because someone mentioned using stacks to remove recursion. I didn't mean to

Re: [algogeeks] Sum from array

2011-08-07 Thread ankit sambyal
@swetha: This problem can't be solved in O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] SPOJ 9199. Circular Track

2011-08-07 Thread arvind kumar
Hi Can any1 pls help me in solving this? Two persons are running on a circular track either in the same direction or in the opposite direction, indefinitely. The speed of both of them is given to you. Speed will be positive in clockwise direction, and negative in anticlockwise direction. Print the

Re: [algogeeks] Sum from array

2011-08-07 Thread raj kumar
similar to make change dp problem -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To 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] Re: MS test

2011-08-07 Thread Dave
6.5 = 2^2 + 2^1 + 2^-1 Binary representation = 110.1 = 1.101 * 2^2. 0.1 = 2^-3 + 2^-4 + 2^-7 + 2^-8 + 2^-11 + 2^-12 + ... Binary representation = 0.001100110011... = 1.10010011... * 2^-3. Dave On Aug 7, 1:18 am, ankit sambyal ankitsamb...@gmail.com wrote: @programming love : 0.1 can't be

[algogeeks] Bitwise operators

2011-08-07 Thread Shashank Jain
bitwise complement operator (~), complements d digits of d input bt when i use it : int a,b; b=~a; output: its giving o/p such that b= -a-1; why is dat so? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering -- You received this message because you are subscribed to

Re: [algogeeks] Re: nlogn, in-place, iterative mergesort?

2011-08-07 Thread immanuel kingston
@DK and Amit, thanks for correcting my understanding. On Sun, Aug 7, 2011 at 3:51 PM, amit karmakar amit.codenam...@gmail.comwrote: @DK Hmm, i do understand what you said. Maybe, i should make it clear that i just wanted to tell that implementing a non-recursive merge-sort will not require

Re: [algogeeks] Re: Intersection of 2 rectangles

2011-08-07 Thread immanuel kingston
@Dave.Thanks, I got your counter-example. And the Separating Axis test is the way to go for finding the intersection of any two polygons. The Separating Axis test does not apply if one of the polygons is not convex. Thanks, Immanuel On Sun, Aug 7, 2011 at 12:18 AM, Dave dave_and_da...@juno.com

Re: [algogeeks] Bitwise operators

2011-08-07 Thread Mukul Gupta
Let us say a= 6 with binary representation as 0110. By inverting its bits, the signed bit becomes 1. Compiler now understands that the no. is a negative no. so adds a negative sign and then converts it to its 2's complement which is inverting its bits and adding 1 to it. Thus, the output is 7.

Re: [algogeeks] Bitwise operators

2011-08-07 Thread Mukul Gupta
*amends :P On Sun, Aug 7, 2011 at 5:29 PM, Mukul Gupta mukul.gupta...@gmail.comwrote: Let us say a= 6 with binary representation as 0110. By inverting its bits, the signed bit becomes 1. Compiler now understands that the no. is a negative no. so adds a negative sign and then converts it

[algogeeks] Re: Bitwise operators

2011-08-07 Thread Yasir
let say a=6; binary= 0110 b = ~a = 1001 Now when you print value of ~a or b, it is calculating 2's complement. 1's complement: 0110 2's complement: 0111 (value = -7) Pls check signed bit representation for details. On Aug 7, 4:40 pm, Shashank Jain shashan...@gmail.com

Re: [algogeeks] Re: Bitwise operators

2011-08-07 Thread Shashank Jain
y r we taking 8 bit numbers, i mean dat way we cant go beyond -127 to 127? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 5:39 PM, Yasir yasir@gmail.com wrote: let say a=6; binary= 0110 b = ~a = 1001 Now when you print

[algogeeks] Re: Bitwise operators

2011-08-07 Thread Yasir
8 bit was taken just for example. It can be 16/32 bit but that won't make any difference on leading 0's or 1's. On Aug 7, 5:28 pm, Shashank Jain shashan...@gmail.com wrote: y r we taking 8 bit numbers, i mean dat way we cant go beyond -127 to 127? Shashank Jain IIIrd year Computer

Re: [algogeeks] Directi Question

2011-08-07 Thread rajul jain
If we get even number (probability 1/2) in first throw , so the expected run is 1 If first throw give ODD (probability 1/2) ,the run needed become 1 + run needed until second odd number .This last waiting time is 2 . Thus expected run become (1/2) (1) + (1/2)(1+2) = 2 On Sat, Aug 6, 2011 at

Re: [algogeeks] Directi Question

2011-08-07 Thread rajul jain
let expected time is T , if we get even(probability 1/2) on first throw so T become 1 If dont then you are at same place where you started so T = (1/2) (1) + (1/2) ( 1+T) = T =2 On Sun, Aug 7, 2011 at 6:05 PM, rajul jain rajuljain...@gmail.com wrote: If we get even number (probability 1/2)

Re: [algogeeks] Re: Bitwise operators

2011-08-07 Thread Shashank Jain
so tell me fr any bit representation, 1st bit is for sign only na? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 6:03 PM, Yasir yasir@gmail.com wrote: 8 bit was taken just for example. It can be 16/32 bit but that won't make any

Re: [algogeeks] Re: Bitwise operators

2011-08-07 Thread Shashank Jain
nd moreover after 2's complement its 0111 which is 7 nd not -7. so how? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 6:25 PM, Shashank Jain shashan...@gmail.com wrote: so tell me fr any bit representation, 1st bit is for sign only na?

[algogeeks] Fwd: max product

2011-08-07 Thread Nikhil Veliath
-- Forwarded message -- From: Nikhil Veliath nve...@gmail.com Date: 7 Aug 2011 18:31 Subject: max product To: algoge...@goooglegroups.com given an array that has n nos . . . . find the maximum product of 3 nos and display the 3 nos . . . 25 9 6 8 -20 -5 -10 so max product 5000

[algogeeks] max product!

2011-08-07 Thread Nikhil Veliath
given an array that has n nos . . . . find the maximum product of 3 nos and display the 3 nos . . . 25 9 6 8 -20 -5 -10 so max product 5000 the nos are -20 -10 25 give an O(n) solution and if possible try avoid using sort -- You received this message because you are subscribed to the Google

[algogeeks] Re: question

2011-08-07 Thread bugaboo
1) Firstly, size of the data type depends on the language. With C/C++, since they are not platform independent, size of integer varies from machine to machine. 2) With C/C++, the size depends on the underlying hardware (architecture). HardwareOSPossible

[algogeeks] Recursion Help

2011-08-07 Thread Nikhil Veliath
i am having problems in writing code using recursion.any help !!...any links? -- You received this message because you are subscribed to the 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] max product!

2011-08-07 Thread Puneet Ginoria
find the first three largest nos. and 3 smallest number(negatives).. then easily you can fig. out the solution.. O(6n) solution i guess which is O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Puzzle

2011-08-07 Thread mani sharma
the word half was so confusing in the ques!! :( On 5 August 2011 00:24, Himanshu Srivastava himanshusri...@gmail.comwrote: oh ok..thankshalf part which was kept inside the wellmeans well must be full..that is 100ok got it completely thank u:) On Fri, Aug 5,

Re: [algogeeks] Fwd: max product

2011-08-07 Thread Nikhil Veliath
@puneet: Any code ? Finding the min 3 and max 3 nos witout using sort...so using 6 variables? On Sun, Aug 7, 2011 at 6:41 PM, Puneet Ginoria punnu.gino...@gmail.com wrote: find the first three largest nos. and 3 smallest number(negatives).. then easily you can fig. out the solution.. O(6n)

Re: [algogeeks] Fwd: max product

2011-08-07 Thread Puneet Ginoria
find the first three largest nos. and 3 smallest number(negatives).. then easily you can fig. out the solution.. O(6n) solution i guess which is O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] max product!

2011-08-07 Thread Prakash D
that won't work.. there may be two negative bigger numbers whose product will bcom +ve On Sun, Aug 7, 2011 at 6:49 PM, Puneet Ginoria punnu.gino...@gmail.comwrote: find the first three largest nos. and 3 smallest number(negatives).. then easily you can fig. out the solution.. O(6n) solution

Re: [algogeeks] max product!

2011-08-07 Thread shady
simple manipulation ans = max( (smallest negative number 1 * smallest negative number 2 * largest positive number 1), (largest positive number 1, largest positive number 2, largest positive number 3) ) On Sun, Aug 7, 2011 at 7:04 PM, Prakash D cegprak...@gmail.com wrote: that won't work.. there

[algogeeks] Re: c-aps

2011-08-07 Thread soundar
try indiabix.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

Re: [algogeeks] max product!

2011-08-07 Thread sanjay ahuja
above solution should work.. any counter example ?? On Sun, Aug 7, 2011 at 7:10 PM, shady sinv...@gmail.com wrote: simple manipulation ans = max( (smallest negative number 1 * smallest negative number 2 * largest positive number 1), (largest positive number 1, largest positive number 2, 

Re: [algogeeks] max product!

2011-08-07 Thread Prakash D
nice 1 On Sun, Aug 7, 2011 at 7:10 PM, shady sinv...@gmail.com wrote: simple manipulation ans = max( (smallest negative number 1 * smallest negative number 2 * largest positive number 1), (largest positive number 1, largest positive number 2, largest positive number 3) ) On Sun, Aug 7,

Re: [algogeeks] SPOJ 9199. Circular Track

2011-08-07 Thread Prakash D
yeah, i also need to know the approach for this kind of problems asked in many places On Sun, Aug 7, 2011 at 3:58 PM, arvind kumar arvindk...@gmail.com wrote: Hi Can any1 pls help me in solving this? Two persons are running on a circular track either in the same direction or in the opposite

[algogeeks] MICROSOFT INTERVIEW QUESTIONS faced by my frenz nd me

2011-08-07 Thread siva viknesh
MICROSOFT INTERVIEW QUESTIONS 2011 ROUND 1 : Written Test Questions : (1) Give the output of the following program int main { char ch[]={‘1’,’2’,’3’,’4’,’5’}; char *p = (char *)(ch+1); char *q = ch+1; printf(“%d %c

Re: [algogeeks] Re: c-aps

2011-08-07 Thread Nikhil Veliath
http://cquestionbank.blogspot.com/2008/02/c-pointer-questions-with-solutions.html On Sun, Aug 7, 2011 at 7:10 PM, soundar soundha...@gmail.com wrote: try indiabix.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Re: Directi question-centre of the tree

2011-08-07 Thread DK
@Everyone: Wladimir has posted the correct solution to the problem and it is an O(N) bottom up solution. *The original solution:* On Wednesday, 6 October 2010 21:10:40 UTC+5:30, wladimirufc wrote: Find the leaf of tree then put all leaf in a queue. While queue not empty: remove u from

[algogeeks] Minimum spanning tree problem

2011-08-07 Thread Anuj Kumar
The link to the problem is http://www.topcoder.com/stat?c=problem_statementpm=10750rd=14153 i applied kruskal to find the mst but my code fails for test case 2 *class* node{*public*: *int* start,end,weight;}; *bool* *operator* (*const* node first, *const* node second){ *return*

Re: [algogeeks] max product!

2011-08-07 Thread Amol Sharma
yes...it should work !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Aug 7, 2011 at 7:13 PM, Prakash D cegprak...@gmail.com wrote: 1 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] Normalised !!

2011-08-07 Thread rShetty
How is floating number 5.375 represented in memory . What is the normalised form of the number 5.375 . The normalised form of 5.375 is 0100 1010 1100 How it is done.Explanation? Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: MS test

2011-08-07 Thread Prakash D
@siddharam: for the second one, the series is like this the first character will print once. second one twice third one four times and so on 1,2,4,8,... On Sun, Aug 7, 2011 at 4:53 PM, Dave dave_and_da...@juno.com wrote: 6.5 = 2^2 + 2^1 + 2^-1 Binary representation = 110.1 = 1.101 * 2^2.

Re: [algogeeks] Re: MS test

2011-08-07 Thread Prakash D
any idea for 5th one? On Sun, Aug 7, 2011 at 7:50 PM, Prakash D cegprak...@gmail.com wrote: @siddharam: for the second one, the series is like this the first character will print once. second one twice third one four times and so on 1,2,4,8,... On Sun, Aug 7, 2011 at 4:53 PM, Dave

[algogeeks] recursion help!!!

2011-08-07 Thread Nikhil Veliath
i am having problems in writing code using recursion.any help !!...any links? -- You received this message because you are subscribed to the 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] recursion help!!!

2011-08-07 Thread sukran dhawan
write simple recursive routines and trace them for each program... using a stack by popping and pushing.do it for some 10 programs.u will automatically appreciate the power of recursion and learn it :) On Sun, Aug 7, 2011 at 8:03 PM, Nikhil Veliath nve...@gmail.com wrote: i am having problems

[algogeeks] recursion nearest square

2011-08-07 Thread Nikhil Veliath
write a recursive code to print the nearest square of a number eg if no is 27 the nearest square is 5 it should also take care of large nos... -- 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] recursion help!!!

2011-08-07 Thread Nikhil Veliath
hey can ya give me some recursive codes wid a little explanationthnx in advance! On Sun, Aug 7, 2011 at 8:05 PM, sukran dhawan sukrandha...@gmail.com wrote: write simple recursive routines and trace them for each program... using a stack by popping and pushing.do it for some 10 programs.u

Re: [algogeeks] recursion help!!!

2011-08-07 Thread sukran dhawan
trace recursive routines for fibbonacci series , tree traversal ,gcd routines .google it for the code. On Sun, Aug 7, 2011 at 8:10 PM, Nikhil Veliath nve...@gmail.com wrote: hey can ya give me some recursive codes wid a little explanationthnx in advance! On Sun, Aug 7, 2011 at 8:05 PM,

[algogeeks] Re: Bitwise operators

2011-08-07 Thread Yasir
@Shashank, You didn't get it properly. If leftmost bit *0*, then it is a *+ve* number. If it's *1* then it's a *-ve* number. Let's take above example with 16 bit: a=6 binary: 0110 (note that leftmost bit is 0, so it's +ve number) ~a= 1001 (now leftmost bit is 1, so

[algogeeks]

2011-08-07 Thread RAHUL AGARWAL
#includestdio.h struct abc{ int len; char *str; }*p; main() { struct abc k; k.len=20; k.str=echo is your command; p=k; printf(%c,++(*p-str)); } I expect the output of this code to be f but it's displays SEGMENTATION

[algogeeks] how to reverse a string in place??plz post code also

2011-08-07 Thread Rajesh Kumar
-- Regards Rajesh 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,

Re: [algogeeks] how to reverse a string in place??plz post code also

2011-08-07 Thread Kunal Yadav
#includestdio.h #includeiostream #includestring.h #includestdlib.h using namespace std; int main() { char s[1000]; cins; int start=0; int end=strlen(s); coutendendl; int end1=end; while(start=end) { char e; //swap e=s[start]; s[start]=s[end];

Re: [algogeeks]

2011-08-07 Thread sukran dhawan
replace ur code with printf(%c,++(p-str)); *ptr is a deferenced value.but mere p is a lvalue On Sun, Aug 7, 2011 at 8:23 PM, RAHUL AGARWAL algogeek...@gmail.com wrote: #includestdio.h struct abc{ int len; char *str; }*p; main() { struct abc k;

Re: [algogeeks] max product!

2011-08-07 Thread Debabrata Das
why do you need three smallest number, two would suffice ? On Sun, Aug 7, 2011 at 7:47 PM, Amol Sharma amolsharm...@gmail.com wrote: yes...it should work !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Aug 7, 2011 at 7:13 PM, Prakash D

[algogeeks] Directi interview question

2011-08-07 Thread Saikat Debnath
There are 100 pertrol pumps between two points A and B. You have to select 10(say) petrol pumps such that the largest distance between any two petrol pumps shud be minimum. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] how to reverse a string in place??plz post code also

2011-08-07 Thread Rajesh Kumar
plz post code in c language also. On Sun, Aug 7, 2011 at 8:26 PM, Kunal Yadav kunalyada...@gmail.com wrote: #includestdio.h #includeiostream #includestring.h #includestdlib.h using namespace std; int main() { char s[1000]; cins; int start=0; int end=strlen(s);

Re: [algogeeks]

2011-08-07 Thread sukran dhawan
oh ya i didnt it sorry :) On Sun, Aug 7, 2011 at 8:29 PM, saurabh singh saurab...@gmail.com wrote: And also u have not allocated any space for str...so even if u do wat sukran has suggested u wont get an f... On Sun, Aug 7, 2011 at 8:27 PM, sukran dhawan sukrandha...@gmail.comwrote:

Re: [algogeeks] how to reverse a string in place??plz post code also

2011-08-07 Thread saurabh singh
dude I smell something fishy On Sun, Aug 7, 2011 at 8:33 PM, Rajesh Kumar testalgori...@gmail.comwrote: plz post code in c language also. On Sun, Aug 7, 2011 at 8:26 PM, Kunal Yadav kunalyada...@gmail.comwrote: #includestdio.h #includestring.h #includestdlib.h using

Re: [algogeeks] how to reverse a string in place??plz post code also

2011-08-07 Thread sukran dhawan
very simple and common interview question for(i=0;str[i];i++); // find the length of the string for(i=0;in/2;i++) { temp = str[i]; str[i] = str[n-1-i]; strpn-1-i] = temp; } it works for all cases On Sun, Aug 7, 2011 at 8:24 PM, Rajesh Kumar testalgori...@gmail.comwrote: --

Re: [algogeeks]

2011-08-07 Thread Amol Sharma
i can see the output coming as f . http://ideone.com/pB9ga but when i ran the same code on ubuntu machine with gcc compiler then it is also giving segmentation fault i don' t know why.this is a illustration taken from K R page no. 132. i don't think there is any need to

Re: [algogeeks] how to reverse a string in place??plz post code also

2011-08-07 Thread sukran dhawan
also try this question reversing th words in a string using the same reverse function written by me above On Sun, Aug 7, 2011 at 8:39 PM, sukran dhawan sukrandha...@gmail.comwrote: very simple and common interview question for(i=0;str[i];i++); // find the length of the string

Re: [algogeeks]

2011-08-07 Thread sukran dhawan
hmmm i got the error char * str - when u declare a string as above in linux the compiler places the string in a read only memory.so if you dont ve access to modify it.so it reports an access violation runt time error ie segmentation fault On Sun, Aug 7, 2011 at 8:45 PM, Amol Sharma

Re: [algogeeks]

2011-08-07 Thread saurabh singh
In that case ignore my post as idioticBut if u dont declare space its usually placed in a read only memory.so that might be the problem,Once again this can be an idiotic explanation...lets debug... On Sun, Aug 7, 2011 at 8:45 PM, Amol Sharma amolsharm...@gmail.com wrote: i can see

Re: [algogeeks] MS test

2011-08-07 Thread iama
I am a little skeptic over the 6th question. Adding more RAM does not necessarily decrease page faults. If the page is in the disk, then more RAM might help by making the interaction with the Hard Disk lesser. But if the page is in some other memory, then this might not be the case. A better

Re: [algogeeks] MICROSOFT INTERVIEW QUESTIONS faced by my frenz nd me

2011-08-07 Thread ankit sambyal
Can anybdy explain the following questions : (5) Find the output int arr[2][3]={{1,2,3},{4,5,6}}; int (*ptr)[3]=a[0]; printf((%d,%d),(*ptr)[1],(*ptr)[2]); ptr+=1; printf((%d,%d),(*ptr)[1],(*ptr)[2]); Will this program compile properly or will end in segmentation fault ?? (9) Given a inorder

Re: [algogeeks]

2011-08-07 Thread sukran dhawan
hmmm this is a kinda problem in linux systems.in windows it works properly. On Sun, Aug 7, 2011 at 8:54 PM, saurabh singh saurab...@gmail.com wrote: In that case ignore my post as idioticBut if u dont declare space its usually placed in a read only memory.so that might be the

Re: [algogeeks]

2011-08-07 Thread RAHUL AGARWAL
that means i was right... On Sun, Aug 7, 2011 at 8:57 PM, sukran dhawan sukrandha...@gmail.comwrote: hmmm this is a kinda problem in linux systems.in windows it works properly. On Sun, Aug 7, 2011 at 8:54 PM, saurabh singh saurab...@gmail.com wrote: In that case ignore my post as

Re: [algogeeks]

2011-08-07 Thread saurabh singh
I wont consider it a problemdats bad style to refer to something that u have not reserved On Sun, Aug 7, 2011 at 8:57 PM, sukran dhawan sukrandha...@gmail.comwrote: hmmm this is a kinda problem in linux systems.in windows it works properly. On Sun, Aug 7, 2011 at 8:54 PM, saurabh

Re: [algogeeks]

2011-08-07 Thread sukran dhawan
better way is to allocate memory and use.that was pointers are desinged to do to support dymanic allocation On Sun, Aug 7, 2011 at 9:01 PM, saurabh singh saurab...@gmail.com wrote: I wont consider it a problemdats bad style to refer to something that u have not reserved On Sun, Aug

Re: [algogeeks]

2011-08-07 Thread saurabh singh
yeahthe OS shouldn't grant permission to change a memory which doesn't belong to u. On Sun, Aug 7, 2011 at 9:03 PM, sukran dhawan sukrandha...@gmail.comwrote: better way is to allocate memory and use.that was pointers are desinged to do to support dymanic allocation On Sun, Aug 7,

  1   2   3   >