HNHacker News
TopNewBestAskShowJobs

anuragbiyani

245 karma · joined January 3, 2013

submissionscomments
anuragbiyani··on Ask HN: Looking for a book on algorithms and data structures
The good thing about Algorithm Design & Analysis as a topic is that there is no lack of great resources to learn from! And even better, a large portion of them are freely available online (in forms of lecture notes, or entire books, video lectures, programming challenges with online judging, etc).

In addition to what others have mentioned, here are some example resources you might prefer for a beginner-intermediate level intro:

1. (free online) Algorithms by Dasgupta, Papadimitriou, and Vazirani http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-...

2. (free online) Algorithms by Jeff Erickson https://jeffe.cs.illinois.edu/teaching/algorithms/

3. Algorithm design by Kleinberg & Tardos https://www.amazon.com/Algorithm-Design-Jon-Kleinberg/dp/032...

4. Another one specifically for more applied view (esp., how they are used in programming contests such as ICPC) is Skiena & Revilla's "Programming Challenges" book (https://www.amazon.com/Programming-Challenges-Contest-Traini...). Note that this is different than Skiena's other popular book (Algorithm Design manual) which is also pretty good and has a "war story" based perspective to design of algorithms.

5. There are also several resources where lecture notes from university Algorithm & DS courses are very useful. Here is an example from my previous Professor, David Kempe: http://david-kempe.com/teaching/DataStructures.pdf

6. Several programming competition specific tutorials can be found on Topcoder: https://www.topcoder.com/thrive/tracks?track=Competitive%20P... (individual SRM archives are also good place to try problems first hand and then learn from other's approach). In general, if you search for ACM-ICPC resources, you will find a lot more targeted information/problems which will apply not only for leetcode, but also for detailed understanding of the theory too.

anuragbiyani··on From WinZips to GIFs, Jacob Ziv’s Algorithms Have Powered Decades of Compression
I was referring to the claim made in the README's section: "Every file that could possibly exist?", which is written as if it's a proven statement:

> That's right! Every file you've ever created, or anyone else has created or will create! Copyright infringement? It's just a few digits of π! They were always there!

But yes, after you mentioned it, I see that the conjecture disclaimer is mentioned in a section at top ("What does π have to do with my data?") and afterwards the fact is assumed as true in rest of the README.

anuragbiyani··on From WinZips to GIFs, Jacob Ziv’s Algorithms Have Powered Decades of Compression
It's a commonly held misconception that Pi is proven to be normal - it is NOT (it is a conjecture as of now) [1] [2]. Proving normality of number is a very hard problem, and hardly any numbers outside of purposefully constructed ones (such as Champernowne's constant [3]) are proven normal.

In fact it's not even proven that every digit occurs infinitely many times in the decimal expansion of Pi. [4]

So https://github.com/philipl/pifs is wrong in claiming that all byte stream will exist somewhere in Pi (it's not proven). Also it's worth calling out that even if Pi was Normal it will likely take more space to store the indices of two location as it will for original data itself (for at least majority of the integers), so it's not much of a "compression" strictly speaking. It's easy to see how this will work out for a known normal number - Champernowne's constant [3] -> Unlike Pi, Champernowne's constant is guaranteed to contain all the possible natural number sequences, but storing just the starting index of them in this constant is going to take much longer than the entire number itself (e.g., number "11" start at index 12 (1-indexing), number "12" starts at index 14, and so on - the size of index increases much faster than integer being looked up itself).

[1] https://mathworld.wolfram.com/NormalNumber.html

[2] https://math.stackexchange.com/a/216578

[3] Champernowne's constant (in base 10) is the concatenation of all positive integers and treating them as the decimal expansion (following "0."): 0.12345678910111213... It can be trivially seen that it contains all natural number strings. It is also proven to be Normal in base 10 (which is a stronger property). See https://en.wikipedia.org/wiki/Champernowne_constant for details.

[4] https://en.wikipedia.org/wiki/Normal_number#Properties_and_e...

