If Yahoo had already been offering a comparable product to Google then Google wouldn't have done so well at all IMO.
That said, when we started our pottery painting business we were pipped to the post by another very similar business (ie pottery painting) in the same area, we'd already been concerned that the area might not support us alone. We'd started the business, rented a building and refurbed it, quit jobs, bought stock, etc.. Still we're going 5 years later and they lasted 6months before closing (due to family issues).
The point being you can still succeed you're just going to have to try a lot harder. They may fail, even if they're better. You can still win even if they're better (betamax, hddvd, etc.).
Nobody really believed their algorithm would significantly better. They were convinced state of the art was all there was and could ever be.
So they founded Google, and pretty much owned their stagnant competitors. There's a reason Ask.com spends good money marketing itself among rednecks with a NASCAR and Google doesn't.