Search Results

Search found 1 results on 1 pages for 'hamax'.

Page 1/1 | 1 

  • Replace for loop with formula

    - by hamax
    I have this loop that runs in O(end - start) and I would like to replace it with something O(1). If "width" wouldn't be decreasing, it would be pretty simple. for (int i = start; i <= end; i++, width--) if (i % 3 > 0) // 1 or 2, but not 0 z += width; start, end and width have positive values

    Read the article

1