Computer Science, asked by Suryarajan, 1 year ago

Write a program to check for duplicates in an 2-d array ?
Urgent please.

Answers

Answered by rishit210
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
rishit210: please make me brianlist
rishit210: yes i will give u
rishit210: i need to check my text book
Suryarajan: thanx
rishit210: ok
rishit210: http://stackoverflow.com/questions/21922354/check-duplicate-in-rows-and-columns-2d-array
rishit210: i dont have in text book
Suryarajan: ok in boolean what does false mean
Suryarajan: is it a char
Answered by Rickey18
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
Similar questions