I have a piece of code which executes three nested for loops in the following way (written as language agnostic as possible):  for i = 0 to n - 1     for j = 0 to n - 1         for k = 0 to n - 1             [do computation in linear time]   My intuition says that this should result in N^3 complexity. I'd like to compare its complexity to the following nested loops:  for i = 0 to n - 1     for j = i + 1 to n - 1         for k = j + 1 to n - 1             [do computation in linear time]   Logically, it should be faster, because as i increases, the inner loops should compute faster; however, having seen countless other threads on the site explaining that the latter of those is also N^3 is confusing.  Is my assumption of N^3 for both correct, and if so, how do I quantify the differences, assuming there are any?
What is the Big-O time complexity of the following nested loops: for (int i = 0; i &lt; N; i++) {     for (int j = i + 1; j &lt; N; j++) {         System.out.println(&quot;i = &quot; + i + &quot; j = &quot; + j);     } }  Would it be O(N^2) still?
Why did Obi-Wan allow Leia to get adopted by such a high profile figure? I know that Leia is a princess because she was adopted by the Queen of Alderaan, but why would Obi-Wan allow this? Wasn't the original plan of Obi-Wan and Yoda to hide the Skywalkers from Palpatine? Luke was placed into a very low-profile position, being the child of two farmers on a backwater planet. However, Leia occupies a very important political position.  Is there any reason why Obi-Wan would do this if he was trying to hide her? Create line heatmap with QGIS I have loaded my bike tours as .gpx files into QGIS.    It already looks quite nice but I was wondering if it might be possible to create something similar to the strava heatmap with tools of QGIS.     I have tried to generate points along the lines and use kernel density but it just does not look nice as a raster layer.  Any suggestions? I have created two files:  sample.txt and sample.txt  (the second file contains some hidden characters, e.g. a space). How can I remove the latest modified file? I'm using Linux. How can I switch back to Nvidia card from Intel with Nvidia-prime So I updated to Ubuntu 14.04 and found that the primusrun command no longer works, so ditched bumblebee in favour of nvidia-prime. This lets you switch video card from nvidia-settings rather than running through the command line (I prefer the old method, but want the primus performance).  The problem is that after switching to Intel from nvidia-settings, I can no longer open it up again to switch back to the nvidia card. When I open nvidia-settings I get a segmentation fault (according to the terminal).  Is there any way to open nvidia-settings switch back? I would like the ability to be able to switch between the two since having the nvidia card on all the time kills my battery and heats up the laptop a lot. Attorney at law, is there any other kind? I have wondered from time to time about the phrase "attorney at law." Are there other kinds of attorneys? Attorneys at arms? If not, why do we specify? I want to Setup GIMP 2.10 on Ubuntu 16.04 (Xenial Xerus) without flatpak.  can it be possible now or on future?? Does anybody know how to move the keyboard caret in a textbox to a particular position?  For example, if a text-box (e.g. input element, not text-area) has 50 characters in it and I want to position the caret before character 20, how would I go about it?  This is in differentiation from this question:  , which requires jQuery. There are several questions here about , about , and about . And of course there's the basic . And plenty of  questions. There's related questions like . But there's no be-all-end-all question asking:  What exactly determines depth of field in a photograph?   Is it just a property of the lens? Can lenses be designed to give more depth of field for the same aperture and focal length? Does it change with camera sensor size? Does it change with print size? How do those last two relate? how can we show $\frac{\pi^2}{8} = 1 + \frac1{3^2} +\frac1{5^2} + \frac1{7^2} + …$? Let $f(x) = \frac4\pi \cdot (\sin x + \frac13 \sin (3x) + \frac15 \sin (5x) + \dots)$. If for $x=\frac\pi2$, we have $$f(x) = \frac{4}{\pi} ( 1 - \frac13 +\frac15 - \frac17 + \dots) = 1$$ then obviously :  $$ 1 - \frac13 +\frac15 - \frac17 + \dots=\frac{\pi}{4}$$ Now how can we prove that: $$\frac{\pi^2}{8} = 1 + \frac1{3^2} +\frac1{5^2} + \frac1{7^2} + \dots$$ Residue fields of schemes of finite type (over $\mathbb{Z}$) Suppose $X$ is a scheme of finite type over $\mathbb Z$. I want to prove that:  (1) The residue fields of closed points of $X$ are finite;  (2) For a given $q=p^n$ with $p$ prime, there is only a finite number of closed points of $X$ whose residue field is $\mathbb F_q$.  For (1), I see that one has to use some form of Nullstellensatz. First, we suppose $X=\operatorname{Spec}(A)$ affine, and $A=\mathbb{Z}[X_1,...,X_n]/I$. We need to show that if $m$ a maximal ideal of $A$, then $A/m$ is finite. Note $p=\mathbb Z\cap m$. If $p$ is maximal, we get that $A/m$ is of finite type over $\mathbb F_p$ thus a finite extension by Nullstellensatz and we are done. But $p$ could be the $(0)$ ideal in which case I neither conclude nor get a contradiction.  For (2), we can again argue locally, so we need to show that $A$ contains only a finite number of maximal ideals $m$ with $A/m$ of fixed cardinality $q=p^n$. I get an impression that to count these ideals its the same as to count the number of automorphisms of $\mathbb{F}_{q}$ which fix $\mathbb F_p$, but the corrspondence is not bijective, so we only get an upper bound which is enough. Is this idea correct? How to get Total Pupulation From Tables In Sqlserver? How can I skip every even item in the enumerate environment without having to continually type \setcounter{enumi}{5}? I am still learning to program macros, so I spologize if this is a ridiculously easy question.   Just to be clear, I would like something like   1. *Something.* 3. *Somthing else.* 5. *A third something.*  ...As opposed to   1. Something.  2. A second something.  3. A tertiary Something. How to remove local (untracked) files from the current Git working tree Loopback to forwarded Public IP address from local network - Hairpin NAT Can non-magical persons see the Hogwarts Express during its journey to and from Hogwarts? Lost my old passport for Schengen visa application How to extract images from Word Document from Linux Is there a (Linux) command-line tool to extract all the images from a MS Word document, (preferably one that could handle the .docx format)? Why does the zoom sometimes stop at a point? I often find that I can zoom in to a point, but then cannot zoom any more, even when there is a lot of room to zoom to the meshes on the scene.   This is particularly annoying in the following scenario:  I often land up left clicking on the scene and the 3D cursor shifts there. I use Shift+C to shift the 3D cursor back to the origin. However, this also centers the view on the cursor and shifts the view to show all objects, and sometimes this zooms things way out &ndash; at this point, if I try to zoom in, I can zoom in to a point (using the pinch/zoom on trackpad), but then it stops zooming in.   How do I zoom in after that? Is there anything else I am doing wrong in this case? How do I find out which DOM element has the focus? I would like to find out, in JavaScript, which element currently has focus. I've been looking through the DOM and haven't found what I need, yet. Is there a way to do this, and how?  The reason I was looking for this:  I'm trying to make keys like the arrows and enter navigate through a table of input elements. Tab works now, but enter, and arrows do not by default it seems. I've got the key handling part set up but now I need to figure out how to move the focus over in the event handling functions. Between you and ("me" or "I")?