Question
The ratio of apples to oranges in a basket is 2:1. The
average weight of oranges is (w β 3) grams and the average weight of all fruits is (w + 3) grams. Find the average weight of apples.Solution
Let apples and oranges be '2a' and 'a', respectively.
Total weight of fruits = 3a Γ (w + 3) = 3aw + 9a
Total weight of oranges = a Γ (w β 3) = aw β 3a
So, total weight of apples = (3aw + 9a) β (aw β 3a) = 2aw + 12a
Therefore, average weight of apples = (2aw + 12a) / 2a = (w + 6)
Which algorithm finds Minimum Spanning Tree in a weighted graph by adding edges in increasing order?
The Master Theorem gives time complexity for recurrences of the form:
In hashing, what is a collision?
Which of the following properties must a problem exhibit to be solvable by a greedy algorithm?
A unique piece of information that is used in encryption.
Which of the following sorting algorithms is best for nearly sorted data?
Which algorithm returns a minimum spanning tree (MST) and uses a priority queue to select the next edge connected to the growing tree?
In a binary search tree (BST), what is true about the left child of a node?
What is the time complexity of inserting an element in a heap?
Depth-First Search (DFS) typically uses which data structure implicitly or explicitly?