HomeWork 17-1.docx - CSE 2221(10:20 Instructor S Joshi...

This preview shows page 1 out of 1 page.

CSE 2221 (10:20) Instructor: S. Joshi January 5, 2018 Homework 17: Queue II o Implement the instance method flip declared as follows ( this is a Queue<T> ): /** * Reverses ("flips") {@code this}. * @updates this * @ensures this = rev(#this) */ public void flip(){ int i = 0; int n = q.length(); while ( i < n ) { q .rotate(-1); int k = q .dequeue(); q1 .enqueue( k ); } out .println( "The reverse of the Queue is: "

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture