Calculating the class number for calculating class number of a number field $K$, first we can calculate Minkowski bound ( Let's call it B). I know that every class in class group has one integral ideal whose norm is less than B. Now we factorize the ideal into product of prime ideals. We get that every such prime ideal has norm less than B. Now, when $K=\mathbb Q(\sqrt d)$ for some $d \in \mathbb Z$ then every prime ideal has norm of the form $ p$  or $p^2$. After this I can't find a way to calculate the class number of the number field.
 A: I will try and give you a few ideas in the quadratic case, but this won't be a complete algorithm.
If the norm of the ideal is $p^2$ then this means $(p)$ is still prime and clearly principal so we can forget about it.
Otherwise we can use Kummer-Dedekind to write $(p)=(p,\sqrt{d}-a)(p,\sqrt{d}-b) = \mathfrak{p}_p\mathfrak{q}_p$, (the suubscript denotes the norm) where $x^2-d = (x-a)(x-b) \mod{p}$. (If it didn't factorise modulo $p$, then its norm would be $p^2$.)
Now if $\mathfrak{p}_p=\mathfrak{q}_p$ (i.e. $a=b \mod{p}$), then we can see that $\mathfrak{q}_p^2=(p)$ is principal so it has order dividing two in the class group. We can check which one it is by determining if there exists an element of norm $p$ in $K$ or not. (This is only a finite check if $d<0$).
Otherwise, $\mathfrak{p}_p\mathfrak{q}_p$ is principal so $[\mathfrak{p}_p]+[\mathfrak{q}_p]=0$ in the class group so we only need to consider one of them, but we don't have any bounds on the order. You can also try to check if this is principal again.
Doing this for all primes up to the Minkowski bound, and then you need we now need to check for relations between the primes of different norms. For this note, that the norm of a principal ideal is equal to the norm of its generator and $N(n-\alpha)=|n^2-d|$ for any integer $n$.
So for example if you had a prime with norm $3$ and one of norm $5$, then you should search for an $n$ such that $|n^2-d|$ is only divisible by $3$ and $5$ (you can just try computing the first few values of $n$ and hope for relations). Say the norm was $15$, then $(n-\alpha)=\mathfrak{p}_3\mathfrak{p}_5$ for some suitable primes (but we can force them into the ones we want by the relations we already have), which tells us that $[\mathfrak{p}_3]+[\mathfrak{p}_5]=0$ so we can remove one of these. (If say we know the order of $[\mathfrak{p}_3]$ but not $[\mathfrak{p}_5]$, then this also tells us the order of the other in this case).
By this point, if you can show that there are no more relations (e.g. by showing no element of norm $3^a5^b$ exists) and have found the order of each non-principal ideal you have left, then you have sucessfully found the class group.
If not, there are a few more things you can try but I can't completely remember what.
