1
SORT ALGORITHM
EXAMPLES
23 May 2014
Ps-Gzde ALP
2
HeapSort
Example1: Sort the following string of letters in ascending
order using heapsort.
GOODLUCK
3
Example 2: Consider the array below. Sort the following
array in ascending order using heapsort.
4
QU

Data Structures Week #7
Hashing
Outline
Motivation for Hashing
Underlying Idea
Hash Tables
Hash Functions
Separate Chaining
Open Addressing
Rehashing
21.Aralk.2011
Borahan Tmer, Ph.D.
2
Hashing
21.Aralk.2011
Borahan Tmer, Ph.D.
3
Motivation for Hashing
K

Data Structures Week #1
Introduction
Contents
A Review on C (MM Repr., Operations,
Passing to Functions, etc .)
Strings,
Arrays
Pointers
Types of Function Invocation (Call by Value,
Call by Reference)
07/11/13
Fatma Corut Ergin
2
C Program Structure
A C p

Data Structures Week #2
Algorithm Analysis
&
Recursion
Outline
Need for Efficiency
Big Oh Notation
Analysing the Algorithm
Execution Time Examples
Recurrence Examples
November 10, 2006
Fatma CORUT ERGN
2
Why we need efficient programs
An Optimisation Prob

Data Structures Week #1
Introduction
Contents
A Review on C (MM Repr., Operations,
Passing to Functions, etc .)
Strings,
Arrays
Pointers
Types of Function Invocation (Call by Value,
Call by Reference)
Math. Review
November 10, 2006
Fatma Corut Ergin
2
C P

Data Structures Week #5
Trees (Aalar)
Trees (Aalar)
Toros Gknar
21.Aralk.2010
Avrupa Gknar
Borahan Tmer, Ph.D.
2
Trees (Aalar)
21.Aralk.2010
Borahan Tmer, Ph.D.
3
Outline
Trees
Definitions
Implementation of Trees
Binary Trees
Tree Traversals & Expression

Data Structures Week #6
Special Trees
Outline
Adelson-Velskii-Landis (AVL) Trees
Splay Trees
B-Trees
21.Aralk.2010
Borahan Tmer, Ph.D.
2
AVL Trees
21.Aralk.2010
Borahan Tmer, Ph.D.
3
Motivation for AVL Trees
Accessing a node in a BST takes O(log2n) in

CSE225 Data Structures
Borahan Tmer
Fall 2008
Midterm Answers
Student Name:_
Student Number:_
Q1. (10pts)
Place relevant letters in the nodes of the following ternary tree such that an LMNR (i.e., leftmiddle-node-right) traversal on the tree will result i

CSE225 DATA STRUCTURES
2006
Borahan Tmer
SAMPLE QUESTIONS
Q1.
Consider the following piece of code!
Student Name:_
Student Number:_
long res=0;
for (i=1; i<=n; i+)
for (j=1; j<=i; j*=2)
res += (i+j);
printf(res=0, res);
long res=0;
for (i=1; i<=n; i+)
for

1
2
CSE 211: Data Structures
3
2005/2006-I
4
MIDTERM
(Open Book Exam) 90 min.
28.11.2005
Name
:
Student id :
Section
:
1. Answer the following questions:
a) [15] What is the execution time of the piece of code on the leftside, in terms of n? Justify your

CSE225 DATA STRUCTURES
2006
MIDTERM EXAM II
M.B.T.
Student Name:_
Student Number:_
1. This exam includes 7 questions.
2. This is an open-book and open-notes exam.
3. Time for this exam is 1:50 hours.
4. Out of 110 points, you are required to complete 100

Q1. (10+10= 20pts) (2013)
n
S
n
s(v , v )
i
i 1 j 1, j i
j
a) S=(1+2(n-2)(n-1)+(n-1)=(n-1)2O(n2)
V
1
Vi-1
Vi
Vi+1
V
n
b) S=2[ n(n-1)/2 + (n-2)(n-1)/2+ (n-2)(n-3)/2+3*2/2+2*1/2]
S O( n3 )
V
1
V
2
V
n
Q2. (7+12=19pts) (2013)
1
Q3. ( 5 + 10 pts)(2007)
Cons

Fct~C1
u,ru,l-
CS~ :L25
CSE225 DATA STRUCTURES
Borahan Turner
MIDTERM EXAM
Student Name:
Student Number:
r
1. This exam includes 5 questions.
2. This is an open-book and open-notes exam.
3. Time for this exam is 2 hours.
4. Do not forget to write down you

CSE225 DATA STRUCTURES Student Name:
Borahan Tamer, PhD. MIDTERM ANSWERS Student Number:
1. This exam includes 5 questions.
2. This is an open-book and open-notes exam.
3. Time for this exam is 2.5 hours.
4. You may use a calculator.
5. Do not forget to w

Data Structures Week #3
Stacks
Outline
Stacks
Operations on Stacks
Array Implementation of Stacks
Linked List Implementation of Stacks
Stack Applications
10/15/12
Borahan Tmer, Ph.D.
2
Stacks (Ynlar)
A stack is a list of data with the restriction
that dat

Data Structures Week #4
Queues
Outline
Queues
Operations on Queues
Array Implementation of Queues
Linked List Implementation of Queues
Queue Applications
5.Kasm.2009
Borahan Tmer, Ph.D.
2
Queues (Kuyruklar)
A queue is a list of data with the restriction t

Data Structures Week #3
Stacks
Outline
Stacks
Operations on Stacks
Array Implementation of Stacks
Linked List Implementation of Stacks
Stack Applications
October 5, 2015
Borahan Tmer, Ph.D.
2
Stacks (Ynlar)
A stack is a list of data with the restriction
t

Data Structures Week #1
Introduction
Components of a Computer and
their Interconnections
October 5, 2015
Borahan Tmer, Ph.D.
2
Goals
We will learn methods of how to
(explicit goal) organize or structure large
amounts of data in the main memory (MM)
consid

Data Structures Week #4
Queues
Outline
Queues
Operations on Queues
Array Implementation of Queues
Linked List Implementation of Queues
Queue Applications
October 5, 2015
Borahan Tmer, Ph.D.
2
Queues (Kuyruklar)
A queue is a list of data with the restricti

1
HEAP EXAMPLES
7 May-9 May 2014
Ps-Gzde ALP
2
Max-Min heap
Max Heap:
Min Heap:
3
Max-Heap Build Heap
Example 1: Construct a binary max-heap using the following sequence of
numbers show heap in each step.
15,7,12,28,36,1,37,13,4,25,3,9,27,2,5,16
4
Max-Hea

Data Structures Week #7
Hashing
Outline
Motivation for Hashing
Underlying Idea
Hash Tables
Hash Functions
Separate Chaining
Open Addressing
Rehashing
October 5, 2015
Borahan Tmer, Ph.D.
2
Hashing
October 5, 2015
Borahan Tmer, Ph.D.
3
Motivation for Hashin

Data Structures Week #6
Special Trees
Outline
Adelson-Velskii-Landis (AVL) Trees
Splay Trees
B-Trees
October 5, 2015
Borahan Tmer, Ph.D.
2
AVL Trees
October 5, 2015
Borahan Tmer, Ph.D.
3
Motivation for AVL Trees
Accessing a node in a BST takes O(log2n

1
GRAPH ALGORITHM
EXAMPLES
Ps-Gzde ALP
2
DFS Algorithm
Example 1: Apply DFS(Depth First Search) algorithm starting at vertex e.
Visit adjacent vertices obsorving the alphabetical order.
3
Result:
4
Example2: Apply the above graph topological sort using t