Optimization Of Spectrum Allocation In Cognitive Radio And Dynamic Spectrum Access Networks