Re: Time-efficient program

2012-08-09 Thread Robert Klemme
On Thu, Aug 9, 2012 at 5:52 PM, ajay paswan wrote: > Suppose you are given a program, now you are given a task to minimize > the time, what will be your approach? What time? > and how will you measure the time needed? > I think if we can get total clock cycle by any mean, that could be the > bes

Re: File eliminating 'a'

2012-08-09 Thread Robert Klemme
On Thu, Aug 9, 2012 at 1:53 PM, ajay paswan wrote: > Could not understand any line.. > can we do in conventional way? > like open a file to read and then open a file to write and then write > logically, then delete source and rename the new file. Like so? 14:50:41 ~$ ruby19 rrr.rb t1.txt 14:50:4

Re: File eliminating 'a'

2012-08-09 Thread Robert Klemme
On Thu, Aug 9, 2012 at 11:31 AM, ajay paswan wrote: > How can I eliminate every 'a' in a file if it is not inside double > quote? > > For example: > > input:"acb"gha"abc" > output:"acb"gh"abc" Here's one way: $ ruby19 -i.bak rr.rb t1.txt t2.txt $ diff -U5 t1.txt.bak t1.txt --- t1.txt.bak 2012-0