Add an interface for matrix search algorithms (closes #3461) (#3464)

This commit is contained in:
Aitor Fidalgo Sánchez
2022-10-09 13:45:36 +02:00
committed by GitHub
parent cce1dbd124
commit 03a4832a7d
3 changed files with 152 additions and 138 deletions

View File

@ -0,0 +1,16 @@
package com.thealgorithms.devutils.searches;
/**
* The common interface of most searching algorithms that search in matrixes.
*
* @author Aitor Fidalgo (https://github.com/aitorfi)
*/
public interface MatrixSearchAlgorithm {
/**
* @param key is an element which should be found
* @param matrix is a matrix where the element should be found
* @param <T> Comparable type
* @return array containing the first found coordinates of the element
*/
<T extends Comparable<T>> int[] find(T matrix[][], T key);
}