Re: [algogeeks] finding element in rotated array

2011-07-30 Thread Mohit Goel
yes ..u r right ...thnks... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To 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] finding element in rotated array

2011-07-30 Thread tech rascal
how to find distortion using binary search?? On Sat, Jul 30, 2011 at 11:34 AM, Mohit Goel mohitgoel291...@gmail.comwrote: yes ..u r right ...thnks... -- 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] finding element in rotated array

2011-07-30 Thread saurabh singh
Look for the spike...that is the index where the sorted property is disturbed. On Sat, Jul 30, 2011 at 11:44 AM, tech rascal techrascal...@gmail.comwrote: how to find distortion using binary search?? On Sat, Jul 30, 2011 at 11:34 AM, Mohit Goel mohitgoel291...@gmail.comwrote: yes ..u r

[algogeeks] Write C code to check if an integer is a power of 2 or not in a single line?

2011-07-30 Thread tech rascal
-- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at

[algogeeks] 32 bit?

2011-07-30 Thread Nikhil Gupta
How do you find out if a machine is 32 bit or 64 bit? I was thinking since the size of pointer variable is different in the 2 configurations, we can declare a pointer and use sizeof() Will that work? Any other suggestions? -- Nikhil Gupta -- You received this message because you are

Re: [algogeeks] Write C code to check if an integer is a power of 2 or not in a single line?

