[algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread Ankuj Gupta
I guess we cant modify the original string. For yahoo should it be yahoohay ? Please clarify On Sep 6, 12:56 am, Pratz mary pratima.m...@gmail.com wrote: int main() {     char *s=nitan;     int n,i,j,c=0;     char *d;     n=strlen(s)/2;     //printf(%d,n);     for(i=1;i=n;i++)     {  

[algogeeks] C# ebook

2011-09-06 Thread UMESH KUMAR
Hi Anybody do u have c# ebook please send on group thanks -- You received this message because you are subscribed to the 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] FUNCTION POINTER IN C

2011-09-06 Thread Puneet Ginoria
i didn't go you.. It will be helpful if you could give me some running example or give me some link.. Thnx 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

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread anshu mishra
http://www.spoj.pl/problems/AIBOHP/ same problem u have asked!! -- You received this message because you are subscribed to the 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: whats d problem wid using gets?

2011-09-06 Thread Shashank Jain
@don - how is fgets invoked coz u said we can limit the characters? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sun, Sep 4, 2011 at 3:56 PM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: gets is deprecated ... that's why gcc gives warning... On

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread Atul Modi
can u remove letters also?as in the example 1 'o' seems to have been removed? On Tue, Sep 6, 2011 at 12:25 PM, anshu mishra anshumishra6...@gmail.comwrote: http://www.spoj.pl/problems/AIBOHP/ same problem u have asked!! -- You received this message because you are subscribed to the

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread rahul vatsa
there is no restriction at all, you can create n no of objects. A member function can call a private constructor any number of times. Just 1 single object is created bcoz this is the property of singleton class. A singleton class is a class which ensures the class has only one instance it

Re: [algogeeks] Zynga intern

2011-09-06 Thread sukran dhawan
is zynga coming for intern ? which coll ? On Tue, Sep 6, 2011 at 12:28 PM, Shashank Jain shashan...@gmail.com wrote: me 2 Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Wed, Aug 31, 2011 at 4:05 PM, Akash Mukherjee akash...@gmail.comwrote: +1 On Wed,

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread sukran dhawan
my soln works without increasing the string length just start with first and last character copy last character with first increment i and decrement j and contibue the procedure continue the same till u get mid element :) On Tue, Sep 6, 2011 at 12:56 PM, Atul Modi atul.a...@gmail.com wrote:

Re: [algogeeks] IP Address

2011-09-06 Thread sagar pareek
@ r_shetty search 1. struct in_addr 2. struct sockaddr_in On Mon, Sep 5, 2011 at 10:04 PM, teja bala pawanjalsa.t...@gmail.comwrote: resource records which is a 5 tuple(domain_name,type,value,class,time_to_live) is returned to respective browser request when a resolver gets called.. On

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread surender sanke
@sukran, string shouldn't be replaced, only addition of characters allowed On Tue, Sep 6, 2011 at 1:48 PM, sukran dhawan sukrandha...@gmail.comwrote: my soln works without increasing the string length just start with first and last character copy last character with first increment i and

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread ROHIT SINGHAL
due to this singleton class i lost 6.5 lpa opportunity :( in Hcentive noida On Tue, Sep 6, 2011 at 12:58 PM, rahul vatsa vatsa.ra...@gmail.com wrote: there is no restriction at all, you can create n no of objects. A member function can call a private constructor any number of times. Just 1

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread rahul vatsa
:D may be u lost this to gt something better :-) On Tue, Sep 6, 2011 at 4:32 AM, ROHIT SINGHAL rohitksingha...@gmail.comwrote: due to this singleton class i lost 6.5 lpa opportunity :( in Hcentive noida On Tue, Sep 6, 2011 at 12:58 PM, rahul vatsa vatsa.ra...@gmail.comwrote: there is no

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread siddharam suresh
my personal experience. guys don't regret while placements, it wont bring any work-ability in the preparation. always look for what was missing in the last interview, prepare well. I didnt prepare because of the initial failure in the placements(ended up where i did not planed). I wish that wont

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread sukran dhawan
ya dont be upset if some one who is not as good as u get a job and u don get it ... think positively ... think that the company don deserve u and start working on ur weak areas On Tue, Sep 6, 2011 at 2:34 PM, siddharam suresh siddharam@gmail.comwrote: my personal experience. guys don't

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread ROHIT SINGHAL
:) thanks for such gud words guys On Tue, Sep 6, 2011 at 2:47 PM, sukran dhawan sukrandha...@gmail.comwrote: ya dont be upset if some one who is not as good as u get a job and u don get it ... think positively ... think that the company don deserve u and start working on ur weak areas On

[algogeeks] Algo Book

2011-09-06 Thread Neha Gupta
hey guys , do tell me a book for algo( other than cormen) with good no. of illustrations or any resource or link on net(especially for dp, backtracking, np problems etc ) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Algo Book

2011-09-06 Thread siddharam suresh
Data Structures and Algorithms Alfred V. Aho (Author), Jeffrey D. Ullman (Author), John E. Hopcroft (Author) Thank you, Sid. On Tue, Sep 6, 2011 at 3:45 PM, Neha Gupta nehagup...@gmail.com wrote: hey guys , do tell me a book for algo( other than cormen) with good no. of illustrations or any

Re: [algogeeks] Algo Book

2011-09-06 Thread Udit Gupta
Fundamentals of Computer Algorithms by Sartaj Sahni On Tue, Sep 6, 2011 at 3:45 PM, Neha Gupta nehagup...@gmail.com wrote: hey guys , do tell me a book for algo( other than cormen) with good no. of illustrations or any resource or link on net(especially for dp, backtracking, np problems etc

Re: [algogeeks] Algo Book

2011-09-06 Thread Neha Gupta
@siddharam ...iski ebook milegi to refer -- You received this message because you are subscribed to the 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.

Re: [algogeeks] Algo Book

2011-09-06 Thread Prashant Kulkarni
The Algorithm Design Manual By Steve S. Skiena -- Prashant Kulkarni On Tue, Sep 6, 2011 at 3:48 PM, Udit Gupta uditgupta...@gmail.com wrote: Fundamentals of Computer Algorithms by Sartaj Sahni On Tue, Sep 6, 2011 at 3:45 PM, Neha Gupta nehagup...@gmail.com wrote: hey guys , do tell me a

Re: [algogeeks] FUNCTION POINTER IN C

2011-09-06 Thread HARISH S.C
Hi, Google Template classes in c++ (or) generic classes in c++ you will get lots of example Regards, S.C.Harish Associate Software Engineer, Cordys RD http://www.cordys.com/, Hyderabad On Mon, Sep 5, 2011 at 5:11 PM, kARTHIK R k4rth...@gmail.com wrote: For sending the type, you dont have to

Re: [algogeeks] Algo Book

2011-09-06 Thread siddharam suresh
@neha: there is site calledhttp://library.nu register there, u'll get majority of the books. Thank you, Sid. On Tue, Sep 6, 2011 at 3:54 PM, Prashant Kulkarni prashant.r.k...@gmail.com wrote: The Algorithm Design Manual By Steve S. Skiena -- Prashant Kulkarni On Tue, Sep 6, 2011 at

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread parth panchal
hi neha how are you send me a nice mail of nature plz reply me i m online now -- You received this message because you are subscribed to the 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] Re: Algo Book

2011-09-06 Thread Ankuj Gupta
Data Structures and Algorithm Analysis by Mark Allen Weiss On Sep 6, 3:39 pm, siddharam suresh siddharam@gmail.com wrote: @neha: there is site calledhttp://library.nu register there, u'll get majority of the books. Thank you, Sid. On Tue, Sep 6, 2011 at 3:54 PM, Prashant Kulkarni

Re: [algogeeks] MS question

2011-09-06 Thread ravinder s
haha lol f o On Tue, Sep 6, 2011 at 8:51 AM, Yogesh Yadav medu...@gmail.com wrote: @all : Thanks for correcting me. On Tue, Sep 6, 2011 at 3:41 AM, Piyush Grover piyush4u.iit...@gmail.comwrote: Here's the pseudo code. I hope it should work. d = date-string (d[0]d[1]) m =

[algogeeks] Re: DE shaw question- urgent

2011-09-06 Thread siva viknesh
@parth U r banned On Sep 6, 3:47 pm, parth panchal parthpancha...@gmail.com wrote: hi neha how are you send me a nice mail of nature plz reply me i m online now -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] Algo Book

