algorithms – For a set of numbers, get the maximum of 10 numbers below a certain threshold

First of all, if you replace 10 by 2, you can solve this problem in linear time using a two-pointer algorithm: a pointer starts at the bottom of the array and the other moves as far as possible while keeping the average. below the threshold. Then you advance the first pointer by 1 and move the second one until the average is below the threshold. Etc. We notice that the same algorithm also works for a weighted average.

Given $ N $ numbers, you can divide them into two halves of $ N / 2 $ numbers ("meet in the middle"). Each series of 10 numbers is divided into one $ a $-set of the first half and a $ b $-set of the second half, for some $ a, b $ by summing to 10. We can run the algorithm above for all these $ a, b $ (using the appropriate weights). This will improve travel time to be proportional to $ binom {N} {10} $ to be proportional to $ binom {N / 2} {10} $ (for $ N geq $ 20).

You can try to improve this by dividing the halves randomly and hoping for a balanced split, which will occur with reasonable probability. Then just try $ a, b $ who are balanced. (The extreme would be to aim $ a = b = $ 5but this is not necessarily the best choice.) Although it is a randomized algorithm, it can probably be degraded by taking just a little bit of execution time.

2013 – List Display Threshold for Administrator Not Working

My web application list threshold is set to 5000. For administrators, it is set to 20000.

My list contains 6000 items. I have an index at the modified date. I create a sorted view on modified. When I open the view, I receive the message that the listview threshold is exceeded. I am a sitecollection administrator. Should not I see the 6000 items because of the 20000 setting for administrators?

Sharepoint Online REST API: Exceeding the threshold of displaying the list when querying items in a subfolder with GetItems

I need to query the elements of a given folder and all of its children in a library of documents with as few APIs as possible.
The ideal solution seemed to be getItems with Scope = "RecursiveAll & # 39; and one FolderServerRelativePath. However, the API below returns a SPQueryThrottledException for a specific document library on Sharepoint Online, and I can not understand the reason.

TO POST / _api / Web / Lists () / getItems? $ select = *, FileRef

POSITION BODY:
{
"request": {
"odata.type": "SP.CamlQuery",
"ViewXml": "1"
"DatesInUtc": true,
"FolderServerRelativePath": {
"DecodedUrl": ""
}
}
}

Some observations:

  • The subfolder contains 4 files and no folders.
  • Obtaining items in any folder in the document library fails with the same error
  • The document library contains approximately 6.5,000 items (folders + files).
  • Range = recursive & # 39; also fails, but & # 39; Default & # 39; and & # 39; filesonly & # 39; works well
  • The same query worked for another document library with 100k files

What is the problem with the query? How can I fix it? If it is impossible to solve the problem, are there any other APIs that can recursively query items in a folder?

Field ux – Definition of the acceptance threshold for the result of the evaluation of the usability

I am currently working on a framework for evaluating the usability of our products against our product design principles, which are nothing more than 10 usability heuristics (N & A). N) expressed in our own words. The goal is to identify areas of use that we do not achieve the best. That said, we have 8 heuristics covering specific usability areas. There will be a checklist in each of the heuristics to evaluate and in the end we will have a percentage as a score for each.

My question is, how do you know what each score means? Is 70% good or bad? How to define the threshold? Also, how do you weight each of the heuristics in order of importance? It is surely more important for a website, that is, to always provide feedback on the system and in a timely manner rather than looking good.

I wonder if you have any advice? I hope all this makes sense. Thank you

Fill below a certain threshold

How do I insert Fill in the graph below, so that only areas below 0.5 and below the line are filled?

Ground[-x + 1, {x, 0, 1}]

enter the description of the image here

5th dnd – Can the sleep spell take effect later when the life point threshold is reached?

A party attacks a creature with a lot of health and some spear To sleep. The creature resists the spell because it has more life than the caster cast for the sleeping spell, but can the sleep effect be triggered later when the creature loses enough health to fall under the threshold of sleep?

