📒 Dynamic ridesharing is a profitable way to reduce traffic and carbon emissions by providing an opportunity for a flexible and affordable service that utilizes vehicle seating space. Matching of ride seeker requests with the rides, distributed over the roads is a tedious work. While fulfilling the request of all passengers, the total travel distance of the trip may get increased. Therefore, this book proposes an optimal dynamic ridesharing system which matches rides and requests in real time by satisfying multiple participant constraints (e.g. time bounds, availability of empty seat, maximum allowed deviation distance and minimized route ride) to minimize the total travel distance. To efficiently match ride givers and riders we are proposing a novel dynamic ride matching algorithm MRB (Minimal route bi-searching algorithm) considering all above mentioned constraints. We demonstrate working of our algorithm by developing a prototype and evaluated our system on GPS (Global positioning system) trajectories of Lahore city dataset. Evaluated results are compared with existing algorithms which shows that our system significantly reduces the travel distance and computation cost.