@@ -0,0 +1,1620 @@
+//  Copyright 2016 The Sawdust Open Source Project%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A//     http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0A//%0A%0A// Isabel has an interesting way of summing up the values in an array A of n integers,%0A// where n is a power of two. She creates an array B of half the size of A and sets%0A// B%5Bi%5D = A%5B2i%5D+ A%5B2i+ 1%5D, for i = 0,1, . . . , (n/2)%E2%88%92 1. If B has size 1, then she%0A// outputs B%5B0%5D. Otherwise, she replaces A with B, and repeats the process. What is%0A// the running time of her algorithm?%0Apublic class C524IsabelSum %7B%0A    // O(N-1)%0A    private static long sum(long%5B%5D data, long%5B%5D by) %7B%0A        for (int i = 0; i %3C by.length; i++) %7B%0A            by%5Bi%5D = data%5B2 * i%5D + data%5B2 * i + 1%5D;%0A        %7D%0A        if (by.length == 1) %7B%0A            return by%5B0%5D;%0A        %7D%0A        return sum(by, new long%5Bby.length %3E%3E 1%5D);%0A    %7D%0A%0A    public static long isabelSum(long%5B%5D data) throws UnsupportedOperationException %7B%0A        double log = Math.log(data.length) / Math.log(2);%0A        if (log != (long) log) %7B%0A            throw new UnsupportedOperationException();%0A        %7D%0A        return sum(data, new long%5Bdata.length %3E%3E 1%5D);%0A    %7D%0A%7D%0A

Add C524IsabelSum