## Probability of terminating in a state in a probabilistic algorithm

Suppose i have a circular array of $$n$$ elements. At time $$t=0$$ i am in position 0 of the array. The algorithm moves left or right with probability $$p=1/2$$ (since the array is circular when it moves left from 0 it goes to position $$n$$). When i visited all the positions at least once the algorithm returns the position it terminated into.
Launching the algorithms many times shows that it stops with the same probability in any of the n positions (except for zero obviously). How do i demonstrate that the probability of ending up in each state is uniform?
My understanding is that this process is explained by a doubly stochastic Markov chain, but is there a theorem i can quote about this specific case?

## Quantum Computing: understanding the state vector

I have just started to learn QC. It is said that

The quantum state of N qubits can be expressed as a vector in a space of dimension 2^N

If there is 1 qubit then we have two possible state vectors |0> and |1> or (0,1) and (1,0) respectively. Getting to 2 qubits we have 4 possible state vectors `(1,0,0,0), (0,1,0,0), (0,0,1,0) and (0,0,0,1)`. Note that in each case, all entries are zero except 1. The point I am trying to get to is that:

1. 2^N seems like a big space but given a vector in this space – all components will be zero except 1. So there are only 2^N possible values the state vector can take. Is this not correct? If not, why?

1. Why don’t we say the space is N dimensional. A N-bit string has 2^N possible values.

## Why the state of the duration is all the time 7 even if updating the state inside the while in the ienumerator?

I want to get the current coroutine state.

``using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.PostProcessing;   public class DepthOfField : MonoBehaviour {     public UnityEngine.GameObject player;     public PostProcessingProfile postProcessingProfile;     public bool dephOfFieldFinished = false;     public LockSystem playerLockMode;      private Animator playerAnimator;     private float clipLength;     private Coroutine depthOfFieldRoutineRef;     private DepthOfFieldModel.Settings depthOfField;     private DepthField state;      void Start()     {         if (depthOfFieldRoutineRef != null)         {             StopCoroutine(depthOfFieldRoutineRef);         }          playerAnimator = player.GetComponent<Animator>();          AnimationClip[] clips = playerAnimator.runtimeAnimatorController.animationClips;         foreach (AnimationClip clip in clips)         {             clipLength = clip.length;         }          DepthOfFieldInit(clipLength);          state = new DepthField();     }      public void DepthOfFieldInit(float duration)     {         depthOfField = postProcessingProfile.depthOfField.settings;         depthOfField.focalLength = 300;         StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, duration));         postProcessingProfile.depthOfField.settings = depthOfField;     }      public IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)     {         playerLockMode.PlayerLockState(true, true);          float counter = 0f;          while (counter < duration)         {             var dof = postProcessingProfile.depthOfField.settings;              counter += Time.deltaTime;              float val = Mathf.Lerp(fromVal, toVal, counter / duration);              dof.focalLength = val;             postProcessingProfile.depthOfField.settings = dof;              state.duration = duration;             state.focalLength = val;              yield return null;         }          playerAnimator.enabled = false;         dephOfFieldFinished = true;         depthOfFieldRoutineRef = null;     }      public struct DepthField     {         public float focalLength;         public float duration;     }      public void Save()     {         SaveGame.Save("depthoffieldstate", state);     }      public void Load()     {         Time.timeScale = 1f;         depthOfField = postProcessingProfile.depthOfField.settings;         DepthField state = SaveGame.Load<DepthField>("depthoffieldstate");         depthOfField.focalLength = state.focalLength;         StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, state.duration));         postProcessingProfile.depthOfField.settings = depthOfField;     } } ``

Inside the while loop I’m doing :

``state.duration = duration; state.focalLength = val; ``

The focalLength value does change if for example I save onethe game start the focalLength value will be 299 and if I will save after the coroutine has finished the focalLength value is 1.

But the coroutine duration value is not changing it keep staying on 7 when saving even if the coroutine has finished and should be 0 it still 7.

The value 7 of the duration is coming from the clipLength.

1. I can’t get the current duration time of the coroutine.

2. In the Load function I’m starting the coroutine over again but since I’m using the loaded focalLength value and duration value it should look like the coroutine is continue from the last saved point. But I can’t get the correct duration value when saving.