2011-09-06 Thread Neha Gupta
thanku sid :) -- You received this message because you are subscribed to the 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

Re: [algogeeks] Algo Book

2011-09-06 Thread Manikanta Babu
The Algorithm Design Manual is the best book you can refer. But its not for beginners. Cheers, Mani On Tue, Sep 6, 2011 at 4:09 PM, siddharam suresh siddharam@gmail.comwrote: @neha: there is site calledhttp://library.nu register there, u'll get majority of the books. Thank you, Sid.

Re: [algogeeks] Algo Book

2011-09-06 Thread Neha Gupta
thnx to all :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this

Re: [algogeeks] Re: Stack problem

2011-09-06 Thread HARISH S.C
Have a separate stack for minimum. While pushing, insert the number in minimum stack only if the given number is less that or equal to the number @ the top of min stack. While removing, remove the value from min stack only if its equal to the value thats popped. -- You received this message

Re: [algogeeks] Re: DE shaw question- urgent

2011-09-06 Thread sumit kumar pathak
*lol *regards - Sumit Kumar Pathak (Sumit/ Pathak/ SKP ...) *Smile is only good contagious thing.* *Spread it*! On Tue, Sep 6, 2011 at 4:51 PM, siva viknesh sivavikne...@gmail.com wrote: @parth U r banned On Sep 6, 3:47 pm, parth panchal parthpancha...@gmail.com wrote:

