logo

Crowdly

Browser

Add to Chrome

Algoritmos e Estruturas de Dados - LEI 2026-2027

Looking for Algoritmos e Estruturas de Dados - LEI 2026-2027 test answers and solutions? Browse our comprehensive collection of verified answers for Algoritmos e Estruturas de Dados - LEI 2026-2027 at moodle.fct.unl.pt.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Qual é a complexidade temporal do método algoritmoX, se vec está totalmente preenchido e tem k elementos?  //

What is the time complexity of the method algorithmX, if the array vec is full and has k elements?

     public int algoritmoX(int[] vec, int n){

        int comp = vec.length-1;

        return algoritmoXAux(vec, 0, comp, n);

     }

    

     private int algoritmoXAux(int[] vec, int low, int high, int n){

        if (low>high)

            return 0;

        if (low == high) {

            boolean res = vec[high] == n;

            if (res) return 1;

            else return 0;

        }

       

        int mid = (low+high)/2;

        return Math.min(algoritmoXAux(vec, low, mid, n), algoritmoXAux(vec, mid+1, high, n));

    }

100%
0%
0%
0%
0%
View this question

Remover um elemento de uma lista ordenada altera necessariamente a ordem dos restantes elementos.

//

Removing an element from an ordered list necessarily changes the order of the remaining elements.

0%
100%
View this question

O último elemento inserido numa fila é sempre o primeiro a ser removido.

//

The last element inserted into a queue is always the first to be removed.

0%
100%
View this question

O TAD Stack tem o comportamento

//

The Stack ADT has the behavior

View this question

Seja p uma pilha vazia. Após a execução da seguinte sequência de operações

p.push(2); p.push(5); p.pop(); p.push(2); p.top(); p.push(5); p.top(); p.push(2); p.pop();p.top()

Qual a resposta à quinta operação?

-----

Let p be an empty stack. Consider the following sequence of operations on p:

p.push(2); p.push(5); p.pop(); p.push(2); p.top(); p.push(5); p.top(); p.push(2); p.pop();p.top()

What is the answer to the fifth operation?

View this question

Uma lista pode conter elementos repetidos.

//

A list can contain repeated elements.

100%
0%
View this question

Qual a complexidade temporal no pior caso do método fatorial? //

What is the worst-case time complexity of the method fatorial?

public static long fatorial(int n) {

if (n < 0)

throw new IllegalArgumentException();

if (n == 0 || n == 1)

return 1;

else

return n * fatorial(n - 1);

}

0%
0%
100%
0%
0%
View this question

Numa lista ordenada, um elemento pode ser inserido em qualquer posição escolhida pelo utilizador.

//

In an ordered list, an element can be inserted at any position chosen by the user.

0%
100%
View this question

Indique se a seguinte afirmação é verdadeira ou falsa.

Um algoritmo que tem tempo de execução T( n ) = 1000n+ n 2 +10  tem complexidade temporal O ( n2 )

//

Indicate whether the following statement is true or false.

An algorithm that has a running time of T( n ) = 1000n+ n 2 +10 has time complexity O ( n2 )

100%
0%
View this question

Qual a complexidade temporal do método allDiff no pior caso? //

What is the worst-case time complexity of the method allDiff?

/**

*

* @param numbers : an array that is filled up to position n-1

* @return true iff all the numbers are different

*/

public static boolean allDiff(int[] numbers,int n) {

int i=0;

while (i<n && diff(numbers[i],numbers,i,n))

i++;

return i==n;

}

private static boolean diff(int number, int[] numbers, int pos, int n) {

int i=pos+1;

while (i<n && number!=numbers[i])

i++;

return i==n;

}

100%
0%
0%
0%
0%
View this question

Want instant access to all verified answers on moodle.fct.unl.pt?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome