Carbon nanotube based nonvolatile memory