public List <int> PushDisksBackTotheStack(StackOfDisks s, List <int> disks) { for (int i = disks.Count - 1; i >= 0; i--) { s.push(disks[i]); } return(disks); }
public List <int> InsertDiskIntoAStack(StackOfDisks s, int diamterOfDisk, bool putdown) { List <int> disks = new List <int>(); while (true) { int d = s.pop(); if (d < diamterOfDisk) { disks.Add(d); } else { s.push(d); // Put the bigger disk back to stack if (putdown) { s.push(diamterOfDisk); // put the diskN to the stack } break; } } return(disks); }