

















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of binary search trees and stacks in computer science. It covers the basics of stack and queue interfaces, their lifo and fifo properties, and their implementation using arrays and linked lists. The document also introduces binary trees, their definitions, and implementation using an array. It discusses binary tree traversals, including inorder, preorder, postorder, and level order traversals. The document concludes with some facts and questions about trees and an introduction to big-o notation.
Typology: Slides
1 / 57
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