I'm writing a program in Python. The algorithm that I use is very slow (and it can't be faster for what I want to do) so how quickly the program will execute is important (in other words: computational complexity matters) and this is what I need to do:   I have a list. I need to iterate the list and do some operation on every element. When iterating the list, I need to remove some elements from the list.   This can be done very easily, but the problem is that I want removing element to have computational complexity O(1), not O(n), so that the entire process of iterating the list and removing some elements has computational complexity O(n). Now, I don't know what the internal implementation of python lists is, but I'm almost sure that when I remove element like that:  del list[5]   or like that:  list.pop(5)   It will probably have to move all of the elements after fifth element one position back which results in computational complexity O(n).  If it was C++, then I would use list that is implemented using pointers, so that I could go through the entire list and remove the elements that I want to remove in the most quickest way. But in Python, there are no pointers, so I can't implement this list on my own. So is there a way to do the above process in Python with computational complexity O(n)?  In other words:  In C++, there are two ways how you can implement a list: using pointers and using an array. The first implementation is faster for some operations, and the second is faster for other operations. I need to use the first implementation, but I don't know if it's possible in Python.
What's the easiest way to use a linked list in python? In scheme, a linked list is defined simply by '(1 2 3 4 5). Python's lists, [1, 2, 3, 4, 5], and tuples, (1, 2, 3, 4, 5), are not, in fact, linked lists, and linked lists have some nice properties such as constant-time concatenation, and being able to reference separate parts of them. Make them immutable and they are really easy to work with!
If A and B are symmetric is AB=BA true? Question  if we have matrices $A$ and $B$ which are symmetric. Both of these satisfy: $$  A=A^T$$ Is $AB=BA$ true ?  Attempt to solve  Now if $A$ and $B$ are symmetric then $AB$ most be symmetric too.  $$ AB=(AB)^T=B^TA^T=BA $$  problem is how do you proof that if $A$ and $B$ are symmetric also $AB$ is symmetric ?  If somone could provide some insight on this that would ge highly appreciated.  Thanks,  Tuki How do I programmatically log in a user with a POST request? $\aleph_1$ is the cardinality of the countable ordinals. It is the least cardinal number greater than $\aleph_0$, and assuming the continuum hypothesis it's equal to $\mathfrak{c}$, the cardinality of the the real numbers.    My question is, is it possible for all $\aleph_1$ subsets of $\Bbb{R}$ to have Lebesgue measure $0$?  This is, of course, impossible assuming the continuum hypothesis, because then all sets of real numbers would have measure $0$, which is absurd.  But is $\mathsf{ZFC}$ + $\lnot\mathsf{CH}$ + "all subset of $\Bbb{R}$ of cardinality $\aleph_1$ have Lebesgue measure $0$" consistent?  If not, what if we replaced Lebesgue measure with some other measure?  It may be worth noting that, although there may be subsets of $\Bbb{R}$ with cardinality $\aleph_1$, there are no subsets of $\Bbb{R}$ which have the order-type $\omega_1$ (the order-type of the countable ordinals) under the usual ordering on $\Bbb{R}$.  Any help would be greatly appreciated.  Thank you in Advance. Why can't I travel onwards if my bag wasn't going to make the flight? I was flying KLM from the UK to the USA with a short layover in Amsterdam.  Because of delays in the UK, I almost missed my flight.  The flight attendant told me my bag wasn't going to make it, but if I walk fast, my gate is just two over.  When I got to the gate, they had already closed the doors, but the counter was opened - I mentioned that my bag was not going to make it, but that's okay.  She said, "hold on," got onto her walkie-talkie, and said,  "Yep, that's what I thought: you can't fly if your bag's not going."  I originally thought that it might be a security concern, but that doesn't really make any sense.  Why can't I travel if my luggage doesn't make the connection?  EDIT: I should clarify that I have no beef with KLM - they treated my overnight in Amsterdam professionally and helpfully; I'm just curious what the reason would be. How do I time a method's execution in Java? How do I get a method's execution time?   Is there a Timer utility class for things like timing how long a task takes, etc?     Most of the searches on Google return results for timers that schedule threads and tasks, which is not what I want. Can you create an illusion of empty space? I've been thinking of various ways for a crafty Illusionist/Rogue to 'hide in plain sight' by essentially creating the cover that they want to hide behind.  Ideas include things like:   Create a wall that is 2.5ft closer than it really is and hide in said space Create some innocuous barrier or container and hide within it Create a 'sheet' that essentially has what an empty room looks like 'painted' on it, so someone walking past an open door would see an empty room.   From different discussions I've had, these all should work, but the one lingering one I have is, what if my illusion is simply 'empty space'?  If I were to create an illusion of empty space and then place myself in it, would I be essentially invisible?  What if I created an illusion that was partially-empty space, like a 5x5 cube of swiss cheese? Would it seem like there was a swiss cheese cube formed around my person or could my 'fake-empty-space-image' fill the holes?  Would my 'empty space' illusion simply need to work like the aforementioned 'sheet of what I expect you to see' in order to function (and thus most likely only work from limited viewing angles)? If $x\sqrt{1+y}+y\sqrt{1+x}=0$ find $y'$ Where does the name of these two famous types of sequences come from?  The article  of Wikipedia says that the geometric sequence is called like this because every term is the geometric mean of its two adjacent terms. Though it is true, it only reduces the question to: why is the geometric mean geometric (in opposition to the arithmetic mean).   Continuing my investigation on , I was told that a square with the same area than a rectangle with sides $a$ and $b$ has their geometric mean $\sqrt{ab}$ for side. That's again totally true, but a square with same perimeter than this rectangle of sides $a$ and $b$ has their arithmetic mean $\frac{a+b}{2}$ for side!  Thus, my question: Who coined these names? And why? Why is the geometric mean more geometric than the arithmetic mean? Who do you have to contact to obtain a license to stream manga? I am curious to know who the copyright holder to a manga is: is it the mangaka, or the publisher (such as Kodansha, Shonen Jump, etc)?  Who do you have to contact to obtain a license for streaming it? How can I search for a keyword with special characters in Google Search? How to get the filename without the extension from a path in Python? I am given two charged particles of same charge at a distance of $r$. They initially apply force $F$.  Now an infinite dielectric (of dielectric constant $4$) of width $\frac{r}{2}$ is introduced between the particles. What will be the new force?   I find this problem confusing because I have only been told about forces when its either fully dielectric or fully vaccum given by Coulomb's law. How do we get forces when only partial space is dielectric? How to solve configure: error: readline library not found? I have an Ubuntu 10.04 LTS server with a minimal install that I want to compile postgres on. With the minimal install the server did not have gcc so I had to do an apt-get install gcc but now I keep getting this error from the postgres ./configure.  configure: error: readline library not found   I can't seem to find the name of the package that contains the readline library. So I have two questions.   What is the name of the package that contains readline? Is there some way given the error message above for me to find the associated package from its standard name? How do I instantiate a string array object into a Spring.Net container? I am trying to create buffers around the Hurricane Sandy path I created in QGIS (points are lat/long).   I have both points from each day she was tracted and the line I created from it with Points2One.   When I go to make buffers around either the line or the points, the buffer takes up the whole screen. Its all just one color.   I have made buffers before but from data I did not create.   Right now all of my projections are set to WGS 84 EPSG 4326. How do I get a selected vertex and it's corresponding uv vertex?  A vertex I can get with  bpy.context.active_object.data.vertices[0]   A uv vertex I can get with  bpy.context.active_object.data.uv_layers['UVMap'].data[0]   But the index is not the same for uv and mesh vertex. Transfer subtype Descriptions form long integer value into a string at new diffrent field Sum of $\sum \limits_{n=0}^{\infty} \frac{1}{(kn)!}$ Does a closed form exist for      $$\sum \limits_{n=0}^{\infty} \frac{1}{(kn)!}$$   in terms of $k$ and other functions? The best that I have been able to do is solve the case where $k=1$, since the sum is just the infinite series for $e$. I would guess that any closed form must involve the exponential function, but am at a loss to prove it. When I import text file into R, I get a special character appended to the first value of the first column I have noticed that some questions get a lot of responses quickly, and the cool fact is that most of the time these initial responses are correct.  I see users are motivated to accept answers. Because many questions take less than 24h to get an acceptable response, I'm unsure what to do when I have a question that takes more than 24h to get a response that I feel is complete enough to warrant being marked as accepted.  And even for acceptable responses, I often hesitate to accept them out of concern that posters will pass my question by if it already has an accepted answer (unless it has lots of upvotes). Does this really deter the higher-quality posters, though?