To Sense or to Transmit: A Learning-Based Spectrum Management Scheme for Cognitive Radio Mesh Networks