[algogeeks] Re: macro

2011-09-06 Thread Dave
@Mohit: If n is a power of 2, then the macro returns x if x is a multiple of n or x rounded up to the next multiple of n if x is not a multiple of n. E.g., ROUNDUP(16,4) = 16 and ROUNDUP(17,4) = 20. The result doesn't appear useful if n is not a power of 2. Since ~(n-1) = -n, it could be written

[algogeeks] Re: Stack problem

2011-09-06 Thread Don
@HARISH: Push 20 1 3 1 5 1 6 1 2 1 Pop Now in your algorithm min will return 20, even though 1 and 3 and other smaller numbers are still in the stack. Don On Sep 6, 6:25 am, HARISH S.C s.c.har...@gmail.com wrote: Have a separate stack for minimum. While pushing, insert the number in minimum

Re: [algogeeks] Re: Stack problem

2011-09-06 Thread Prem Krishna Chettri
Guys What the Issue Here?? I think its straight forward. If I hv two Stack First :- Keep pushing and Popping the incoming values Second :- Keeping track of the so far min element in the First Stack. Now maintaining second stack is bit tricky. PUSH :- If the element is

Re: [algogeeks] Re: Stack problem

2011-09-06 Thread Shravan Kumar
void push(int num){ if(stk1.isEmpty()){ stk1.push(num); stk2.push(num); } else{ if(numstk2.top())stk1.push(num); else{stk1.push(num);stk2.push(num)} } } int pop(){ int num=stk1.pop(); if(num==stk2.top())stk2.pop(); return num; } On Tue, Sep

[algogeeks] virtual memory

2011-09-06 Thread Aman Kumar
Hii what happen if size of main memory is greater than size of virtual memory? -- You received this message because you are subscribed to the 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] virtual memory

2011-09-06 Thread Piyush Grover
it's a subjective question. If you have 100GB of main memory and 2 GB of virtual memory and you are running very light weight programs then nothing will happen. The system memory has enough space to take care of all the applications but if your system is heavily loaded with processes then it

[algogeeks] java books???

2011-09-06 Thread htross
guys i need to prepare for java aptitude so please refer some books.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send

