Re: [algogeeks] C concept on memory layout

2012-02-06 Thread sumit mahamuni
Hello, Here you are right about variable p in add function that it retains it's value even though function loses its scope. And for main function error you are seeing has nothing to do with how that variable is stored? It is about the scope of that variable C compiler sees the scope of static vari

Re: [algogeeks] C concept on memory layout

2012-02-06 Thread atul anand
http://www.geeksforgeeks.org/archives/14268 On Tue, Feb 7, 2012 at 1:06 AM, gmagog...@gmail.com wrote: > I think you are right about p being in BSS segment and it does last even > the function finishes, however, you may need a pointer to get the data out > of p. Then you can read the data. > > Co

Re: [algogeeks]

2012-02-06 Thread Durgesh Kumar
U can use dictionary or linked list Better if U choose language like python or java. Python have module named "Urllib2" and "httplib2" which implements all the functions for getiing ,posting and browsing data. INFORMAL ALGORITHM.. 1. Start with any arbitray link. LINK=[new lin

Re: [algogeeks] C concept on memory layout

2012-02-06 Thread gmagog...@gmail.com
I think you are right about p being in BSS segment and it does last even the function finishes, however, you may need a pointer to get the data out of p. Then you can read the data. Correct me if i am wrong On Mon, Feb 6, 2012 at 1:04 PM, Ravi Ranjan wrote: > i have a confusion in it > > #incl

[algogeeks] segment tree problem (spoj GSS1)

2012-02-06 Thread Anshul AGARWAL
hii friend.. its my first segment tree problem.but i get WA in 10 test case..all the test case that i try i got correct answer..can any one find bug in program and correct me plz problem http://www.spoj.pl/problems/GSS1/ algo-- i use segment tree My solution.. #include #include using namespace s

[algogeeks] C concept on memory layout

2012-02-06 Thread Ravi Ranjan
i have a confusion in it #include #include void add(int,int); int main(int argc, char *argv[]) { add(6,3); printf("%d",p); system("PAUSE"); return 0; } void add(int a, int b) { static int p; p = a+ b; } here the memory layout says variable "p" is in BSS segment ... so its an indep

[algogeeks] hint

2012-02-06 Thread Ravi Ranjan
guys.. can u please refer me the best book for graph theory for algorithm purpose thanx ravi -- 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 t

Re: [algogeeks] ORDERS

2012-02-06 Thread Piyush Kapoor
First note that the person standing at the last position can be easily found,because if it has to move by X,then after shifting its position will be N-X,which will be the position in the sorted array ,(Array becomes sorted after shifting of the last person),and the number at position N-X will be N

Re: [algogeeks] Re: In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-06 Thread atul anand
@ashish : i dont think so , given test will work fine. On 6 Feb 2012 17:06, "Ashish Goel" wrote: > > > Harshal : > check for > > aaccbcdefacccbcc > > will fail for accb > > > Best Regards > Ashish Goel > "Think positive and find fuel in failure" > +919985813081 > +919966006652 > > > On Mon, Feb

Re: [algogeeks] Re: In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-06 Thread Ashish Goel
Harshal : check for *a*acc*b*cdef*a*ccc*b*cc will fail for acc*b* Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Mon, Feb 6, 2012 at 7:42 AM, Harshal wrote: > > Initialize > i = index of first 'a' > j = index of first 'b' > n = array leng

Re: [algogeeks] ORDERS

2012-02-06 Thread Arpit Sood
i have not solved it, but you can use a BST with fields as number of elements on left and height. On Sun, Feb 5, 2012 at 7:01 PM, shady wrote: > Hi, Any hints for this problem ? > Link > > -- > You received this message because you

Re: [algogeeks] Re: In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-06 Thread Harshal
@atul, wgpshashank: its harshal, not harsahl :P wgpshashank: i think my solution works fine, can u give me a test case where it fails? On Mon, Feb 6, 2012 at 11:06 AM, atul anand wrote: > @WgpShashank : for which test case harsahl soln will fail??? > > > On Mon, Feb 6, 2012 at 11:02 AM, WgpS