Google Interview Question

Design and implement a garbage collection algorithm in any programming language. also needed to give out run time analysis.