Online algorithms and approximation algorithms for vertex cover and other variants