package uassd;
import java.util.Arrays;
public class sortiengint {
public static void main(String[] args) {
int [] angka = {5,7, 1, 4, 0};
Arrays.sort(angka);
int index=0;
for (index=0 ; index<angka.length ; index++)
System.out.println(angka[index]+"");
}
}
Nama : Manuel Junisabel Pinto
Nim : 04108011
ujian pratikum struktur Data
//package uassd;
import java.util.Arrays;/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author JHOVANI
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Integer[] No = {5, 7, 1,4,0};
Arrays.sort (No);
int index=0;
for (index=0 ; index<No.length ; index++)
System.out.println(No[index]+"");
}
}
Nama : Manuel Junisabel Pinto
Nim : 04108011
ujian pratikum struktur Data
import java.util.LinkedList;
import java.util.Queue;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author JHOVANI
*/
public class simplequeue {
/**
* @param args the command line arguments
*/
public static void main(Integer[] args) {
// TODO code application logic here
Queue<Integer> queue = new LinkedList<Integer>();
queue.add(5);
queue.add(7);
queue.add(1);
queue.add(4);
queue.add(0);
System.out.println("Peek = " + queue.peek());
System.out.println("Ukuran queue = " + queue.size());
queue.remove();
queue.remove();
queue.remove();
int jumlah = queue.poll()+ queue.poll();
System.out.println("Pool = " + queue.poll());
System.out.println("Ukuran queue = " + queue.size());
}
}
Nama : Manuel Junisabel Pinto
Nim : 04108011
ujian pratikum struktur Data
Tidak ada komentar:
Posting Komentar