Re: [algogeeks] Re: SEEK advice very urgent

2011-09-06 Thread Vipin Vishvkarma
On Thu, Sep 1, 2011 at 12:32 PM, raj kumar megamonste...@gmail.com wrote: I am from Delhi College of Engineering[now DTU] i don't think it's on us to chose the location where we want to work , they will ask our preferences if possible then only they will send us to singapore otherwise we will

Re: [algogeeks] Re: Stack problem

2011-09-06 Thread Prem Krishna Chettri
@ Shravan :- Thank for the Code but there are couple of issue with that.. 1 Please try to provide the algo approach. Coz I feel here we discuss irrespective of language , the technique of approach. 2 Your Code implementation of whatever your approach is

Re: [algogeeks] Re: SEEK advice very urgent

2011-09-06 Thread Vipin Vishvkarma
On Tue, Sep 6, 2011 at 9:21 AM, Vipin Vishvkarma vipinvi...@gmail.comwrote: On Thu, Sep 1, 2011 at 12:32 PM, raj kumar megamonste...@gmail.comwrote: I am from Delhi College of Engineering[now DTU] i don't think it's on us to chose the location where we want to work , they will ask our

[algogeeks] Re: Stack problem

2011-09-06 Thread Dave
@Shravan: Push can be written more compactly as void push(int num) { stk1.push(num); if(stk2.isEmpty() || num=stk2.top()) stk2.push(num); } Then don't forget min: int min() { return stk2.top(); } Dave On Sep 6, 7:56 am, Shravan Kumar shrava...@gmail.com wrote: void

[algogeeks] Re: Stack problem

2011-09-06 Thread Dave
@Prem: The approach has been discussed in previous posts in this thread, so there is no need for Shravan to repeat it. Please follow your own advice and tell what problem shows up with the sample input. Dave On Sep 6, 8:26 am, Prem Krishna Chettri hprem...@gmail.com wrote: @ Shravan :-  Thank

[algogeeks] Re: Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?

2011-09-06 Thread yamini gupta
partition the array using quick sort and find the kth smallest or largest number On Sep 6, 12:20 am, learner nimish7andr...@gmail.com wrote: @Dave,All So Can Anyone Provide The Working Code in Linear Time for the same ? Thanks On Sep 5, 6:41 pm, Dave dave_and_da...@juno.com wrote:

Re: [algogeeks] java books???

2011-09-06 Thread md shaukat ali
nageshwar rao On Tue, Sep 6, 2011 at 8:22 PM, Sandy sandy.wad...@gmail.com wrote: Java How To Program - Deitel Deitel On Tue, Sep 6, 2011 at 5:38 PM, htross htb...@gmail.com wrote: guys i need to prepare for java aptitude so please refer some books.. -- You

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread Shravan Kumar
@Yamini Please read the subject of this mail On Tue, Sep 6, 2011 at 7:54 PM, yamini gupta adorableyamin...@gmail.comwrote: add all the characters present in the string in reversed order to the string On Sep 6, 1:26 pm, surender sanke surend...@gmail.com wrote: @sukran, string shouldn't be

Re: [algogeeks] Re: Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?

2011-09-06 Thread Shravan Kumar
http://jonah.cs.elon.edu/sduvall2/courses/csc331/2006spring/Lectures/Order_statistics.ppt On Tue, Sep 6, 2011 at 7:53 PM, yamini gupta adorableyamin...@gmail.comwrote: partition the array using quick sort and find the kth smallest or largest number On Sep 6, 12:20 am, learner

Re: [algogeeks] Re: macro

2011-09-06 Thread Sandy
What is the practical application of this expression? On Tue, Sep 6, 2011 at 5:38 PM, Dave dave_and_da...@juno.com wrote: @Mohit: If n is a power of 2, then the macro returns x if x is a multiple of n or x rounded up to the next multiple of n if x is not a multiple of n. E.g., ROUNDUP(16,4) =

[algogeeks] C output????

2011-09-06 Thread sivaviknesh s
main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] C output????

