Fundamental-Algorithms Assignment 4-Merge k Ordered Lists Efficiently Solved

30.00 $

Category: Tags: , , , , ,
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

Rate this product

Merge k Ordered Lists Efficiently

You are required to implement c​orrectly and e​fficiently an O(nl​ogk​) method for m​erging k sorted sequences,​where n is the total number of elements. (Hint: use a heap, see seminar no. 2 notes).

Implementation requirements:
● Use linked lists to represent the k sorted sequences and the output sequence

Input: k lists of numbers >,

Output: a permutation of the union of the input sequences: < >

Thresholds

7 Adapt heap operations to work on new structure (list_index, key); use min­HEAP

  1. 9  Correct and complete algorithm implementation, with demo on a small­sized input
  2. 10  Evaluation, interpretations, discussion

Evaluation
! Before you start to work on the algorithms evaluation code, make sure you have a correct

algorithm! You will have to show your algorithm works on a small­sized input (e.g. k=4, n=20).

We will make the average case analysis of the algorithm. Remember that, in the average case, you have to repeat the measurements several times. Since both k​and n​may vary, we will make each analysis in turn:

Threshol d

Requirements

5

Generate k random sorted lists, having n elements in total (n and k given as parameters); merge 2 lists

  1. Choose, in turn, 3 constant values for k (k1=5, k2=10, k3=100); generate k r​andom sorted lists for each value of k so that the combined number of elements in all the lists (n) varies between 100 and 10000, with a maximum increment of 400 (we suggest 100); run the algorithm for all values of n (for each value of k); generate a chart that represents the sum of assignments and comparisons done by the merging algorithm for each value of k as a curve (total 3 curves).
  2. Set n = 10.000; the value of k must vary between 10 and 500 with an increment of 10; generate k r​andom sorted lists for each value of k so that the combined number of elements in all the lists is 10000; test the merging algorithm for each value of k and generate a chart that represents the sum of assignments and comparisons as a curve.
  3. Interpret your charts.
  • assignment-4-Merge-k-Ordered-Lists-Efficiently-jgm9zg.zip