I’m working with a custom search solution on SharePoint Online using the modern experience. I’m hoping to be able to sort the results from this based on the number of views per document (i.e. the documents relative popularity). Is there a managed property i can use to sort on? Or will i have to do a REST call of some sort? Any help is appreciated. Thanks

# Tag: Counting

## Question about how can i determine if counting sort is the right option over other sorting algorithms

So, an exam’s exercise asks me to find an alghoritm that can determine if counting sort is the best solution, otherwise use another optimal sorting algorithm.

Now i find that solutions for that question given by my professors are wrong because they do something like( pseudocode)

`Sorting(A,k) //where k is a value inserted by the user(?) { max=a[0]; for i=1 to n // n=dim { if( a[i] > max) update max with a[i] } if( max <= k*n) then countingsort(A) else heapsort(A); return A; `

Now that being said, K is passed but i dont get what this k exactly is, neither there is explanations in prof’s notes… i guess it is not the range between max/min otherwise why would he check for max if u already got the range?

my solution is:

`Sort(A){ int max, i; int min; if( arr[0] > arr[1]){ max=a[0]; min=a[1]; } for(i= 2 ; i < n ; i++){ if(a[i] > max) max=arr[i]; else if( a[i]< min) min=arr[i]; } range= max-min+1; // range for counting sort if(range/n < log n) counting sort(A,range); else mergesort/heapsort(A......); return A; } `

If range/n is less than logn , it means that range is atleast < nlogn, which implies it “”should”” be better than other optimal sorting algorithms. It might be not the most accurate way but it seems like it should be something like that, shouldnt it?

## Polynomial size Boolean circuit for counting number of bits

Given a natural number $ n \geq 1$ , I am looking for a Boolean circuit over $ 2n$ variables, $ \varphi(x_1, y_1, \dots, x_n, y_n)$ , such that the output is true if and only if the assignment that makes it true verifies

$ $ \sum_{i = 1}^{i = n} (x_i + y_i) \not\equiv n \bmod 3$ $

I should specify that this I am looking for a Boolean *circuit*, not necessarily a Boolean formula as it is usually written in Conjunctive Normal Form (CNF). This is because when written in CNF, a formula like the one before has a trivial representation where the number of clauses is approximately $ \frac{4^n}{3}$ , as it contains a clause for every assignment $ (x_1, y_1, \dots, x_n, y_n)$ whose bits sum to a value which is congruent with $ n \bmod 3$ . Constructing such a formula would therefore take exponential time.

I have been told that a Boolean circuit can be found for this formula that accepts a representation of size polynomial in $ n$ . However, so far I have been unable to find it. I would use some help; thanks.

## Counting accounts and reporting

With the #cpanelgate i need to find a way to monitor accounts on a server or reseller package. I’m thinking their must be a … | Read the rest of http://www.webhostingtalk.com/showthread.php?t=1771117&goto=newpost

## Estimation of the number of solutions by Counting

This is a question from a quantum computation textbook.

Consider a classical algorithm for counting the number of solutions to a problem. The algorithm samples uniformly and independently $ k$ times from the Search Space of size $ N$ for solutions using an Oracle that outputs 1 or 0, and let $ X_1,X_2,X_3,…X_k$ be the results of the Oracle calls. So $ X_j=1$ if the $ jth$ Oracle call found a solution and $ X_j=0$ otherwise. This algorithm estimates the number of solutions $ S$ :

$ $ S=N * \sum_{j}\frac{X_j}{k}$ $

Assuming the number of solutions is $ M$ and this is not known in advance. The Standard Deviation of $ S$ is stated and found to be:

$ $ \Delta S=\sqrt{\frac{M(N-M)}{k}}$ $

**The question is:**

Prove that to obtain a probability at least $ \frac{3}{4}$ of estimating $ M$ correctly to within an accuracy $ \sqrt{M}$ for all values of $ M$ , we must have $ k=\Omega(N)$ .

