/******************************************************************************************
PROBLEM: Sort An Array of Integers
******************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
public static int[] list;
public static void Main(string[] args)
//Load the list of integers
list = new int[]{11, 2, 5, 6 , 10, 18, 13, 500, 1, 9, 91, 11, 500};
int[] stackArray = new int[list.Count()];
int stackTop = -1;
foreach(int number in list)
if(stackTop == -1)
stackTop++;
stackArray[stackTop]=number;
}
else
bool found = false;
int targetIndex = -1;
for(int s=0; s<stackTop+1 && !found; s++)
1 2 5 6 9 10 11 11 13 18 91 500 500