## What is the smallest time/space complexity class that is known to contain complxity class $\mathsf{SPARSE}$

Is it known if complexity class of all sparse languages is contained within e.g. $$\mathsf{EXP}$$ or $$\mathsf{EXPSPACE}$$? Or what is the smallest time or space complexity class that contains complexity class $$\mathsf{SPARSE}$$?

Posted on Categories proxies

## Find the smallest group of numbers with sum bigger then $X$

Given a list of numbers $$S$$ where $$0 < s_i < 100$$, find the smallest group of numbers with sum bigger than $$X$$.
Each number can be used multiple times.

Ex: for $$S = [3,4.1], X = 10$$ the solution is $$[3, 3, 4.1]$$

Is it a known problem? What will be the best way of solving it?

For now, my best solution is to randomly pick numbers and repeat the process multiple times.

## Finding Smallest Frontier for Graphs of bounded “width”

Let $$G$$ be a graph and $$X=x_1,x_2,…,x_n$$ be an permutation/ordering of the vertex set of $$G$$. We then let $$S_i = \{x_j:j\le i\}$$, and $$F_i$$ be the number vertices $$v\in S_i$$ that are adjacent to some vertex $$u(v) \not\in S_i$$. We finally define $$F$$ to be a list of values $$F_i$$ sorted from largest to smallest. e.g. if $$F_1=2,F_2=1,F_3=6, F_4=2$$ we’d have $$F = 6,2,2,1$$ (we caution that in reality $$F_{i+1}-F_i\le 1$$ so the sequence features in the example could not occur)

In general, finding $$X$$ such that $$F$$ is lexicographically minimal is a task which I’d assume is NP-Hard.

However, letting $$\mathcal{G}_{k,t}$$ denote the family of graphs $$G$$ such that the vertex set of $$G$$ is partitioned in to $$t$$ parts $$V_1,\dots,V_t$$ such that $$V_i \le k$$ for all $$i$$, and $$|a-b|\ge 2$$ implies there is no edge $$(u,v)$$ in $$G$$ where $$u\in V_a$$ and $$v\in V_b$$.

For fixed $$k$$, and given $$G\in \ mathcal{G}_{k,t}$$, is there an algorithm that finds $$X$$ such that $$F$$ is lexicographically minimal, whose worst case run time is polynomial in $$t$$?

Posted on Categories proxies

## Smallest subarray problem

Say you have an array of integers like [1, 2, 3, 4, 5, 6], the problem is to find the smallest way to break up the array into sub-arrays where each sub-array satisfies the following requirement:

• sub-array.first_integer and sub-array.last_integer must have a common divisor that is not 1.

So for [1, 2, 3, 4, 5, 6] the answer would be 2, because you can break it up like  and [2, 3, 4, 5, 6], where 2 and 6 have a common divisor of 2 (which is > 1 so it meets the requirement).

You can assume the array can be huge but the numbers are not too big. Is there a way to do this in n or n*log(n) time? I think with dp and caching n^2 is possible but not sure how to do it faster.

## Fibonacci Heap smallest possible grandchildren

Suppose a node of a Fibonacci heap has 52 children. What is the smallest possible number of grandchildren it can have?

Posted on Categories proxies

## Finding the point with smallest x-ordinate between two given y-ordinates

Given a set of points P=p1,p2,..pn in R2 in where pi=(xi,yi),finding the point with smallest x-ordinate having y-ordinates between y1 and y2, where y1 and y2 are given as inputs. I can compare the point with other points which gives me an O(n) time algorithm ? Can this be improved any further ?

Posted on Categories proxies

## Finding the smallest number that scales a set of irrational numbers to integers

Say we have a set $$S$$ of $$n$$ irrational numbers $$\left\{a_1, …, a_n\right\}$$.

Are there any known algorithms that can determine a scaling factor $$s \in \mathcal{R}$$ such that $$s * a_i \in \mathcal{N} \;\forall a_i \in S$$, assuming that such factor exists? If multiple exist, how about the smallest one?

Moreover, I wonder, under what input conditions could one assume that an algorithm for this problem can’t (or can) return a valid scaling factor?

If no known algorithms to this problem exist, are there any known classes of “scaling algorithms” that may solve a similar problems?

Posted on Categories proxies

## Write the smallest positive number that can be represented by the floating point system

Using a normalised floating point representation box with an 8-bit mantissa and a 4-bit exponent, both stored using two’s complement.

(a) Write the smallest positive number that can be represented by the floating point system in the boxes below. The result is: Mantissa 0.1000000 and exponent 1000

Do not see how this can could someone please explain.

Posted on Categories proxies

## Finding the smallest integer such that a given condition holds with “binary search”

Setup. Suppose we are given a function $$f:\mathbb N\to\{\text{False},\text{True}\}$$ such that $$f(n)=\text{True}\implies f(n+1)=\text{True}$$ and such that $$f(n)=\text{True}$$ for some $$n$$ large enough.

In natural language. The function $$f$$ imposes a condition on the natural numbers which is fulfilled once $$n$$ is large enough.

My question. How can I, for any given $$f$$, find the smallest $$n$$ such that $$f(n)=\text{True}$$?

A first idea would be to start with $$n=1$$ and to increment $$n$$ by one until $$f(n)$$ is True. However, this is fairly slow. So I designed a sort of “binary search” for this task. How can I translate this to Mathematica?

Here is the Code in Python:

def bin_search(cond):     n = 1     while not cond(n):         n *= 2     lower_bound = n//2     upper_bound = n     middle = (lower_bound + upper_bound)//2     while upper_bound - lower_bound > 1:         if cond(middle):             upper_bound = middle         else:             lower_bound = middle         middle = (lower_bound + upper_bound)//2     return upper_bound 

For example, one such condition would be $$f(n)=[H_n\geq 10],$$

where $$H_n=\sum_{i=1}^n \frac 1i$$ is the $$n$$th harmonic number.

Posted on Categories cheapest proxies

## What are the smallest and biggest negative floating point numbers in IEEE 754 32 bit?

I am stuck with a question that asks for smallest and biggest negative floating point numbers in IEEE 754 32-bit (their representation and decimal numerical value from which one can approximate the precision of the number)? So -0, NaN and Infinity do not belong to negative rational numbers.

I have stumbled upon -3.403 x 10^38 and 2^-126. I came close to the first one actually. I tried to do some calculations but got kind of lost in the process as floating point representation is counter-intutive for me, especially when calculating negative numbers. Can someone help me to clarify my thought process for the calculations so that I can find the numbers?

Posted on Categories proxies