What is the theoretical result of flattening a list containing only itself?

Consider the following python code

X = [None] X[0] = X 

This has many fun properties such as

X[0] == X 


X[0][0][0][0][0][0][0][0] == X 

I understand how this works from a practical standpoint, as it’s all just the same pointer.

Now, when flattening a list, we tend to convert things from

[[1, 2, 3], [[4, 5], [6, 7]], 8, 9] 


[1, 2, 3, 4, 5, 6, 7, 8, 9] 

In this case, I am considering flattening to be reducing a multi-dimensional list down to a single list of only non-list elements.

In practice, flattening this list would be impossible, as it would create an infinite loop.

This may be more mathematical in nature, but I’m unsure how to put it in mathematical terms. Suppose we could flatten this list, would the result simply be the empty list?

For context, I initially got this idea by considering the list

X = [[], []] X[0] = X 

It is clear to see that at each pass of flattening, the empty list that is the second element simply disappears. This lead me to think that the overall result, may be the empty list.

Could it be possible that flattening this list would theoretically produce an infinitely long list of the list itself, as in

X == [X, X, X, X, X, X, ..., X] 

This is purely a fun thought exercise. Any insight and discussion on this would be appreciated.

P.S. Although I’m looking for an answer in plain terms, if anyone is more mathematically inclined, I would be interested to see how this problem could be formulated in some sort of set notation. Please feel free to point me to a relevant math exchange thread as well.

P.P.S. I would also be interested in a solid proof (not formal) to go along with the answer.

Theoretical lower bound of finding number of occurrences of a target integer in a sorted array

Given a sorted array of integers and a target integer, let’s say we want to find the number of occurrences of the target integer.

It is well-known that a binary search can give time complexity $ O(\lg n) $ where $ n$ is the size of the array. For example, given an array $ [1,2,3,3,4,5]$ and a target $ 3,$ the algorithm should return $ 2$ since there are two copies of $ 3$ in the array.

Question: Is there a faster algorithms which give time complexity less than $ P(\lg n)?$ Otherwise, is there a proof to prove that $ O(\lg n)$ is the theoretical lower bound?

Theoretical question with regard to weak password based KDF & high entropy input

I know this question is theoretical however I would like some thoughts from a security perceptive.

Take this thought:

1) I generate a high entropy, cryptographically secure string of bits (256-bits of entropy) 2) I use this entropy as a password fed into a weak PBKFD, like PBKDF1 3) I use the output as a key, should I expect this key provides 256-bit entropy?

Extra question, should I instead use a strong KDF, like PBKDF2, would I then be able to expect no drop in entropy?

PBKDF2 by definition should stretch entropy right? not decrease it.


Are there any any public synchronous discussion forums (slack, discord, etc.) for Theoretical CS

I’m a 2nd year masters student studying theoretical CS (algorithms to be precise). I would like to know if there are any public synchronous discussion groups (slack, discord, etc.) on TCS. CSTheory StackExchange works well when someone has a specific question/query. I felt it would be awesome to have an online forum of people interested in TCS to discuss about various developments of the field and also talk about interesting papers and concepts.

Theoretical CS broadly encompass algorithms, complexity theory, applications of logic in CS, automata theory and also discrete math in general.

If enough people are interested we could create one in discord.

Theoretical question about Zobrist hashing and chances of collision with slight modification

I’m using zobrist hashing, but for certain positions I want to put them in the cache but make them unique. This is what I’m doing:

quint64 hash = position.zobristHash(); if (makeItUnique)     hash ^= reinterpret_cast<quint64>(this); 

Is there any reason to suppose that what I’m doing will increase the likelihood of hash collisions?

Why is it hard for theoretical computer scientists to find funding?

From Funding a Revolution: Government Support for Computing Research,

funding for theoretical computer science has declined as a percentage of the NSF budget for computing research (it constituted 7 percent of the budget in 1996, down from 20 percent in 1973)

I have heard quite often that theoretical computer scientists are starved for funding. I don’t see why, if the theoretical CS includes work relevant to all computing disciplines, that such research would not be prioritized. Are the implications of TCS research not clear or immediate enough to attract investment?

Is there some theoretical verification or explanation of why KDTree gets slower when the dimensionality gets higher?

This post and this post indicate that when the dimensionality gets higher, KDTree gets slower.

Per scikit-learn doc, the KDTree becomes inefficient as D(dimensions) grows very large (say, $ D>20$ ): this is one manifestation of the so-called “curse of dimensionality”.

Is there some theoretical verification or explanation of why KDTree gets slower when the dimensionality gets higher?

What does exactly theoretical computer science entail? [on hold]

I am confused by the term “theoretical computer science”. How can I distinguish which part of computer science are considered “theoretical” and which not?

To expand further, take Machine Learning. Is the study of Machine Learning Theoretical Computer Science? To me it is, because we are studying the computational qualities of learning, without declining our study into a particular technology or application, but usually, I hear machine learning spoken as a part of applied CS or engineering.

theoretical question about difference between transmitting stations in Bit-Map Protocol

i am wondering about the difference between the transmitting station in a bit map protocol.

for instance, if we have 8 broadcasting stations numbered 0-7, and the racing (contenting) time is $ t_0$ and the length of each broadcasting frame is $ 20t_0$

then, will there be a difference, if for instance, only station 0 wants to broadcast in each time slot and all of the other stations doesn’t want to broadcast at all(at any time slot), or the exact same thing if the only station that wants to broadcast in each time slot is station 2?

is there any difference except of the station number(both seem to be low numbers)?

curious about that

What is the theoretical relation between zoom length and guide number for a flash?

The point of a guide number is to specify the relation between aperture number and distance. For zoomable flashes there are still extensive tables considering ISO number and zoom length. The relation with ISO is straightforward (the square root of the ISO number factors into the guide number). The relation with zoom length tends to be inscrutable. Part of the reason is that zoom length and light angle are somewhat non-linearly related at wider zoom levels (should be 2 arctan (18mm/f) horizontally and 2 arctan (12mm/f) vertically with f being the 35mm equivalent). But at least at longer zoom levels, one would imagine a somewhat predictable relationship.

Assuming that the zoom head makes best use of the available light output (and for the sake of simplicity we are zoomed far enough that arctan(x)=x is a reasonable approximation) what would be the expected effect on the guide number? Whatever I come up with seems so far from the actual tables that I seriously doubt my assumptions.