2011-07-30 Thread Nikhil Gupta
if(!(num (num - 1)) num) { // Power of 2! } On Sat, Jul 30, 2011 at 11:49 AM, tech rascal techrascal...@gmail.comwrote: -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To

Re: [algogeeks] Write C code to check if an integer is a power of 2 or not in a single line?

2011-07-30 Thread saurabh singh
if(t!(t(t-1)) return true; reason: any power of two will be of form 00100 that is 0 at only one position.If you subtract 1 from it that will make it of the form 11 that is ones at all positions to the right except the position where there is 1 in the original number.If you take and now you

Re: [algogeeks] Write C code to check if an integer is a power of 2 or not in a single line?

2011-07-30 Thread ankit sambyal
If x is the number which is to be checked, if (x !(x (x-1)) == 0) then power of 2 -- You received this message because you are subscribed to the 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] 32 bit?

2011-07-30 Thread rajeev bharshetty
If pointer size is 4bytes then it is 32 bit machine and if 8 bytes it is 64 bit On Sat, Jul 30, 2011 at 11:51 AM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: How do you find out if a machine is 32 bit or 64 bit? I was thinking since the size of pointer variable is different in the 2

Re: [algogeeks] finding element in rotated array

2011-07-30 Thread Ankur Khurana
low =lower_bound , high=upper_bound; int a=arr[low]; while(lowhigh) { mid=(low+high)/2; if( arr[mid]a midupper_bound arr[mid+1] a) break; //you found the index of distortion if(arr[mid]a) low=mid+1; else high=mid-1; } On Sat, Jul 30, 2011 at 11:46 AM, saurabh singh saurab...@gmail.com wrote:

Re: [algogeeks] finding element in rotated array

2011-07-30 Thread Ankur Khurana
above is when the sorted array is in increasing order. On Sat, Jul 30, 2011 at 11:56 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: low =lower_bound , high=upper_bound; int a=arr[low]; while(lowhigh) { mid=(low+high)/2; if( arr[mid]a midupper_bound arr[mid+1] a) break; //you found the

Re: [algogeeks] Write C code to check if an integer is a power of 2 or not in a single line?

2011-07-30 Thread tech rascal
thanx for the explanation saurabh On Sat, Jul 30, 2011 at 11:54 AM, ankit sambyal ankitsamb...@gmail.comwrote: If x is the number which is to be checked, if (x !(x (x-1)) == 0) then power of 2 -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] BST Question

2011-07-30 Thread Mani Bharathi
connect all sibling nodes of a binary search tree -- 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/-/GWAhIi6vaxAJ. To post to this group, send email to

Re: [algogeeks] Write C code to check if an integer is a power of 2 or not in a single line?

2011-07-30 Thread Amol Sharma
if ( x(x-1)==0 ) then number is of forn 2^n else false put a separate check for x=0 as the above will not work for x=0 explanation- take x = 8 =1000 x-1 = 7 =111 clearly x(x-1) is 0 similarly do for a number which is not 2^n hope this helps !! -- Amol Sharma Third Year Student

Re: [algogeeks] BST Question

2011-07-30 Thread saurabh singh
please give an example. On Sat, Jul 30, 2011 at 12:10 PM, Mani Bharathi manibharat...@gmail.comwrote: connect all sibling nodes of a binary search tree -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web

[algogeeks] Data Structure Question

2011-07-30 Thread Mani Bharathi
Find the ‘n’th node as it appears in the in order traversal of the given tree if each node contains the number of nodes in its subtree as value of node. -- 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: adobe written round que

2011-07-30 Thread SAMM
Single bit shift... int divide(int n) { n-=1; n=1; return n; } On 7/30/11, tech rascal techrascal...@gmail.com wrote: hw will u get the ans on repeated subtraction from the sum of the digits?? I mean if I hv 2 divide 27 by 3 thn first I'll find sum of the digits i.e, 2+7=9 then I'll

Re: [algogeeks] Re: adobe written round que

2011-07-30 Thread aditi garg
@Samm : Im not able to understand ur logic...im not getting the correct ans...can u explain the working taking n as 7? On Sat, Jul 30, 2011 at 12:25 PM, SAMM somnath.nit...@gmail.com wrote: Single bit shift... int divide(int n) { n-=1; n=1; return n; } On 7/30/11, tech rascal

Re: [algogeeks] Re: Testcases

2011-07-30 Thread Puneet Gautam
Guys, what are the technical terms used while writing testcases..i mean if its a 10 marks question...,how wud u answer it..? On 7/30/11, hary rathor harry.rat...@gmail.com wrote: oh! sorry : if(c^2 a^2+b^2) acute angle if(c^2 =a^2+b^2) right angle if(c^2 a^2+b^2) obtuse angle -- You

Re: [algogeeks] Re: binary search tree question!!!!

2011-07-30 Thread varun pahwa
do morris traversal until you find k. but that may modify the tree if you break as you find k. On Sat, Jul 30, 2011 at 9:14 AM, ankit sambyal ankitsamb...@gmail.comwrote: Here the required program : void findkthSmallest(Node *root,int k) { Node *stack[100]; int top=-1,count=0;

[algogeeks] Any one has IPC (Inter Process Communication) good materia?

2011-07-30 Thread Swathi
-- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at

Re: [algogeeks] 32 bit?

2011-07-30 Thread aditi garg
it can also be found out by using printf(%d,sizeof(int)*8); Correct me if i am wrong... On Sat, Jul 30, 2011 at 11:55 AM, rajeev bharshetty rajeevr...@gmail.comwrote: If pointer size is 4bytes then it is 32 bit machine and if 8 bytes it is 64 bit On Sat, Jul 30, 2011 at 11:51 AM, Nikhil

Re: [algogeeks] BST Question

2011-07-30 Thread aditi garg
Do u mean something like level order traversal?? On Sat, Jul 30, 2011 at 12:11 PM, saurabh singh saurab...@gmail.com wrote: please give an example. On Sat, Jul 30, 2011 at 12:10 PM, Mani Bharathi manibharat...@gmail.comwrote: connect all sibling nodes of a binary search tree --

[algogeeks] Book Request

2011-07-30 Thread DIPANKAR DUTTA
If any one has the follow book, post it.. Data Structures and Algorithms Made Easy Data Structure and Algorithmic Puzzles Authored by Mr Narasimha Karumanchi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] FB intern

2011-07-30 Thread arvind kumar
Find the least time complexity algorithm(most efficient algo) to find x^m(x to the power of m)..Facebok intern interview question! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com.

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-30 Thread Puneet Gautam
@everyone: What happens to those padded byte addresses.. do they remain empty or what..? Can we utilize those padded bytes in any way ..? On 7/30/11, tech rascal techrascal...@gmail.com wrote: can anyone explain in detail .how structure padding is advantageous??? On Fri, Jul 29, 2011 at

[algogeeks] Re: Amazon

2011-07-30 Thread Rajeev Jayaswal
hii ... Yeah i m from NIT warangal , and i took the amazon test day b4 yesterday , and total there were 20 question out of which two question was to write d progm and compile it and get the correct output for addition of number storing element in link list and rest 18 question were

[algogeeks] array constant

2011-07-30 Thread Arshad Alam
Why it is showing an error at line number 5 1. void main() 2. { 3. clrscr(); 4. int i,max=5; 5. float arr[max]; 6. for(i=0;imax;i++) 7.scanf(%f,arr[i]); 8. getch(); 9.} -- You received this message because you are subscribed to

Re: [algogeeks] Re: Amazon

2011-07-30 Thread arvind kumar
Can u please a few questions here..It will be helpful to others. On 7/30/11, Rajeev Jayaswal justjayas...@gmail.com wrote: hii ... Yeah i m from NIT warangal , and i took the amazon test day b4 yesterday , and total there were 20 question out of which two question was to write d

Re: [algogeeks] FB intern

2011-07-30 Thread saurabh singh
o(log n) x^n=pow(x^n/2)*pow(x^n/2)*(x^mod2) the base case pow(x,1)=x pow(x,0)=1 On Sat, Jul 30, 2011 at 1:02 PM, arvind kumar arvindk...@gmail.com wrote: Find the least time complexity algorithm(most efficient algo) to find x^m(x to the power of m)..Facebok intern interview question! --

Re: [algogeeks] array constant

2011-07-30 Thread varun pahwa
make max as a macro. as for c static memory allocation take place either with a constant or a macro. i.e. either u declare #define max 5 then write float arr[max]; or u may write float arr[5]; On Sat, Jul 30, 2011 at 1:05 PM, Arshad Alam alam3...@gmail.com wrote: Why it is showing an error

Re: [algogeeks] array constant

2011-07-30 Thread Ankur Khurana
or const int max=5; On Sat, Jul 30, 2011 at 1:09 PM, varun pahwa varunpahwa2...@gmail.comwrote: make max as a macro. as for c static memory allocation take place either with a constant or a macro. i.e. either u declare #define max 5 then write float arr[max]; or u may write float

[algogeeks]

2011-07-30 Thread Karthikeyan palani
Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of the array is not. -- karthikeyankkn -- You received this message because you are subscribed to the Google

Re: [algogeeks] FB intern

2011-07-30 Thread Ankur Khurana
use divide and conquer . logm complexity . . . On Sat, Jul 30, 2011 at 1:09 PM, saurabh singh saurab...@gmail.com wrote: o(log n) x^n=pow(x^n/2)*pow(x^n/2)*(x^mod2) the base case pow(x,1)=x pow(x,0)=1 On Sat, Jul 30, 2011 at 1:02 PM, arvind kumar arvindk...@gmail.comwrote: Find the

Re: [algogeeks]

2011-07-30 Thread Ankur Khurana
use bit manipulation to use an integer as a hash table. set bits to hash the alphabets . . . On Sat, Jul 30, 2011 at 1:10 PM, Karthikeyan palani karthikeyan...@gmail.com wrote: Design an algorithm and write code to remove the duplicate characters in a string without using any additional

Re: [algogeeks] array constant

2011-07-30 Thread sukhmeet singh
just adding to the concept.. this is not allowed since value of max may change during the program .. either by declaring it as a macro or as a const we (as said by ankur and varun ) restrict that the value from changing during the program ..!! On Sat, Jul 30, 2011 at 1:09 PM, Ankur Khurana

Re: [algogeeks] array constant

2011-07-30 Thread Bhanu Pratap Singh
In GCC, its okay!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to 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] Re: Amazon

2011-07-30 Thread Rajeev Jayaswal
q1 #define sqr(x) x*x wat vl be d value of 64/sqr(4); q2 and 1 quest was from probability... i dont remember the exact question .!! and yeah, one question was from lex and yacc one grammar was given (aab)*bba ( dont remember exact pattern ) and 4 option was given out of which one

Re: [algogeeks] array constant

2011-07-30 Thread saurabh singh
yeah u can do any non executable statement before you declare the array.remove clrscr statement everything will be fine http://www.ideone.com/SpKpQ On Sat, Jul 30, 2011 at 1:16 PM, Bhanu Pratap Singh bp.mn...@gmail.comwrote: In GCC, its okay!! -- You received this message because you

Re: [algogeeks] array constant

2011-07-30 Thread prashant bhutani
If the value can change then do the memory initialization at run-time using malloc/calloc. The line 5 is giving error because the declaration of an array (and so the allocation of memory) happens at compile time, while the initialization of the variables happen when the program is loaded for the

[algogeeks] Re: array constant

2011-07-30 Thread Rajeev Jayaswal
in my compiler its not showing any error !! -- 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/-/fXDj3Q29epwJ. To post to this group, send email to

Re: [algogeeks] Re: Amazon

2011-07-30 Thread coool !!
its 64... if u want to get 4 as output change the macro definition to #define sqr(x) (x*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,

Re: [algogeeks] array constant

2011-07-30 Thread prashant bhutani
If a compiler is compiling the code, simply means the compiler is intelligent enough to know what you want to do. But the language specifications, clearly explains not to do such things as these are non-portable!! Thanks Regards, Prashant Bhutani Senior Undergraduate Computer Science

Re: [algogeeks] Re: Amazon

2011-07-30 Thread arvind kumar
@coool:y is that so..does braces matter here?? On 7/30/11, coool !! coool4...@gmail.com wrote: its 64... if u want to get 4 as output change the macro definition to #define sqr(x) (x*x) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] Re: Amazon

2011-07-30 Thread arvind kumar
@rajeev:thanks! On 7/30/11, arvind kumar arvindk...@gmail.com wrote: @coool:y is that so..does braces matter here?? On 7/30/11, coool !! coool4...@gmail.com wrote: its 64... if u want to get 4 as output change the macro definition to #define sqr(x) (x*x) -- You received this message

[algogeeks] Novel - Coding Round

2011-07-30 Thread Reynald
A company sells ipods online. There are 100 stocks maintained at Argentina and Brazil. A single ipod costs $100 in Brazil and $50 in Argentina. The cost of exporting stocks from one country to the other will cost $400 per 10 blocks. The transportation is always done in the multiples of 10.

Re: [algogeeks] Re: Amazon

2011-07-30 Thread prashant bhutani
Well the macro definition should be #define sqrt(x) ((x)*(x)) to capture all the possible scenarios!! Thanks Regards, Prashant Bhutani Senior Undergraduate Computer Science Engineering (B.Tech) Institute of Technology - BHU (IT-BHU) Varanasi-221005 On Sat, Jul 30, 2011 at 1:28 PM, arvind

Re: [algogeeks] Re: Amazon

2011-07-30 Thread Rohit jalan
BODMAS rule. Brackets are of higher priority. 64/4*4 = 16*4 =64 64/(4*4)=64/16=4 On Sat, Jul 30, 2011 at 1:28 PM, arvind kumar arvindk...@gmail.com wrote: @coool:y is that so..does braces matter here?? On 7/30/11, coool !! coool4...@gmail.com wrote: its 64... if u want to get 4 as

Re: [algogeeks] FB intern

2011-07-30 Thread Amol Sharma
i think saurabh you wanted to say this -- x^n=pow(x^n/2)*pow(x^n/2)*(x^(*n*mod2)) -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sat, Jul 30, 2011 at 1:10 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: use divide and conquer . logm complexity . .

Re: [algogeeks] FB intern

2011-07-30 Thread saurabh singh
Thanx mate...You rock.:) On Sat, Jul 30, 2011 at 1:40 PM, Amol Sharma amolsharm...@gmail.com wrote: i think saurabh you wanted to say this -- x^n=pow(x^n/2)*pow(x^n/2)*(x^(*n*mod2)) -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sat, Jul

