I am trying to write a program for quicksort using singly linked list in java.  Below is the code.  public class QuickSortInSLinkedList { Node head; private static class Node{     private int data;     private Node next;      Node(int data){         this.data = data;         this.next = null;     } }   public void printList(Node head){     Node node = head;     while(node != null){         System.out.print(node.data+" ,");         node = node.next;     } }  private Node getLastNode(Node head){     Node node = head;     while(node != null &amp;&amp; node.next != null){         node = node.next;     }     return node; }  public void push(int data){     Node node = new Node(data);      if(head == null){         head = node;         return;     }      node.next = head;     head = node; }  void quickSort(Node head){     Node lastnode = getLastNode(head);     head = _quickSort(head, lastnode);     return; }  Node _quickSort(Node low, Node high){     Node newHead = null, newTail = null;      if(low == null || low == high){         return low;     }      Node part = partition(low, high, newHead, newTail);      if (newHead != part){         Node temp = newHead;         while(temp.next != part){             temp = temp.next;         }          temp.next = null;          newHead = _quickSort(newHead, temp);         temp = getLastNode(newHead);         temp.next = part;      }      part.next = _quickSort(part.next, newTail);     return newHead; }  private Node partition(Node low, Node high, Node newHead, Node newTail){     Node pivot = high;     Node previous = null, current = head, tail = pivot;      while(current != pivot){         if (current.data &lt; pivot.data){             if (newHead == null)                 newHead = current;              previous = current;             current = current.next;         }else{             if(previous != null)                 previous.next = current.next;              Node temp = current.next;             current.next = null;             tail.next = current;             tail = current;             current = temp;         }     }      if(newHead == null){         newHead = pivot;     }      newTail = tail;      return pivot; }  public static void main(String[] args){     QuickSortInSLinkedList list = new QuickSortInSLinkedList();     list.push(5);     list.push(35);     list.push(7);     list.push(8);     list.push(34);     list.push(23);      System.out.println("Linked list before sorting");     list.printList(list.head);      System.out.println("\n Linked list after sorting");     list.quickSort(list.head);     list.printList(list.head);  }   }  I understand that since in java we have pass by reference value, this code should work but in line 62 i.e. variables newHead and newTail is always received as null after the call to partition method.  below is the error  Exception in thread "main" java.lang.NullPointerException 23 ,34 ,8 ,7 ,35 ,5 ,     at implementation.sorting.QuickSortInSLinkedList$Node.access$100(QuickSortInSLinkedList.java:6)  Linked list after sorting     at implementation.sorting.QuickSortInSLinkedList._quickSort(QuickSortInSLinkedList.java:62)     at implementation.sorting.QuickSortInSLinkedList.quickSort(QuickSortInSLinkedList.java:47)     at implementation.sorting.QuickSortInSLinkedList.main(QuickSortInSLinkedList.java:123)  Please help me understand why is it so. Thanks
I always thought Java uses pass-by-reference. However, I've seen a couple of blog posts (for example, ) that claim that it isn't (the blog post says that Java uses pass-by-value). I don't think I understand the distinction they're making. What is the explanation?
Does one need a visa to transfer between two airports during a transit through the Schengen area? I am an Indian citizen travelling from New York to Delhi with a layover in Paris where I need to transfer between Paris Orly Airport (ORY) and Paris Charles de Gaulle Airport (CDG).  Do I need to have a visa to make this transfer?  I didn't notice that while booking the ticket. I have a complex integral $$\int_{|z|=r}x \, dz$$ for the positive portion of the circle.  I know that this integral seems easy enough but I am having trouble with it, and I'm fairly certain my answer is incorrect.  I wanted to use a parameter such that $x=r\cos\theta$, so we then have $dz=dx+i\,dy=dx$ since there is no reason to have have the $i\,dy$ since the imaginary part is equal to $0$.  So now I have the double integral  $$\int^r_0\int^\pi_0 r \cos\theta \, dx$$  which equals $0$ since integration the $\cos\theta$ gives $\sin\theta$ and evaluated from $0$ to $\pi$ makes the integral evaluate to $0$.  Am i misinterpreting part of the question?  Way off base?  The book suggests to also solve the problem by realizing $x=\frac{1}{2}\left(z+\frac{r^2}{z}\right)$ along the circle.  For this portion of the problem I assume that I would integrate the above by $z$ as if it were a normal calculus problem, but I have problems with what to put as upper and lower limits.  Thanks in advance! Ubuntu halts after few seconds of starting and nothing works command, virtual terminal, GUI Representation of electromagnetic wave? In Representation of electromagnetic waves we show both electric and magnetic fields perpendicular to each other and having zero magnitude at one point and maximum at other point. This representation and understanding of EM waves violating law of conservation of energy... Finding $\int^{\infty}_{0}\frac{\ln^2(x)}{(1-x^2)^2} dx$ \AtEveryBibitem{\clearfield{Title}} in beamer? In my beamer presentation, I want to cite the reference without title. So, I tried:  \documentclass{beamer} \usepackage[   backend=bibtex8,   defernumbers=true,   sorting=none,   firstinits=true,   uniquename=init,   uniquelist=false,   refsegment=section,   citestyle=numeric ]{biblatex} \addbibresource{mini.bib} \AtEveryBibitem{\clearfield{Title}} \begin{document} \section{Start} \begin{frame}   first cite\footfullcite{Julie2006}   %\printbibliography \end{frame} \section{2nd} \begin{frame}   Second cite\footfullcite{gyof} \end{frame} \end{document}   with the mini.bib :  @article{gyof,   Author={BLJ},   Title={Some Title},   Journal={joural1},   volume={15},   pages={1337},   Year={1985} } @article{Julie2006,   Author={JBS},   Title={Some Other Title},   Journal={journal2},   volume={74},   pages={144411},   Year={2006} }   with \AtEveryBibitem{\clearfield{Title}} I was expecting no title will be produced, but thats not the case:   Is there any incompatibility between clearfield and footfullcite? Or I am just missing something? Can a bird, previously at earth potential, get electrocuted by landing on a powerline at high-enough voltage due to the initial "equalization charge"? At the voltage levels of typical overhead transmission lines in the US, a bird can land on one and be just fine (as long as it doesn't do something like spread its wings and touch a tree or something else at lower electric potential).  However, what about a hypothetical powerline at much higher voltage (as in tens of megavolts). Could landing on such a powerline fatally-shock the bird even though it does not complete a circuit for sustained current? (Assume that the distance is long enough that electrical arc'ing is impossible.)  NOTE: My understanding of what happens when a bird flies from an earth object to a powerline (please correct me if I'm wrong) is that - upon contacting the wire - its electric potential changes from earth-potential to the powerline's potential. In order for this to happen, there is an initial transfer of electrical energy (i.e. flow of charge i.e. current) from the powerline to the bird which "equalizes" their electric potential, which happens nearly instantaneously. If this is correct, then my question can be restated more generally as "Can an 'equalization charge' such as this result in a fatal shock, if the potential difference that it's equalizing is high enough?" Application of Complex Numbers I was just wondering how complex numbers can be applied in electrical engineering and why we use complex numbers over regular, real numbers for this application (e.g what capabilities does the complex number have that real numbers do not in electrical engineering)?  I have done some research concerning impedances and understand how they are written in complex form, however I am still confused why complex numbers are necessary in this field over regular numbers. What's the main difference between Intel processor generations? What are the main differences between each processor generation of Intel processors/chipsets? Is there a performance difference?  I've already seen processors from first to sixth generation, however I don't know/understand the exact differences. A continuous bijection from a compact space to a $T_2$ space is always a homeomorphism This problem is bugging me for some time.     $f:(X,\mathcal{T}) \to (Y,\mathcal{T}')$ is a continuous bijection where $(X,\mathcal{T})$ is compact and $(Y,\mathcal{T}')$ is $T_2$ (i.e. Hausdorff and $T_1$). Then show that $f$ must be a homeomorphism.   So far I have failed to understand any relation between the compactness of domain and $T_2$-ness of the range. I tried in vain to prove that $f(U)$ is open in $(Y,\mathcal{T}')$ whenever $U$ is so in $(X,\mathcal{T})$. I know $f$ makes $X$ and $Y$ respectively $T_2$ and compact and hence makes both of them $T_4$ spaces. But that is not coming to any use. I would be glad if someone helps me with a solution. Thank you. Understanding English (Listening skills) Why is there no absolute maximum temperature? If temperature makes particles vibrate faster, and movement is limited by the speed of light, then I would assume that temperature must be limited as well. Why is there no limit? Knowing the interface of ubuntu and editing them Where are the files for the desktop or the interface that appears on the screen stored? And how can we edit them. How are they programmed?  What programming language is used to built the interfaces? Although many have attempted to explain the difference among \mathrm, \textrm, \textnormal and \text (and others?), I found them misleading.  See for example the LaTeX's Wiki \mathrm explanation   Why is it wrong? Let's try all of them within an article and a beamer and you'll see the difference and, therefore, error.  equation.tex  \begin{eqnarray*}   \int_1^9\! \cos{x} \,\mathrm{d}x &amp; &amp; \textrm{this is textrm}\   \sum_1^9 y                       &amp; &amp; \textsf{this is textsf}\   \prod_1^9 z                      &amp; &amp; \textnormal{this is textnormal}\   \bigcup_1^9 w                    &amp; &amp; \text{and this is just text} \end{eqnarray*}   article.tex  \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}   \input {equation} \end{document}     And until here everything looks fine...  beamer.tex  \documentclass{beamer} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}   \begin{frame}     \input{equation}   \end{frame} \end{document}     And here we can clearly see that \mathrm does not behave as expected, i.e. does not provide a function aspect to the d. Does anyone know what am I supposed to use here instead? Just \text?? o.O  Moreover, I cannot see any difference between \textnormal and \text.  Finally, \textrm looks useless.. What does "65" mean? K-2SO beats up the troopers easily. Up in the sky, the bombers are preparing to attack. Just as they start the attack run, TIE fighters come in from the shield and swarm the rebel fleet.  JON VANDER (GOLD LEADER): Red Leader, this is Gold Leader, we’re starting our attack run on the  shield gate. Keep it tight and watch out for those towers. GOLD PILOT: More fighters. Form up, at 65.  What does &quot;65&quot; mean? I'm looking for the name of a series of space opera novels I read some time ago, probably between 2003 and 2010.    It may have been published quite a few years before I read it, I don't think it was new at the time. I borrowed the novels from the local library, but I can't find them in its catalogue. I think the covers were fairly dark and plain, though there may have been some artwork on them. There was a totalitarian empire that controlled most planets, possibly ruled by a queen. There was no mention of Earth, the solar system or other real planets, the setting was completely fictional. There were people with psychic/psionic powers, referred to as something like "psi". These people were second-class citizens or slaves. Spaceships were used to travel between worlds. I'm not sure what kind of FTL technology they had, if any. Beyond the edge of the empire was some kind of "dark space", where there was no light. There were some horror themes: When travelling in dark space in one of the novels, a ships crew experienced strange thoughts and hallucinations. I remember finding this quite scary at the time.   Does anyone know which series this could be?  This isn't a duplicate of , since the two questions are about different parts of the same series (the first and second episodes). Can a non-EU citizen travel freely within the Schengen area without passport? My current situation is that I have residence permit of Germany (as a stamp in passport) and I wish to apply for UK visa in next few days from Germany and won't have my passport anymore during the processing time.  Instead of waiting for the process, I wish to travel to Scandinavian countries immediately on holidays, later receive my passport from visa center after I return back to Germany.   I am wondering if photocopy of passport and residence permit suffice as identity proof to border control (if I face them)? What else are valid documents that I can show as valid identity proof to border control? What are the exact problems I will face if I face the border control, and they are not satisfied with my travel documents? Overheard on an elevator today,     I didn't realize it was him.   Corrected by the know-it-all,     He.  "I didn't realize it was he."   The know-it-all then went on a rant about how everybody is a dolt for not knowing that.  I swear I have never heard this before in my life.  Is the know-it-all correct?    If so, why is "I didn't realize it was he," grammatically correct?  What rule makes "him" incorrect here? Geometric series for two-point function In deriving the expression for the exact propagator  $$G_c^{(2)}(x_1,x_2)=[p^2-m^2+\Pi(p)]^{-1}$$   for $\phi^4$ theory all books that i know use the following argument:  $$G_c^{(2)}(x_1,x_2)=G_0^{(2)}+G_0^{(2)}\Pi G_0^{(2)}+G_0^{(2)}\Pi G_0^{(2)}\Pi G_0^{(2)}+...$$  wich is a geometric series so the formula for the exact propagator.Here  $$G_0^{(2)}$$   is the free propagator and   $$\Pi=X+Y+Z+...+W$$  is the sum of all irreducible diagrams.Here the irreducible diagrams is represented by $X,Y,Z,...,W$.  Using the path integral i can see, that  connected diagrams $D$ can be written in the form  $$D=G_0^{(2)}XG_0^{(2)}Z...G_0^{(2)}W$$  Question: But how to prove that there is no constant $C$ so that instead we have  $$D=G_0^{(2)}XG_0^{(2)}Z...G_0^{(2)}W$$  we would have  $$D=CG_0^{(2)}XG_0^{(2)}Z...G_0^{(2)}W~?$$  In the last case we would not have a geometrical serie. Can someone explain me i t please  or give me another way to derive it. Can the Flash run faster than light?