I want to create a recursion pseudocode that will executed in O(logn) complexity and i want it to find the lower f(i) &lt; 0 and f[1....n] which f(1) >0 and f(n)&lt;0  prodedure fanc(A[n] , p , q )  //(this is my array,first digit of A ,last digit of A) if A[n/2] &gt;= 0      return fanc(A[n/2] , A[n/2] , A[n-1]) else      return fanc(A[n/2] , A[0] , A[n/2 -1]) if p&lt;q    print p else    print q   I know that somehow i have to end the recursion. Also i would like to know if i am in the correct path and if u have any good thoughts for this problem!    Better text of assignment copied from :     Let an integer function f:{1,2,3...n} be monotonic and defined in {1,2,3...n} and suppose that f(1) > 0 and f(n) &lt; 0. We would like to find the smallest integer i with f(i) &lt; 0. Design an algorithm for this purpose that run in O(logn).
How would I implement a binary search using just an array?
JPA and Hibernate - Criteria vs. JPQL or HQL What are the pros and cons of using  or ? The Criteria API is a nice object-oriented way to express queries in Hibernate, but sometimes Criteria Queries are more difficult to understand/build than HQL.   When do you use Criteria and when HQL? What do you prefer in which use cases? Or is it just a matter of taste? What i did?   [root@mdfdevha1 ~]# Group_ID=`/opt/keycloak/bin/kcadm.sh get groups -r TEST`  [root@mdfdevha1 ~]# echo $Group_ID [ { "id" : "57c86153-11ba-4d19-aafb-9903ee00086b", "name" : "Admin_UserGroup", "path" : "/Admin_UserGroup", "subGroups" : [ ] } ] [root@mdfdevha1 ~]# SURE_USER_ID=`echo $Group_ID | cut -d : -f2 | awk -F\" '{print $2}'` [root@mdfdevha1 ~]# echo $SURE_USER_ID 57c86153-11ba-4d19-aafb-9903ee00086b   In this case i am able to get the id but my requirement little bit complex  I run below command   [root@mdfdevha1 ~]#  Group_ID=`/opt/keycloak/bin/kcadm.sh get groups -r My_Realm`   and then   [root@mdfdevha1 ~]# echo $Group_ID   Output was multiple record in JSON format  [ { "id" : "e27206c0-aeb6-43db-acda-c4ba43233071", "name" : "A1", "path" : "/A1", "subGroups" : [ ] },  { "id" : "89f3bd6a-33a9-4e02-9fe3-eae660c5a6cf", "name" : "Admin_UserGroup", "path" : "/Admin_UserGroup", "subGroups" : [ ] },  { "id" : "cdc2bce5-c3bb-4b88-bdaf-d87b8bb6c644", "name" : "Group104", "path" : "/Group104", "subGroups" : [ ] },  { "id" : "a0d749f2-ab6c-4c27-ad55-3357eaab9527", "name" : "Group105", "path" : "/Group105", "subGroups" : [ ] },  { "id" : "fbf99c34-d50d-408b-8d19-9713f9af3e3a", "name" : "Group106", "path" : "/Group106", "subGroups" : [ ] },  { "id" : "ebd8336f-4017-4fb1-8035-153ae1d9ba37", "name" : "Group201", "path" : "/Group201", "subGroups" : [ ] },  { "id" : "38f4aef7-caf0-4430-9e61-1ae7026e872f", "name" : "Group202", "path" : "/Group202", "subGroups" : [ ] },  { "id" : "436a0f4a-8b1b-4d7d-a014-fcec3513644e", "name" : "Group203", "path" : "/Group203", "subGroups" : [ ] },  { "id" : "41962c5f-e7e9-4748-b81f-e3f1880b78de", "name" : "Sure_Groups", "path" : "/Sure_Groups", "subGroups" : []}]   Now from the above output i want to get the ID where name = Admin_UserGroup.  How can this will achieve ? Strategies to denest nested radicals $\sqrt{a+b\sqrt{c}}$ I have recently read some passage about nested radicals, I'm deeply impressed by them. Simple nested radicals $\sqrt{2+\sqrt{2}}$,$\sqrt{3-2\sqrt{2}}$ which the later can be denested into $1-\sqrt{2}$. This may be able to see through easily, but how can we denest such a complicated one $\sqrt{61-24\sqrt{5}}(=4-3\sqrt{5})$? And Is there any ways to judge if a radical in $\sqrt{a+b\sqrt{c}}$ form can be denested?  Mr. Srinivasa Ramanujan even suggested some CRAZY nested radicals such as: $$\sqrt[3]{\sqrt{2}-1},\sqrt{\sqrt[3]{28}-\sqrt[3]{27}},\sqrt{\sqrt[3]{5}-\sqrt[3]{4}}, \sqrt[3]{\cos{\frac{2\pi}{7}}}+\sqrt[3]{\cos{\frac{4\pi}{7}}}+\sqrt[3]{\cos{\frac{8\pi}{7}}},\sqrt[6]{7\sqrt[3]{20}-19},...$$ Amazing, these all can be denested. I believe there must be some strategies to denest them, but I don't know how.  I'm a just a beginner, can anyone give me some ideas? Thank you. Is $\mathbb{Z}[\sqrt{-7}]$ a UFD or not? Is $\mathbb{Z}[\sqrt{-7}]$ a UFD or not? I feel like there should be some easy example showing that it is not, but I can not think of one. I try to create a common extent for rasters in QGIS 2.99. Here is my script:  import processing  processing.runalg("script:unifyextentandresolution",                   "/qgis_data/rasters/Image2.tif;                   /qgis_data/rasters/Image1.tif",                  -9999,"/qgis_data/rasters",True)   However, processing.runalg is being used for QGIS 2.99. I need it for QGIS 2.99 Inexact measurement and wavefunction collapse "Duplicate of...[deleted post]" I'm trying to enable alsa on different prefix than default through winetricks.  More specifically, the prefix that has Rosetta Stone on it, as it cannot see my microphone.  When I open winetricks, it only lets me select default.  I tried anyway, on default, and it did not resolve the issue.  I saw some answers online, through the terminal, but that didn't work either.  Maybe I have the syntax wrong?  steve@stevelap:~$ WINEPREFIX=~/.PlayOnLinux/wineprefix/Rosetta sh winetricks alsa sh: 0: Can't open winetricks steve@stevelap:~$ sudo WINEPREFIX=~/.PlayOnLinux/wineprefix/Rosetta sh winetricks alsa [sudo] password for steve:  sh: 0: Can't open winetricks   Could anyone please offer assistance?  Thanks! How to prove that $z\gcd(a,b)=\gcd(za,zb)$ I need to prove that $z\gcd(a,b)=\gcd(za,zb)$.    I tried a lot, for example, looking at set of common divisors of the two sides, but I can't conclude anything from that. Can you please give me some advice how I can handle this problem? And $a,b,z \in \mathbb{Z}$. Which hydroxyl from either the phosphate or the glycerol is taken during synthesis of a phospholipid head? This image from wikipedia, explains that there occurs a potential drop across a , and an electric field confined to the depletion region.  I already know the reason for the existence of this drop and the calculation of the difference but I have two questions regarding this drop.    1) If the  regions are externally connected using a perfectly conducting wire, why will not any current flow? Connecting the two regions should equalize their potentials (since wire is a resistance less) conductor, and therefore the gradient at the junction is destroyed resulting in a  which is obviously against conservation of energy as the semiconductor has non-zero resistivity. Where will extra potential drops will be created so that Kirchoff's voltage rule holds without any current and the built-in potential difference $V_o$ of the juction persists?    2) (probably naive) If an external Bias is applied, of say $|V|&lt;|V_o|$, then the pn potential difference across the junction will just reduce by that amount ($|V|$). Assuming that the external voltage source is ideal without any resistance, what will be the potential drops which would sum to zero in this case? Will drop due to the resistance of semiconductor play a par in it? If yes, then there cannot be any ideal resistance-less semiconductor junction, can there? What Sci-Fi book (1987 or older) had Aliens conquer earth and made Humans their slaves? I have been trying to recall the title of a book I read about 25 years ago (1987), I have tried to find it again a couple of times over the years without any luck.    The story takes place on earth, which has been invaded and conquered by aliens.  The humans have become servants or slaves.  One of the primary human characters is the human servant of an alien leader.  If I remember correctly, the aliens are much bigger than humans, I keep thinking of horses or elephants for some reason with regard to the aliens.  At the end, somehow the human slaves have forced the aliens to abandon their conquest of earth, but I don't remember exactly why.  I think it was something to do with simply refusing to be obedient, which the aliens could not comprehend, but I'm not sure about that.  I think the book ends with the alien leader (and the rest of the aliens) blasting off from earth in a rocket.  Does anyone recognize what book I'm referring to?  Thanks for any help! I am using two books for my calculus refresher.   Thomas' Calculus  Higher Math for Beginners by Ya. B. Zeldovich   My question is : When applying Integral Calculus for calculation of volumes of solids, generated by curves revolved around an axis, we use slices of 'cylinders' to approximate the volume of the resulting solid and then integrate the sum of those infinitesimal cylinders. However, when we are using the same techniques to calculate the surface area of the surfaces generated by revolving curves around an axis, we consider the 'slope' of the differential length of curve 'dx', calculate the total length of the curve and derive the required surface area.  Are we not supposed to use the same 'slope' for calculating the volumes of the infinitesimal 'cylinders' for calculation of volumes? Shouldn't we use 'sliced portions of 'cones' as the infinitesimal volumes?? When it come to calculation of volumes of solids of revolution, why are we neglecting the slope of the curve for the differential length and simply assume that it is an infinitesimal cylinder??  Ex: Let us say we want to calculate the surface area and the volume of the solid generated when the parabola y = 10 . x^2 is revolved about the y-axis, with limits of x from 0 to 5.  In such cases, when calculating the volume of the solid, we consider infinitesimal 'cylinders', ignoring the 'slope' of the curve for the differential element 'dx', but when calculating the surface area, we consider the 'slope' of the differential element 'dx'. A matrix and its transpose have the same set of eigenvalues/other version: $A$ and $A^T$ have the same spectrum Let $ \sigma(A)$ be the set of all eigenvalues of $A$. Show that $ \sigma(A) = \sigma\left(A^T\right)$ where $A^T$ is the transpose matrix of $A$. What is the maximum number of pucture repairs an inner tube can take? What is the purpose of LongLength for .Net Arrays? From this , I now understand the gradient to be the directional derivative that returns the steepest slope at a point. However, reading my textbooks, they all say that the gradient is normal to the tangent plane. In the above SE question, the gradient sounds like it should be parallel to a direction in the $xy$ plane, not actually up on the surface.   My question is therefore do I have a misunderstanding of the tangent plane, gradient or directional derivative?   In addition, I question how the gradient always passes through the origin or the $xy$ plane? If for instance in the graphic, the gradient had been another direction (say horizontal), then it wouldn't pass through the origin! In addition, the gradient of other points in the graphic would satisfy this example. Many thanks! Understanding how references and labels work List user's folder access permissions What is the difference between conditioning on regressors vs. treating them as fixed?