What is the optimal time complexity to count the number of nodes in a linked list?

CTDL & GT

Quiz
•
Science
•
University
•
Medium
Hoàng Kiệt
Used 9+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
O(n)
O(1)
O(log n)
None of the above
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What will be the output of the following code snippet for the list 1->2->3->4->5->6?
1 2 3 4 5 6
1 3 5 5 3 1
1 3 5 1 3 5
2 4 6 1 3 5
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}
Prints all nodes of linked lists
Prints all nodes of linked list in reverse order
Prints alternate nodes of Linked List
Prints alternate nodes in reverse order
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is
log 2 n
n/2
log 2 n – 1
n
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In Linked List implementation, a node carries information regarding
Data
Link
Data and Link
None of the mentioned
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which data structure allows deleting data elements from and inserting at rear?
Stacks
Queues
Dequeues
Binary search tree
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Stack is also called as
A First in first out
B First in last out
C Last in last out
D Last in first out
Create a free account and access millions of resources
Similar Resources on Quizizz
25 questions
Classifying Plants

Quiz
•
5th Grade - University
25 questions
Binary System Quiz

Quiz
•
8th Grade - University
20 questions
Data Structures and Algorithms Quiz

Quiz
•
University
30 questions
Tech-Quiz (1st Round)

Quiz
•
University
22 questions
Quiz 5 Review

Quiz
•
University
20 questions
[Q1 BWJ20203] Prokaryotic vs Eukaryotic cell

Quiz
•
University
25 questions
Analog and Digital

Quiz
•
8th Grade - University
20 questions
computer

Quiz
•
University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade