Khadijah Assignment
Khadijah Assignment
S122202023
1. Which of the following algorithms are used to find the shortest path from a source node to all
other nodes in a weighted graph?
A. Djikstra’s algorithm
B. BFS
C. PRIMS
D. Krushkal's Algorithm
2. What is the maximum number of swaps that can be performed in the Selection Sort algorithm?
A. n-1
B. n
C. 1
D. n-2
Answer: A- n-1.
3. What is the technique called in which it does not require extra memory for carrying out the
sorting procedure?
A. Stable
B. Unstable
C. In-place
D. In-partition
Answer: C- In-place.
A. O(n)
B. O(1)
C. O(log2n)
D. O(logn2)
Answer: C- O(log2n)
B. O(n2)
C. O(1)
D. O(login)
Answer: B- O(n2)
6. What is the time complexity to insert an element to the front of a LinkedList(head pointer
given)?
A. O(n)
B. O(1)
C. O(logn)
D. O(nlogn)
Answer: B- O(1)
9. When a pop() operation is called on an empty queue, what is the condition called?
A. Overflow
B. Underflow
C. Syntax error
D. Garbage value
Answer: B- Underflow
A. Linked list
B. Array
C. Queue
D. Stack
Answer: D- Stack.