Monday, 20 March 2017

Chapter 2 Exercise 2.2, Introduction to Algorithms, 3rd Edition Thomas H. Cormen

2.2-1 Express the function n3/1000100n2100n+3 in terms of
θnotation.

Solution:
The leading term of the function ignoring the constant coefficient is n3 . So, the function in θnotation will be θ(n3).

2.2-2 Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[1]. Then find the second smallest element of A, and exchange it with A[2]. Continue in this manner for the first n 1elements of A. Write pseudocode for this algorithm, which is known as selection sort. What loop invariant does this algorithm maintain? Why does it need to run for only the first n 1 elements, rather than for all n elements? Give the best-case and worst-case running times of selection sort in θnotation? Justify your answers.

Solution: 

Pseudocode


SELECTION-SORT(A):
  for i = 1 to A.length - 1
      min = i
      for j = i + 1 to A.length
          if A[j] < A[min]
              min = j
      temp = A[i]
      A[i] = A[min]
      A[min] = temp

Loop invariants

At the start of each iteration of the inner for loop, A[min] is the smallest number in the subarray A[i..j−1].

Why n−1 elements?
In the final step, the algorithm will be left with two elements to compare. It will store the smaller one in A[n−1] and leave the larger in A[n]. The final one will be the largest element of the array, since all the previous iteration would have sorted all but the last two elements (the outer loop invariant). If we do it n times, we will end up with a redundant step that sorts a single-element subarray.

Running times
In the best-case time (the array is sorted), the body of the if is never invoked. The number of operations (counting the comparison as one operation) is:
$$ (n - 1)(\frac{n + 2}{2} + 4) $$
In the worst-case time (the array is reversed), the body of the if is invoked on every occasion, which doubles the number of steps in the inner loop, that is:
 (n-1)(n+6)
Both are clearly Θ(n2).

2.2-3 Consider linear search again (see Exercise 2.1-3). How many elements of the input sequence need to be checked on the average, assuming that the element being searched for is equally likely to be any element in the array? How about in the worst case? What are the average-case and worst-case running times of linear search in ‚Θ-notation? Justify your answers.

Solution:

If the element is present in the sequence, half of the elements are likely to be checked before it is found in the average case. In the worst case, all of them will be checked. That is, n/2 checks for the average case and n for the worst case. Both of them are Θ(n).

2.2-4 How can we modify almost any algorithm to have a good best-case running time?

Solution:

We can modify it to handle the best-case efficiently. For example, if we modify merge-sort to check if the array is sorted and just return it, the best-case running time will be Θ(n).

Friday, 17 March 2017

Chapter 2 Exercise 2.1, Introduction to Algorithms, 3rd Edition Thomas H. Cormen


2.1-1 Using Figure 2.2 as a model, illustrate the operation of INSERTION -SORT on the array A=⟨31,41,59,26,41,58⟩.