2011-09-06 Thread Shravan Kumar
String literals are saved into a separate table in compiler. So second time when you define persons it wont be created or allocated memory as it already exists in table. On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr();

Re: [algogeeks] C output????

2011-09-06 Thread aditi garg
It is basically comparing the addresses of the two and since p contains the memory address of persons it gives the output as technical persons... infact ull be surprised to see dis #includestdio.h main(){char p[]=persons;char q[]=persons;if(p==q)printf

Re: [algogeeks] C output????

2011-09-06 Thread Dheeraj Sharma
in case of constant strings..they all return the same pointer..where they are defined.. but in case of non constant strings..like a[]=sumthing and b[]=sumthing...they will have separate memory allocations.. On Tue, Sep 6, 2011 at 9:12 PM, aditi garg aditi.garg.6...@gmail.comwrote: It is

Re: [algogeeks] C output????

2011-09-06 Thread sukran dhawan
addresses are compared here i think On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works

Re: [algogeeks] C output????

2011-09-06 Thread Sandy
String constants (literals) are saved into the .data section of the program, Here is the sample program to show that. if() is essentially comparing the addresses of two pointers which is same. int main() { char *p=persons; char *q=persons; char *r=persons; char *s=persons; printf(%x %x %x

[algogeeks] Re: problems about the puzzle Chameleon

2011-09-06 Thread sandeep gupta
let the blue and green chameleon meet first. Result : 14 - red 14 - green 16 - blue now 14 times pair of red and green meet to make it all 44 blue On Sep 5, 11:44 pm, Don dondod...@gmail.com wrote: Yes, you are right, it is 4 in that case. It seems that f is always even. It is possible for 44

Re: [algogeeks] Re: problems about the puzzle Chameleon

2011-09-06 Thread Sandy
@SandeepGupta: That ways red will be 15. On Tue, Sep 6, 2011 at 9:43 PM, sandeep gupta sandeepgupta...@gmail.comwrote: let the blue and green chameleon meet first. Result : 14 - red 14 - green 16 - blue now 14 times pair of red and green meet to make it all 44 blue On Sep 5, 11:44 pm,

[algogeeks] Re: C output????

2011-09-06 Thread siva viknesh
thanks a lot guys :) On Sep 6, 11:48 am, Rajeshwar Patra rajeshwarpa...@gmail.com wrote: pointer points to read only memory location and this address is then compared whch evaluates to true hence the output... -- You received this message because you are subscribed to the Google Groups

[algogeeks] c output .. help plz

2011-09-06 Thread sivaviknesh s
printf(%d,3.14*6.25*6.25); ...ans : 0 ..how and why?? why not type conversion take place?? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

[algogeeks] Re: Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?

2011-09-06 Thread Dave
@Yamini: The quicksort partitioning method will find the kth order statistic in _average_ time O(n), but the worst cast time is O(n^2). Getting O(n) worst cast behavior is more complicated. Shravan gives a helpful link that describes the algorithm well. Dave On Sep 6, 9:23 am, yamini gupta

[algogeeks] Re: macro

2011-09-06 Thread Dave
@Sandy: You could use this when you need to round up a number to a number that has a certain number of low-order zeros. As far as a practical application: when you need it you need it. Dave On Sep 6, 10:31 am, Sandy sandy.wad...@gmail.com wrote: What is the practical application of this

[algogeeks] sap labs

2011-09-06 Thread siva viknesh
hi anybody who attended plz share interview experiences and also written test ques -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email

Re: [algogeeks] FUNCTION POINTER IN C

2011-09-06 Thread Puneet Ginoria
i am getting things in C++ but i need all this to be done in C. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] c output .. help plz

2011-09-06 Thread sukran dhawan
it wil not truncate the floating point to integer remember... On Tue, Sep 6, 2011 at 9:55 PM, sivaviknesh s sivavikne...@gmail.comwrote: printf(%d,3.14*6.25*6.25); ...ans : 0 ..how and why?? why not type conversion take place?? -- Regards, $iva -- You received this message because you

