InferenceAI

Enter at least two characters to search.

Start free

Algorithms

Asymptotic analysis, recurrences, sorting, searching, greedy, dynamic programming and graph algorithms. 8 questions with worked solutions.

Q1MCQ1 markRecurrences

Solve T(n)=2T(n/2)+nT(n) = 2T(n/2) + n.

Q2MCQ1 markRecurrences

Solve T(n)=T(n/2)+1T(n) = T(n/2) + 1.

Q3NAT1 markSearching

What is the maximum number of elements binary search examines in a sorted array of 1000 elements?

Q4MCQ1 markShortest paths

Dijkstra's algorithm may give wrong answers when the graph has:

Q5NAT2 marksMinimum spanning tree

A graph has vertices A, B, C, D and weighted edges AB = 1, BC = 2, CD = 1, AD = 4, AC = 3, BD = 5. What is the weight of its minimum spanning tree?

Q6MCQ1 markSorting

Which of these sorting algorithms is stable in its standard form?

Q7NAT2 marksDynamic programming

A knapsack has capacity 5. Items (weight, value) are (2, 3), (3, 4), (4, 5) and (5, 6), each usable at most once. What is the maximum total value?

Q8MCQ1 markGraph algorithms

A directed graph has a topological ordering if and only if it: