O
Ofri Cachlon
Guest
Hey everyone,
i need help with a question in recursion.
i need to chack if in queue the order is sorted from big to small
i have a problem with my code. i know what the problem but i didnt know how to solve it.
Thanks in advance
by the way the class Queue isn't from System.Collections.Generic.
public static bool REolea(Queue<int> q)
{
int x = q.Remove();
if (q.IsEmpty())
{
q.Insert(x);
return false;
}
if (x<q.Head())
{
q.Insert(x);
return true;
}
q.Insert(x);
bool work = REolea(q);
return work;
}
Continue reading...
i need help with a question in recursion.
i need to chack if in queue the order is sorted from big to small
i have a problem with my code. i know what the problem but i didnt know how to solve it.
Thanks in advance
by the way the class Queue isn't from System.Collections.Generic.
public static bool REolea(Queue<int> q)
{
int x = q.Remove();
if (q.IsEmpty())
{
q.Insert(x);
return false;
}
if (x<q.Head())
{
q.Insert(x);
return true;
}
q.Insert(x);
bool work = REolea(q);
return work;
}
Continue reading...