Question
answer the following in java if possible 1. Referencing an array implementation of a Queue; Illustrate by drawing the implementation of what happens if the
answer the following in java if possible
1. Referencing an array implementation of a Queue; Illustrate by drawing the implementation of what happens if the front or rear advances past the last array position (it is reset to the first array position). How would you code this event?
2. Draw a sorted queue (linked List or Array) with five elements (assume no repeats). Label the First and Last elements so they have identical element values. What is the size of the queue?
3. Write the code for a singlylinked list that supports the following: (Please note which examples would be more/less efficient with an array implementation)
a. accessing the element value in the current position.
b. insertion after the current position.
c. moving to the position immediately prior to the current position
d. moving to the position immediately following the current position
4. Which statement inserts a new item x after position current? Illustrate.
a. current = new ListNode(x, current);
b. current = new ListNode(x, current.next);
c. current.next = new ListNode(x, current);
d. current.next = new ListNode(x, current.next);
5. If a header node is used, write the code that indicates (true) a list with only one item and illustrate.
6. Write the condition, if true, guarantees that a doubly linked list with head and tail nodes is empty?
7. Illustrate the insertion of a node into a doubly linked list.
8. For the singly linked list implementation of the queue, illustrate where the enqueue and dequeues are performed? Note:A Queue is First in and First Out. Please label the first and last elements.
9. For the linked list implementation of the stack (use reference provided), state in English where are the pushes and pops performed? Note: A Stack is a First in Last Out Queue. Then write the code to push and pop.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started