Monday, March 28, 2011

Exercise 12, Task 1

To add or extract elements from a queue, the functions below were used:

function q = insert(cell,queue)
i=size(queue,1)+1;
queue(i,:)=cell;
q = queue;
end


function [val,q] = retrieve(queue)
val = queue(1,:);
q = queue(2:(size(queue,1)),:);
end

No comments:

Post a Comment