Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that reads data from a file containing a datum called prefix in each line of the file called routing _ table. Each
Write a program that reads data from a file containing a datum called prefix in each line of the file called routingtable. Each prefix has the format of IPlength as following examples:
The first part abcd is a bit IP address. So you have to store the IP address into an unsigned variable. For prefixe length, you can use an unsigned character. So for all the prefixes, you can use an array of struct prefix unsigned ip; unsigned char len; struct prefix next; to store all the prefixes. Assume prefix does not exist.
Do the following,
a write a function input
b print out the total number of prefixes in the input file,
c write a function lengthdistribution to compute the number of prefixes with prefix length for to
d write a function segment int to divide the prefixes into groups such that the prefixes in the same group have the same first bits.
e Now, the prefix of length are put a special group that prefix duplicate created.
printout the number prefixes group i for
For each group, you have use linked list chain the prefixes together.
Therefore, you have write a function nsert insert a prefix a oneone fashion the increasing order the unsigned numbers the prefixes. The prefixes inserted after the segments are built are from a file called refixes.
Also, you have write a function elete insert a prefix. The prefixes deleted after inserting all the prefixes from files able and refixes are from a file called refixes.
you have write a function search giving address report the search successful fails.
Finally, you have report average numbers search, insert, delete clock cycles, draw three figures followe
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started