Re: [algogeeks]

2011-07-30 Thread Amol Sharma
use hashing and then one more traversal.O(n) see this post method 2-- http://geeksforgeeks.org/?p=21 they have explained it quite well !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sat, Jul 30, 2011 at 1:11 PM, Ankur Khurana

Re: [algogeeks] FB intern

2011-07-30 Thread rajeev bharshetty
@amol and saurabh : How exactly is that formula derived for this problem ? I need to know the method to evaluate such problems in the feature . Thank you On Sat, Jul 30, 2011 at 1:43 PM, saurabh singh saurab...@gmail.com wrote: Thanx mate...You rock.:) On Sat, Jul 30, 2011 at 1:40 PM,

[algogeeks] Re: FB intern

2011-07-30 Thread rShetty
@amol and saurabh : How exactly is that formula derived for this problem ? I need to know the method to evaluate such problems in the future . Thank you On Jul 30, 1:13 pm, saurabh singh saurab...@gmail.com wrote: Thanx mate...You rock.:) On Sat, Jul 30, 2011 at 1:40 PM, Amol

Re: [algogeeks] Re: FB intern

2011-07-30 Thread saurabh singh
Its the method of going mad over optimizing ur solution till it satisfies ur heart :) There is no hard and fast rule.(If there is i am not aware) On Sat, Jul 30, 2011 at 1:59 PM, rShetty rajeevr...@gmail.com wrote: @amol and saurabh : How exactly is that formula derived for this problem ?

