Re: [algogeeks] C output

2011-07-14 Thread T3rminal
@ all This code is error in C as pre-increment operator in C returns rvalue but it will work fine in C++ as it returns lvalue in C++ which is required as LHS of assignment operator -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this

Re: [algogeeks] C OUTPUT HELP

2011-07-14 Thread T3rminal
1) getchar must be a function in that case . Check /usr/include/stdio.h . It must have contained an extern definition (it is on my machine). 2) Machines generally have separate registers for floating point values(let say %fr). While executing this line *printf(%d\n,t); *that register is loaded

Re: [algogeeks] NVIDIA Q

2011-07-07 Thread T3rminal
struct t{}; int main(){ struct t a,b,c; int l; printf(%u %u %u %u\n,a,b,c,l); } o/p 3213845680 3213845680 3213845680 3213845676 a,b,c all are pointing to same location, so no space is allocated to them. As i already mentioned, *may be* . I dont know what standard says about it or rather i

Re: [algogeeks] Re: VIRTUAL INHERITANCE

2011-07-06 Thread T3rminal
@oppilas In normal inheritance base class is not shared. Each derived class X and Y have separate instance of base class. The whole point of virtual inheritance is sharing so that there shall be no ambiguity as there is only one object of base class. -- You received this message because you

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread T3rminal
@ashish Most probably because empty struct in C have nothing associated with it. They are as good as nothing. But empty classes in C++ can have member functions. These functions need to be associated with object, having a unique address, for that class. And unique address is not possible with

[algogeeks] Re: VIRTUAL INHERITANCE

2011-07-03 Thread T3rminal
@abc abc 4th class= two ints from X and Y classes + one int from base class( as this class is shared ) + 2 virtual pointers of X and Y classes. On Jul 3, 2:24 pm, abc abc may.i.answ...@gmail.com wrote: In the second case , the size of vptr will be added to each and every object . 1st class =

[algogeeks] Re: c query

2011-06-23 Thread T3rminal
How printf can print 2 values for %s and %f if you provided only 1 (3,x1)[*arr] ? On Jun 24, 12:13 am, Anika Jain anika.jai...@gmail.com wrote: #includestdio.h typedef struct {       char *name;        double salary;}job; main() {     static job a={tcs,15000.0};     static job

[algogeeks] Re: FOR ALL INDIANS PLZ READ IT

2011-06-15 Thread T3rminal
Absolutely.. Personal comments should be completely banned. And its matter of shame for people who think that they are serving the nation by abusing others. On Jun 13, 5:29 pm, Umer Farooq the.um...@gmail.com wrote: +1 I really like this group ... but sometimes people get rude and show

[algogeeks] Re: Find shortest substring that is only occurring once. in Given String

2011-06-14 Thread T3rminal
@Akshay Suffix tree construction is O(n) On Jun 14, 8:58 pm, Akshay Rastogi akr...@gmail.com wrote: But generating a suffix tree itself is O(n2) . On Tue, Jun 14, 2011 at 7:54 PM, sunny agrawal sunny816.i...@gmail.comwrote: it must be any general string Suffix tree approach seems

[algogeeks] Re: Find shortest substring that is only occurring once. in Given String

2011-06-14 Thread T3rminal
@bittu How can u find the shortest substring from the tree in 0(n). Can u please elaborate a bit ? On Jun 14, 6:03 pm, bittu shashank7andr...@gmail.com wrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples:

[algogeeks] Re: C OUTPUT HELP

2011-06-12 Thread T3rminal
@all Stop guessing and making your own standards. C standards haven't defined anything (though in gcc arguments are processed from left to right) about processing arguments in a function call. And sentence like assgnment to a preincrement expression is delayed vry mch have no meaning .

[algogeeks] Re: C floating point issue....

2011-06-04 Thread T3rminal
@nicks KR says A warning: printf uses its first argument to decide how many arguments follow and what their type are. It will get confused and you will get wrong answer. if there are not enough arguments or if they are the wrong types. I think that is the reason for unpredictable output. On Jun 5,

[algogeeks] Re: Binary Tree Problem

2011-05-30 Thread T3rminal
Right!! that is pretty standard problem but the solution u have given is for undirected graphs and intuitively binary trees are directed. Piyush solution will work for binary tree. On May 30, 2:04 am, anshu mishra anshumishra6...@gmail.com wrote: this is a very standard problem :D start with