Campbell Ritchie wrote:If you mean they calculate the timings with an² + bn + c, then a b c are “constants” and n the number of elements in question. When you are dealign with large numbers, say 1,000,000 or 2,000,000, if you square them you get 1.0×10¹² or 4.0×10¹² and that increase will overwhelm the change from n = 1,000,000 to n = 2,000,000. So the time complexity reduces to its worst (=highest exponent) term. Beware if you have the misfortune to get eⁿ (or xⁿ) complexity (=exponential complexity) where doubling the size of the task can cause its duration to square itself. You will find a naïve recursive approach to calculating Fibonacci numbers in many beginning books; that runs in exponential complexity, but its base is small: it uses (approx) 1.618‟ complexity.
Campbell Ritchie wrote:I haven't got the time to watch those videos. But I looked at Wikipedia, which says that insertion sort is one of the more efficient types of sorting in quadratic time (n²). The bit about quadratic time means that the time taken is proportional to the square of the number of elements; it should take 4× as long to sort a 2,000,000‑element list as a 1,000,000‑element list. Note that is the worst case behaviour; you will occasionally be lucky and find lists requiring little sorting, and the process runs much faster.
Paul Clapham wrote:I moved the thread to the JavaFX forum in the hope that people who knew something about JavaFX would see it.
I'm not one of those people but I'm sure that having your Application implement EventHandler is the wrong thing to do. It's been the wrong thing to do in Swing for over 15 years now and JavaFX isn't that different. So I tracked down a tutorial about how to use an EventHandler for a JavaFX Button:
Using JavaFX UI Controls
There's "back" and "forward" buttons there which I expect go to pages which deal with other kinds of control.
Campbell Ritchie wrote:Welcome to the Ranch
Please post your code here; people are often reluctant to go to distant websites.No, it isn't. Action events and action listeners are used in AWT/Swing, not FX. You have obviously had the misfortune to find the wrong sort of tutorial. I hardly know any FX, but you usually pass a λ to a setOnXXX() method. Let's see your code please.Linden Garcia wrote:. . . related to action events and possibly action listener . . .