public static void gerarNumeros(int tamanhoLista, int[] lista){
Random rnd = new Random();
public static void numDecrescente(int[] lista, int tamanhoLista){
while (ordenada == false ) {
int c = lista[x + deslocamento];
while (c <= e && x + deslocamento < tamanhoLista) {
deslocamento = deslocamento + 1;
c = lista[x + deslocamento];
lista[x + deslocamento] = e;
public static void selectingSort(int[] lista){
int minimiumValueFound= 0;
for(int mainIndex = 0; mainIndex < lista.Length; mainIndex++){
for(int remaingIndex = mainIndex + 1; remaingIndex < lista.Length; remaingIndex++){
if(lista[remaingIndex] < lista[minIndex]){
minimiumValueFound = lista[minIndex];
lista[minIndex] = lista[mainIndex];
lista[mainIndex] = minimiumValueFound;
public static void ordemDecrescente (int[] lista){
for(int i = 0; i < lista.Length - 1; i++) {
for (int j = i + 1; j < lista.Length; j++) {
if (lista[i] < lista[j]) {
foreach(int value in lista)
public static void Main()
int[] lista = new int[5];
Console.WriteLine("numeros gerados aleatoriamente: ");
gerarNumeros (tamanhoLista, lista);
Console.WriteLine("Ordeando por selectign sort:");
for(int i =0; i < lista.Length; i++){
Console.WriteLine("Ordeando descrescentes: ");
numDecrescente(lista, tamanhoLista);