## microsoft excel – How can I use VLOOKUP/INDEX/MATCH to search for my target term and adjacent results in a sequenced list?

I have a sequenced list of numbers from A2:A165000. In D1 I have my target number as a column heading: 2588. In this column I would like to generate a list all of the numbers that occur directly before my target. And in E1 a list of the numbers that occur directly after my target.

I am able to find a single instance with the following formulae:

``````=INDEX(A2:A165000,MATCH(2588,A2:A165000,0)-1)

=INDEX(A2:A165000,MATCH(2588,A2:A165000,0)+1)
``````

How do I expand this to find all of the other instances?

## algorithms – Find original array from array with pairs of adjacent elements

Given an array composed of pairs, like this:

((3,5),(1,5),(3,2),(1,4))

Each element in the array (call it pair) means that pair(0) and pair(1) are adjacent in the original array. Note, they can come in either order. For instance, for the sample array above, the original array would be:

4,1,5,3,2 (or the reversed version of this)

How can I do this quickly? I tried doing this as follows, which works, but it’s too slow:

Create a hashmap that maps adjacent elements. Map = {3: (5,2), 1: (5,4), 5: (1,3), 4: (1), 2:(3)}. My algorithm would then start with one of the keys that only has a corresponding value length of 1 (in this case either 4 or 2), and then add to an output array, and go through the hashmap. I.e. First I would add 4 to my output, and then go from key of 4 (with a corresponding value of 1), to the key of 1, with corresponding values of 5 and 4. I’d ignore 4 (since it’s already in output), and add 5, then go to the key of 5, and so on and so forth. This is too slow! Is there a better algorithm?

## np complete – No of ways of selecting k non adjacent nodes in a graph for all k

Since $$n$$ is constant you can just enumerate and check all $$2^{38}$$ solutions to solve your problem in constant time.

If you throw in some heuristics when enumerating them you can probably compute the number of independent set in minutes.
For example, when you add a vertex you can immediately skip all its neighbors.

Also if there is any “central” cut vertex in the graph you can immediately decompose your problem into several smaller instance (which you can probably brute-force directly).

## algorithms – Given a list of integers and a target integer, return the number of triplets whose product is the target integer and two adjacent triplets

Let $$n$$ be the number of integers and $$t$$ be the target integer.
You can solve your problem in $$O(n log n)$$ time as follows:

For every $$i=0, dots, n-1$$, let $$p = A(i) cdot A(i+1)$$ and compute, in $$O(log n)$$ time, the number $$eta(t/p)$$ of integers in $$A$$ that are equal to $$t/p$$ (more on that later).
Then the number $$gamma_i$$ of triplets formed by $$A(i)$$, $$A(i+1)$$ and a non-adjacent element is $$gamma_i = eta(t/p) – |{A(j)=t/p , : , i-1 le j le i+2 }|$$.

It follows that the number of triplets of interest is $$sum_{i=1}^{n-1} gamma_i$$.

To find the values $$eta(cdot)$$ do a preprocessing in which you create a copy $$B$$ of $$A$$, sort $$B$$ in $$O(n log n)$$ time, and append an element with value $$+infty$$ to $$B$$ (this is just to avoid edge cases, $$+infty$$ can actually be any integer greater than $$t$$).

If $$x notinmathbb{Z}$$, $$eta(x)=0$$. Otherwise $$eta(x)$$ can be found in $$O(log n)$$ time by binary searching for the smallest indices $$i$$ and $$j$$ in $$B$$ such that $$B(i)ge x$$ and $$B(j) > x$$, respectively. Notice that $$i$$ and $$j$$ are always well defined and that $$eta(x) = j-i$$.

## Display the corresponding adjacent cell value selected in another cell

if my cursor selection on cell c2 will display data from cell b2 in cell j2, similarly if the cursor selection moves to c3, it will display data b3 to j2. Any form and help in this regard will be grateful.

## memory management – How to store large graphics, when the adjacent lists / matrices do not cut the mustard?

If space is paramount, how could we improve the adjacency matrices and the adjacency lists to represent a graph of nodes and edges not oriented in memory?

Across the academic world, we learn matrices and adjacency lists, but in the real world, we come across size charts that exceed the capabilities of these representations.

Are there any known techniques to drastically reduce memory usage while retaining the representation of the graph?

## dnd 5th – Can you prepare a help action against a creature that is not (currently) adjacent to you?

According to the rules of combat,

Alternatively, you can help a friendly creature attack a creature within 5 feet of you.

