Write a program to check for duplicates in an 2-d array ?
Urgent please.
Answers
Answered by
1
public static boolean hasDuplicates(int [][] inArray)
{
for (int row = 0; row < inArray.length; row++)
{
int rowCheck = inArray[row][inArray.length];
for (int col = 0; col < inArray[row].length; col++)
{
}
}
return false;
}
Suryarajan:
so is there any other alternative method
Answered by
0
Java, C programs can be used for checking of duplication in an 2-d array.
In C++, you could std::sort (as a sequence of std::pairs) and then std::unique or std::adjacent_find in a loop or whatever you need.
Or you could add them to a std::set (or even std::unordered_set) of such pairs, tracking where set.insert().second is false. There are plenty of ways to manipulate a sequence like this.
If you check this 14
45
25
67
You've to print the duplicate entries and use C++ containers. For accurate results and check. Thanks
In C++, you could std::sort (as a sequence of std::pairs) and then std::unique or std::adjacent_find in a loop or whatever you need.
Or you could add them to a std::set (or even std::unordered_set) of such pairs, tracking where set.insert().second is false. There are plenty of ways to manipulate a sequence like this.
If you check this 14
45
25
67
You've to print the duplicate entries and use C++ containers. For accurate results and check. Thanks
Similar questions