Re: [algogeeks] Re: FB intern

2011-07-30 Thread saurabh singh
And yes the formula is derived by the fact that x^(a+b)=x^a*x^b and then think top down with respect to a general variable n.(That is how to split n in the most efficient way such that a+b=n) Thats how I reached to the solution. On Sat, Jul 30, 2011 at 2:01 PM, saurabh singh saurab...@gmail.com

Re: [algogeeks] Re: Amazon

2011-07-30 Thread Abhishek Gupta
Can you please post those 2 questions here in detail which they asked for compilation and output. On Sat, Jul 30, 2011 at 1:18 PM, Rajeev Jayaswal justjayas...@gmail.comwrote: q1 #define sqr(x) x*x wat vl be d value of 64/sqr(4); q2 and 1 quest was from probability... i dont remember the

Re: [algogeeks] Re: adobe written round que

2011-07-30 Thread Ankit Minglani
#includestdio.h #includestdlib.h #includeconio.h #includestring.h #includemath.h int multiply(int a,int b) { int i; int temp=a; printf(\na=%d b=%d\n,a,b); for(i=1;ib;i++) a+=temp; printf(\nfinal a = %d,a); return(a); } void main () { int x,rem,quo=0,i,j;

[algogeeks] Re: Amazon

2011-07-30 Thread Agyat
thanks rajeev, btw can u tell the coding question amazon asked??? On Jul 30, 12:48 pm, Rajeev Jayaswal justjayas...@gmail.com wrote: q1 #define sqr(x) x*x wat vl be d value of 64/sqr(4); q2 and 1 quest was from probability... i dont remember the exact question .!! and yeah, one

