public IActionResult OrdenacaoPorInsercao([FromBody] IList <string> lista) { var stopwatch = new Stopwatch(); stopwatch.Start(); for (int atual = 0; atual < lista.Count; atual++) { int analise = atual; int menor = Auxiliares.bucaMenor(lista, analise); Auxiliares.trocar(lista, atual, menor); } stopwatch.Stop(); return(Ok(new { stopwatch.Elapsed, lista })); }
public IActionResult OrdenacaoPorSelecao([FromBody] IList <string> lista) { var stopwatch = new Stopwatch(); stopwatch.Start(); for (int atual = 1; atual < lista.Count; atual++) { int analise = atual; while (analise > 0 && Auxiliares.EMenorQue(lista[analise - 1], lista[analise])) { Auxiliares.trocar(lista, analise - 1, analise); analise--; } } stopwatch.Stop(); return(Ok(new { stopwatch.Elapsed, lista })); }