Explore BrainMass



Quest: In English like pseudo-code, or structured English -- just to make sure everyone can read it; write an algorithm to determine if a string is a palindrome. A palindrome is a word or phrase that is spelled the same whether you are reading it forwards or backwards (ex. race car, Madam I'm Adam). Your algorithm should igno

Suppose an array

Suppose an array with 6 rows and 8 columns is stored in row major order starting at address 20 (base ten). If each entry in the array requires only one memory cell, what is the address of the entry in the third row and fourth column? What if each entry requires two memory cells? (See attached file for full problem descriptio

Order-statistic tree (Augmenting Data Structures)

Need help to show how to use an order-statistic tree to count the number of inversions in an array of size n in time O(n lg n). Note that we call a pair (i,j) an inversion if i < j, but key[i] > key[j]. Thus, an increasing sequence has no inversions. A decreasing list has the maximum number of inversions, n(n-1)/2. I beli

Sorting an array of integers in linear time

How can I sort an array of integers in O(n) time, where different integers may have different numbers of digits, but the total number of digits over ALL the integers in the array is n? My assumption is that radix sort is somehow involved.


Step by step instructions Create an application that either sums or averages the rows or columns of a two-dimensionsl array depending on user choices. Use the following data for the array: 5 7 3 9 12 4 8 9 13 4 0 -1 -7 13 8 4 4 4 4 0

Arrays in java

Write the definition of a method, isReverse , whose two parameters are arrays of integers of equal size. The method returns true if and only if one array is the reverse of the other. ("Reverse" here means same elements but in reverse order.) So, suppose you had two int arrays, forward and backward, each with 4 elements. N

Computer Programming

Multi-dimensional arrays could cost a lot of memory. How much memory (how many bytes) does it take to create an integer array of 3 dimensions, with each dimension having 1000 elements (i.e. int myHugeArrays[1000] [1000] [1000])? Explain your answer.


Specification Implement the Banker's algorithm described in Section 8.5.3 using C/C++. Your program should ... 1) Prompt user to enter the size of matrix n and m. Your program should accept any n x m matrix and m vectors where n and m are positive integer less than 10. 2) Read in Allocation, Max, and Available from all

Range Selection of Unsorted Array

Write a method findRanks in Java that accepts an unsorted array of integers vals, and a starting and ending rank start and end, numbering ranks from 0, and returns an unsorted (any order is acceptable) array containing the lo-th through the hi-th elements, inclusive, of vals. int[] findRanks(int[] vals, int lo, int hi)

one-dimensional array and its components

Explain what a one-dimensional array and its components are. Explain why arrays are useful, and how they are created within Visual Basic .NET. Finally, explain how two-dimensional arrays are different than one-dimensional arrays. Thank you

Arrays, vector<T>s, and STL

If x denotes the mean of a sequence of numbers x1, x2,.....xn, the variance is the average of the squares of the deviations of the numbers from the mean, and the standard deviation is the square root of the variance. Write functions to calculate the mean, variance, and standard deviation of the values stored in an array and a d

Shortest Prefixes are emphasized.

Shortest Prefixes Input: Prefix .in Output: Prefix .out A prefix of a string is a substring string at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", car", "carb", "carbo", and "carbon". Note that the empty string is not considered a prefix in this problem, but every non-empty string is conside

Theory of Computation with a Vending Machine

Problem: Consider a vending machine that accepts nickels, dimes and quarters. 1. Give an implicit definition of the set of all strings whose value mod 30 = 0. 2. Give recursive definition of the set of all strings whose value = 30 cents. See attachment for the full and formatted problem.

Example of an array in java using a sample program.

Write all the code for a class called ArrayQsn. This class will contain two methods. The first method runningSumMean accepts an array of ints as a parameter, and will return the mean of the values as a double. It also changes the values of the array so that they are running sum values. For example, the array: {2, 4, 5, 1, 3}