chap algorithm analysis to have sides perpendicular to the and axesthat contains the object if the point is not in the bounding boxthen it cannot be in the object if the point is in the bounding boxonly then would we conduct the full comparison of the object versus the point note that if the point is outside the bounding boxwe saved time because the bounding box test is cheaper than the comparison of the full object versus the point but if the point is inside the bounding boxthen that test is redundant because we still have to compare the point against the object typically the amount of work avoided by making this test is greater than the cost of making the test on every object example section presents sorting algorithm named selection sort the chief distinguishing characteristic of this algorithm is that it requires relatively few swaps of records stored in the array being sorted howeverit sometimes performs an unnecessary swap operationspecifically when it tries to swap record with itself this work could be avoided by testing whether the two indices being swapped are the same howeverthis event has insufficient chance of occurring because the cost of the test is high enough compared to the work saved when the test is successfuladding the test typically will slow down the program rather than speed it up be careful not to use tricks that make the program unreadable most code tuning is simply cleaning up carelessly written programnot taking clear program and adding tricks in particularyou should develop an appreciation for the capabilities of modern compilers to make extremely good optimizations of expressions "optimization of expressionshere means rearrangement of arithmetic or logical expressions to run more efficiently be careful not to damage the compiler' ability to do such optimizations for you in an effort to optimize the expression yourself always check that your "optimizationsreally do improve the program by running the program before and after the change on suitable benchmark set of input many times have been wrong about the positive effects of code tuning in my own programs most often am wrong when try to optimize an expression it is hard to do better than the compiler the greatest time and space improvements come from better data structure or algorithm the final thought for this section is first tune the algorithmthen tune the code