Welcome to my blog! Here I will post my thoughts on software, computing, food, philosophy, travel, real estate and everything else :)
Get link
Facebook
X
Pinterest
Email
Other Apps
The Man who knows how will always have a job, The man who also knows why will always be his boss!
- Ralph Waldo Emerson!
Get link
Facebook
X
Pinterest
Email
Other Apps
Comments
Popular posts from this blog
Indian's Blogging
After a long time, I though I will drop in some words of my own. I am moving to virginia and this is when I had few days without working/going at Nordborg lab. While surfing I found many interesting things. Few of them are pointed out as follows:
1) A lot has happened to Indian culture since the time I left it. A lot has happened on IT front too. Here I am not only talking about the oursourcing world but about the IT culture. When googling, I found so many blogs describing their life/lifestyles/experiences with work, etc. Few of them are Gautam Gosh's world and Dina Mehta's world
'am really happy about my new finding. Hope this trend continues and prospers
choose one millon random lines from a file containing one billion lines This is an interesting problem and I can imagine lots of data intensive companies must be facing these types of challeges where they need to analyse the weblogs. So let me write down the problem statement and look at various available solutions "Given an apache webserver logfile containing appx 1 billion entries, write an algorithm to select 1 million entries randomly from this file" Solution: Here are a few assumptions 1) Because the problem states that the file has appx 1 billion lines, I will assume that we don't know the exact number of lines in the files 2) I will assume that I don't have enough memory in my computer to hold all 1 billion lines. But I do have memory to hold 1 million lines and also I do have a data-structure that can count untill 1 million (longint ?) Here is an algorithm I propose $N=1000000 for (1..$N) { push @lines, scalar ; } while( )...
Comments