Refer to the code fragment below and convert the following Queue structure into a Stack structure. You should create a r

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Refer to the code fragment below and convert the following Queue structure into a Stack structure. You should create a r

Post by answerhappygod »

Refer to the code fragment below and convert the following Queue
structure into a Stack structure. You should create a reference
called S1 for the stack structure.
Code:
Queue Q1 = new LinkedList ();
Q1.add(“Sandra”);
Q1.add (15);
Q1.add (200);
Q1.add (‘# ‘);
Q1. remove ();
System.out.println(Q1);
System.out.println(Q1.peek());
Q1.add(“Mary”);
System.out.println(Q1);
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply