Review: Map (Dictionary) ADT
Map ADT operations
CS515
!
!
!
Insert
Find
erase
Store entries of data value associated with keys
! Data Values : any type
! Keys : any comparable type
Hashing
2
Map Implementation:
"
Linked List
Skip List
BST
AVL Tree
2-3-4 T
Binary Search Tree - Review
All BST operations are O(h), where h is tree height
Minimum height is h = !log N#
"
$
!
CS515
!
2
for a binary tree with N nodes.
What is the best and worse case for h ?
Thus:
!
!
AVL Trees
Best case running time of BST operati
Summary of the performance of symbol-table implementations
Performance comparison
Order of growth of the frequency of operations.
typical case
CS515
implementation
search
red-black BST
Tries
insert
delete
log N
log N
log N
1
ordered
operations
operatio
on
!
CS515
Previously studied sorting algorithms in
CS416
"
"
"
"
Sorting
!
!
Selection sort
Insertion sort
Bubble sort
Merge sort
In-place sort: sort that needs a single array
Stable sort: sort that maintains the relative
ordering of items with the same key
Threaded Binary Tree
Threaded Binary Tree
In a linked representation of a binary tree, the number
of null links (null pointers) are actually more than nonnull pointers.
Consider the following binary tree:
Threaded Binary Tree
In above binary tree, there a
Heap Sort
You may have noticed that in a max heap, the largest value can easily be removed
from the top of the heap and in the ensuing siftDown() a 'free' slot is made available at
what was the end of the heap. The removed value could then be stored in th
CSCI-1200 Data Structures Spring 2015
Lecture 21 Operators & Friends
Review from Lecture 20
Last piece of ds_set: removing an item, erase
Tree height & tree height order notation
Todays Lecture
Finish last lecture!
Limitations of our ds set implementa
Classes
The fundamental ideas behind classes are
data abstraction and encapsulation.; A class
using data abstraction and encapsulation
denes an Abstract Data Type (ADT).
Classes are often called user-dened types.
C+ uses class (and struct) to describe
c
Optimization problems
CS515
!
!
Greedy Algorithm
Divide and Conquer
And
Dynamic Programming
An optimization problem is one in which
you want to find, not just a solution, but the
best solution
E.g. Huffman Code
2
Greedy Algorithm
!
Huffman Code
A greedy a
ZYNELEME
(RECURSION)
1
2
ZYNELEME(RECURSION)
Kendi kendisini dorudan veya dolayl olarak aran
fonksiyonlara zyineli (recursive) fonksiyonlar ad verilir.
zyineleme bir problemi benzer ekilde olan daha basit alt
problemlere blnerek zlmesini salayan bir tekni