positive integers for example mod mod mod and mod unfortunatelythere is more than one way to assign values to and rdepending on how integer division is interpreted the most common mathematical definition computes the mod function as mod mbn/mc in this case- mod howeverjava and +compilers typically use the underlying processor' machine instruction for computing integer arithmetic on many computers this is done by truncating the resulting fractionmeaning mod (trunc( / )under this definition- mod - unfortunatelyfor many applications this is not what the user wants or expects for examplemany hash systems will perform some computation on record' key value and then take the result modulo the hash table size the expectation here would be that the result is legal index into the hash tablenot negative number implementers of hash functions must either insure that the result of the computation is always positiveor else add the hash table size to the result of the modulo function when that result is negative logarithms logarithm of base for value is the power to which is raised to get normallythis is written as logb thusif logb then bx yand blogb logarithms are used frequently by programmers here are two typical uses example many programs require an encoding for collection of objects what is the minimum number of bits needed to represent distinct code valuesthe answer is dlog ne bits for exampleif you have codes to storeyou will require at least dlog bits to have different codes ( bits provide distinct code valuesexample consider the binary search algorithm for finding given value within an array sorted by value from lowest to highest binary search first looks at the middle element and determines if the value being searched for is in the upper half or the lower half of the array the algorithm then continues splitting the appropriate subarray in half until the desired value is found (binary search is described in more detail in section how many times can an array of size be split in half until only one element remains in the final subarraythe answer is dlog ne times