[algogeeks] Re: Amazon

2011-07-30 Thread Agyat
what about interview process, how many guys shortlisted and which quest did they ask On Jul 30, 12:48 pm, Rajeev Jayaswal justjayas...@gmail.com wrote: q1 #define sqr(x) x*x wat vl be d value of 64/sqr(4); q2 and 1 quest was from probability... i dont remember the exact question .!!

Re: [algogeeks] Re: adobe written round que

2011-07-30 Thread Puneet Gautam
I think the whole point and advantage of using itoa is to make the code suitable for larger integer inputs.. eg: if i/p is: 32765 , itoa gives 32765, we take each sum=3+2+7+6+5= 23 and then use repeated subtraction... Repeated subtraction on 2 digit no. is much faster than on 5 digit one..!!

Re: [algogeeks] Re: adobe written round que

2011-07-30 Thread Abhishek Gupta
let the number be num so code is this int ans=0; while(num=3) { num=num-3; ans++; } No need to use itoa. This is simple division algo based on subtraction. On Sat, Jul 30, 2011 at 2:09 PM, Ankit Minglani ankit.mingl...@gmail.comwrote: #includestdio.h #includestdlib.h

[algogeeks] printing integer of more than 4 bytes

2011-07-30 Thread Abhishek Gupta
#includestdio.h int main() { factorial(20); return 0; } int factorial(int n) { if(n==1) return 1; else printf(%d,n*factorial(n-1)); } its printing the result. i think it should not as sizeof(int) on linux fedora 15 compile:gcc is 4bytes. can anyone explain why?

