ios – Como mostrar un Toolbar temporal abajo de un UITableViewController en Swift Xcode?

Necesito mostrar un Toolbar de manera temporal en la parte de abajo de un UITableViewController, es decir, solamente cuando se seleccionen varias celdas para realizar acciones en forma masiva y luego ocultarlo.

Lo he insertado en el storyboard arrastrando directamente un (Bar Buttom Item) desde la librería de objetos a la parte inferior del UITableViewController y automáticamente me agrego un Toolbar quedando de la siguiente manera.

introducir la descripción de la imagen aquí

No estoy seguro si esta es la manera correcta de realizarlo, pero lo que quiero lograr es esto:

introducir la descripción de la imagen aquí

Al ejecutarlo no se visualiza el toolbar, creo que es porque la tabla ocupa toda la pantalla.

Como es la manera correcta de agregar, mostrar y ocultar un Toolbar abajo de un UITableViewController ?


Is there a battery complexity similar to temporal and spatial complexity?

Understood that for all of these ways of measuring time and space depends on user hardware, I was wondering if there is a similar way to calculate the battery usage of a program sure n amount of time? Where is it completely dependent on material?

first research depth – Temporal complexity of DFS and recurrence relation

For an implicit graph, the recurrence can be written as follows:

Let $ b $ be the number of branches of each node (assumed to be constant)

let $ d $ the depth of the graph

For depth 1, there are $ b $ branches:

$ T (b, 1) = b $

For the following levels, it can be written

$ T (b, d) = b + b * T (b, d-1) $

or $ b $ are the nodes at this level, and are the $ b * T (b, d-1) $ knots to the next level.

If you replace the definition with $ T (b, d-1) $ you obtain

$ b * (1 + b * (1 + T (b, d-2)) = b + b ^ 2 (1 + T (b, d-2)) $

If you replace the definition of $ T (b, d-2) $ you obtain

$ b + b ^ 2 (1 + b + b * T (b, d-3)) = b + b ^ 2 + b ^ 3 + b ^ 3 * T (b, d-3) $

If you keep growing, you get

$ T (b, d) = b + b ^ 2 + b ^ 3 + … + b ^ (d-1) * T (b, 1) $

Since we know that $ T (b, 1) = b $, we can replace

$ T (b, d) = b + b ^ 2 + b ^ 3 + … + b ^ (d-1) * b $


$ T (b, d) = b + b ^ 2 + b ^ 3 + … + b ^ d $

Use of Big-O notation. $ O (b ^ d) $

temporal complexity – Matrix multiplication on the range in $ O (n) $

Let $ M $ denote the time it takes to multiply 2 matrices, and $ Q $ indicates the number of requests.

Is it possible to create a data structure with $ O ((n + Q) M) $ pre-computation time, and can respond to range matrix multiplication requests that satisfy $ l_ {i-1} le l_i $ and $ r_ {i-1} le r_i $ with an overall time complexity of $ O ((n + Q) M) $. I have thought a lot about how to manipulate 2 pointers to get the expected results, but I have yet to find any approach. The matrices are not necessarily invertible.

r – How to find temporal faults?

I have several time series with faults. In other words, the day to observe, passes without a few days, then returns to observe and therefore follows with holes. The problem is that they joined these series in the archives. If a month of daily data is missing, the company that filled it out did not leave the days unattended with NA or -9.9e10. The company joined. In other words, in an Excel spreadsheet, it is as if the line with the observation of 03/02/1995 had the observation of 03/10/1995. In other words, a furode 8 days.

I then generated a sequence of dates from a base year (1900) until 2018 and wanted to find the flaws in the series and join it to this sequence of dates in a data.frame.

I am using the full_join () function of dplyr, but everything is bad.

I wanted this union to be a function of the sequence of dates that I created, no more no less. In order to have a regular data frame at the end.

A method to do this?

Thanks in advance.

temporal complexity – Subset of vectors $ k $ with the shortest sum, compared to the norm $ ell_ infty $

I have a collection of $ n $ vectors $ x_1, …, x_n in mathbb {R} _ { geq 0} ^ {d} $. Given these vectors and an integer $ k $, I want to find the subset of $ k $ vectors whose sum is the shortest compared to the uniform norm. In other words, find the whole (maybe not unique) $ W ^ * subset {x_1, …, x_n } $ such as $ left | W ^ * right | = k $ and

$$ W ^ * = arg min limits_ {W subset {x_1, …, x_n } land left | W right | = k} left lVert sum limits_ {v in W} v right rVert _ { infty} $$

The brute-force solution to this problem takes $ O (dkn ^ k) $ operations – there are $ {n choose k} = O (n ^ k) $ subsets to be tested, and each takes $ O (dk) $ operations to calculate the sum of the vectors, then find the uniform norm (in this case, just the maximum coordinate, because all the vectors are non-negative).

My questions:

  1. Is there a better algorithm than brute force? The approximation algorithms are correct.

One idea that I had was to consider a convex relaxation where we give each vector a fractional weight $ (0, 1) $ and require that the weights total $ k $. The subset resulting from $ mathbb {R} ^ d $ covering all these weighted combinations is indeed convex. However, even if I can find the optimal weight vector, I don't know how to use this set of weights to choose a subset of $ k $ vectors. In other words, which full rounding scheme to use?

I also thought about dynamic programming but I don't know if it would end up being faster in the worst case.

  1. Consider a variation where we want to find the optimal subset for each $ k $ in $ (n) $. Again, is there a better approach than naively solving the problem for each $ k $? I think there should be a way to use race information on size subsets $ k $ to those of size $ (k + 1) $ etc.

  2. Consider the variation where instead of a subset size $ k $, we receive a target standard $ r in mathbb {R} $. The task is to find the largest subset of $ {x_1, …, x_n } $ whose sum has a uniform standard $ leq r $. In principle, we should seek $ O (2 ^ n) $ vector subsets. Are the algorithms changing? Also, is the decision version (for example, we could ask if there is a size subset $ geq k $ whose sum has a uniform standard $ leq r $) of the NP-hard problem?

turing machines – Temporal complexity of advanced SAT solvers for formula length

For 3SAT, the number of variables is polynomially linked to the number of clauses. (See end for justification.)

Therefore, any algorithm for 3SAT whose execution time is polynomial in the number of clauses would also be polynomial in the number of variables; and any algorithm for 3SAT whose execution time is polynomial in the number of variables would also be polynomial in the number of clauses.

It is known that there is a polynomial-time algorithm for 3SAT, if and only if there is a polynomial-time algorithm for SAT, if and only if there is a polynomial-time algorithm for CircuitSAT (for example, for formulas). In addition, despite decades of work on SAT solvers, no one knows of an algorithm for 3SAT that runs in polynomial time (or even less exponential time in the worst case). You can take this as proof that there is no polynomial algorithm for 3SAT; which implies that there is also no polynomial algorithm for SAT or CircuitSAT, and also implies that P! = NP.

Rationale: Either $ n $ denote the number of variables and $ m $ the number of clauses. We have $ n le 3m $ (a variable that does not appear in any clause can be ignored) and $ m le 8n ^ 3 $ (each clause has three literals and you can ignore repeated clauses). It follows that $ n / 3 le m le 8n ^ 3 $ and $ sqrt (3) {m / 8} le n le 3m $, that is to say that each one is polynomially related to the other.

I see you have revised your question. This clarifies that I think you have a misconception. You talk about "run (ning) (an SAT solver) on arbitrary Boolean formulas". However, you cannot run a SAT solver on an arbitrary Boolean formula. SAT solvers only work on CNF formulas.

However, we know that any Boolean formula can be converted to an equisatisfiable CNF formula of size at most polynomial in size of the formula, and vice versa. If you had an algorithm that could test the satisfiability of arbitrary Boolean formulas in time polynomial in the size of the formula, then it would follow that you have an algorithm that could test the satisfiability of 3CNF formulas in time polynomial in size of the formula (all The 3CNF formula is a Boolean formula), and therefore an algorithm that could test the satisfiability of the 3CNF formulas in time polynomial in the number of variables – which contradicts the available evidence. So, if you think that there is no algorithm to solve 3SAT in time polynomial in the number of variables, then you must also believe that there is no algorithm to test the satisfiability of arbitrary boolean formulas in time polynomial in the size of the formula.

algorithms – Difficulty understanding these summations to analyze temporal complexity

I want to know if the calculation of this link by of the complexity of sorting by shell is true.

Here is the shell sorting algorithm:

void shellSort(int array(), int n){
    for (int gap = n/2; gap > 0; gap /= 2){
      for (int i = gap; i < n; i += 1) {
        int temp = array(i);
        int j;
        for (j = i; j >= gap && array(j - gap) > temp; j -= gap){
          array(j) = array(j - gap);
        array(j) = temp;

Let me join the site author's calculation using summations:


Where did he get the o (n log n) from? And why O (n ^ 2)?

performance – Addition of asymptotic temporal complexities – mergesort

mergesort implements what you call the "divide and conquer" paradigm.

It divides an array into subnets until they reach a length of one, then it will start calling merge ()

The resulting arrays based on the order of fractionation and derivation can be organized into something like a binary tree.

There are at most log (n) levels / layers inside the tree, and each element is affected by a constant number of operations on each level.

Therefore, it works in n times log (n), so, neglecting the constants, you have an algo O (nlogn) (time complexity)

We know that the mergesort traditionally divides the tables in two.
That is, if you have an array of length n, then if it divides into x and n – x, then x = n-x.

But in fact, if for example, you decided to trisect the array, it means that you will have to call merge () twice after the return of recursive calls for a call to mergesort ()

This means that even if you have fewer levels, you still call merge () as many times, which means that breaking an array into an arbitrary number of equal parts leaves performance unchanged.

I was wondering, how would this affect performance, if I split the array in 2, but not exactly by bisecting it.

Let's say I called mergesort () on 2 parts of an array of length n, one with x, the other with n-x elements.

One will occur at O ​​(xlogx), the other will occur at O ​​((n-x) log (n-x))

If I made the naive assumption that I can measure the approximate approximate performance of the 2 calls together by adding the 2, then I get:

xlogx + (n-x) log (n-x)

If you put a constant number in place of n and graph it, you can see that the graph always have a minimum where x = m

It made me think that the 2 mergesort calls together work better when they bisect the array exactly, and worse if not.

1) Is it okay to add the 2 asymptotic performances like this to get a good estimate of imprecise performance?
2) Is the bisection of the berries in mergesort the best in terms of performance?

Temporal and spatial complexity of the Brute Force backpack problem

I was wondering if someone could confirm my work for the complexity of 0/1 Knapsack Brute Force and Dynamic Programming solutions,

For brute force, I reasoned $ O (N. 2 ^ N) $

This is because to work on all possible subsets (the way I did brute force was to calculate the power set and then calculate the weight / values ​​for each set ), take $ 2 ^ N $ then we calculate the sum of each size subset from 1-N, which takes $ N.2 ^ N $

The complexity of the space would $ O (P) $ where p is the total number of subsets

But according to my notes, the Brute Force 0/1 backpack is $ O (2 ^ N) $ with space $ O (N) $

I think it's for the recursive solution but my brute force is not recursive.