Though it now feels as if every automaker, auto parts supplier, ride-sharing service provider and his algorithm-writing cousin has an autonomous driving strategy in place, Alphabet/Google's (GOOGL) - Get Report Waymo unit and Tesla Motors (TSLA) - Get Report still seem to be ahead of the pack when it comes to actually bringing a car that can drive itself to market. In addition to having made tremendous progress towards developing the hardware and software needed by a mass-market self-driving system, Waymo and Tesla are unique in terms of the number of miles their self-driving solutions have racked up, which gives them a huge and growing amount of real-world driving data that can be used to optimize their autonomous driving algorithms.

But there's another type of algorithm that's also bound to be quite important in the autonomous driving wars: Algorithms used to coordinate and optimize the routes taken by fleets of self-driving cars. This apparently isn't lost on the very data-obsessed Google, as shown by Waymo's new alliance with #2 U.S. ride-sharing firm Lyft.

Sources tell The New York Times that Waymo and Lyft will "work together to bring autonomous vehicle technology into the mainstream through pilot projects and product development efforts." Lyft, for its part, declares Waymo to have "today's best self-driving technology," and says the deal will "accelerate our shared vision of improving lives with the world's best transportation." Waymo predicts the tie-up will "help Waymo's self-driving technology reach more people, in more places."

The agreement follows a 2016 partnership between Waymo and Fiat Chrysler (FCAU) - Get Report that involves outfitting a fleet of Chrysler Pacifica minivans with Waymo's self-driving hardware and software. Bloomberg has reported Waymo and Fiat want to launch a ride-sharing service featuring "semi-autonomous" Pacificas by year's end. Waymo, now focused on teaming with automakers rather than trying to bring its own car to market, has also talked with Honda (HMC) - Get Report about an alliance.

Lyft, meanwhile, announced an autonomous driving partnership with General Motors (GM) - Get Report in early 2016, along with a $500 million investment from the auto giant. Reuters reported in February that the companies plan to deploy "thousands of self-driving electric cars in test fleets," starting in 2018. GM is currently testing an autonomous version of its Chevy Bolt electric car in a handful of cities.

For ride-sharing firms, the incentive for embracing autonomous driving is pretty obvious: Rides that require no driver become a lot cheaper, and could significantly expand ride-sharing's addressable market. Among other things, they could lead to many urban consumers being willing to forego car ownership in favor of relying on ride-sharing fleets, possibly through subscription services providing a certain number of prepaid miles per month.

Tesla chief Elon Musk and others have also raised the possibility of autonomous car owners leasing out their vehicles to ride-sharing fleets when they don't need them. Meanwhile, the fact that an autonomous ride-sharing fleet could initially be used on a limited number of carefully-tested routes might make it easier to deploy fully driverless cars on them, as compared with selling cars promised to fully take over from human drivers on all roads.

Jim Cramer and the AAP team hold positions in Apple and Alphabet for their Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells AAPL or GOOGL? Learn more now.

Uber, nervous about an automaker or some other company using an autonomous driving technology edge to launch a superior ride-sharing service -- Musk has suggested Tesla is looking to create its own ride-sharing service in time -- has largely taken a go-it-alone approach for its self-driving work. And judging by the details being unearthed through Waymo's trade secret theft lawsuit against Uber, it may have cut some corners along the way. Lyft, which has fewer resources, has been willing to partner.

For a Waymo or GM, the incentive for teaming with Lyft isn't just about its current status as major ride-share provider, but the data that this status has allowed it to amass. Lyft, which handled 162.6 million U.S. rides in 2016, has used its ride data to develop algorithms to determine things such as where empty cars within its fleet should be stationed, which car should handle a particular ride request, which route a car containing passengers should take at a given time of day and how to coordinate pickups for the Lyft Line carpooling service.

For now at least, that provides the likes of Lyft and Uber with a big competitive advantage in the battle to bring autonomous ride-sharing fleets to market. Analyst Ben Thompson, discussing Google and Uber's autonomous driving strengths, spelled this out last August. "[A] transportation-as-a-service company built around self-driving cars not only needs cars that can drive themselves, but an entire infrastructure on the back-end that tells those cars exactly where to go in a way that maximizes what will undoubtedly be a massive capital investment in the cars themselves," he said.

Apple (AAPL) - Get Report may have been thinking something similar last year when it decided to pour $1 billion into Chinese ride-sharing giant Didi Chuxing. In addition to potential earning goodwill with Beijing and providing a use for some of its offshore cash, Didi and its data/algorithms could be useful to Apple as the company pushes ahead with its own autonomous driving work with its trademark secrecy.

When it comes to core self-driving hardware and software development, Google appears to be well ahead of automakers not named Tesla, as well as other players such as Apple and Delphi (DLPH) - Get Report. Waymo's self-driving test cars have logged over three million miles on public roads -- about a million of those miles appear to have been driven in the last year -- and its algorithms benefit from Google's huge AI investments, the fruits of which can often be applied across multiple services. For example, a machine learning algorithm used to detect objects in Google Photos could also be applied by a self-driving system to recognize signs and traffic lights.

Waymo also claims to have cut the cost of the LIDAR sensors used by its systems by 90%, potentially giving it a cost advantage over both camera-intensive self-driving solutions and systems relying on startup Velodyne's LIDAR sensors. And it appears to have a lead in creating the advanced mapping data that self-driving systems need.

Adding Lyft and its algorithms to the mix addresses a lingering hole in Waymo's strategy, at least in the U.S. As autonomous ride-sharing services gradually evolve to being a commercial reality in the coming years, Waymo's newest ally could prove quite valuable.

Read More Trending Articles:

Jim Cramer and the AAP team are discussing fallout from first-quarter earnings from Apple (AAPL) - Get Report and Facebook (FB) - Get Report and how to play the big tech names. Get his insights or analysis with a free trial subscription to Action Alerts Plus.