garbage collection algorithm in data structure