Solution:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl0AAAJFCAYAAADnB0LdAABQDElEQVR4nO3de4xUxb73/yJ5kJsGgRFhBhUTEIRtgIS9AefIRRAwyAESZlAhAgoqCgECCoKRSwBRmS1kjwoHjihBxcEEOHJEBOSyw2UUA0RQ2GAgOiAgKERuHv/4/Z5PPc/qZ3XTc2G6u1b36vcr6czQ084sq7tXfVbVt6r/1//3vxkAAACk1P8K+gAAAACyAaELAADAAUIXAACAA4QuAAAABwhdAAAADhC6AAAAHCB0AQAAOEDoAgAAcIDQBQAA4AChCwAAwAFCFwAAgAOELgAAAAcIXQAAAA4QugAAABxIKHSNGzfOFBcXJ+tYAAAA0lZeXp4pKyur9n+fUOg6c+aMyc/PN+PHj0/k1wAAAKS10tJSU1RUlNDvSHh6MTc31xQUFCT6awAAAEKNmi4AAAAHCF0AAAAOELoAAAAcIHQBAAA4QOgCAABwgNAFAADgAKELAADAAWeha/v27ebs2bOu/lxG6tevn6lbt25KfjftXznaP1i0f7Bo/2DR/sFKZfv7OQtd3bt3d/WnMlZJSUnKNpql/StH+weL9g8W7R8s2j9YqWx/P6fTizNnzuTJLwftEn6u3tSZqEaNGin/G7R/+Wj/YNH+wXLR/h5qugAAABwgdAEAADhA6AIAAHCA0AUAAOAAoQsAAMABQhcAAIADhC4AAAAHCF0AAAAOELoAAAAcIHQBAAA4QOgCAABwgNAFAADgAKELAADAAUIXAACAA4QuAAAAB0Idun7//XezceNGc+bMGdOpUyfTrl07U7NmzXIfv23bNpOfn1/hY1A9OTk55plnnjFz584t9zGPPPKI2bp1q7l8+bLDIwu39evXm4sXL0b+ffr0aTNmzBhTt27dyH3bt2+3r/1GjRqZHj16mLZt2wZxqKFz5coV8+GHH5rDhw+b1q1bm8cffzyq3eM9fs2aNfY5atWqlX0/IDnOnz9viouLzYwZM8p9jN4rDz74YIXPEW5MVc4/e/futecgGTBggGnRooXz43QptKFLgevZZ5+1Jzs96atXr7adyVtvvXXdY9XhrFy50hw7dsx8+umnhK4UePvtt+0JLV7oUueik2HHjh3NbbfdRuhKkkOHDpn+/ftH3Td06NCoE964cePMtWvXzKJFi8zx48fNkCFD7Ptm7Nixrg83VHQu6d69u6lTp479Xl577TV7UdGsWbPrHq/z06xZs8yECRPMpEmTXB9u6KmjV9vHC10KBmp7df7nzp0jdCVJVc4/kydPtkFs/vz5tp+eNm2avb+kpMTpsboU2tClILV48WJzyy232H8rVC1btsx8++235r777os87uzZs6ZNmzbmrrvuipwckVyjRo0yHTp0iPuzvLw8s2/fPnPkyBEbupA8CxcuNJs2bbIXHp6GDRtGvldHr6t/r6PRRYlOfjpR6j3SrVu3IA47FCZOnGhH2dWmGmWZOnWqPf+oc1+6dGnUY9Xx6FxVWlrKKGMKqN11jomnrKzMtG/f3o4sKnQheSo7/6i9i4qKzE8//WQvRHSbN2+eadmypdm8ebPp1atXEIedcqEMXX/++aft5L3AJb1797Zvvtq1a0c9tnHjxvZrkyZNnB5jttBQsaZ1161bZ0aMGHHdz0+ePGm/EniTS53J/v377ZV9vJEVWbJkiX1+NK3o6dKli/26YMECQlc1qTN59NFHIwFK7avnQeef3bt3Rz1WwVcdj4IYgSv5dF45cOCAnbZ6//33r/u5995o3ry54yMLt6qcfzSyLpp+9x7j9c8afQ+rUIYuTQ/GPtHfffedrddSioY7unIZOXKkvcKHOxo5Ued/xx132GA1ZcoUO+Lop5Odpr/8FBD0+D179rg83FC5++67rxu11flI99WqVStynzqm5557zo72xj43SA5NV7333nvmlVdeCfpQskpVzj/9+vUz9erVMy+99JIdJNG55+OPP7YXHypFCatQhi4/jXppqlFvvDfffDPow8kqM2fOtLVC1Gi5p3oiXS0qPO3cudOMHj3arFq1yg7be7x6IxVw++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bo06rHqeBR0S0tL7eORXGp3vZ7j4fyfOgsXLjSbNm2yo7yehg0bRr5XexcVFZmffvrJXojoNm/ePNOyZUuzefPmSmemMlVoQ1ffvn0jgUueeuopG7pycnKiHudddeoqH8mnk5pGuO6//357pRmrcePG9qumvZA8eXl5tjPRa/7kyZNxH/P000/boKure48uVEQhIfYqFVWjzuTRRx+NBCidhzTCos5/9+7dUY/VCJc6HgUxAlfy6fV94MABO231/vvvX/dzzv+pofP+/v377es+3siuHD9+3H7VRaH3GI26y7Vr19wcaABCG7pi54X1AlCNBCc2d/7880+zfPlyO+KyYsWKoA8nq4wePdpOp+vkp45HU1vq9P10BRp7clMA0+O7dOni8nBD5e6777Zt76dORffVqlUrcp+em+eee84G5FGjRrk+zKyg6SrV9b7yyitBH0pW0citLj7uuOMO2xdPmTLlutd4v379TL169cxLL71kOnToYC9OVN6gPlq1dWEV2tDl59VLfP7550EfSlbRyW7gwIHmlltuCfpQss4///lPO4Kijl7T6RpJGTJkiHnooYcij1Hg0glRJz5/nZemguPdj6rxj7D7/fzzzzYMe3Q+Usjt2bOnKSwsNLt27bL3jxgxwsyZM8fJsYbZyy+/bJ5//nlqtAKgekadXzRyrjIFve5XrVplpw09el7UL2t6XfXXOj/p3KMSoDA/Z6EOXVoNNH78eFvfpc5DaXrDhg3XXYUi+b799ltbRHzfffcFfShZacuWLfYmunLUFaRqJKZPn27mzp1r71enr5quHj162GJiz6233mrrkAhcyeOtznrhhRci96mGSzQV6Y0CKCjo+VGHtWDBAvcHGhJqby3I8dfvwh2da7yaLNWKKlDpfKSQ5V/M4C0aUfDS614Xh+VdtIRFqEOX0rKeRN101a8nVqtY4q1gRPJoewhd1aieCMHTSU+reFU78dhjj0VCl06Aqn185513bE2dVg917drVLmzwRl2QHAq7a9eujbqCV8mD+KddNMKlx+l8NXv27FBf8aeKLhjeeuutUK+AyyS66Pvqq6/MPffcY2ed/KFLpQzaJkV9tPoLjYipBrWirT0yXahDl58Sta4s9aQjtZYsWWLuvff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49erVM82bNzdt2rQxd955p2ndunWSjxTIXIQuAICdTqyOgwcP2q8qrv/9999tndeJEyfMv/71LzsKtnjx4mQeJpDRCF0AALNgwQL7dc2aNWbnzp039N+2bdu2wp+7XJIPpDNCFwDATgVqH6dJkybZ2q5du3aZzz//3N60grE83vYRACpH6AIARFExfK9evexNI2Dao+vLL780X3zxhdmwYYM5efJk5LF8vAxQdYQuAECFGjVqZEfBvB3NtbJx27Zt9tahQ4eAjw7IHIQuAMANadGihb2NGjUq6EMBMgqhCwAAwAFCFwAAgAOELgAAAAcIXQAAAA6EOnRpr5kPP/zQHD582H4UxeOPP17h54Lp8doYUDsqt2rVyjzyyCMOjzZ8tMz8vffes7tTDxgwwC4/r4h2xH7wwQf57LYU0E7h69atM8OGDSv3MVqJlp+fb2rWrOnwyMJNbfrnn39G/n3mzBkzZMiQqDb+9ttvzYEDB0zt2rVNu3btTMuWLYM41FDTZ0M+88wzZu7cueU+Ruf7rVu33tDHIKFiOqdfvHgx8m/1rWPGjIk6x+/du9d+coGon9ACjTALbejSkmZ9JlidOnUiH9z62muv2TdVs2bNrnv86tWrzaxZs8yECRPs5oBIjAJX586dTadOnewbrbi42HTs2NF8/fXX1z1Wb0y1vd582miR0JV88+fPN0eOHIkbuhQMVq5cad8nn376KaErScrKyszMmTOj7uvZs2dU+7711lvm6tWrZvz48TaQTZkyxQwaNMgMHjzY8dGG29tvv20v6OKFLoWtGTNm2PPTbbfdRuhKEm2o279//6j7hg4dGnV+nzx5su0fdH5SOJs2bZq9v6SkxOmxuhTa0DVx4kSzceNG+/EUCgBTp041y5Yts5370qVLox6rJ16fD1ZaWlrpx1mgaj766COzZ88eu7+PqN3VAemKplu3bpHHqWNq3769HVlU6ELyKUhptDEebWypDya+6667IhcnSI5Vq1bZjUW107unQYMGke8VdnWx5wVdXQzqvKXzkd4P9913XxCHXSG9RrQxal5ensnNzc2ICyRta1HeXmL6/9i3b5+9IFHoQvIsXLjQbNq0KeoDzxs2bBj5Xuf7oqIi89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N91ERmoKBe7R/sGj/5NHolXY417nfG61SuYja2L8qXYXc2jJCYcAbbdG5S7W+WgCE6qlq+/tpIETbqyhw+fviMApl6NL+IErUGs6P3eVZbzLteutZuXKlvQrVlhFdu3a1hXya048dHcON0UebqB31puvTp49p0qSJDVyxVzDe5zNqOF9UD6MtO5h+cYP2Dxbtn3yaylXtkC62tR2Qdvxv2rRpZAW7R/tBKXDpo990Ma5pX00Lq38Ie8efSlVtf1H/rE1SdbHh/wSTMAtl6FJHf+nSpSo/3tsaQgk9zJ/55IqClVYoqkPRXiwVDRXrTaYiez7vMrX0Go+3BQrt7wbt7453/tf5XDvMV1QmonB78OBBO+2rbYJ4HhJX1fbX6JcGRjQqFubpxFihDF3VxafLJ1c2XLUASE83cj6nfjf5Kmv/bN0ZgNAFAADgAKELAADAAUIXAACAA4QuAAAABwhdAAAADhC6AAAAHCB0AQAAOEDoAgAAcIDQBQAA4AChCwAAwAFCFwAAgAOELgAAAAcIXQAAAA4QugAAABwgdAEAADjgNHSVlpa6/HOIQfsHi/YPFu0fLNo/WLR/enAWuvLy8kxRUZGrP5eRGjdunLLfTftXjvYPFu0fLNo/WLR/sFLZ/n7OQldZWZmrP4U4aP9g0f7Bov2DRfsHi/ZPH9R0AQAAOEDoAgAAcIDQBQAA4AChCwAAwAFCFwAAgAOELgAAAAcIXQAAAA4QugAAABxIOHTt2rXLFBYWJuNYAAAA0tKpU6cS/h0Jha6CgoKEDwAAACDd5ebmmkmTJiX0OxIOXQQvAACAylHTBQAA4AChCwAAwAFCFwAAgAOELgAAAAcIXQAAAA4QugAAABwgdAEAADhA6AIAAHCA0AUAAOAAoQsAAMABQhcAAIADhC4AAAAHCF0AAAAOELoAAAAc+P8B/S3xOy1eg3wAAAAASUVORK5CYII=

