This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMPORTANT | |
Please duplicate this radar for a Safari fix! | |
This will clean up a 50-line workaround. | |
rdar://22376037 (https://openradar.appspot.com/radar?id=4965070979203072) | |
////////////////////////////////////////////////////////////////////////////// | |
(Now available as a standalone repo.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* In this code we have a very large array called arr, and very large set of operations | |
* Operation #1: Increment the elements within range [i, j] with value val | |
* Operation #2: Get max element within range [i, j] | |
* Build tree: build_tree(1, 0, N-1) | |
* Update tree: update_tree(1, 0, N-1, i, j, value) | |
* Query tree: query_tree(1, 0, N-1, i, j) | |
* Actual space required by the tree = 2*2^ceil(log_2(n)) - 1 | |
*/ |