Introduction To Data Structures & Algorithms
Introduction To Data Structures & Algorithms
• files • records
• lists • trees
• arrays • tables
Natural language:
find max(a,b,c)
• Assign x = a Flowchart:
• If b great than x then assign
x=b
begin x := a
• If c great than x then assign
x=c;
• Result: x => max(a,b,c) True
b>x x := b
Pseudo-code:
function max(a,b,c) False
c>
Input: a, b, c x
Output: max(a,b,c) True True
x = a;
if b > x then x = b; end x := c
if c > x then x = c;
return x;
Data Structures and Algorithms in Java 9/10
Data Structures and Algorithms
• Most algorithms operate on data collections,
so define
• Collection Abstract Data Type (ADT)
– Methods
• Constructor / Destructor
• Add / Edit / Delete
• Find
• Sort
• ….