Question: Question 2 A Domain Name System ( DNS ) translates domain ALL ( i ) names to IP addresses which are then used by browsers
Question
A Domain Name System DNS translates domain
ALL
i names to IP addresses which are then used by browsers to load internet resources. For quicker DNS lookups, browsers often store a number of recent DNS queries in a DNS cache. Retrieving data from the cache is often faster than retrieving it
from a DNS server. This task aims to simulate DNS resolution and determine the time taken to process different URLs.
Assume that the DNS cache can store a maximum of the cachesize most recent DNS requests, ie URLIP mappings. The cache is intitilly empty. It takes cachetime units of time to ferch data from the DNS cache, and servertime units of time to fetch data from the DNS server.
Given a list of URL s visited as an array of strings, urls, determine the minimum time taken to resolve each DNS request.
Note: New DNS requests are dynamically added to the cache, and the cache stores mappings according to the order in which the requests were made.
Example
suppose cache size cache time
servertime urls
hackerrank.comtestoskdhnquestionsrbpgeetica
mleft
Question
Language Python
I!binpytho
#
Complete
:
The funct
i The funct
INTEG
$ INTEC
$ INTEC
: STRI
def gethin
if
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
