Question
1)Given a singly linked list contains 5 nodes, which simply shows as 5->4->3->2->1, what is the value that you can find in the second node
1)Given a singly linked list contains 5 nodes, which simply shows as 5->4->3->2->1, what is the value that you can find in the second node of the remaining list if the following statements are applied? Assume head reference refers the first node of the list.
Node prev = head;
Node curr = head. next;
while(curr.next!=null)
{
if(prev.element > 3)
{
prev = curr;
curr = curr.next;
}
else break;
}
head = prev.next;
Question 1 options:
3 | |
2 | |
4 | |
1 |
2)
Which of the following is the code to insert a new node, referenced by newNode, into an empty queue implemented by a SinglyLinkedList with a head and tail references?
Question 2 options:
| |||
| |||
| |||
|
3)
Which of the following code fragments is used to delete the item at the front of a queue represented by a circular array?
Question 3 options:
| |||
| |||
| |||
|
4)
If a sequence of number 8, 12, 10, 6, 15 is added to a queue, in the order given, which number will be the second number to be removed from the queue?
Question 4 options:
| |||
| |||
| |||
|
5)
If a sequence of numbers 6, 2, 7, 13, 5, 4, 20 is added to a stack, in the order given, which number will be the last number to be removed from the stack?
Question 5 options:
| |||
| |||
| |||
|
6)Suppose an initially empty stack S has performed a total of 25 push operations, 12 top (or peek) operations, and 10 pop operations, 3 of which returned null to indicate an empty stack. What is the current size of S?
Question 6 options:
| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
7) Suppose an initially empty queue Q has performed a total of 32 enqueue operations, 10 first (or peek) operations, and 15 dequeue operations, 5 of which returned null to indicate an empty queue. What is the current size of Q? Question 7 options:
|
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