# Recursion in queue C#

• ### Question

• 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.

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;
}

{
q.Insert(x);
return true;
}
q.Insert(x);
bool work = REolea(q);
return work;
}```

Saturday, February 22, 2020 7:41 PM

### All replies

• I am not sure what the question is but I think something I would do is to put Debug.WriteLine calls in strategic places to see what happens.

Sam Hobbs
SimpleSamples.Info

Saturday, February 22, 2020 9:24 PM
• 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.

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;
}

{
q.Insert(x);
return true;
}
q.Insert(x);
bool work = REolea(q);
return work;
}```

Nothing you've presented here helps anyone understand what you're doing or what you want.

What exactly is Queue?  Show code.

What exactly is the problem that you "know about but not how to fix?"

If you want to keep hiding everything, look up ISortable<T>

Sunday, February 23, 2020 7:58 PM
• by the way the class Queue isn't from System.Collections.Generic.

Why do you say that? We know what the Queue class is or at least we can look it up. So is there something you are trying to say that is not obvious?

Sam Hobbs
SimpleSamples.Info

Sunday, February 23, 2020 8:30 PM
• I deleted my previous reply.

The important thing is that it is better to wait for the person asking for help to clarify things. Discussions like this always become large when the person asking for help does not clarify things and others try to guess.

Sam Hobbs
SimpleSamples.Info

Monday, February 24, 2020 12:45 AM