in Java public static class Deque { private E[] data; private int f, size, capacity; /* P3. [6 x 2 pt

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

in Java public static class Deque { private E[] data; private int f, size, capacity; /* P3. [6 x 2 pt

Post by answerhappygod »

in Java
public static class Deque<E> {
private E[] data;
private int f, size, capacity;
/* P3. [6 x 2 pt] Implement
Deque
*/
public Deque(int cap) {
data = (E[]) new
Object[cap];
capacity = cap; f = 0;
size = 0;
}
public Deque()
{ this(256); }
public boolean isEmpty() { return size
== 0; }
public int size()
{ return size; }
public E first() {
//1. TODO implement
first

}
public E last() {
//2. TODO implement
last

}
public void addFirst(E e) {
//3. TODO implement
addFirst
}
public void addLast(E e) {
//4. TODO implement
addLast
}
public E removeFirst() {
//5. TODO implement
removeFirst
}
public E removeLast() {
//6. TODO implement
removeLast
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply