These algo implimentations are only for learning and practice. They may be less efficient from the algorithms of your knowledge. If you have a better approach to impleament these codes then feel free to contribute.
Read our Contribution Guidelines before you contribute.