TITLE: How does a Class group measure the failure of Unique factorization?
QUESTION [16 upvotes]: I have been stuck with a severe problem from last few days. I have developed some intuition for my-self in understanding the class group, but I lost the track of it in my brain. So I am now facing a hell. 
The Class group is given by $\rm{Cl}(F)=$ {Fractional Ideals of F} / {Principle fractional Ideals of F} ,  ($F$ is a quadratic number field)  so that we are actually removing the Principal fractional ideals there  (that's what I understood by quotient group). But how can that class group measure the failure of Unique Factorization ? 
For example a common example that can be found in any text books is $\mathbb{Z[\sqrt{-5}]}$
in which we can factorize $6=2\cdot3=(1+\sqrt{-5})(1-\sqrt{-5})$. So it fails to have unique factorization. Now can someone kindly clarify these points ? 

How can one construct $\rm{Cl}(\sqrt{-5})$ by using the quotient groups ? 
What are the elements of $\rm{Cl}(\sqrt{-5})$ ? What do those elements indicate ? ( I think they must some-how indicate the residues that are preventing the $\mathbb{Z[\sqrt{-5}]}$ from having a unique factorization ) 
What does $h(n)$ indicate ? ( Class number ). When $h(n)=1$ it implies that unique factorization exists . But what does the $1$ in $h(n)=1$ indicate. It means that there is one element in the class group , but doesn't that prevent Unique Factorization ? 

EDIT: 

I am interested in knowing whether are there any polynomial time running algorithms that list out all the numbers that fail to hold the unique factorization with in a number field ?

I am expecting that may be Class group might have something to do with these things. By using the class group of a number field can we extract all such numbers ? For example, if we plug in $\mathbb{Z}[\sqrt{-5}]$ then we need to have $6$ and other numbers that don't admit to a unique factorization. 
Please do answer the above points and save me from confusion . 
Thank you.

REPLY [5 votes]: First of all, I want to clarify one thing: taking the quotient by the subgroup of principal ideals is not the same thing as removing the subgroup. It means that two fractional ideals $\frak{A}$ and $\frak{B}$ are equivalent iff $\frak{A}^{-1}\frak{B}$ is a principal ideal.
In general, if one wants to compute the class group of a number field, the first thing you might want to do is compute the class number; a good way to tackle this is to first compute an upper bound for the class number. For this purpose, you can use Minkowski's bound:
$$M_F:=\sqrt{|D|}\left(\dfrac{4}{\pi}\right)^{r_2}\dfrac{n!}{n^n},$$
where $F$ is a number field of degree $n$ over $\mathbb{Q}$, $D$ is the discriminant, $r_2$ is half the number of complex embeddings. In general, every class in the class group contains an ideal of norm at most $M_F$, and so the class group is generated by the prime ideals of norm at most $M_F$. By studying the splitting of the rational prime ideals in $F$, you can deduce a lot of information about the class group. To see example of computations, I highly recommend this note by Keith Conrad.

Here are two ways of thinking about a Dedekind domain with class number equal to 1. First, for Dedekind domains, being a Unique factorisation domain (UFD) is equivalent to being a Principal ideal domain (PID) (this basically follows from the fact that Dedekind domains are Noetherian integral domains in which every nonzero prime ideal is maximal). Therefore, a Dedekind domain has a trivial class group if and only if every ideal is principal, if and only if it is a UFD. Second, we know that in Dedekind domains, every fractional ideal has a unique factorisation into prime ideals. Hence, you can think of the class group as being a comparison between unique factorisation of fractional ideals and unique factorisation per se.