[algogeeks] Tug of War

2011-07-30 Thread sylvester
input consists of N integers, separated by a space. The ith integer indicates the strength of the ith person. For each case, output YES if it is possible to pick some people from the group and separate into two teams of equal strengths else NO -- You received this message because you are

Re: [algogeeks] Tug of War

2011-07-30 Thread shady
equivalent to 2 set partition... On Sat, Jul 30, 2011 at 3:14 PM, sylvester abeygau...@gmail.com wrote: input consists of N integers, separated by a space. The ith integer indicates the strength of the ith person. For each case, output YES if it is possible to pick some people from the

Re: [algogeeks] Doubt

2011-07-30 Thread Nikhil Gupta
Thanks. Is there any way to implement 2's compliment on binary numbers? On Fri, Jul 29, 2011 at 7:13 PM, rajeev bharshetty rajeevr...@gmail.comwrote: ~ does bitwise not on the operand . It simply inverts all the bits . On Fri, Jul 29, 2011 at 7:09 PM, Nikhil Gupta

Re: [algogeeks] Novell - Technical Interview

2011-07-30 Thread saurabh singh
Reynald..u r right.. On Fri, Jul 29, 2011 at 10:59 AM, Reynald Suz reynaldsus...@gmail.comwrote: Rajeev, I think 'vmlinuz' file in /boot directory is the symbolic link to kernel. On Fri, Jul 29, 2011 at 9:45 AM, rajeev bharshetty rajeevr...@gmail.comwrote: 1 )System map in Linux is a

Re: [algogeeks] DS representation.

2011-07-30 Thread saurabh singh
Once again I feel it boils down to the problem where the representation has to be used. If its a sparse polynomial(i dont think its a technichal term but i hope folks realize wat I want to say) link list is a gud idea. PS:MS visited our campus for interns(as well as for placements) and they were

Re: [algogeeks] printing integer of more than 4 bytes

2011-07-30 Thread Amol Sharma
notice that it's printing integer only you are not returning anything when n==1 so whatever the printf returns will be returns and see that printf returns the number of characters printed the sequence of printing will be --- in the opposite order first f(1) will return 1 then f(2) prints 2*f(1)

Re: [algogeeks] Tug of War

2011-07-30 Thread saurabh singh
Its the same as we divide teams.Pick the Largest in one and second largest in other,then putting the remaining best player to the team which is weaker. the weakest get selected last.if the teams are not equal strength not possible else possible. PS:I dont know whethr this algorithm will work.This

[algogeeks] Implementation of trie data structure

2011-07-30 Thread AMAN AGARWAL
Hi, Can somebody please give me code snippet for implementing trie data structure??? -- AMAN AGARWAL Success is not final, Failure is not fatal: It is the courage to continue that counts! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] Re: Amazon

2011-07-30 Thread Amir
In Amazon First Round all about Linux and Open Source Commands and Usage... -- 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/-/su20uc4k8ZcJ. To post to this

Re: [algogeeks] Re: Amazon

2011-07-30 Thread rajeev bharshetty
@amir : Could you please share the questions they asked?? Thanks On Sat, Jul 30, 2011 at 4:52 PM, Amir pkpat...@gmail.com wrote: In Amazon First Round all about Linux and Open Source Commands and Usage... -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Amazon

2011-07-30 Thread Amir
They Gave me a sheet and asked me to write the commands u know Then they asked the commands which weren't mentioned by me..like dostounix, sed with regex with backreference,etc etc -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view

Re: [algogeeks] Amazon

2011-07-30 Thread pankaj kumar
what was cutoff cgpa for amazon?? -- pankaj 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

Re: [algogeeks] Doubt