anuragbiyani··on Mistakes we made in our company’s first 8 years
It all depends. Instagram was ~13 employees when bought at $1B. WhatsApp was like ~30-40 employees and bought at $19B.
anuragbiyani··on Facebook’s New Message to WhatsApp: Make Money
Talk about living in a bubble. +everything drdaeman@ said above.

There are more people using WhatsApp in India (thanks to popularity of image/video/voice-messages) than who can actually read or have usable Bank accounts. If you think they can pay "$1" for something they can get for free (and have been using for free in past), then you are completely out of touch of reality. Apart from the amount (which is not trivial btw), there is no concept of digital payment for masses.

Also I know it's hard for HN crowd to understand, but the concept of paying to protect "Privacy" is completely foreign for majority of the users in the world. I can guarantee you majority of the users (at least in India) will happily let you track them, show targeted ads at them, give you all the personal details you need, heck even give your their Genome for for free without even blinking an eyelid. And I am not saying this is just because of ignorance on their part, but rather "Who cares if they track me" - I get free services in return.

And this is actually not a bad setup really (again I know HN crowd will get their pitchforks out at it): Show Ads to provide actual free services (like WhatsApp, Google search, Maps, etc) to the masses. It's much better IMO then charging for these services and never have the masses be able to use them (like "GPS" would be a premium service for rich people).

Disclaimer: All opinions expressed are mine and only mine and have no connection to my employer (Google).

