Complexity of the cycle while Average, better, worse case

int()A;
int L=A.length-1;
int index=(L-1)/2;

int k=2*index+1;
while(k

how to make matrices that grow with each cycle

Utopian trees grow in a particular way in two cycles:

every spring doubles its size
a meter grows every summer
If Laura plants a three-foot utopian tree in late autumn, what would be her height after N cycles?

Some examples:

if N = 0, its height will be 1 meter (nothing grew)
if N = 1, its height will be 2 meters (doubled the height in spring)
if N = 2, its height will be 3 meters (one meter grew in summer)
if N = 3, its height will be 6 meters (double the height the following spring)
It's like that …
Write the heightTreeUtopica function, which uses several growth cycles, and returns the resulting height of Laura's tree.

Interaction design: Should the cycle be stopped / paused through a list at the end of the list?

Scroll through a list of items It is a common user interface design pattern.

For example:

  • Browser address bar: keep Up or Down to scroll through the list of websites.
  • On-screen keyboard: keep Left or Right to select a password.
  • Operating system application switch: press and hold the keys to scroll through a list of all open windows or applications:
    • Windows: AltTongue
    • Mac: Tongue

After touching the end of the list, the selection cursor can usually return to the beginning. But should the next cycle occur immediately and without problems? Or after a pause or subsequent action?

This question refers to what should happen when you are holding the key and the list selection cursor reach the end of the list.

There are two frequently used behaviors:

  • The cycle stops or pauses At the end of the list. Press and hold the key again, in any direction, to restart the cycle.
  • The cycle fits smoothly to the other side of the list and continue by bicycle.

These behaviors can be easily compared through the Mac and iOS application switches:

When you to hold Tongue:

  • The macOS application switch stops at the end of the list, until you manually restart it:

    macOS application switch

  • The iOS application switch adjusts and cycles continuously:

    IOS application switch


What behavior is preferable?

What are the advantages and disadvantages of continuous cycling in front of a stop / pause?

computer architecture – A question about the pipeline cycle

This is my question, I am so confused with my answer that I am looking for help!
enter the description of the image here

This is my answer:
enter the description of the image here
However, the instructor said that if an instruction is waiting before the ID, the next IF phase instruction must start in 6th place in the 3rd (what I did)

Therefore, I am looking for help and I want someone to discuss and verify the idea with me. Thank you very much for the help!

For example, which of the two IFs is appropriate?

unit: why does the while cycle not stop the corutin?

I am trying to find a way to pause the game the whole game. timeScale = 0f does not work in routines.

I have this script that stops the game on the escape key:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class BackToMainMenu : MonoBehaviour
{
    public static bool gamepaused = false;

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            gamepaused = true;
            Time.timeScale = 0f;
        }
    }
}

And a script with a routine:

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;

    void Start()
    {
        if (depthOfFieldRoutineRef != null)
        {
            StopCoroutine(depthOfFieldRoutineRef);
        }

        playerAnimator = player.GetComponent();

        AnimationClip() clips = playerAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        var depthOfField = postProcessingProfile.depthOfField.settings;
        depthOfField.focalLength = 300;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, clipLength));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }

    IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)
    {
        while(BackToMainMenu.gamepaused)
        {
            yield return null;
        }

        playerLockMode.PlayerLockState(true, true);

        float counter = 0f;

        while (counter < duration)
        {
            var dof = postProcessingProfile.depthOfField.settings;

            if (Time.timeScale == 0)
                counter += Time.unscaledDeltaTime;
            else
                counter += Time.deltaTime;

            float val = Mathf.Lerp(fromVal, toVal, counter / duration);

            dof.focalLength = val;
            postProcessingProfile.depthOfField.settings = dof;

            yield return null;
        }

        playerAnimator.enabled = false;
        dephOfFieldFinished = true;
        depthOfFieldRoutineRef = null;
    }
}

But when I press the escape key, the freeze for a second or two, but then the blur effect in this script continues and then continues to run the game after this part of the script. It seems that TimeScale is not pausing the game at all, but only for a few seconds, if it does. Or pausing just a few things.

What I want is to pause the whole game. Maybe I should use a game state somehow? I don't want to disable / enable game objects in the hierarchy.

I checked it again now. For example, the player cannot move it with the keys, but I can turn the player looking around with the mouse while I am in pause mode. But other things are leisurely like other npc. I have stopped moving (without using animation). Then some things are leisurely but others are not.

What exactly is the logic behind 6502 and the precise emulation of the clock cycle?

Key questions to consider based on page 10 of this document:

http://archive.6502.org/datasheets/rockwell_r650x_r651x.pdf

  • What does page 10 mean by "Add 1 to N if the page boundary is crossed"?
  • What does page 10 imply "Add 1 to N if a branch occurs on the same page?"
  • What does it mean to add 2 to N if the branch occurs on a different page?
  • Does reading and writing on other devices, ie RAM, cause any irregularity in the clock cycles?
  • Are there other factors that could affect the clock cycles in 6502 (more specifically the NES)?

datetime – Cycle for in python test generator

I am doing a python exam calendar generator and I am barely getting involved with the language, I need my algorithm to work as follows, I give it a date and that date has to go 6 days ago, in case there is a Saturday or Sunday should run another day, so far I have this:

from datetime import date,timedelta

fecha_final = date(2019, 1, 15)
fecha_inicial = fecha_final - timedelta(days=6)

i = 1
fecha_nueva = fecha_inicial


for i in range(i < 6):

if fecha_nueva.weekday() == 5:
    print("No hay examen el: " + fecha_nueva)
    fecha_nueva = fecha_inicial + timedelta(days=i)

if fecha_nueva.weekday() == 6:      
    print("No hay examen el: " + fecha_nueva)
    fecha_nueva = fecha_inicial + timedelta(days=i)

else:
    i +=1
print("final")

However, I can't detect when it's Saturday or Sunday

Consult Firebase in each cycle of an array map

I have an array and I run it with a map to render some components

const list = ({'id':1,'name':'a'},{'id':2,'name':'b'},{'id':3,'name':'c'})

list.map(item=>{
  return 
})

This works perfect for me. But now I need to make a query to firebase in each cycle of the map, and send the result of that query

list.map(item=>{

  let firebasedata=()
  var ref = database.ref('example');
  //acá hago la consulta a Firebase por cada cíclo del map, me devuelve un array y lo guardo en firebasedata para enviarlo como props en cada 

  ref.orderByChild('id').equalTo(item.id).on('value', snapshot => {
    snapshot.forEach(x=> {
      firebasedata.push(x.val())
    }); 
    console.log(firebasedata) //acá me muestra cada array de cada consulta en los ciclos
  });

  console.log(firebasedata) //pero acá sólo obtengo arrays vacíos, y al momento de enviarlo como props en el return del  también llega vacío el array

  return   //firebasedata está vacío por cada 
})

How could I make the query in each iteration of the map and send that answer to each as props?

Hamiltonian cycle, verify and find

If we have an algorithm that in polynomial time says that if a G chart has a Hamiltonian cycle, can we have an algorithm that finds a Hamiltonian cycle in polynomial time?

Could the check again function in the Verified List indicate in which cycle it is activated?

Hi sven I hope you are having a good weekend. :]
Anyway, is there any way in which GSASER can indicate which reverification cycle depends?
This can be useful when aborting …
Thank you…