2.1-2 Rewrite the INSERTION -SORT procedure to sort into nonincreasing instead of non-decreasing order.

Solution:

Insertion-Sort(A)

for j = 2 to A.length
    key = A[j]
    // Insert A[j] into the sorted sequence A[1..j − 1]
    i = j  1
    while i > 0 and A[i] < key
        A[i + 1] = A[i]
        i = i  1
    A[i + 1] = key
2.1-3 Consider the searching problem:
Input: A sequence of n numbers A=<a1,a2,...,an> and a value v.
Output: An index i such that v=A[i] or the special value NIL if v does not appear in A.
Write pseudocode for linear search, which scans through the sequence, looking for v. Using a loop invariant, prove that your algorithm is correct. Make sure that your loop invariant fulfills the three necessary properties.

Solution:

Linear-Search(A,v): 
for i = 1 to A.length
    if A[i] == v
        return i

return NIL

Initialization: Initially the subarray is empty. So, none of its’ elements are equal to v.
Maintenance: In i-th iteration, we check whether A[i] is equal to v or not. If yes, we terminate the loop or we continue the iteration. So, if the subarray A[1..i1] did not contain v before the i-th iteration, the subarray A[1..i] will not contain v before the next iteration (unless i-th iteration terminates the loop).
Termination: The loop terminates in either of the following cases,
  • We have found index i such that v = Ai
  • We reached the end of the array, i.e. we did not find v in the array A. So, we return NIL
