advanced data structures and implementation /stably sort in[ - with indices into that has keys in /into out[ - ]sort is relative to offset into /uses counting radix sort void radixpassconst vector invector outconst vector sint offsetint nint vector countk )/counter array forint ++ ++countsini offset ]forint < ++ counti +counti ]/count occurrences /compute exclusive sums forint ++ outcountsini offset ]+ini ]/sort /stably sort in[ - with indices into that has keys in /into out[ - /uses counting radix sort void radixpassconst vector invector outconst vector sint nint radixpassinouts nk )figure counting radix sort for the suffix array radix sort is that the indices are sorted so that the characters in are sorted at those indices (where the indices are offset as specifiedfigure contains the routines to compute the suffix arrays for and then finallythe merge routine is shown in figure with some supporting routines in figure the merge routine has the same basic look and feel as the standard merging algorithm seen in figure - trees suppose that an advertising company maintains database and needs to generate mailing labels for certain constituencies typical request might require sending out mailing to people who are between the ages of and and whose annual income is between $ , and $ , this problem is known as two-dimensional range query in one dimensionthe problem can be solved by simple recursive algorithm in ( log naverage timeby traversing preconstructed binary search tree here is the number