In this book we apply the B-ordering of vectors of length n over the ring Z4. This ordering is a generalization of the B-ordering deinedfor vectors over binary field Z2, and over the prime field Zp.Then we study greedy codes generated by this ordering over the ring Z4 using Lee distance. Also we modify the greedy algorithm to anotherone called almost" greedy. By this algorithm we show that codes and self-orthogonal codes generated by using B-ordering for Lee distanceare linear codes over Z4.An extension and a generalization of these results are applied to another ring of four alphabets which is F2 + uF2.Finally we study linear codes over the rings Z4 and F2+uF2 of constant Lee weight using the almost greedy algorithm and also the additive greedy codes over the ring Z2 x Z2.