In either case, our algorithm does exactly what was required, which means the algorithm is correct.

2.1-4 Consider the problem of adding two n-bit binary integers, stored in two n-element arrays A and B. The sum of the two integers should be stored in binary form in an .n C 1/-element array C . State the problem formally and write pseudocode for adding the two integers.

Solution:

Input: Two n-bit binary integers stored in two n-element array of binary digits (either 0 or 1)
A=<a1,a2,...,an> and B=<b1,b2,...,bn>.
Output: A (n+1)-bit binary integer stored in (n+1)-element array of binary digits (either 0 or 1) C=c1,c2,...,cn+1⟩ such that C=A+B.

Binary-Add(A,B): 
n = A.length
for i = 1 to (n + 1)
    C[i] = 0

carry = 0
for i = n to 1
    C[i] = (A[i] + B[i] + carry) % 2
    carry = (A[i] + B[i] + carry) / 2
C[i] = carry

return C

Thursday, 16 March 2017

Chapter 1 Problems, Introduction to Algorithms, 3rd Edition Thomas H. Cormen

1-1 Comparison of running times
For each function f(n) and time t in the following table, determine the largest size n of a problem that can be solved in time t, assuming that the algorithm to solve the problem takes f(n) microseconds.

Solution:



1 second
1 minute
1 hour
1 day
1 month
1 year
1 century
lg n
n
nlg n
62746
2801417
133378058
2755147513
71870856404
797633893349
68654697441062
1000
7745
60000
293938
1609968
5615692
56175382
100
391
1532
4420
13736
31593
146677
19
25
31
36
41
44
51
n!
9
11
12
13
15
16
17