anuragbiyani··on Facebook’s New Message to WhatsApp: Make Money
You are completely mistaken if you think adding a subscription-only would not reduce usage of WhatsApp by 10x at least. I am an Indian (WhatsApp's biggest market by far), and know for a fact that hardly 1% of people using it right now in India would be able/willing to set up a payment system AND willing to pay $1 for it (which is not as inexpensive as you think) when there are so many free alternatives. And then it immediately loses its value as a messaging platform (since if my relatives/friends are off it due to forced subscription, what will I do on WhatsApp even though I am ok paying $1). #networkEffect

So adding forced subscription is a definite death sentence for WhatsApp. Also remember that even if everyone of the 1B people did pay $1 for the service, it will still be impossible for FB to recoup $19B it purchased WhatsApp for.

On the other hand, I would love a "Ad-free" mode for people who are willing to pay (like YT Premium), and ads to support other 99.xx%.

anuragbiyani··on Show HN: FSQL – Search through your file system with SQL-esque queries
Not to take anything away from this project, but you can filter on size, permission, etc easily and robustly using just `find` (try -perm, -size, -{c,m}time, etc flags): https://linux.die.net/man/1/find

If you are splitting strings (from output of `ls -l` presumably) for such tasks, then definitely take a look at find.

anuragbiyani··on Smart pointers and move semantics in modern C++
"The C++ Programming Language" has been updated in 2013, and includes C++11 changes: http://www.stroustrup.com/4th.html

"A Tour of C++" (also by Bjarne) is a quick overview of the language (including C++11 changes): http://www.stroustrup.com/Tour.html

Another very useful resources is the FAQs from "Standard C++ Foundation": https://isocpp.org/faq

anuragbiyani··on VPN Comparison Chart
You are missing headings in Row 2 & 3.

I think you are talking about Column E (Privacy->Logging->Activity->"DNS Requests") ? Since it falls under "Logging", you want it to be Red for YES & Green for NO (you don't want your VPN provider to log DNS Requests, etc). You will notice that everything within the "Logging" columns (Col D-H) follow this color coding, whereas for Col J-M (which are still under "Privacy", but the subsection is "Activism") it's opposite.

anuragbiyani··on Moving on from Picasa
Why doesn't Google Photos work for you ? It does provide all the features you mention (depending on definition of "Nice gallery feature" of course), and on top of it really awesome search features.

Full disclosure: I work at Google (not on the Photos product though). All opinions expressed are purely mine, and not of my employer.

anuragbiyani··on The Tragic Data Behind Selfie Fatalities
https://xkcd.com/1138/
anuragbiyani··on Graph Isomorphism Algorithm Breaks 30-Year Impasse
A quasi-polynomial time algorithm is one which has a worst case running time of 2^[O((log n)^c)], for some fixed constant 'c'. Polynomial time (PTIME) algorithms are a special case (where c=1).

"Greater metropolitan area" is a way of saying that Babai's proposed algorithm while not exactly in PTIME, is still very close. Indeed, in a certain sense it is now "closer" to PTIME than EXPTIME.

anuragbiyani··on The next version of Safari will let users block ads on iPhones and iPads
https://www.google.com/contributor/welcome/
anuragbiyani··on Send Money to Friends in Messenger
"$44 to get $40" => $4 in fees for using another bank's ATM. This is very much within the ballpark range for USA at least.

Sidenote: Usually such fees are O(1), i.e., independent of the actual amount being withdrawn (and even applies to non-monetary transactions, such as balance inquiry).

anuragbiyani··on Send Money to Friends in Messenger
"The total for both of us was $55, so you owe me $27.5."

"OK, here is some random bank's ATM which charged me $44 to get $40 (2 x $20) out, and now you say you don't have $12.5 in change on you ... well, shit." ... "What will you prefer: GWallet or FB ?"

anuragbiyani··on LibreOffice Project's Check
Thanks for correcting me sjolsen. You are right, the behavior is unspecified only.

I added a StackOverflow question (http://stackoverflow.com/questions/28816936/is-the-value-of-...) to increase the chances of someone being able to find (hopefully authoritative) information when searching for it.

anuragbiyani··on LibreOffice Project's Check
It's perfectly valid for the function getColor() to return different value for each invocation, e.g., think std::rand().

However, the function as you wrote, when used in the expression (getColor() == getColor()), results in undefined behavior. This is because equality operator (==) is not a sequence point in C++, and thus by calling getColor() twice, you are modifying variables a & b more than once between a pair of sequence points (see "Undefined behavior" section here: http://en.cppreference.com/w/cpp/language/eval_order).

In general, you cannot be sure of the order of evaluation for a statement of form say, f() == g(). The relative order in which f & g are called is unspecified. Also, the behavior can easily become undefined if you violate certain conditions in f & g (as in the case above).

anuragbiyani··on A regular expression to check for prime numbers
Also, it's easily provable (using pumping lemma) that the language: { 1^n | n is a prime number } is non-regular, so no "regular expression" (referring to strict mathematical definition here) can express it.
anuragbiyani··on How Not to Write a Signal Handler
Although I cannot recall any specific name right now, I have certainly seen programs handling a single Ctrl-C different than say two Ctrl-C in quick succession.

Example: Pressing one Ctrl-C will display a message like this on some programs (which do not want to terminate themselves upon receiving a single SIGINT, because accidents happen): "Press Ctrl-C again to quit."

anuragbiyani··on The Rust community's crate host
> you'd be surprised at how often people publish proprietary/private information, and then need to pull it down.

But once published, isn't such information already compromised for all practical purposes ?

I can understand the legal reason behind "pulling it down" (using someone else's IP, etc), but practically speaking the private information once published cannot really be "undone" (at best you can make it hard to find, and disassociate from yourself).

anuragbiyani··on Go is moving to GitHub
> Go was on Mercurial before so it was already away from any Google own source control system.

How being on Mercurial implies that it was "away from Google code" ? It is in fact hosted on Google code currently (https://code.google.com/p/go/)

PS: Google code supports: subversion, mercurial and even git (https://code.google.com/p/support/wiki/GettingStarted#Workin...)

anuragbiyani··on Show HN: Improving WhatsApp
Personally "It left the phone" state is very important to me, esp., when I am travelling and network connectivity is intermittent.

Also "Message Read" is a very ambiguous state according to me - If the content of a message is read from the notification drop down, but user never opened whatsapp to read it - is it read, or not ?

anuragbiyani··on India’s Downward Spiral
> "especally if they bothererd to called everyone to the police headquarters to get their fingerprint."

What !? This statement has NO factual basis, and is completely incorrect. (PS: I have a Aadhaar card (aka UID) myself).

anuragbiyani··on “Shellshock”
Apologies for the confusion, and thanks for the correction @jamessb. I mixed the author of the post with David J Wheeler (http://en.wikipedia.org/wiki/David_Wheeler_(British_computer..., when the author is clearly David A. Wheeler (http://en.wikipedia.org/wiki/David_A._Wheeler).
anuragbiyani··on “Shellshock”
To add to this:

He is the co-inventor of "Burrows–Wheeler transform", which is a key component in any modern genomics analysis pipeline, used in bzip2 (the "b" stands for BWT), etc.

anuragbiyani··on We have C++14
Until now there have been four standardized versions of C++: C++98, C++03, C++11, and C++14. And the versions have been consistently named (to be precise, "nicknamed") as "C++YY", where YY are the last two digits of the year in which that ISO standard was adopted.

Note: C++03 was a very minor change (sort of a "bug fix"), so people sometime refer to C++11 as direct successor of C++98. Also in the interim (2007) there was C++-TR1 ("ISO/IEC TR 19768:2007") which was not a formal standard per se, but instead a technical report specifying bunch of standard library extensions (which were formally included in C++11)

For sake of completeness: The format C++YY is the one which is commonly used almost everywhere, but the official language name follow ISO's convention. Here is a mapping:

C++98: "ISO/IEC 14882:1998 Programming languages C++"

C++03: "ISO/IEC 14882:2003 Programming languages C++"

C++11: "ISO/IEC 14882:2011 Programming Language C++"

C++14: "ISO/IEC 14882:2014 Programming Language C++"

There are also language classifier like (E), (F), etc present at the end (e.g., "ISO/IEC 14882:2014(E) Programming Language C++"). I am not sure if the official standard is fixed in a particular language, or are all the different language translations equally authoritative (I suspect the latter, but it's just a guess).

anuragbiyani··on Subhash Khot and the Unique Games Conjecture
Actually general version of TSP (optimization problem) cannot be approximated to a constant factor in polynomial time unless P = NP. [1]

Your confusion likely stem from the fact that metric-TSP (a special case of TSP problem where the distance between cities form a metric [2]) is actually APX-complete, which means it can be approximated to a constant factor in polynomial time (Christofides algorithm, approx ratio = 1.5).

PS: A potentially interesting aside - Sanjeev Arora, the PhD advisor of Subhash Khot actually got his first Gödel prize (2001) for discovering a PTAS (polynomial time approximation scheme, which in layman term means you can approximate it as close to real answer (but not exactly) as you like in polynomial time) for Euclidean-TSP (independently discovered by Joseph S. B. Mitchell as well). The algorithm make pretty interesting use of Dynamic programming, and was a surprise for the theoretical CS community that time.

[1] Brief intuition - HAMILTON-PATH (decision version) can be solved exactly in polynomial time using a constant factor poly time approximation of general TSP (optimization). But since, HAMILTON-PATH is proven to be NP-Complete, then P must equal NP (in which case we can solve all problems in NP and their optimization counterparts exactly in polynomial time anyway). For a formal proof see Khot's lecture notes: http://www.cs.nyu.edu/~khot/lec1.ps (you can find a variety of other similar resources as well, as this is one of the first impossibility proof in almost any graduate level approximation algorithm class).

[2] http://en.wikipedia.org/wiki/Metric_(mathematics)

anuragbiyani··on Stellar
Ref: https://www.stellar.org/about/mandate/#Bitcoin_program

Will the date for snapshotting the Bitcoin blockchain be publicized in advance ?

anuragbiyani··on Stellar
https://www.stellar.org/about/mandate/#Bitcoin_program

How does that work for someone who has bitcoins in an e-wallet, like Coinbase ?

anuragbiyani··on Show HN: Download all threads of an Orkut community
Thanks for sharing these links! I did take a brief look at Selenium, but due to my lack of familiarity with it and no mention on how to save the full page in html (instead of screenshot) I moved quickly to writing this version using xdotool. I agree this approach is more clunky and perhaps less likely to work across different platforms (than say Selenium/CasperJS), but it finally served the purpose for me (Ubuntu 12.04, GNOME, Chrome) by letting me download a bunch of communities. :)

Good luck with your CasperJS approach, and I would love to learn from it if you wish to share the code later.

Page 1 of 2Next →