22 Count number of unique addresses Input format This progra
     2.2 Count number of unique addresses Input format: This program takes a le name as argument from the command line. The le can have from a few lines to millions of lines. Each line contains an address in hexadecimal format Le. 0x711a91026b00, generated by pintool (http:/lpintool.org). Each address is represented as a 64-bit hexadecimal number Output format: Your program should print the number of unique addresses in the le. There should be no leading or trailing white spaces in the output. Your program should print error (and nothing else) if the le does not exist. Example Execution: Lets assume we have 3 text les with the following contents. le1.bxt is empty and, le2.txt 0x7f1a9804ae19 0x711a9804ae1c 0x7f1a9804ae1c 0x7f1a9804ae1c e3.tt: Ox7f1a9804ae19 Ox711a9804ae1c OxTf1a9804ae1c 0x711a98048e19 Ox711a9804ae16 0x711a9814ae1c count le1.txt count le2.txt 2 count le3.txt 4 third le4.txt 2.3 Scalability In this assignment, we will test your program with millions of lines of addresses. You can initialize the hash table with 1000 entries. The largest test case contains 5 million lines with about 15,000 unique addresses. In this case, the average number of nodes in each linked list is 15  
  
  Solution
Here is the code for you:
#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 int main()
 {
 FILE *fp;
 char fileName[10];
 printf(\"Enter the file name: \");
 scanf(\"%s\", fileName);
 fp = fopen(fileName, \"r\");
 if(fp == NULL)
 {
 printf(\"Error.\ \");
 return 0;
 }
 int count = 0, i;
 char array[100][20];
 char temp[20];
 while(!feof(fp))
 {
 fscanf(fp, \"%s\", temp);
 if(feof(fp))
 break;
 for(i = 0; i < count; i++)
 if(!strcmp(array[i], temp))
 break;
 if(!strcmp(array[i], temp))
 continue;
 for(int i = count-1; i >= 0 && strcmp(array[i], temp); i--)
 strcpy(array[i+1], array[i]);
 strcpy(array[i], temp);
 count++;
 }
 printf(\"The number of unique addresses is: %i\ \", count);
 }

