answersLogoWhite

0


Best Answer

Yes. It is possible to provide a solution to the diamond-square algorithm using Java and recursion.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

You can implement the diamond-square algorithm in Java using stack overflow.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you provide a solution to the diamond-square algorithm using Java and recursion?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is are advatages and disadvatages of bresenham's line algorithm?

1. High accuracy. Comparing to Basic Incremental algorithm (especially if the slope were > 1.) 2. High speed. Comparing to Digital Differenmtial algorithm. 3. Draws the line between any two points. Comparing to Basic Incremental algorithm which can't draw if x0 > x1 ( the format is: (x0, y0), (x1, y1). )


Which is better encryption algorithm among DES Blowfish and MD5?

MD5 isn't a encryption algorithm, it's a hashing algorithm. Encryption will 'hide' the meaning of the encrypted text, while MD5 will 'add up' all the text to come up with a number. This number can be compared to another time this file was 'added up', to provide a simple kind of check to see if the text has been changed or if it is the same.


What is fitness function in GA algorithm?

In order to understand the fitness function, you first have to understand that a genetic algorithm is one which changes over time (it evolves). In nature we have things like predators and harsh environments which eliminate unwanted specimens of animals (a slow zebra will get eaten by a lion). We need to simulate this behavior when programming genetic algorithms. The fitness function basically determines which possible solutions get passed on to multiply and mutate into the next generation of solutions. This is usually done by analyzing the "genes," which hold some data about a particular solution to the problem you are trying to solve. The fitness function will look at the genes and make some qualitative assessment, returning a fitness value for that solution. The rest of the genetic algorithm will discard any solutions with a "poor" fitness value and accept any with a "good" fitness value. In short: the goal of a fitness function is to provide a meaningful, measurable, and comparable value given a set of genes.


Which encryption algorithm is better and why?

If you're talking about symmetric key encryption (the kind where you just use one key for encryption and decryption), then arguably, the best encryption algorithm you can use is the Rijndael algorithm, better known now as AES (advanced encryption standard). It is the encryption standard used by the U.S. government for classified information. It is fast, requires little memory, and the only potential attacks against it are highly theoretical. Rijndael beat out Twofish and Serpent in the AES standard contest, but those other two algorithms will provide more than enough security as well. In the end, it doesn't really matter, since most successful attacks are made simply by finding out your key through brute force, espionage or extortion, rather than pure data analysis. Humans are almost always the weakest point when it comes to security, and it doesn't matter what algorithm you use if someone can guess your password.


What is the importance of recursion in computer programming?

Recursion is important because many algorithms are naturally recursive, particularly those that involve a divide-and-conquer technique. That is, we divide a complex problem into smaller instances of the same problem. Each division divides and reduces the problem further until the divisions are small enough to be resolved. We then aggregate those individual solutions to solve the original problem. As a simple example, factorials can be calculated such that f(n) = n * f(n-1) for all n>1 where f(1) and f(0) are both 1. We can implement this function recursively as follows: unsigned f(unsigned n) { return n<2 ? 1 : n * f(n-1); } While the function itself is naturally recursive, that doesn't mean we must use a recursive solution. In this case, an iterative solution would actually be more efficient: unsigned f(unsigned n) { unsigned a = 1; while (1<n) a *= n--; return a; } However, in languages that allow compile-time computation (such as C++), recursive functions can be advantageous: constexpr unsigned f(unsigned n) { return n<2 ? 1 : n * f(n-1); } With this function, a good compiler will convert f(6) to the literal constant 720, completely eliminating the runtime overhead of invoking the function recursively. However, for values that cannot be computed at compile time due to excessive recursions, the runtime function will still be invoked, such that f(10) might be replaced with the constant expression 10 * f(9). Languages that support template metaprogramming can provide the means to completely eliminate the runtime overhead associated with recursion: template <unsigned N> constexpr unsigned f () { return N*f<N-1>(); } template<> constexpr unsigned f<1>() { return 1; } template<> constexpr unsigned f<0>() { return 1; } Note that the terminating conditions are handled through specialisation rather than through recursion. At compile time, f<1>() invokes the first specialisation while f<0>() invokes the second. For all values N>1, the general function is invoked recursively at compile time. constexpr unsigned x = f<10>(); Compile-time computation will effectively replace the above expression with: constexpr unsigned x = 3628800; Note that no code is generated for these template functions so we cannot invoke them at runtime, they are used purely for compile-time computation. In languages that do not support template metaprogramming or constexpr, we can still make use of recursion, particularly where an iterative approach is too complex to implement efficiently. Divide-and-conquer algorithms are a typical example. The Quicksort algorithm is a relatively simple recursive algorithm that can be implemented as follows: void qsort (int a[], int lo, int hi) { if (hi<=lo) return; unsigned pivot = partition (a, lo, hi); qsort (a, lo, pivot-1); qsort (a, pivot+1, hi); } The partition() function does most of the actual work. Given the lower and upper bounds of the array it will select a pivot value and position this value such that all values to the left of it are less than it and all those to the right are not less than it. Once the array is partitioned, the index of the pivot value is returned. This value is used to determine the upper bound of the left sub-array (pivot-1) and the lower bound of the right sub-array (pivot+1).

Related questions

What is an algoithm?

It is a method of doing some particular thing. in Psychology, it describes solving problem in a step by step procedure that guarantees a result. The opposite of algorithym is heuristic.


Does A data-flow diagram provide a visual representation of an algorithm?

False


How can one validate the designed algorithm?

Providing validation of an algorithm, is a fairly complex process, and it may not be possible, to provide a complete theoretical validation in all cases. Alternately, algorithm segments, which have been proved else where, may be used, and the over all working algorithm, may be empirically validated, for several test cases.


Who do you tell the solution to the theory of everything?

I have the solution to the "theory of everything", I need to know who and how to provide the solution.


Can someone provide the C program for Prim's algorithm?

The C code for Prim's algorithm can be found in the following link. https://sites.google.com/site/itstudentjunction/lab-programming-solutions/data-structures-programs/program-to-find-minimal-spanning-tree-using--prims-algorithm


What is quinnox inc?

It is an IT company which provide solution to Fortune500


A sentence with the word solution?

We provide a complete, reliable business email solution for just pennies a day.


What is are advatages and disadvatages of bresenham's line algorithm?

1. High accuracy. Comparing to Basic Incremental algorithm (especially if the slope were > 1.) 2. High speed. Comparing to Digital Differenmtial algorithm. 3. Draws the line between any two points. Comparing to Basic Incremental algorithm which can't draw if x0 > x1 ( the format is: (x0, y0), (x1, y1). )


Delaying tactics only provide a temporary solution.?

true


What is the low cost solution to provide fast secure and reliable communications for mobile users.?

Identify the low cost solution to provide fast, secure and reliable communications for mobile users


What is parallism in computer science?

Parallelism is running processes simultaneously to maximize resources for faster processing.Actually, that's incorrect. Parallelism in computer science is a property of an algorithm used to solve a problem. The Parallelism of an algorithm is its ability to be broken into discrete, independent parts which can be operated on separately, then recombined to obtain the answer the algorithm was supposed to provide. The greater the number of discrete parts that the algorithm can be broken into, the higher the Parallelism."Parallelism" can, however, be used to characterize the ability of a processor to work on different tasks at once, in a manner analogous to that of describing the ability of an algorithm to work on different portions of a problem simultaneously.


What information does a chlorine test kit provide about a sanitizing solution?

Concentration