I need an algorithm that manipulates a linear list of the FILA type. (In PASCAL, or it can be done in pseudo-code, or C, or whatever is preferable).
The algorithm must take an element from the queue, remove it, and insert this element at the beginning. The vector that holds the queue must be rearranged (since if you remove the element from the middle, you break the queue).
The ROW is circular, it comes back on itself, I will leave below the structure of the stack made in PASCAL:
type
ElementosF = integer; //tipo de dado que a fila ira receber
fila = record
memoria:array[1..TAMF] of ElementosF; //memoria da fila
final,inicio,total:integer; //ultimo, primeiro, total de elemento da fila
end;
Doubt is, how do I do this? I tried in several ways, and all failed ... Thanks