599 views
1 votes
1 votes
  1. Assume you have a chocolate bar containing a number of small identical squares arranged in a rectangular pattern. Our job is to split the bar into small squares by breaking along the lines between the squares. We obviously want to do it with the minimum number of breakings. How many breakings will it take?
  2. Consider that the chocolate bar has n breaking lines along the length and m breaking lines along the breadth. Write a C function that will take n, m as inputs and print the line numbers along the length and the breadth according to your strategy of breaking the chocolate.

1 Answer

Related questions

1 votes
1 votes
1 answer
1
go_editor asked May 31, 2016
739 views
Let $A$ and $B$ be two arrays, each containing $n$ distinct integers. Each of them is sorted in increasing order. Let $C = A \cup B$. Design an algorithm for computing t...
1 votes
1 votes
1 answer
2
go_editor asked May 31, 2016
704 views
Let $G = (V, E)$ be an undirected weighted graph with all edge weights being positive. Design an efficient algorithm to find the maximum spanning tree of $G$.
14 votes
14 votes
2 answers
3
go_editor asked May 31, 2016
1,663 views
Let $H_1$ and $H_2$ be two complete binary trees that are heaps as well. Assume $H_1$ and $H_2$ are max-heaps, each of size $n$. Design and analyze an efficient algorithm...