0

Hello..

I'm doing a project that involves searching/matching 2 matrix's. The basic idea:

Matrix 1:

0 1 0 1 0
1 0 1 0 1
1 1 1 0 1

Which will then be interpreted in memory as:

0 1 0 1 0 1 0 1 0 1 1 1 1 0 1

Matrix 2:

0 1 0 1 0
1 0 1 0 1

Which will then be interpreted in memory as:

0 1 0 1 0 1 0 1 0 1

Would a binary tree (search) be most efficient? I've come up with the idea of starting at the midpoint and in the array(matrix 2) and checking to see if it matches with the other array (matrix2) and if it does, go left until it returns false, and then go right to check if there's a match.

Any ideas? :)

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by firstPerson
0

What's the data type of Matrix?

Thanks for your reply :)

The matrix is a double.

0

If its just 1's and 0's you might as well use std::bitset

std::bitset<15> mat1(std::string("010101010111101"));
cout << mat1.to_ulong() << endl;
This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.