Numa lista, a ordem dos elementos depende exclusivamente da ordem de inserção ((o último elemento registado encontra-se no final da lista).
//
In a list, the order of elements depends exclusively on the order of insertion (the last recorded element is at the end of the list).
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.pop(); p.push(5); p.top(); p.push(2); p.pop();p.top()
Qual a resposta à sétima 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.pop(); p.push(5); p.top(); p.push(2); p.pop();p.top()What is the answer to the seventh operation?
Seja list uma lista ordenada vazia. Esta lista é de valores inteiros e está ordenada de forma crescente. Se for realizada a seguinte sequência de operações:
list.add(5); list.add(10); list.add(3); list.add(15); remove(1); list.add(8)
Qual a sequência que representa a lista ordenada resultante?
-----
Let list be an empty sorted list. The list is of integer values and it is sorted in ascending order. Consider the following sequence of operation on list:list.add(5); list.add(10); list.add(3); list.add(15); remove(1); list.add(8))What sequence represents the final configuration of list?
Seja list uma lista vazia, na qual é realizada a seguinte sequência de operações:
list.addLast(10); list.addFirst(5); list.add(0,3); list.add(3,15); remove(1); list.add(2,8)
Qual a sequência que representa a lista resultante?
-----
Let list be an empty list. Consider the following sequence of operations on list:
list.addLast(10); list.addFirst(5); list.add(0,3); list.add(3,15); remove(1); list.add(2,8)
What sequence represents the final configuration of list?
A complexidade temporal no pior caso do método algoritmoX é O( n ).
//
The worst-case time complexity of the method algoritmoX is O( n ).
public int algoritmoX(int[] vec){ int n = vec.length-1; return algoritmoXAux(vec, 0, n); } private int algoritmoXAux(int[] vec, int low, int high){ if (low>=high) return vec[high]; int mid = (low+high)/2; if (vec[mid] % 2 == 0) return algoritmoXAux(vec, low, mid); else return algoritmoXAux(vec, mid+1, high); }
Match each IATA Special Load Code with its corresponding description.
Which option correctly describes the roles of IATA’s cargo initiatives?
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)); }
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.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.