## 4 The Proposed Algorithm
### Longest-First Algorithm in the Heterogeneous Phase  
The algorithm introduced in this research paper proposes a parallel methodology for partitioning a set of sequence reads, incorporating both the _k-mer_ distance and the maximum length of the sequence read datasets. The _k-mer_ distance is a measure of dissimilarity between genomic sequences with respect to the frequencies of subsequences of length \(k\). The realization of multiple jobs executed simultaneously with an optimal balance is intended to be carried out in a NUMA node-based heterogeneous computing environment. ```
Input: (1) Sequence reads set \(S=\{S_{i}|1\leq i\leq s\}\), \(s=|S|\), \(i\in N+\). (2) \(k\)_-mer_ distance set of \(S\) is \(K=\{K_{i}|1\leq i\leq k\}\), \(k=|K|\), \(i\in N+\). (3) The longest length of a sequence read set \(S\) is \(I(S)\). (4) \(j\)-part partitioned sequence reads set \(S^{\prime}=\{S^{\prime}_{i}|1\leq i\leq j\}\), \(j=|S^{\prime}|\), \(i\in N+\). Output: (1) \(d\)-part partitioned sequence reads set \(S^{\prime}=\{S^{\prime}_{i}|1\leq i\leq d\}\), \(d=|S^{\prime}|\), \(i\in N+\). Steps: 1. Calculate the _k-mer_ distance \(K_{i}\in K\) for each element \(S_{i}\in S\) in parallel. 2. Rank sequence reads set \(S\) in the decreasing order \(K_{i}\geq K_{i+1}\) based on the values of _k-mer_ distance set \(K\). 3. Divide \(S\) into \(j\) subread sets \(S^{\prime}=\{S^{\prime}_{i}|1\leq i\leq j\}\), where \(S^{\prime}=\{S^{\prime}_{i}|1\leq i\leq j-1,|S^{\prime}_{i}|=|s/j|+1\}+\{S^{ \prime}_{i}|i=j,|S^{\prime}_{i}|=s-(j-1)(|s/j|+1)\}\). 4. Sort \(S^{\prime}\) in decreasing order \(S^{\prime}_{i}\geq S^{\prime}_{i+1}\) based on the longest length of subsequence reads set \(S^{\prime}\), make \(S^{\prime}=S^{\prime}_{i}|1\leq i\leq j,|S^{\prime}_{i}\geq l(S^{\prime}_{i}) \geq\cdots\geq l\left(S^{\prime}_{j-1}\right)\geq l\left(S^{\prime}_{j}\right)\). 5. Set \(S^{\prime}_{i}\
eq\varnothing\), \(S^{\prime}_{i}\subset S^{\prime}\), \(L_{i}\) is the total sum of complementation time in \(S^{\prime}_{i}\), \(1\leq i\leq d\). 6. For _k = 1_ to \(d\). 7. Sort \(S^{\prime}_{1}\), \(S^{\prime}_{2}\ldots S^{\prime}_{d-1}S^{\prime}_{d}\) in increasing order \(l(S^{\prime}_{k-1})\leq l(S^{\prime}_{k})\), such that \(L_{1}\leq L_{2}\leq\cdots\leq L_{d-1}\leq L_{d}\). 8. Set \(S^{\prime}_{k}=S^{\prime}_{k}\cup S^{\prime}_{k}\), \(L_{k}=L_{k}+l(S^{\prime}_{k})\). 9. End for. ```  
**Algorithm 1** LF algorithm  
The following sequence depicts the parallel workflow of the longest-first algorithm in the heterogeneous phase. 1. Calculating the _k-mer_ distance: For all the sequence reads in the input set, the first operation calculates the _k-mer_ distance in parallel. The _k-mer_ distance is calculated for any two sequence reads and measures the dissimilarity between them. 2. Ranking sequence reads: The sequence reads are ordered from the highest to the lowest based on _k-mer_ distances. Therefore, the sequence reads with the highest _k-mer_ distance are ranked at the top, the second highest _k-mer_ distance follows, and so on. 3. Partitioning sequence reads: The ranked sequence reads are partitioned into several sets. There can optimally be different numbers of sets based on the value of \(j\), where \(j\) is the number of partitioned sequence read sets. All the sets could be of almost equal size except for the last set, which can have any size based on the total number of sequence reads and the value of \(j\). 4. Arranging subread sets: The subread sets are arranged in decreasing order from the longest size of the sequence reads in a subset. That means the subread with the longest sequence read is the one of the highest priority, and the subread with the second longest sequence read is the one of the second highest priority, and so on. 5. Merging partitions: The algorithm enters a loop that runs \(d\) times, where \(d\) is the final number of partitions. For each of those \(d\) iterations, the partitioned sequences are sorted in ascending order according to the sum of total complementation time.