Growth of nanowire heterostructures and their optoelectronic and spintronic applications