New York City officials said on Sunday that they faced the daunting challenge of finding homes for as many as 40,000 people who were left homeless after the devastation of last week’s storm, a situation that the city’s mayor, Michael R. Bloomberg, compared to New Orleans’s after Hurricane Katrina.

The mayor said that the 40,000 figure was the worst possible case given by the Department of Housing and Urban Development, and that a more realistic assessment was 20,000 people — most of them residents of public housing. Even in the best possible case, he said, the task will be formidable.

“We don’t have a lot of empty housing in this city,” Mr. Bloomberg said at a news conference on Sunday. “We are not going to let anybody go sleeping in the streets or go without blankets, but it’s a challenge, and we’re working on that as fast as we can.”

It is a task shared throughout the region, as officials in New York, New Jersey and Connecticut struggle to meet the demands of those whose homes have been left uninhabitable. In some cases, the solution may be a familiar, if unwelcome sight: the trailers provided by the Federal Emergency Management Agency after Hurricane Katrina.