-
Book Overview & Buying
-
Table Of Contents
C++ Data Structures and Algorithm Design Principles
By :
In this activity, we will create a program to map shorter URLs to corresponding longer URLs. Follow these steps to complete the activity:
#include <iostream>
#include <unordered_map>
struct URLService
{
using ActualURL = std::string;
using TinyURL = std::string;
private:
std::unordered_map<TinyURL, ActualURL> data;
As we can see, we've created a map from the small URL to the original URL. This is because we use the small URL for the lookup. We want to convert it into the original URL. As we saw earlier, a map can do fast lookups based on a key. So, we have kept the smaller URL as the key of the map and the original URL as the value of the map. We have created aliases to avoid...
Change the font size
Change margin width
Change background colour