Is there anything in the rules that prevents me from planning an action to help a specific creature (friend) attack another (enemy), should at some point before my next turn, the enemy within 5 feet of me?

## pathfinder 1e – Concept of adjacent and natural range for large creatures or more

"Adjacent" means what it does in English – limiting itself directly to each other. Two squares are adjacent if they share a corner or an edge. Two creatures are adjacent if their spaces include two adjacent spaces. It's the same as the squares that are within five feet of each other, yes, because the grid is 5 feet. squares. This does not change with the size of the creature – adjacent always means that the sides must touch at least one corner or one edge.

But it all just comes down to what the word adjacent means. This parenthesis may well be the only explicit description of it, but it cannot be "the official definition" or anything, not in parentheses on a very specific subject. Instead, the word is not defined at all by the rules of the game, and "the official definition" can be found in any dictionary instead.

Anyway, no, Bodyguard does not change its scope with the scope (the number of adjacent squares increases with space, because there are 8 squares around a 1 × 1 space and 12 around a 2 × 2 space). That said, I tend to agree with you that certain uses of things affecting adjacent squares would make more sense affecting natural range for a given size (i.e. no subject to bonuses for reaching that a creature may have in addition to their size). But to decide if a given feature should use natural range instead of adjacent squares, to be fair and honest, you need to decide that in advance and let the players know, and also keep in mind that tiny and smaller creatures have a natural range of 0 feet – should they only be able to use this feature while sharing a space with something? (Maybe! But that's something to consider when judging, because you have to be consistent.)

In the case of "it just happened in the middle of a fight and I only realize now that I want to change the rules", my usual approach is to do the houserule immediately only if it benefits the PCs. If this could harm the PCs, I make the rule after the end of the fight, for all future combats. In both cases, I warn the players, and if a player decides that the change makes them wish they had achieved this feat, I find a way to let that happen. (There may be exceptions in very unusual circumstances – maybe a boss fight would be completely neutralized if I don't act, and it's not fun for non-gamers more – but I don't remember the last time I did that.)

## melee combat – Why is targeting an adjacent attacker with a 5 cubic foot attack considered a ranged attack?

An opponent moved next to a character's face and threw it at it. In turn, in retaliation, the character would like to retaliate with his favorite cube area attack, made the size of a 5-foot cube to be ergonomic. Oddly enough, the rules as written (see below) seem to qualify this attack as a ranged attack, even if the target is adjacent and all other area attacks also containing the attack. attacker would not be. Is it an oversight, an intentional conception decision, or is there something I forget that makes this decision invalid?

The rules leading to this conclusion appear here:

Melee ranged attacks

Whenever you make a ranged attack and there is an enemy within melee range, you have a 1 disadvantage on your attack roll. Area attacks are considered ranged attacks if the area does not include at least one space adjacent to the attacker.

The 5-foot cube placed on the attacker's square does not do not includes at least one space adjacent to the attacker, but it includes the box of the attacker herself, which intuitively should not be a ranged attack as well as other area attacks. RAW however, this means that it is a ranged attack and imposes a disadvantage 1. For me, a more intuitive decision and writing would be:

Melee ranged attacks

Whenever you make a ranged attack and there is an enemy within melee range, you have a 1 disadvantage on your attack roll. Zone attacks are considered ranged attacks if the zone does not include the attacker or at least one space adjacent to the attacker. (changes in italics)

Are there any existing rules or other evidence that the designer's intention was for this scenario to be a ranged attack? If this is the case, why only 5 cubic feet and not all other zone effects (they must also include a square adjacent to the opponent)? Is there perhaps another mechanical reason why I don't find this attack should be viewed from a distance? Is the attack simply supposed to impose a disadvantage 1 and to be considered from a distance is simply a by-product?

In the event that it should not be considered remote (or only considered remote for the purposes of disadvantage 1), I would like to revise this confusing wording. I found the Open Legends repository and my intention is to submit a pull request if I understand the rules correctly and this decision is against RAI. However, I ask my question here first to get insurance, because I know that I am very new to the system and may be neglecting something.

## geometry – Is there a terminology for the polyhedron in space N where each vertex is equidistant from both its adjacent vertices and a circumcentre?

For example, in 2 spaces, the points of a regular hexagon are all equidistant from their connected vertices, but also from the circumcentre (intuitive by gluing six equilateral triangles together). In 3 spaces, you get a regular convex icosahedron (sticking 20 regular tetrahedra together at a mutual point).

So, is there a classification of these types of polyhedra where all the edges are the same length as the radius of the district?