2011-07-30 Thread aditi garg
@nikhil..yea do ones complement by using ~ operator and thn add 1... On Fri, Jul 29, 2011 at 7:16 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: Thanks. Is there any way to implement 2's compliment on binary numbers? On Fri, Jul 29, 2011 at 7:13 PM, rajeev bharshetty

[algogeeks] OUTPUT PROBLEM

2011-07-30 Thread kartik sachan
#include stdio.h void foo(const char **p) { } int main(int argc, char **argv) { foo(argv); return 0; } why the above code giving me warning can body explain me?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Re: In-memory dictionary

2011-07-30 Thread vaibhav agarwal
Storing length of the word in the dictionary will help in building On Mon, Jul 18, 2011 at 2:20 AM, Dumanshu duman...@gmail.com wrote: @Sagar: for 1 i need implementation of hash function please. for 2, any other suggestion? other than trie? because they are memory intensive. On Jul 18,

Re: [algogeeks] Tug of War

2011-07-30 Thread shubham
hey sylvester, just clarify the problem .. Is it such that in forming the group some people can be left out or the sum of the number of people in both partitions is equal to the total number of people -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] OUTPUT PROBLEM

2011-07-30 Thread Amol Sharma
the warning comes is as warning: passing argument 1 of ‘foo’ from incompatible pointer type foo expects a constant char** but it is not the case...hence warning is displayed... remove the const keyword.you'll see no warning !! -- Amol Sharma Third Year Student Computer Science and

Re: [algogeeks] Tug of War

2011-07-30 Thread arun kumar
problem link: https://www.spoj.pl/problems/TUG/ i think your asking about this one On Sat, Jul 30, 2011 at 5:51 PM, shubham shubh2...@gmail.com wrote: hey sylvester, just clarify the problem .. Is it such that in forming the group some people can be left out or the sum of the number of

Re: [algogeeks] Tug of War

2011-07-30 Thread Amol Sharma
@saurabh- your algo has very high probability of failure take the case 9,7,8,4,3,1 acc to ur algo group 1 is 9,8,3 strength =20 group 2 is 7,4,2 strength =13 but it is possible to divide them into 2 equal grp's take G1 - 9,4,3 total =16 G2 - 7,8,1 total =16 so we have to think of some

Re: [algogeeks] OUTPUT PROBLEM

2011-07-30 Thread kartik sachan
*@AMOL *sending a normal pointer to a const pointer doesn't give any warning why this is giving?? -- You received this message because you 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] Re: Implementation of trie data structure

2011-07-30 Thread Gary Drocella
Knowing The Definition of a Trie Data Structure should be all you need to know how to implement a trie ADT. It's a structure where all the true (key,value) pairs are in the external nodes, and the guide keys/values are in the internal nodes. Examples of Trie Data structures are B+ Trees, B*

Re: [algogeeks] Tug of War

2011-07-30 Thread keyan karthi
if it is spoj -tug , then the problem gets reduced to knapsack dp which is used for subset sum calculation :) since u just have to print yes or no break once the sum count becomes '2' for some sum. On 7/30/11, Amol Sharma amolsharm...@gmail.com wrote: @saurabh- your algo has very high

[algogeeks] Re: Tug of War

2011-07-30 Thread Gary Drocella
To Solve This Problem, I would 1. Sort the given list S by their respective strengths. 2. Then I would create two other lists A and B for respective partitions. 3. (a) Remove First and Last from S add them both to A (b) Remove First and Last from S add them both to B 4. Repeat Step 3 until

Re: [algogeeks] Re: binary search tree question!!!!

2011-07-30 Thread Tushar Bindal
i think sunny's method should work. On Sat, Jul 30, 2011 at 12:45 PM, varun pahwa varunpahwa2...@gmail.comwrote: do morris traversal until you find k. but that may modify the tree if you break as you find k. On Sat, Jul 30, 2011 at 9:14 AM, ankit sambyal ankitsamb...@gmail.comwrote: Here

[algogeeks] Myantra Iview

2011-07-30 Thread Ankur Garg
Has anybody given Myantra Iview recently I have an interview coming up Please share ques if you have Regards Ankur -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-30 Thread Nikhil Gupta
They remain empty. You cannot use them. The purpose for which they are left will be defeated then. On Sat, Jul 30, 2011 at 1:03 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @everyone: What happens to those padded byte addresses.. do they remain empty or what..? Can we utilize those padded

