Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 1: Java Arrays In this assignment you'll need to build a class that performs a few operations on the array(s) passed to them, namely:

image text in transcribed

Assignment 1: Java Arrays In this assignment you'll need to build a class that performs a few operations on the array(s) passed to them, namely: 1. Determine if two arrays are equal. 2. Copy a portion of a given array to a new array. 3. Calculate the sum of the rows in a 2-dimensional array (or matrix). 4. Calculate the Hamming distance between two arrays. 5. Perform a recursive binary search for a key in a sorted array (see below for more details). All of these should be implemented as static methods in a single class. Furthermore, you will need to build some form of automated way to test these methods. A separate class can be used to store these tests and have them run in the main method. When using multiple files in a single folder, you don't need to perform any imports between the files to use it. Hamming Distance of Two Arrays: The hamming distance is the number of positions at which the symbols differ when comparing two strings. For example, these arrays have a hamming distance of 2: int[] a = {0,1,1,0), b = {1,1,1,1}; // Positions 0, and 3 are different Here is an example with a hamm distance of 4: int[] c = {1,0,1,0), d = {0,1,0,1); Binary Search: A binary search involves searching though a sorted array by taking the midpoint, checking if the element matches the key, and if not, searching either the left section (if the element is less than the midpoint) or the right section (if the element is greater than the midpoints). Here is a visualization of this. Key = 5, Array = {1,3,5,7,10,11,12); Midpoint, key less than 7, go left Key = 5, Array = {1,3,5}; Midpoint, key greater than 3, go right Key = 5, Array = {5}; Found

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

Students also viewed these Databases questions

Question

2. How will the team select a leader?

Answered: 1 week ago