for example: The group fights an enemy creature with 30 life. The magician casts Sleep, the enemy is the only creature in the area of ​​effect and rolls 5d8 for a total of 20. The creature resists because it has more than 20 health. After a few attacks, the creature is reduced to 18 life and we are still in the duration of one minute of the sleep spell. Would the sleep effect then be activated since the creature now has less than 20 health?

In context of the question, I saw this scenario unfold in an episode of season 1 of critical role Webcast where a giant first resisted a sleep spell, to fall asleep after sustaining enough damage, even though the sleep spell had been cast a few laps before. I know that DM Matt Mercer is playing a modified version of the 5E rules, especially since Season 1 was converted from Pathfinder, but since I only recently started playing at 5E, I thought that That was how the spell worked until one of my group's assistants threw it out last night and we spent some time re-reading the details of the spell.

Theory of complexity – Reduction of weighted linear threshold to unweighted

Reading "On the power of threshold circuits with low weights" of Siu and Bruck, I had several problems to understand how an unweighted linear threshold element can be constructed efficiently from the weighted element .

Let $ X = (x_1 ldots x_n), x_i in {- 1, 1 } $. We define the linear weighted threshold element as $ f (X) = sgn ( sum_ {i = 1} ^ n w_i x_i + w_0) = sgn (F (X)), w_i in Z $. There are no restrictions on $ | w_i | $, and the question is whether $ F (X) $ can be represented as a linear combination where $ | w_i | $ is limited by the polynomial of $ n $.

The authors say:

First, observe that considering the binary representation of the weights $ w_i $we can introduce more variables and assign constant values ​​to renamed variables so that any linear threshold function can be assumed to assume the following generic form:

$ f (X) = sgn (F (X)) $, or $ F (X) = sum_ {i = 1} ^ {nlogn} 2 ^ i (x_ {1_i} + ldots + x_ {n_i}) $

  • I do not understand how the binary representation of weights relates to the
    $ logn $ which is defined by $ X $ only.
  • Why the summation is made for
    $ i = 1 ldots nlogn $?
  • We do not know what $ x_ {k_i} $ represent.

numpy – Implementation of a threshold detection function in Python

I want to implement the following trigger function in Python:

Contribution:

  • time vector t [n dimensional numpy vector]
  • vector of data y [n dimensional numpy vector] (the values ​​correspond to the vector t)
  • threshold tr [float]
  • Threshold type vector tr_type [m dimensional list of int values]

Exit:

  • Tr_time threshold time vector [m dimensional list of float values]

A function:

I would like to return tr_time which consists of the exact time values ​​(preferable also interpolated which are not yet in the code below) to which tr is crossed tr (crossing means going from less to greater or vice versa). The different values ​​in tr_time correspond to the vector tr_type: the elements of tr_type indicate the number of the crossing and if it is a crossing upstream or downstream. For example, 1 means that the first time it passes from less than tr to greater than tr, -3 means that the third time that it passes from more than tr to less than tr (third time along the time vector t)

At the moment I have the following code:

import numpy as np
import matplotlib.pyplot as plt


def trigger (t, y, tr, tr_type):
triggermarker = np.diff (1 * (y> tr))
positive indicators = [i for i, x in enumerate(triggermarker) if x == 1]
    negativeindices = [i for i, x in enumerate(triggermarker) if x == -1]
    triggertime = []
    for i in tr_type:
if i> = 0:
triggertime.append (t[positiveindices[i - 1]])
elif i <0:
triggertime.append (t[negativeindices[i - 1]])
return triggertime


t = np.linspace (0, 20, 1000)
y = np.sin (t)
tr = 0.5
tr_type = [1, 2, -2]
print (trigger (t, y, tr, tr_type))
plt.plot (t, y)
plt.grid ()

Now that I'm pretty new to Python, I'm wondering if there's a more pythonic and efficient way to implement that. For example, without loop and no need to write separate code for upstream or downstream crossings.

Thank you!