Write a method in your class called reversearray

Assignment Help Data Structure & Algorithms
Reference no: EM131588425

Array Exercises

Create a class named ArrayExercises that contains the following array tasks in the main method:

1. Write some code that asks the user to enter an integer via the keyboard, use that integer to set the length of an array and populate it with random integers from -17 to 19 (inclusive). Print the array back in a nice way (10 numbers per line with commas and such);

2. Below that write some java to reverse the arrays:

char[] a = {'t', 'o', 'y', 'o', 't', 'a'} char[] b = {'r', 'a', 'c', 'e', 'c', 'a', 'r'}

You should do this by creating new arrays to store the reversal. Then write some more java code to prove to me that array b contains a palindrome, while array a does not.

3. (Challenge:) Write a method in your class called reverseArray that is of void return type and it takes as argument a String array (any String array the teacher can think of!) and it reverses the given array in place. That is, it manipulates the given array and modi?es it (this is because arrays are passed in to methods by reference and not by value.

Reference no: EM131588425

Questions Cloud

The responsibilities of a debtor in possession : The responsibilities of a debtor in possession include ________. CAFTA is
Prepare a budgeted income statement for the month of july : Following information relates to Acco Co. Beginning cash balance on July 1: $50,000. Prepare a budgeted income statement for the month of July
Calculate the reorder point in units for kabelo business : Calculate the economic order quantity for Kabelo’ business. Calculate the reorder point in units for Kabelo’ business.
What is the frequency of the fundamental : What is the frequency of the fundamental and the second harmonic - If the tension in the clothesline is increased
Write a method in your class called reversearray : Write a method in your class called reverseArray that is of void return type and it takes as argument String array (any String array the teacher can think of!).
How can taxes affect the firm optimal capital structure : How could bankruptcy costs affect a firm’s WACC? How can taxes affect the firm’s optimal capital structure?
Discuss the ethical and legal concerns of brians actions : Discuss the ethical and legal concerns of Brian's actions. What might the ramifications or consequences of his actions be? Why?
What is the distance covered on the return trip : What is the distance covered on the return trip, as measured by the astronaut? Give your answer in light-years.
Determine the number of occurrences : Write a script that inputs several lines of text and a search character and uses String method index of to determine the number of occurrences of the character.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement the dynamic-set operation insert

Can you implement the dynamic-set operation INSERT on a singly linked list in O(1) time? How about DELETE - what is the maximum number of keys that can be stored in a B-tree of height h?

  Sort the functions by increasing order of growth

Array A of size n contains all integers form 1 to (n+1) but one! Assuming the array is sorted, propose a (best-running time) algorithm that finds/identifies the missing number, and analyze its worst-case running time in terms of big-O notation

  What is the probability that you hire exactly n times

What is the smallest value of n such that an algorithm whose running time is 100n2 runs faster than an algorithm whose running time is 2n on the same machine?

  Describe the linear search and binary search algorithm

Compare the worst-case time complexities of these two algorithms. c) Is one of these algorithms always faster than the other (measured in terms of comparisons)?

  Implement the following pseudocode

private static ArrayList board = new ArrayList ();

  Finding the values of queuefront and queuerear

Assume that queue is a queue type object and the size of the array-implementing queue is 100. Also, assume that the value of the queueFront is 25 and the value of queueRear is twenty-five.

  Write a print function that can be called to print the tree

Write a print function that can be called to print the tree. The printed output should contain the node level number in parentheses, its data, and its balance factor.

  Design a class that has an array of floating-point numbers

Design a class that has an array of floating-point numbers. The constructor should accept an integer argument and dynamically allocate the array to hold that many numbers.

  What is algorithm what is algorithm

What is Algorithm? What is Algorithm? What is Algorithm? What is Algorithm? What is Algorithm? What is Algorithm?

  Explain why the tower of hanoi puzzle is an example of a

the tower of hanoi puzzle is a popular diversion which you may have encountered before.nbsp we are interested in this

  What metric is used for traffic demand information?

what metric is used for traffic demand information?

  Describe a most efficient algorithm to remove all duplicate

You are given an unsorted list containing integer values with duplicates. Describe a most efficient algorithm to remove all duplicates from this list. Derive the time complexity (Big O) for your algorithm.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd