

















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















































public interface Stack { public void push(Object x); public void pop(); public Object top(); public boolean isEmpty(); public void clear(); }
a
b
c
d
e
Pop operation:
Last element that was pushed is the first to be popped.
public interface Queue { public void enqueue(Object x); public Object dequeue(); public boolean isEmpty(); public void clear(); }
back front
y^ k^ r^ q^ c^ m
Enqueue operation:
back front y k r q c m
Enqueue operation:
a
b
c
Linked representation. All operations constant time, or O(1).
a b c
top
Now to Trees
root
leaves