Advertisement
Guest User

binpacking232

a guest
Feb 27th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public class WorstFit {
  2.  
  3. private static Scanner s ;
  4. private static MaxPQ pq ;
  5.  
  6. public static void main(String[] args) {
  7.  
  8. try {
  9. s = new Scanner(new File("input20.txt"));
  10. } catch (FileNotFoundException ex) {
  11. System.out.println("error");
  12. }
  13. ArrayList<Disk> list = new ArrayList<Disk>();
  14.  
  15. while (s.hasNextInt()){
  16.  
  17. int value = s.nextInt() ;
  18. Disk disks = new Disk(value) ;
  19.  
  20. list.add(disks) ;
  21.  
  22. }
  23. s.close();
  24.  
  25. //testing purposes
  26.  
  27. pq = new MaxPQ(list.size()) ;
  28.  
  29. for(int i = 0; i < list.size(); i++) {
  30. pq.insert(list.get(i).getSize()) ;
  31.  
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement