Generic tries, constructible in linear time