## What is the current state of author recognition software and what can be done about it?

I’m curious what the current state of author recognition software is, i.e. software that detects the author of a certain anonymous text based on a certain pool of texts obtained from elsewhere. This could identify people in dangerous positions like critics of a government or whistle blowers even if they have been totally careful in terms of security otherwise.

I found this question but it is quite old now: https://softwareengineering.stackexchange.com/questions/203133/how-advanced-are-author-recognition-methods

Some articles (Software Helps Identify Anonymous Writers or Helps Them Stay That Way and The Analysis Software That Wrecked J.K. Rowling’s Anonymity) are also old but portray a more scary world than the stackexchange answer.

I imagine recent years with machine learning becoming far more popular and powerful have done a lot to make software like this much more reliable than back in 2013.

So how reliable is this nowadays and what would be appropriate measures to take against it?

## Should you save the state in a page with infinite scrolling?

• I have a page with infinite scrolling on it.
• I display news in descending order of time and new items keep coming in
• When people go to the bottom of the page, they load more items automatically and this goes on till my database is not exhausted
• I also have a search bar at the top of my page letting people search news
• Here is my concern, user loads page, user scrolls down 4 pages
• User types something in search box, the 4 pages are completely gone and we have 50 new results instead relevant to the user’s search
• User clears search, now we load 50 default items once again

Should I save the state of the page when user jumps between searches?

• Example, user loads page, goes down 4 pages
• User types “Election news” in the search box, default state is stored in local storage with 200 results
• User searches “UK news” in the search box, election news with 50 items is stored in local storage
• user clears search box
• Default 200 items loaded from local storage instantly

## How to implement program with better state machines performance?

Could I get best performance than I already obtain with automata using better than state machines performance in a common case?

## What are the consequences for a Warforged that does not spend 6 hours in its inactive state?

In the Wayfinder’s Guide to Eberron (p. 68-69 – the version quoted here is as it appears in UA: Eberron Races), a Warforged has the two following traits:

Sentry’s Rest. When you take a long rest, you must spend at least six hours in an inactive, motionless state, rather than sleeping. […]

Warforged Resilience. […] You don’t need to sleep and don’t suffer the effects of exhaustion due to lack of rest, […]

(Wayfinder’s Guide to Eberron, emphasis mine)

While Sentry’s Rest states the rest must be taken, Warforged Resilience seems to indicate there is no penalty for not doing so.

What are the actual consequences for a Warforged that does not go inactive during a long rest?

## Why does this finite state machine state transition diagram solution has more states than my solution?

I can’t figure out what is wrong with my solution and why does it differ from book’s solution. I think the only thing that matters is the previous state of A so that there should be two states, one for previous A=0 and one for previous A=1. Where am I mistaken? I would really appreciate any explanation.

## Initial state of checkboxes for basic list filtering

I’m developing a web application which features a list of items. The list can be filtered by type, and the user can choose to view one or more types at once. Let’s say the types are Red, Green, Blue, and Yellow.

My idea was to use checkboxes, one for each type, so that e.g. when Blue and Yellow is selected, then the list contains the sum of these two. Basic logic.

Now, the default view is as above: no type is selected. In the app’s logic, this is treated the same as selecting all types – in other words, all items are visible on the list. The user can now click on the type they’re interested in, and the list will only contain that.

Is this an intuitive approach?
Or maybe all the checkboxes should be selected on init instead?
Or perhaps a completely different mechanic should be used in place of checkboxes?

I couldn’t decide and made a list of pros and cons:

• All checkboxes empty on init
• 🙂 One click required to filter by one given type
• 🙁 It doesn’t make much sense that nothing checked means all shown
• All checkboxes checked on init
• 🙁 Three clicks required to filter by one given type
• 🙂 Makes more sense that all checked means all shown

I’m not sure if my reasoning is correct. Looking at shops which let you e.g. select a laptop brand, it’s normal for them to start with all options unchecked. But since my app’s list is rather short and filtering results are immediate, I’m not sure if any of these approaches is better than the other, or maybe I’m missing a better way.

## How do I prove a PDA with a single active accept state is decidable?

How do I prove a PDA with a single active accept state is decidable?

PDA has multiple possible accept states but only ends up using one of them.