CS代考程序代写 Java package edu.iastate.cs311.hw2;

package edu.iastate.cs311.hw2;

/**
* @author
*
* This code template is prepared by Xiaoqiu Huang
* You are welcome to add your own code for testing.
*/

import java.util.List;
import java.util.ArrayList;

public class Application
{

public static void main(String[] args)
{
Heap pq = new Heap();
pq.add(10);
pq.add(15);
pq.add(20);
pq.add(30);
pq.add(25);
pq.add(25);
pq.add(30);
pq.add(40);
pq.add(35);
pq.add(50);
pq.add(10);
pq.showHeap();
System.out.println( pq.getLastInternal() );
pq.trimEveryLeaf();
pq.showHeap();
while ( ! pq.isEmpty() )
{
System.out.println( pq.removeMin() );
}

List alist = new ArrayList();
alist.add(“TGA”);
alist.add(“ACG”);
alist.add(“GCT”);
alist.add(“GTA”);
System.out.println( “Before sorting: ” + alist.toString() );
Heap.heapSort(alist);
System.out.println( “After sorting: ” + alist.toString() );
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *