Can you give me a Programming problem in java [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am learning java on my own. I have books to read. but i feel i am not really coding anything significant . Can you guys give me any programming problem that would really help me get more practical experience rather than a theoretical experience with java ?
Appreciate it.
silverkid

Many people learn new languages by solving problems from Project Euler.
To give you some examples, here are the 10 first problems in the project:
Add all the natural numbers below one thousand that are multiples of 3 or 5.
Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million.
Find the largest prime factor of a composite number.
Find the largest palindrome made from the product of two 3-digit numbers.
What is the smallest number divisible by each of the numbers 1 to 20?
What is the difference between the sum of the squares and the square of the sums?
Find the 10001st prime.
Discover the largest product of five consecutive digits in the 1000-digit number.
Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000.
Calculate the sum of all the primes below two million.

I just wanted to put an idea out here for you from my own experiences.
Whilst studying I was given the task of creating a Client/Sever chat application, I found it really interesting and there are plenty of obvious ways you can extend the program to better your ability.
For instance, start with a basic server and client simply sending text to one another. And then advance to having users (from a database perhaps) who have to log in to the application. You can make it as simple and as complicated as you wish.
Hope this helps.
Tony

Try this:
Martyr2’s Mega Project List

Java exercises:
http://www.google.com/search?aq=f&sourceid=chrome&ie=UTF-8&q=java+exercise
Java examples:
http://www.exampledepot.com/
What area of Java programming are you interested in? Web, device, desktop?

Sure Why Not, Here it is : http://download.oracle.com/javase/tutorial/

Related

Algorithm to index 2d points by clusters [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a problem to solve for which I did not find any usable algorithms after an internet search and I have not been able to come up with a satisfying solution myself yet.
Problem definition:
I am given a set of N-many points, defined by their X- and Y-coordinates, and I am supposed to give each point a unique index between 0 and N. There are a few conditions though:
1) if the geometric distance between two points is small, the difference between their indices should be small too.
2) if point A has a higher X-coordinate as point B it should have a higher index value too.
3) if point A has a higher Y-coordinate as point B it should have a higher index value too.
Other:
The algorithm does not need to be particularly fast or efficient as the data is fairly small (50 ~ 100 points).
I need this algorithm for a user interface with only 2 buttons for navigation through a data set. With one button the user selects the next point and with the other the user selects the previous point.
All suggestions are welcome. Thanks in advance.
Example Image:
This is an example of what a result could look like. Please note how the conditions are not fulfilled for all points (as that would be impossible) but how the indices are still nicely distributed among the clusters.
Sort the points by the Morton curve aka Z-order (Wikipedia).
Then assign numbers.

Is there a programmatic way or eclipse plugin to calculate big O notation for java method [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Is there a programmatic way or eclipse plugin to calculate big-O notation for java method ?
No, there isn't such plugin, and if it was, it would be a mere approximation. Namely, even determining whether the program will finish running or not is intractable - see Halting problem.
Now, about the possible approximation. Let's say you have a plugin that tests your program with a small dataset (e.g. N = 1000) and a medium dataset (e.g. N = 10000). If your program runs 10 times longer with a medium dataset compared to a small dataset, plugin should conclude that your program is O(N), right? Not quite. What about best/average/worst case? For example, quicksort's worst case is O(N^2), but it is generally considered as O(N*logN) sorting algorithm. Therefore, if the plugin hits the special input, it will give a wrong result. What about constants? The program whose running time is O(N + k*logN) is considered O(N), but if a constant k is large enough compared to N, plugin would not be able to reach this conclusion, etc.
Regarding your comment:
If anybody tried codility challenges
they are evaluation your solution
against performance using big O notation , and I'm sure that they are
not calculation it manually, that's why I'm asking this question.
Authors of Codility challenges have solutions of their problems with a well-known time complexity (they analyzed it manually). When they measure the running time of your solution for various input and compare it with a running time of their solutions for the same input, they can automatically determine the time complexity of your program (of course, taking into account the programming language you have chosen and certain deviations of the measured time).

cost a huge time because the number is huge? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a program which involves with a bunch of huge numbers (I have to put them into bignumbers type). The time complexity is unexpectedly huhge too. So, I was wondering, do these two factors have a connections? Any comments are greatly appreciated.
Do they have a connection to each other? Probably not.
You can have a large complexity algorithm working on small numbers (such as calculating the set of all sets for ten thousand numbers all in the range 0..30000) and you can have very efficient algorithms working on large numbers (such as simply adding up ten thousand BigInteger variables).
However, they'll both probably have a cascading effect on the time it takes your program to run. Large numbers will add a bit, a high-complexity algorithm will add a bit more I say 'add' but the effect is likely to be multiplicative, much worse - for example, using an inefficient algorithm may may your code take 30% longer, and the use of BigInteger may add 30% to that, giving you a 69% overall hit:
t * 1.3 * 1.3 = 1.69t
Sorry for the general answer but, without more specifics in the question, a general answer is the best you'll probably get. In any case, I believe (or at least hope) it answers the question you asked.

Fibonacci Series generation using Matrices [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
There's one question posted about Fibonacci Series, which I am much familiar with it. But there are multiple answers and linked questions to it. As I was digging through it with some interest, there's a solution which is linked to here
This algorithm solves the problem by O(log(n)) quite impressive. But I couldn't understand the logic and so called Matrix exponentiation [looked wiki, but unable to relate to it].
So kindly anyone can explain exactly how they achieved with more details and better explanation [if you can explain with code, prefer in Java, much helpful].
Thanks :)
What you need to understand is the algorithm, not the implementation.
The first thing you need to understand is that this algorithm will not give you all the fibonacci numbers, only those with with a n that is a power of 2.
The second thing is that a multiplication of constantly sized matrices of course takes constant ( O(1) ) time.
The trick now is to correctly note that the n'th fibonacci number can be formed by n-times multiplication of the matrix described in your link, which i will call M.
You get the log complexity by now "reordering" the matrix operations from, for example M*(M*(M*M)) to (M*M)*(M*M). With each matrix squaring, you go to M^2n instead of M^n+1.

Plain-English tutorial on artificial neural networks? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I've Googled, StackOverflowed, everything, and I cannot seem to find a tutorial I can understand. I understand the concept of genetic algorithms, and how to implement them, (Though I haven't tried) but I cannot grasp the concept of neural networks.
I know vaguely how they work... And that's about it. Could someone direct me to a tutorial that could help someone who has not even graduated middle school yet? Sure, I'm several years ahead of the majority of people my grade, but I don't understand summation, (which I apparently need if I don't want a simple binary output) vectors, and other things that I apparently should know.
Is there a simple, bare-bones tutorial for neural networks? After I learn the basics, I'll proceed to more difficult ones. Preferably, they would be in Java.
Thanks!
Summation is just adding up a bunch of things. So,
Summation(1,2,3,4,5) = 1+2+3+4+5 = 15
(note: it's always adding: if you want to subtract, do a summation with negative numbers)
That was easy, right? ;)
A vector is an ordered tuple, which really just means it's bunch of numbers in a specific order. Most often seen in physics to describe position, force, velocity, etc... it's really nothing special, just some ordered numbers, where the ordering is significant:
v = <1,2,3>
If we are talking about geometry, then this vector represents a point in 3-dimensional space where the x coordinate is 1, the y coordinate is 2, and the z coordinate is 3 (See that was easy too, right)?
In neural nets, the vector is usually the vector of inputs to a neuron, so it's really just a list of numeric values. The summation of the vector would be nothing more than adding up all of the values in the vector and getting a single number as a result (which may be referred to as as "scalar" value).
(this was rushed and simplified - I'm sure someone else will help me refine it ;) )
PS. Kudos to you for diving into this stuff at the middle school level! :)
Well, there is this article in Wikipedia's Simple English, but I think you know already all that it contains.
I've had the same problem for a while. I'm a high school student, so you're a little ahead of me. I got a vacation and I used it to learn all I could on backpropagation, and I've found almost no resources that really help too much unless you want to read so much calculus that you want to die. My advice is to first write a perceptron, which is a network with only input layers and output layers. This inspired me o write a post, so hopefully within half an hour of my posting here there should be a tutorial on http://certioraomnia.blogspot.com/. It may be a little late as this question was asked three years ago, but it may help others later.

Categories

Resources