Re: [algogeeks] c output .. help plz

2011-09-06 Thread sukran dhawan
coz both floating point are stored in ieee format which is different from integers On Tue, Sep 6, 2011 at 10:18 PM, sukran dhawan sukrandha...@gmail.comwrote: it wil not truncate the floating point to integer remember... On Tue, Sep 6, 2011 at 9:55 PM, sivaviknesh s

[algogeeks] Re: problems about the puzzle Chameleon

2011-09-06 Thread Don
@Sandeep: there are 45 chameleons, not 44. If blue and green meet first, there will be 15 red, not 14. You can find all of the possible combinations very quickly using a 46x46 table. Start with all cells set to false except for the first (13,15). If you know the red and green count, you can

[algogeeks]

2011-09-06 Thread Sanjay Rajpal
#include stdio.h #includeconio.h int main() { printf( %d,sizeof(main())); ... getche(); return 0; } o/p is 4..how ??? Sanju :) -- You received 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]

2011-09-06 Thread siddharam suresh
*main()* is an address/probably the function pointer, Thank you, Sid. On Tue, Sep 6, 2011 at 11:19 PM, Sanjay Rajpal srn...@gmail.com wrote: #include stdio.h #includeconio.h int main() { printf( %d,sizeof(main())); ... getche(); return 0; } o/p is 4..how ??? Sanju :) -- You

Re: [algogeeks]

2011-09-06 Thread sukran dhawan
function pointer so answer is size of pointer can be 4 or 2 depending on word size On Tue, Sep 6, 2011 at 11:21 PM, siddharam suresh siddharam@gmail.comwrote: *main()* is an address/probably the function pointer, Thank you, Sid. On Tue, Sep 6, 2011 at 11:19 PM, Sanjay Rajpal

Re: [algogeeks] Re: Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?

2011-09-06 Thread sukran dhawan
+1 to piyush On Tue, Sep 6, 2011 at 11:15 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: this can be done using heap tree data structure. -create a max heap tree of first k elements (for finding kth min) -keep on adding elements in the heap if the root element is greater than the

Re: [algogeeks]

2011-09-06 Thread SANDEEP CHUGH
i think main gives the address not main() ?? On Tue, Sep 6, 2011 at 11:21 PM, siddharam suresh siddharam@gmail.comwrote: *main()* is an address/probably the function pointer, Thank you, Sid. On Tue, Sep 6, 2011 at 11:19 PM, Sanjay Rajpal srn...@gmail.com wrote: #include stdio.h

Re: [algogeeks]

2011-09-06 Thread himanshu kansal
sizeof is nt defined for function typeundefined reslt On Tue, Sep 6, 2011 at 11:21 PM, siddharam suresh siddharam@gmail.comwrote: *main()* is an address/probably the function pointer, Thank you, Sid. On Tue, Sep 6, 2011 at 11:19 PM, Sanjay Rajpal srn...@gmail.com wrote:

Re: [algogeeks]

2011-09-06 Thread Sanjay Rajpal
if main() were a pointer, then char c() { return '1'; } int main() { printf(%d,sizeof(c())); } would also have shown 4, but it shows 1. I think there is a hidden concept. If we change the return type of c() to void, it shows an error. But instead of c(), we use main() with void as return type,

Re: [algogeeks]

