how to reduce the time complexity?

I have a graph G=(V+E) and list of list Node where each sublist is subset of V. I want to find out nodes of each sublist that are not reachable from other nodes of that sublist and add edge between those nodes. Suppose,Node=[[1,2,3,4,5,7,8],[9,10],….] and in sublist=[1,2,3,4,5,7,8], {1,7,3,8} reachable from each other and {2,4,5} reachable from each other so an edge needs to be added between 1/7/3/8 and 2/4/5. I have used the following :

for each sublist in Node  SG=node_induced_subgraph(sublist) of G  C=connected_components(SG)   for each component c_i in C   add edge between c_i and c_{i+1}  end end 

complexity of node_induced_subgraph() is O(V+E) complexity of connected_components() is O(m+n) # m is no. of nodes and n is no. of edges in Sub-graph

So how to reduce the overall complexity?

Freezing time in D&D

My part is level 17 and one of my PC’s is a sorcerer. He discovered a combo using the extended spell with time stop to just freeze time. Time stop lasts a minimum of 2 rounds or 12 seconds so by using 13 sorcery points he could freeze time for 24h. He could then use 8 of those 24 hours to take a long rest regaining his points and 9th level spell slot. He could then do whatever he wanted and just before time unfreezes he could recast it, rinse and repeat over and over again . Unless he affects another creature he can keep time frozen as long as he chooses. I’m not so worried about the OP of this because I can introduce scenarios and enemies specifically tailored to counter this ability (homebrew if you were wondering) but I do wonder if this Freezing time strat is viable by official and adventurers league rules?

Time complexity – Head stay transition – Turing Machine

I’m checking time complexity in a turing machine. There is a transition that don’t move the head, it justs stays (not right nor left movement) .

Should I count that state transition to calculate the complexity, -even though- the head don’t move? I understand that it should be counted as that step would take a time unit anyway, but i’m not sure really.

Thanks! Sorry for my english!

Will a Web Server detect a base64 encoded reverse shell on run time?

A vulnerable website blocks almost everything that is related to PE (Privilege Escalation), but when encoding the ls -al code into a base64 format, the website doesn’t block the dangerous code (at Scan Time), will the web server detect and block the code at Run Time ?

base64 -d <<< bHMgLWFs | sh: Base64 of ls -al

Web Server: Scanning the input.. Seems fine, I will not block it.

Web Server Inside: ls -al # Will it block it at run time ?

Time to FCP changes based on order of and tags

I was troubleshooting why one particular page took a full second longer to reach FCP compared to similar pages for mobile according to Google’s Page Insights. The difference ended up being the order of two tags at the beginning of the page.

3.4 seconds to FCP

<h2>heading</h2> <p>some paragraph</p> 

versus 2.5 seconds to FCP

<p>opening paragraph</p> <h2>heading</h2> 

In the first scenario, Google Page Insights gave a logo from the header as the FCP content. But with the second scenario, Google would display either text from the <p> or <h2> tag for the FCP content.

Why would the order of these two simple tags change the FCP content from text to an image header?

Are there any non-epic methods of time travel (years/decades/centuries) in third edition?

Are there any non-epic methods of time travel (years/decades/centuries, not smaller than a year) in third edition?

I’m not looking at short duration tricks, nor am I looking for anything that is a one-way trip. Please exclude theoretical optimization tricks.

I am looking for a way to travel a large temporal distance, and back again, preferably affecting the destination in question. Forwards or backwards in time is fine.

What is the time complexity of sorting n words length wise and then alphabetically? Should we consider the length of the strings in the complexity?

Let’s assume I have a list of some words found in the English dictionary: ["hat", "assume", "prepare", "cat", "ball", "brave", "help" …. ]

I want to sort these words (which are n in number) in a way, such that they are ordered based on their length, but if 2 words have the same length, they are ordered alphabetically.

What is the time complexity of this sorting operation?

Would it be fair to say that the complexity is just O(nlogn) and not take into consideration the length of the strings? If the largest length is S, can the complexity also involve a factor of S?

What is the expected time complexity of checking equality of two arbitrary strings?

The simple (naive?) answer would be O(n) where n is the length of the shorter string. Because in the worst case you must compare every pair of characters.

So far so good. I think we can all agree that checking equality of two equal length strings requires O(n) runtime.

However many (most?) languages (I’m using Python 3.7) store the lengths of strings to allow for constant time lookups. So in the case of two unequal length strings, you can simply verify len(string_1) != len(string_2) in constant time. You can verify that Python 3 does indeed make this optimization.

Now, if we’re checking the equality of two truly arbitrary strings (of arbitrary length) then it is much more likely (infinitely, I believe) that the strings will be of unequal length than of equal length. Which (statistically) ensures we can nearly always compare them in constant time.

So we can compare two arbitrary strings at O(1) amortized, with a very rare worst-case of O(n). Should we consider strings comparisons then to be O(1) in the same way we consider hash table lookups to be O(1)?

Stack Overflow, and my copy of Cracking the Coding interview cite this operation as O(n).

How can I keep time out of combat?

How can I keep time out of combat? I’m currently running Tomb of Annihilation (ToA) and I know later in the adventure I’ll need a way to keep track of how long the party has been exploring (this is for in the tomb itself).

Last time I played this as a player our DM didn’t have much of a way of keeping time which led to us (admittedly more me than the other player) constantly asking if it had been long enough for the party to take another long rest. This became even worse when my Warlock opted to not rest with the rest of the party before what she suspected was a big fight for the sake of not losing her 17 temp HP.

I’m hoping to avoid situations like the party asking when they can take another long rest by having some standardized way of keeping track of time when not in combat in a way the players can also keep track of. I thought about simply keeping initiative the whole time but that would be a highly impractical option considering that would be 14,400 rounds by which time they could explore the entire dungeon most likely.