list, queue, stack

버전 1.1.0.0 (6.31 KB) 작성자: Zhiqiang Zhang
implement the list, queue, stack data structures in matlab
다운로드 수: 5.1K
업데이트 날짜: 2011/5/5

라이선스 보기

The files implement the list, queue, stack data structures in matlab, and the queue and stack are a litter faster than the java's alternatives.

CStack define a stack data strcuture

It likes java.util.Stack, however, it could use CStack.content() to
return all the data (in cells) of the Stack, and it is a litter faster
than java's Stack.

s = CStack(c); c is a cells, and could be omitted
s.size() return the numble of element
s.empty() return whether the stack is empty
s.push(el) push el to the top of stack
s.pop() pop out the top of the stack, and return the element
s.top() return the top element of the stack
s.remove() remove all the elements in the stack
s.content() return all the data of the stack (in the form of a
cells with size [s.size(), 1]

CQueue define a queue data strcuture

It likes java.util.Queue, however, it could use CQueue.content() to
return all the data (in cells) of the Queue, and it is a litter faster
than java's Queue.

q = CQueue(c); c is a cells, and could be omitted
s.size() return the numble of element
s.empty() return whether the qeueu is empty
s.push(el) push el to the top of qeueu
s.pop() pop out the the beginning of queue, and return the element
s.front() return the the the beginning element of the qeueu
s.back() return the the the rear element of the qeueu
s.remove() remove all data from the queue
s.content() return all the data of the queue (in the form of a
cells with size [s.size(), 1]

update 2011-05-05
1. add an method "isempty" to determine if the stack and queue is emtpy, and the method "emtpy" is to remove the content of the stack and queue. (thanks to Vojtech)
2. throw a warning when top an empty stack, and back, front an empty queue. throw an error when pop an empty stack and queue. (Thanks to Derek)

인용 양식

Zhiqiang Zhang (2024). list, queue, stack (https://www.mathworks.com/matlabcentral/fileexchange/28922-list-queue-stack), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2010b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Oil, Gas & Petrochemical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

1. add an method "isempty"
2. throw a warning when top an empty stack, and back, front an empty queue. throw an error when pop an empty stack and queue. (Thanks to Derek)

1.0.0.0