The book is called Futility or The Wreck of the Titan.
The fictional Titan and the real Titanic had many similarities such as crashing into an iceberg and sinking situation. Also these ships were over 800 feet long with 3000 passengers and they both were known as “unsinkable”. Besides they sunk in the North Atlantic and didn’t have enough lifeboats.
However, the most important difference between them is that more people survived from the real Titanic than from the Titan.