In a doubly circular linked list MCQ
Ngày đăng:
27/01/2022
Trả lời:
0
Lượt xem:
30
Post navigation Data Structure Questions and Answers-Doubly Linked List Data Structure Questions and Answers-Stack using Array DOWNLOAD ALL SUBJECTS PDF < Page 1 of 212Next» Data Structure Questions and Answers-Circular Linked ListPlease wait while the activity loads. If this activity does not load, try refreshing your browser. Also, this page requires javascript. Please visit using a browser with javascript enabled. If loading fails, click here to try again
What differentiates a circular linked list from a normal linked list?
Question 1 Explanation: The 'next' pointer points to null only when the list is empty, otherwise it points to the head of the list.
How do you count the number of elements in the circular linked list?
Question 2 Explanation: If the head is null, it means that the list is empty. Otherwise, traverse the list until the head of the list is reached.
What is the functionality of the following piece of code? Select the most appropriate public void function(int data) { int flag = 0; if( head != null) { Node temp = head.getNext(); while((temp != head) && (!(temp.getItem() == data))) { temp = temp.getNext(); flag = 1; break; } } if(flag) System.out.println("success"); else System.out.println("fail"); }
Question 3 Explanation: The function prints fail if the given element is not found. Note that this option is inclusive of option d, the list being empty is one of the cases covered.
What is the time complexity of searching for an element in a circular linked list?
Question 4 Explanation: In the worst case, you have to traverse through the entire list of n elements.
Which of the following application makes use of a circular linked list?
Question 5 Explanation: Generally, round robin fashion is employed to allocate CPU time to resources which makes use of the circular linked list data structure. There are 5 questions to complete.
|