Re: [algogeeks] Re: Code it...
@Utkarsh In this code I am writing on the source code file at time of execution Every time the file executes it changes its own source code...However I too would like to know if we can do that in c ... On Fri, Nov 11, 2011 at 12:38 PM, UTKARSH SRIVASTAV usrivastav...@gmail.com wrote: @NAMAN i don't know python but i think u r writing in a new file . what i want to say a c code that could write on a.out without the use of another file On Fri, Nov 11, 2011 at 12:32 PM, NAMAN KOHLI naman09...@iiitd.ac.inwrote: I think @Don meant this For a *New Text Document.py* in my folder I am running this script in python File = open(New Text Document.py,'r') data = File.readlines() print 1 value = int(data[2].split( )[1]) print value File.close() File = open(New Text Document.py,'w') value += 1 data[2]=print +str(value)+'\n' for i in data: File.writelines(i) File.close() This prints a new value every time the program runs... The only catch is that you have to shut the program after running it once and then again restart it.. Please tell if there is any error On Fri, Nov 11, 2011 at 1:48 AM, UTKARSH SRIVASTAV usrivastav...@gmail.com wrote: @don can u give a code for your logic On Wed, Oct 19, 2011 at 2:45 PM, Azhar Hussain azhar...@gmail.comwrote: I am not sure about the program to do it. But, 'strace' on linux would give the details of a program(parameters passed, retrun values, signals recieved etc). If you are looking for something similar then you can loot at strace source. mean while a.out does not not have information of stack pointer etc which will be built only at run time and it just tells what data goes to text, stack etc. it is dumb it does not do anything, the interpreter recollects all the info from a.out. - Azhar. On Wed, Oct 19, 2011 at 2:29 PM, Rahul raikra...@gmail.com wrote: http://www.dgp.toronto.edu/~ajr/209/notes/memoryos.html Rahul On Wed, Oct 19, 2011 at 2:29 PM, Rahul raikra...@gmail.com wrote: http://valgrind.org/ I am not sure but this may help on linux. I have a question that how to determine the number of system calls a program has made ? That too of a particular type Rahul On Wed, Oct 19, 2011 at 11:07 AM, kumar raja rajkumar.cs...@gmail.com wrote: Can someone give me an idea about how to see the range of segments like data ,heap,stack and text segments of an executable file.(a.out) Is there anyway to access the those segments from the program itself (while in execution), like using stack pointer for stack segment ?? On 18 October 2011 19:54, sravanreddy001 sravanreddy...@gmail.comwrote: @Don, Gene: very good insights, didn't even thought of the changing the executable, but it indeed is one way to do. :) @Don: agree with scripts and interpreted code.. :) [coming out of the same language helps answers some questions easily] -- 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/-/ONw7a6q9VRMJ. 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 http://groups.google.com/group/algogeeks?hl=en. -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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 http://groups.google.com/group/algogeeks?hl=en. -- 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 http://groups.google.com/group/algogeeks?hl=en. -- 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 http://groups.google.com/group/algogeeks?hl=en. -- *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 group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Naman Kohli Roll No. 2009027 -- You received this message because you
Re: [algogeeks] Re: Code it...
I think @Don meant this For a *New Text Document.py* in my folder I am running this script in python File = open(New Text Document.py,'r') data = File.readlines() print 1 value = int(data[2].split( )[1]) print value File.close() File = open(New Text Document.py,'w') value += 1 data[2]=print +str(value)+'\n' for i in data: File.writelines(i) File.close() This prints a new value every time the program runs... The only catch is that you have to shut the program after running it once and then again restart it.. Please tell if there is any error On Fri, Nov 11, 2011 at 1:48 AM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: @don can u give a code for your logic On Wed, Oct 19, 2011 at 2:45 PM, Azhar Hussain azhar...@gmail.com wrote: I am not sure about the program to do it. But, 'strace' on linux would give the details of a program(parameters passed, retrun values, signals recieved etc). If you are looking for something similar then you can loot at strace source. mean while a.out does not not have information of stack pointer etc which will be built only at run time and it just tells what data goes to text, stack etc. it is dumb it does not do anything, the interpreter recollects all the info from a.out. - Azhar. On Wed, Oct 19, 2011 at 2:29 PM, Rahul raikra...@gmail.com wrote: http://www.dgp.toronto.edu/~ajr/209/notes/memoryos.html Rahul On Wed, Oct 19, 2011 at 2:29 PM, Rahul raikra...@gmail.com wrote: http://valgrind.org/ I am not sure but this may help on linux. I have a question that how to determine the number of system calls a program has made ? That too of a particular type Rahul On Wed, Oct 19, 2011 at 11:07 AM, kumar raja rajkumar.cs...@gmail.comwrote: Can someone give me an idea about how to see the range of segments like data ,heap,stack and text segments of an executable file.(a.out) Is there anyway to access the those segments from the program itself (while in execution), like using stack pointer for stack segment ?? On 18 October 2011 19:54, sravanreddy001 sravanreddy...@gmail.comwrote: @Don, Gene: very good insights, didn't even thought of the changing the executable, but it indeed is one way to do. :) @Don: agree with scripts and interpreted code.. :) [coming out of the same language helps answers some questions easily] -- 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/-/ONw7a6q9VRMJ. 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 http://groups.google.com/group/algogeeks?hl=en. -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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 http://groups.google.com/group/algogeeks?hl=en. -- 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 http://groups.google.com/group/algogeeks?hl=en. -- 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 http://groups.google.com/group/algogeeks?hl=en. -- *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 group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Naman Kohli Roll No. 2009027 -- 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 http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Median in logn
Hi This question can be done by observing the fact that if you take median m1 of the first array and the median of the second array m2 then the median of the sorted merged arrays can be found in the new array formed by :- If m1 m2 taking the right of median m1 in the first array and the left elements of the median of m2 in second array and vice versa. This formation of new array can be again repeated via recursion and at the last case you will get the median. On Fri, Sep 30, 2011 at 8:03 PM, Shruti Gupta shruti.gupt...@gmail.comwrote: Given two sorted arrays of size n each. Find the median of the array obtained after merging the above two arrays in complexity logn?? Shruti Thapar University -- 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 http://groups.google.com/group/algogeeks?hl=en. -- Naman Kohli Roll No. 2009027 -- 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 http://groups.google.com/group/algogeeks?hl=en.