The structure of James Joyce's Ulysses, is based on Homer's The Odyssey and there are many correspondences between the two works. But another text, which is really important for Ulysses, is Shakespeare's Hamlet. In the novel, the young Stephen Dedalus gives a sort of an impromptu lecture in the National Library on Hamlet. And in fact, when Joyce was living in Trieste, he himself gave a number of lectures in the city about Hamlet. And in those lectures, he began to tease out ideas and images that would later appear often transformed in Ulysses.