I know i am not supposed to ask these types of question here, but I am stucked and cannot figure out the problem. So, I wrote this code which takes root of the tree as input and check if the given tree is BST or not. But i am failing few test cases and i don't understand why ? If someone can tell me what's wrong in my code that would be very much appreciated. This is the link to question   Here is the code.  bool checkBST(Node* root) {     if(root == NULL)         return false;           int d = root-&gt;data;         bool r1 = true,r2=true;         if(root-&gt;left != NULL){             if(d &lt; root-&gt;left-&gt;data)                 r1 = false;             else                 r1 = checkBST(root-&gt;left);          }          if(root-&gt;right != NULL){             if(d &gt; root-&gt;right-&gt;data)                 r2 = false;             else                 r2 = checkBST(root-&gt;right);         }         return r1 &amp;&amp; r2;      }
I read on here of an exercise in interviews known as validating a binary search tree.  How exactly does this work? What would one be looking for in validating a binary search tree? I have written a basic search tree, but never heard of this concept.
Sum $\frac{1}{6} + \frac{5}{6\cdot 12} + \frac{5\cdot 8}{6\cdot 12\cdot 18} + \frac{5\cdot 8\cdot 11}{6\cdot 12\cdot 18\cdot 24}+\ldots$ A series is given as follows   $$\frac{1}{6} + \frac{5}{6\cdot 12} + \frac{5\cdot 8}{6\cdot 12\cdot 18} + \frac{5\cdot 8\cdot 11}{6\cdot 12\cdot 18\cdot 24}+\ldots$$  Can you give me hints to get started finding its value? Thanks. Shapefile layer no longer editable (toggle edit option greyed out) in QGIS Is there a way of conditionally triggering a compile-time error in verilog? Do there exist general conditions under which we can conclude that continuity on a topological space is detected by $\mathbb{R}$? Whenever $X$ is a topological space, let us say that continuity on $X$ is detected by $\mathbb{R}$ iff for all functions $f : X \rightarrow Y$ where $Y$ is another topological space, we have that if every continuous function $c : \mathbb{R} \rightarrow X$ satisfies "$f \circ c$ is continuous", then $f$ is itself continuous.   Clearly, continuity on $\mathbb{R}$ is detected by $\mathbb{R}$ It is shown  that continuity on $\mathbb{R}^2$ is detected by $\mathbb{R}$. Clearly, it is not the case that continuity on $\mathbb{Q}$ is detected by $\mathbb{R}$, since every continuous mapping $\mathbb{R} \rightarrow \mathbb{Q}$ is constant.      Question. Do there exist general conditions underwhich we can conclude that continuity on a topological space is detected by $\mathbb{R}$? Do lens hoods need to be matched to focal length? Is it true that not all generic lens hoods work on all lenses (provided the filter diameter matches, of course)? I read that the focal length plays a role in it - but I cannot find such readings on any lens hoods I see available online. When is assembly faster than C? One of the stated reasons for knowing assembler is that, on occasion, it can be employed to write code that will be more performant than writing that code in a higher-level language, C in particular.  However, I've also heard it stated many times that although that's not entirely false, the cases where assembler can actually be used to generate more performant code are both extremely rare and require expert knowledge of and experience with assembly.    This question doesn't even get into the fact that assembler instructions will be machine-specific and non-portable, or any of the other aspects of assembler.  There are plenty of good reasons for knowing assembly besides this one, of course, but this is meant to be a specific question soliciting examples and data, not an extended discourse on assembler versus higher-level languages.  Can anyone provide some specific examples of cases where assembly will be faster than well-written C code using a modern compiler, and can you support that claim with profiling evidence?  I am pretty confident these cases exist, but I really want to know exactly how esoteric these cases are, since it seems to be a point of some contention. Story about last 2 men on Earth. One very evil, and the other very ethical How can I install Ubuntu on a headless machine? I have a headless storage server with preconfigured Windows Home Server. How can I install Ubuntu without a display?  Do I have to build a custom install flash drive? If so, what would be the basic procedure? Is there a program (like unetbootin) to do this? Viruses: Adaptation to a new host through repeated host jumps A friend told me, during a 3 minute discussion, that viruses that are endemic in host $A$ and make repeated jumps to host $B$ but can't be transmitted between individuals of species $B$, may slowly adapt (through these repeated jumps) to be able to be transmitted between individuals of host $B$ and become epidemic.  I don't know much about epidemiology. I don't understand how a virus population that is endemic to host $A$ may adapt to host $B$ with repeated jumps while the viruses that jump to host $B$ are dead end because they cannot be transmitted further more. Or Are these viruses able to jump back to host $A$ to bring back their newly acquired adaptations to host $B$?  Also, I might misunderstand the meaning of "repeated host jumps transmission". I first thought it meant repeated jumps from a reservoir population in host $A$ to host $B$, but it is also possible that it describes the dynamic of a virus population that is adapted to jump from species to species and they actually gain this ability by keeping jumping and jumping. But then, how could a virus species get adapted to jump from species to species? I'm a bit confused…. Can you give me some hints about this process of cross-species transmission through repeated jumps? Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter [168c:003e] (rev 32) can't enable wi-fi "How are" or "How is" the wife and kid? How to create old looking/ cracked glass I am looking for old looking cracked glass for a window in a shack scene. I have looked everywhere but can find a tutorial or material or model on this please can someone help me on this thanks SSH tunneling error: "channel 1: open failed: administratively prohibited: open failed" When I open this ssh tunnel:  ssh -nXNT -p 22 localhost -L 0.0.0.0:8984:remote:8983   I get this error when trying to access the HTTP server running on localhost:8984:  channel 1: open failed: administratively prohibited: open failed   What does this error mean, and on which machine can you fix the problem? I would like to transform 5V 500mA (from USB power) into 12V with a few cheap components.  Is this possible with the help of some generic parts (and not with the help of some expensive transformer, etc.)?  Also, how many milliamps would this provide? I have learnt that the cardinality of the power set of the natural numbers is equal to the cardinality of the real numbers. What is the function that gives the one-to-one correspondence between these two sets?  I have also learnt that there exists no set whose cardinality is strictly between the natural numbers and the real numbers. Is there a proof of this or at least some intuitiveness behind it? Matrix Group induction proof and order of elements question Newer "mainline" versions of the kernel are available from the , e.g. 3.4 and 3.5, while Ubuntu 12.04 is on 3.2.   What are the mainline kernels? Are they better than my existing kernel? What are the pros and cons of upgrading to a mainline kernel? Will I easily be able to go back? Is it possible to make abstract classes in Python? How do I manually install Adobe Flash player for Chromium? Traditionally  at the end of a filename after uploading it via the image uploader. That doesn't seem to work any more. I've tested it on Q&amp;A as well as chat.        (Yes, I know big M doesn't work)  Could we have this fixed please?