I know how to get the 2nd equation from the 1st, which is by moving $ N$ and $ k$ to the left, thus treating $ kS/N$ as a Binomial Distribution $ B(k,\frac{M}{N})$ . Then finding the variance of the Binomial Distribution and some algebraic manipulation will lead to the 2nd equation. I’m clueless in proving of $ k=\Omega(N)$ . Only thing I tried writing is:

$ $ P\Big(\sqrt{\frac{M(N-M)}{k}}\leq \sqrt{M}\Big)\geq \frac{3}{4}$ $

Can someone help me with this?

## Counting elliptic curves by discriminant

Enumerating elliptic curves $ E/\mathbb{Q}$ sorted by (the absolute value of) their minimal discriminants is a difficult open problem, as is the (likely easier) problem of counting elliptic curves $ E/\mathbb{Q}$ given by a minimal Weierstrass model $ E_{A,B} : y^2 = x^3 + Ax + B$ , ordered by the model discriminant $ \Delta(E_{A,B}) = -16(4A^3 + 27B^2)$ .

For the question, it is not too hard to show that the number of curves $ E$ with $ |\Delta(E_{A,B})| \leq X$ is $ O(X)$ . Counting elliptic curves by their minimal Weierstrass models is essentially equivalent to counting monogenic cubic rings by discriminant, and the number of monic cubic rings of discriminant bounded by $ X$ is surely less than the number of cubic rings having discriminant bounded by $ X$ , and the number of cubic rings having discriminant bounded by $ X$ is $ O(X)$ by the Davenport-Heilbronn theorem.

I am asking about whether there is any improvement over this bound: is it known that

$ $ \displaystyle N(X) = \#\{E_{A,B} : 16|4A^3 + 27B^2| \leq X\} = o(X)?$ $

## Counting number of states from a regular expression

Given the regular expression: $ r=ab+((a+\epsilon)c^*)^*$ . Let A be a non-deterministic automaton that accepts the language of r. How many states are in A? Answer the question without building A explicitly, explain how you got the answer.

I’m having trouble figuring this question out. The answer that was given is: $ 5*2+4*2=18$

With the explanation that for the $ \epsilon$ regular expression we build an automaton with 2 states.

for each $ \sigma \in \Sigma$ for the regular expression $ \sigma$ we build an automaton with 2 states

For concatenating we do not add states and for each union or star operation we add 2 states.

But even with this explanation I’m not quite sure did they reach this answer.

I can understand that we have $ \epsilon$ , so we have 2. Plus we have $ \Sigma = \{a,b,c\}$ so we do $ 2*3$ .

Even with the stars, how do we reach $ 5*2$ ?

Also I haven’t seen this kind of calculation before, are there any additional rules when trying to calculate states from a regular expression?

## Prove problem by double counting

I want to prove probem by Double counting but i have no ideal. Could you help me, please ? Suppose that $ C_1, C_2, . . . , C_n$ are circles of radius 1 in the plane such that no two of them are tangent and the subset of the plane formed by the union of these circles is connected (i.e., for any partition of {1, 2, . . . , n} into nonempty subsets A and B, $ \bigcup_{a\in A}$ and $ \bigcup_{b\in B}$ are not disjoint). Prove that $ |S|\geq n$ , where $ $ S= \bigcup_{1\leq i< j \leq n} C_i\cap C_j $ $

the intersection points of the circles. (Each circle is viewed as the set of points on its circumference, not including its interior.)

## counting the integer solutions to 1000a + 100b + 10c + d where 0 < x,y < 20 [on hold]

I am trying to figure out the integer solutions to 1000a + 100b + 10c + d where 0 < x,y < 20. I can print out the solutions by replacing n = n + 1 with ‘print(a,b,c,d)’ and removing the ‘print(n)’ bit.

However, when I try and count the solutions, it seems that there is no output for this code. I can’t figure out why. Any thoughts?

## Can I measure time by counting frames and trusting on the ‘240 FPS’ that my iPhone 7+ slow motion camera is capable of record?

I’m using a slow motion video recorded using an iPhone 7+ to track something but would like to avoid recording a chronometer to know the time the process is taking. I need to measure about 10 seconds with an uncertainty of at most 0.1 s… Is this possible by just counting 2400 frames of my homemade video?