International Olympiad in Informatics (IOI)

Description: Welcome to the International Olympiad in Informatics (IOI) Quiz! Test your knowledge on algorithms, data structures, and problem-solving techniques used in competitive programming.
Number of Questions: 15
Created by:
Tags: ioi competitive programming algorithms data structures
Attempted 0/15 Correct 0 Score 0

What is the maximum number of edges in a tree with n nodes?

  1. n-1

  2. n

  3. n+1

  4. 2n-1


Correct Option: A
Explanation:

A tree is a connected graph without cycles. The maximum number of edges in a tree with n nodes is n-1, as adding one more edge would create a cycle.

Which of the following sorting algorithms has the best worst-case time complexity?

  1. Bubble Sort

  2. Selection Sort

  3. Insertion Sort

  4. Merge Sort


Correct Option: D
Explanation:

Merge Sort has the best worst-case time complexity of O(n log n), which is optimal for comparison-based sorting algorithms.

What is the most efficient data structure for storing a collection of unique elements and quickly checking if an element is present?

  1. Array

  2. Linked List

  3. Hash Table

  4. Tree


Correct Option: C
Explanation:

Hash tables use a key-value pair to store data, allowing for constant-time lookup and insertion, making them the most efficient data structure for checking if an element is present.

Which of the following algorithms is used to find the shortest path between two nodes in a weighted graph?

  1. Dijkstra's Algorithm

  2. Bellman-Ford Algorithm

  3. Floyd-Warshall Algorithm

  4. Kruskal's Algorithm


Correct Option: A
Explanation:

Dijkstra's Algorithm is used to find the shortest path between two nodes in a weighted graph, where the weights represent the distances between nodes.

What is the time complexity of finding the minimum element in an unsorted array using a linear search?

  1. O(1)

  2. O(log n)

  3. O(n)

  4. O(n^2)


Correct Option: C
Explanation:

Linear search involves checking each element of the array sequentially, resulting in a time complexity of O(n).

Which of the following is a greedy algorithm?

  1. Dijkstra's Algorithm

  2. Prim's Algorithm

  3. Kruskal's Algorithm

  4. Traveling Salesman Problem


Correct Option: B
Explanation:

Prim's Algorithm is a greedy algorithm used to find a minimum spanning tree in a weighted graph, where the goal is to find a subset of edges that connects all vertices with the minimum total weight.

What is the name of the algorithm used to find all possible subsets of a set?

  1. Breadth-First Search

  2. Depth-First Search

  3. Backtracking

  4. Dynamic Programming


Correct Option: C
Explanation:

Backtracking is an algorithm used to find all possible subsets of a set by systematically exploring all possible combinations.

Which of the following is a dynamic programming problem?

  1. Longest Common Subsequence

  2. Knapsack Problem

  3. Traveling Salesman Problem

  4. Dijkstra's Algorithm


Correct Option: B
Explanation:

The Knapsack Problem is a classic dynamic programming problem where the goal is to find the maximum value of items that can be placed in a knapsack with a given capacity.

What is the name of the algorithm used to find the maximum flow in a network?

  1. Ford-Fulkerson Algorithm

  2. Edmonds-Karp Algorithm

  3. Dinic's Algorithm

  4. Push-Relabel Algorithm


Correct Option: A
Explanation:

The Ford-Fulkerson Algorithm is used to find the maximum flow in a network, which represents the maximum amount of flow that can be sent from a source node to a sink node.

Which of the following is a non-deterministic algorithm?

  1. Bubble Sort

  2. Selection Sort

  3. Insertion Sort

  4. Monte Carlo Simulation


Correct Option: D
Explanation:

Monte Carlo Simulation is a non-deterministic algorithm that uses random sampling to obtain approximate solutions to problems.

What is the name of the algorithm used to find the convex hull of a set of points?

  1. Graham's Scan

  2. Jarvis's March

  3. QuickHull

  4. Gift Wrapping Algorithm


Correct Option: A
Explanation:

Graham's Scan is an algorithm used to find the convex hull of a set of points, which is the smallest convex polygon that contains all the points.

Which of the following is a divide-and-conquer algorithm?

  1. Merge Sort

  2. Quick Sort

  3. Heap Sort

  4. Radix Sort


Correct Option: A
Explanation:

Merge Sort is a divide-and-conquer algorithm that recursively divides the input array into smaller subarrays, sorts them, and then merges them back together.

What is the name of the algorithm used to find the minimum spanning tree in a weighted graph?

  1. Prim's Algorithm

  2. Kruskal's Algorithm

  3. Dijkstra's Algorithm

  4. Bellman-Ford Algorithm


Correct Option: A
Explanation:

Prim's Algorithm is used to find the minimum spanning tree in a weighted graph, which is a subset of edges that connects all vertices with the minimum total weight.

Which of the following is a sorting algorithm that works by repeatedly swapping adjacent elements?

  1. Bubble Sort

  2. Selection Sort

  3. Insertion Sort

  4. Merge Sort


Correct Option: A
Explanation:

Bubble Sort is a simple sorting algorithm that repeatedly compares adjacent elements and swaps them if they are in the wrong order.

What is the name of the algorithm used to find the shortest path between two nodes in an unweighted graph?

  1. Breadth-First Search

  2. Depth-First Search

  3. Dijkstra's Algorithm

  4. Bellman-Ford Algorithm


Correct Option: A
Explanation:

Breadth-First Search is used to find the shortest path between two nodes in an unweighted graph by exploring all nodes at the same level before moving to the next level.

- Hide questions