Please show your detailed work I will rate correct answers T

Please show your detailed work! I will rate correct answers! Thank you.

Let X _1, X _2, ...X_tbe sorted files with sigma^t_i=1 l X_i|= n. (So the total number of objects in all files is n.) Describe an O(n log t) time algorithm divide and conquer algorithm for merging all these files into one file. (Assume that you have a standard merge algorithm for merging 2 sorted files.)

Solution

ALGORITHM:

INPUT NUMBER_OF _FILES_TO_BE_MERGED

i = 1

CREATE NEW FILE Y

# New file Y is created

WHILE i IS NOT EQUAL TO NUMBER_OF _FILES_TO_BE_MERGED

call function MERGE(Xi,Xi+1,Y)

# here Xi and Xi+1 are merged in new file Y(here X1 and X2 is merged into Y)

Xi+1 = Y

# Y is copied to X2

   i=i+1

END-WHILE

Please show your detailed work! I will rate correct answers! Thank you. Let X _1, X _2, ...X_tbe sorted files with sigma^t_i=1 l X_i|= n. (So the total number o

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site