Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Assignment_3 {
- private static Scanner s;
- public static void main(String[] args) {
- System.out.println("Input a number into the program:");
- s = new Scanner(System.in);
- int num1 = s.nextInt();
- ArrayQueue aq = new ArrayQueue(num1);
- long time = System.nanoTime();
- for(int i = 0; i <= num1; i++) {
- aq.enqueue(i);
- }
- while(!aq.isEmpty()) {
- aq.dequeue();
- }
- long totalTime = System.nanoTime() - time;
- System.out.println("Total aq time = " + totalTime);
- LLQueue llq = new LLQueue();
- long lltime = System.nanoTime();
- for(int j = 0; j <= num1; j++) {
- llq.enqueue(j);
- }
- while(!llq.isEmpty()) {
- llq.dequeue();
- }
- long totalllTime = System.nanoTime() - lltime;
- System.out.println("Total llq time = " + totalllTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement