Rename year directories to allow natural ordering

This commit is contained in:
2023-12-20 03:57:27 +00:00
parent 0ab1f5ad3a
commit 1f7d812b98
1895 changed files with 0 additions and 7188 deletions

View File

@ -0,0 +1,28 @@
function[push, pop, peek] = mystack()
% function to return handles to the subfunction push, pop, & peek
push = @push;
pop = @pop;
peek = @peek;
end
function [stack] = push(stack, value)
% function to push a value onto the stack at location 1 and return the
% stack
stack = [value; stack];
end
function [stack] = pop(stack)
% function to pop the value at location 1 off the stack and return the
% stack
stack(1) = [];
end
function [value] = peek(stack)
% function to return the top value from the stack (arrau location 1)
% returns NaN if there is no value at location 1
if isempty(stack)
value = NaN;
else
value = stack(1);
end
end

View File

@ -0,0 +1,13 @@
% test script as specified in assignment spec
[push, pop, peek] = mystack();
stack = []
stack = push(stack, 100)
stack = push(stack, 200)
peek(stack)
stack = pop(stack)
peek(stack)