2011-09-06 Thread siddharam suresh
if its size of return type, the program has to show segmentation error (it calls main infinitely,BTW size of void = 1). Thank you, Sid. On Tue, Sep 6, 2011 at 11:26 PM, Sanjay Rajpal srn...@gmail.com wrote: if main() were a pointer, then char c() { return '1'; } int main() {

[algogeeks] Re:

2011-09-06 Thread ankush garg
better contact AKSHAY CHADHA .. the person is quite good at c and algos currently placed in MICROSOFT.. akshay.chadha...@gmail.com 9899466888 -- 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:

2011-09-06 Thread siddharam suresh
its size of return type, but why the above program not showing segmentation fault? Thank you, Sid. On Tue, Sep 6, 2011 at 11:34 PM, ankush garg agb.g...@gmail.com wrote: better contact AKSHAY CHADHA .. the person is quite good at c and algos currently placed in MICROSOFT..

Re: [algogeeks] Re:

2011-09-06 Thread Kunal Patil
sizeof never executes whatever expression is given as parameter. It needs only size of parameter. In this case, parameter main() returns an int type. So sizeof returns sizeof int. It doesnt need to call main() to get its task, of finding size, done. On Tue, Sep 6, 2011 at 11:41 PM, siddharam

Re: [algogeeks] Re:

2011-09-06 Thread siddharam suresh
my guess, sizeof() takes only the declaration properties not the definition properties(that means it wont call the function) *#includestdio.h* *void c(); * *int main()* *{* *printf(%d,sizeof(c()));* *}* *void c()* *{* *printf(c); * *}* *o/p:* *1* Thank you, Sid. On Tue, Sep 6, 2011 at 11:41

[algogeeks] EOF

2011-09-06 Thread Anurag Gupta
how to read a string whose length is not known and string is so long that we can't read it all at once? input (i.e string) is terminated by EOF -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] SPOJ

2011-09-06 Thread Akshata Sharma
I am getting WA in this problem, I am not getting what i am doing wrong . http://www.spoj.pl/problems/AE2A/ My dp is: dp[n][k] = (dp[n - 1][k - 1] + dp[n - 1][k - 2] + dp[n - 1][k - 3] + dp[n - 1][k - 4] + dp[n - 1][k - 5] + dp[n - 1][k - 6]) and my code: #includeiostream using namespace

Re: [algogeeks] Linkedlist problem

2011-09-06 Thread Arun prasath
if(nodeptr) { } On Mon, Sep 5, 2011 at 5:29 PM, $hr! k@nth srithb...@gmail.com wrote: Hi guyz, *Given only a pointer to a node to be deleted in a singly linked list, how do you delete it?* if that node is in between the list, we can copy the data from next node into this node and we

Re: [algogeeks] EOF

2011-09-06 Thread Kunal Patil
If I understand question correctly, then just read as many characters as you can using standard string functions. (like fgets n all related) Output these all characters in a file. Iterate until you have read all the characters and go on appending what you have read to file. You intended to ask

Re: [algogeeks] Re:

2011-09-06 Thread Kunal Patil
@siddharam suresh: sizeof(void) is an prohibited operation. So your code would result in compile time error. On Tue, Sep 6, 2011 at 11:47 PM, siddharam suresh siddharam@gmail.comwrote: my guess, sizeof() takes only the declaration properties not the definition properties(that means it

[algogeeks] Re: Linkedlist problem

2011-09-06 Thread Don
You can't delete the last node from a singly linked list if all you have is a pointer to that node. The previous node has a pointer to the deleted node, and there is no way for you to get there to set it to NULL. Sometimes this is addressed by having a deleted flag in each node. If you set that

[algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread Brijesh
This can be solve by considering following case: i) If all the letters in the word are distinct : Just concatenate, reverse of the string(excluding last letter) to the original word..e.g. ZXKH==ZXKH KXZ ii)If two letters are same in the word : First ignore all the letters between those same

[algogeeks] Re: sap labs

2011-09-06 Thread htross
its an online test which consusts of 1.logical ability 2.database concepts 3 algorithms 4 aptitude On Sep 6, 9:31 pm, siva viknesh sivavikne...@gmail.com wrote: hi    anybody who attended plz share interview experiences and also written test ques -- You received this message because you are

Re: [algogeeks] Re:

2011-09-06 Thread UTKARSH SRIVASTAV
sizeof(void) s not giving error... On Tue, Sep 6, 2011 at 12:13 PM, Kunal Patil kp101...@gmail.com wrote: @siddharam suresh: sizeof(void) is an prohibited operation. So your code would result in compile time error. On Tue, Sep 6, 2011 at 11:47 PM, siddharam suresh

[algogeeks] size of

2011-09-06 Thread UTKARSH SRIVASTAV
why sizeof(vod) is giving ans 1 not error? -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @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

[algogeeks] Re: size of

2011-09-06 Thread UTKARSH SRIVASTAV
and why sizeof(NULL) is giving 4 any ans? -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT ALLAHABAD* -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT ALLAHABAD* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] SPOJ

