Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

provided code (C) not C++. it's C#include #include#define SIZE 9void readTimestamps(int x[], FILE *inp);void mergeTimestamps(int x[], int xsize, int y[], int ysize, int z[], int

provided code (C) not C++. it's C#include #include#define SIZE 9void readTimestamps(int x[], FILE *inp);void mergeTimestamps(int x[], int xsize, int y[], int ysize, int z[], int zsize);void printTimestamps(int x[], int xsize);int main(void){ int x1Size = SIZE; int x2Size = SIZE; int x3Size = SIZE; int x1[x1Size]; // initiate the array to read Timestamps from file1 int x2[x2Size]; // initiate the array to read Timestamps from file2 int x3[x3Size]; // initiate the array to read Timestamps from file3 FILE *inp; inp = fopen("timestamp1.txt", "r"); if (inp == NULL){ return -1; } else{ // your code goes here }}void readTimestamps(int x[], FILE *inp){ // reads a timestamp file into array x (assume the file store 9 ordered timestamps) }void mergeTimestamps(int x[], int xsize, int y[], int ysize, int z[], int zsize){ // merge the ordered timestamps array x[] of xsize and array y[] of ysize to generate array z[] of zsize }void printTimestamps(int x[], int xsize){ // print timestamps from array x[] }

image text in transcribed
In our internet infrastructure, each server is responsible for recording incoming telecommunication packets in an array as they arrive, ensuring that they are ordered according to their respective time fields within the array. Now, let's consider a scenario where an application needs to locate and sort these telecommunications packets by their timestamps across three servers. To achieve this, write a program that takes the input from three Timestamp files (each with 9 ordered timestamps) and outputs the merged and sorted packets based on their time order. Your program should use a function called printTimestamps to display the timestamps. void readTimestamps (int x, int xsize, FILE *inp) ; / / reads the timestamps from a file pointed by inp to array x[ ] with array length equal to xsize void mergeTimestamps (int x, int xsize, int y, int ysize, int z[ ], int zsize) ; / / merge the timestamps array x[ ] with array y[ ] to generate array z[ ] void printTimestamps (int x, int xsize ) ; / / prints the timestamps array x[ ] with array length equal to xsize An example of Timestamp files is given below. timestamp1: 1 3 6 9 13 16 20 25 39 timestamp2: 2 11 21 22 23 24 25 30 35 timestamp3: 3 5 10 24 30 32 33 34 35 Sample Output 1,2,3,3,5,6,9, 10,11,13,16,20,21,22,23,24,24,25,25,30,30,32,33,34,35,35,39

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

Primary function of root ?

Answered: 1 week ago

Question

The only phyto hormone which is a gas at ordinary temperature?

Answered: 1 week ago

Question

The two fluids that circular in the body?

Answered: 1 week ago

Question

Eliminated from the body?

Answered: 1 week ago