-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiWay.java
More file actions
28 lines (28 loc) · 850 Bytes
/
Copy pathMultiWay.java
File metadata and controls
28 lines (28 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//package priorityqueue;
//
///**
// * Multiway merge priority queue
// */
//public class MultiWay {
// public static void merge(In[] streams) {
// int N = streams.length;
// IndexMinPQ<String> pq = new IndexMinPQ<String>(N);
// for (int i = 0; i < N; i++)
// if (!streams[i].isEmpty())
// pq.insert(i, streams[i].readString());
// while (!pq.isEmpty())
// {
// StdOut.println(pq.min());
// int i = pq.delMin();
// if (!streams[i].isEmpty())
// pq.insert(i, streams[i].readString());
// }
// }
// public static void main(String[] args) {
// int N = args.length;
// In[] streams = new In[N];
// for (int i = 0; i < N; i++)
// streams[i] = new In(args[i]);
// merge(streams);
// }
//}