2011-09-06 Thread Gaurav Menghani
Description of the problem and your solution could help others. On Wed, Sep 7, 2011 at 12:01 AM, Akshata Sharma akshatasharm...@gmail.com wrote: I am getting WA in this problem, I am not getting what i am doing wrong . http://www.spoj.pl/problems/AE2A/ My dp is: dp[n][k] = (dp[n - 1][k -

[algogeeks] Re: Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?

2011-09-06 Thread Dave
@Piyush: You are correct, but the more complicated median-of-median algorithms can find the kth order statistic in O(n), independent of k. Thus, the median, which is the n/2th order statistic, can be found in O(n), whereas the heap algorithm will find the median in O(n log n). Dave On Sep 6,

Re: [algogeeks] Re: c output .. help plz

2011-09-06 Thread UTKARSH SRIVASTAV
printf behaves abnormally when it sees arguments not matching with its datatype @dave printf(%d,(int)3.14*6.25*6.25); is also giving 0. -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT ALLAHABAD* -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?

2011-09-06 Thread UTKARSH SRIVASTAV
find by sing median of median methods -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @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

[algogeeks] Re: c output .. help plz

2011-09-06 Thread Dave
@Srivastav: Yeah. You need more parens: printf(%d,(int)(3.14*6.25*6.25)); Without the extra parens, the 3.14 is cast to an int, but then implicitly recast to a double for the multiplications. With the parens, the product is formed in type double, and then the result is cast into integer. Sorry

[algogeeks] Maximum possible edges in a graph

2011-09-06 Thread Shuaib Khan
What is the maximum number of edges possible in a graph with N nodes, and where any three nodes can have at most two edges between them. 1=N=10. -- Shuaib -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] Re: Maximum possible edges in a graph

2011-09-06 Thread Shuaib Khan
I don't have a formal proof yet, but can anyone give a counter test case to following: Let f(n) be our function: if n is even: f(n) = (n^2)/4 else: f(n) = ((n-1)^2)/4 + (n-1)/2 On Wed, Sep 7, 2011 at 5:36 AM, Shuaib Khan aries.shu...@gmail.com wrote: What is the maximum number of edges

[algogeeks] Re: Microsoft written!!!

2011-09-06 Thread Vikram Singh
i m asking again, cos no one replied earlier: in example given by mohit... is the leftmost right cousin of 8 and 9, NULL or 12?? On Aug 27, 6:42 pm, aditi garg aditi.garg.6...@gmail.com wrote: This grp is full of MS interview ques..search the archives... On Sat, Aug 27, 2011 at 6:55 PM, teja

[algogeeks] stack implementation with a constraint

2011-09-06 Thread *$*
HI, Need logic to implement a stack which should support push , pop , top as well as mostFrequent. mostFrequent should return the most frequently pushed element. I have provided the following logic have one general stack implementation and one Heap .. (Heapify based on frequeny not based on

Re: [algogeeks] Re:

2011-09-06 Thread rahul vatsa
sizeof(void) - 1 void is a datatype, though u cant create obj of void type, then also it hs to hs a size, so it hs been given the minimal sz i.e 1. On Tue, Sep 6, 2011 at 3:13 PM, Kunal Patil kp101...@gmail.com wrote: @siddharam suresh: sizeof(void) is an prohibited operation. So your

Re: [algogeeks] size of

2011-09-06 Thread rahul vatsa
bcoz void is a datatype, though u cant create obj of void type, then also it hs to hs a size, so it hs been given the minimal sz i.e 1 On Tue, Sep 6, 2011 at 5:11 PM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: why sizeof(vod) is giving ans 1 not error? -- *UTKARSH SRIVASTAV CSE-3

  1   2   >