[algogeeks] Microsoft

2011-07-30 Thread Sanchit Manchanda
Hi, Microsoft is coming to my campus. Can anyone tell me what kind of questions do they ask in written test? Thanks -- Sanchit Manchanda COE(3rd year) , NSIT http://iblogmythots.wordpress.com/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

[algogeeks] Recursive version of reversing linked list

2011-07-30 Thread bharath sriram
Can anyone give the recursive version of reversing a linked list. Please post the reverse function code snippet and not the entire .c file since it just hampers readability. Bharath. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] 32 bit?

2011-07-30 Thread Poised~
@ Aditi, I guess what you are thinking is size of unsigned int = size of int. True also. @ all, But consider this A Program runs under some OS which is a 32 bit but on a 64 bit processor. What will be result? Since the OS is capable of handle only 32 bit long addresses, will it assign the

Re: [algogeeks] Recursive version of reversing linked list

2011-07-30 Thread Nikhil Gupta
void reverse(node *list) { if(list-next==NULL) return; else reverse(list-next); list-next-next=list; return; } On Sat, Jul 30, 2011 at 8:11 PM, bharath sriram bharath.sri...@gmail.comwrote: Can anyone give the recursive version of reversing a linked list. Please post the

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-30 Thread tech rascal
@ Nikhil: please explain y these memory spaces r left empty??? or hw structure padding increase execution speed? On Sat, Jul 30, 2011 at 8:05 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: They remain empty. You cannot use them. The purpose for which they are left will be defeated then.

[algogeeks] Exploring C

2011-07-30 Thread aanchal goyal
hi, someone please send me ebook exploring C by yashwant kanetkar asap.. Thanks -- Regards,* Aanchal Goyal*. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from

Re: [algogeeks] Exploring C

2011-07-30 Thread rahul
If u really want to explore the C, read Deep C Secrets On Sat, Jul 30, 2011 at 8:25 PM, aanchal goyal goyal.aanch...@gmail.comwrote: hi, someone please send me ebook exploring C by yashwant kanetkar asap.. Thanks -- Regards,* Aanchal Goyal*. -- You received this message

Re: [algogeeks] Re: Novell - Puzzle

2011-07-30 Thread Tushar Bindal
for rabbits answer would be different from cows as they give birth to a pair at a time, so at any time odd number of rabbits won't be there On Sat, Jul 30, 2011 at 9:13 AM, Reynald Suz reynaldsus...@gmail.comwrote: Thank ya shiv, agarwal and Anders. On Sat, Jul 30, 2011 at 8:10 AM, Anders Ma

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-30 Thread Nikhil Gupta
As explained by someone above : Structure padding is done to try and make sure that variables start in memory at addresses that are a multiple of their size. This is more efficient at hardware level (needs less cpu ticks to read or write variables) and in some platforms this is mandatory, though

Re: [algogeeks] Exploring C

2011-07-30 Thread aanchal goyal
I have that. I want exploring C. On Sat, Jul 30, 2011 at 8:27 PM, rahul rahulr...@gmail.com wrote: If u really want to explore the C, read Deep C Secrets On Sat, Jul 30, 2011 at 8:25 PM, aanchal goyal goyal.aanch...@gmail.comwrote: hi, someone please send me ebook exploring C by

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-30 Thread tech rascal
This is more efficient at hardware level (needs less cpu ticks to read or write variable). I am asking ..how it needs less CPU ticks for accessing the variable?? On Sat, Jul 30, 2011 at 8:33 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: As explained by someone above : Structure padding is

Re: [algogeeks] Re: Novell - Puzzle

2011-07-30 Thread Nikhil Gupta
For rabbits, answer is 256. On Sat, Jul 30, 2011 at 8:33 PM, Tushar Bindal tushicom...@gmail.comwrote: for rabbits answer would be different from cows as they give birth to a pair at a time, so at any time odd number of rabbits won't be there On Sat, Jul 30, 2011 at 9:13 AM, Reynald Suz

  1   2   3   >