This repository contains an algorithm that covers all zeros in a matrix using minimum amount of lines. This is the most efficient and performant algorithm all around the globe.
This repository tends to contain this algorithm in many programming languages. Request in issues, Don't be shy.
I will be happy to accept any contribution and help. ❤️
It's free to use and copy but please consider a simple link to this repo!
- Javascript
- C++
- Python
- PHP
- Java
- Go
There is some benchmark results below and you can see the performance your self!
The test code is included in every language and you can test it your self. Below results comes from JavaScript.
- Result of 100 random generated matrixes with 15 rows and 13 columns:
Total timings are (seconds):
{ Bruteforce: 255.69042939997465, Optimized: 0.008223899953067302 }
Average timings are (milliseconds):
{ Bruteforce: 2556.9042939997466, Optimized: 0.08223899953067303 }
- Result of 100 random generated matrixes with 12 rows and 10 columns:
Total timings are (seconds):
{ Bruteforce: 3.459206000007689, Optimized: 0.0069830000549554825 }
Average timings are (milliseconds):
{ Bruteforce: 34.59206000007689, Optimized: 0.06983000054955482 }
- Result of 1000 random generated matrixes with 10 rows and 10 columns:
Total timings are (seconds):
{ Bruteforce: 13.808599199980497, Optimized: 0.02556609996408224 }
Average timings are (milliseconds):
{ Bruteforce: 13.808599199980497, Optimized: 0.02556609996408224 }
Feel free to contact at anytime about anything.
I will write a wiki about it in near future so you can understand the algorithm.
Made with ❤️.