Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to find the period comparing two boolean arrays in Java? I have two boolean arrays, with some pattern in each of them, I need

How to find the period comparing two boolean arrays in Java?

I have two boolean arrays, with some pattern in each of them, I need to calculate what is the period.

For the first two array (example 1), the period is 2, since the pattern repeats after that the second position.

In the the next two arrays (example 2) the period is 5 since it repeats the pattern after the fifth.

How would I compare both array, and differntiate when the pattern is met, and I have a correct period.

Thanks.

Example 1, period is 2

F T F T F T F T
F T F T F T F T

Example 2, period is 5

F T F T T F T F T T
F T F T T F T F T T

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions