Professional Documents
Culture Documents
0.2 IntroductionToDSA Slides
0.2 IntroductionToDSA Slides
• A data structure is
• an arrangement of data
• in a computer’s memory (or sometimes on a disk).
Flowchart:
begin x := a
Natural language:
Pseudo-code:
find max(a,b,c) function max(a,b,c) True
• Assign x = a Input: a, b, c b>x x := b
• If b great than x then assign Output: max(a,b,c)
x=b x = a; False
• If c great than x then assign c>x
if b > x then x = b;
x=c; if c > x then x = c; False True
• Result: x => max(a,b,c) return x;
end x := c
{ {
private double balance; // account balance public static void main(String[] args)
{
// constructor
BankAccount ba1 = new BankAccount(100.00); //
public BankAccount(double openingBalance)
create acct
{ balance = openingBalance; }
public Y Y Y Y
protected Y Y Y N
no modifier Y Y N N
private Y N N N
THURSDAY, 07 SEPTEMBER 2023 26
Feature of OOP
• Inheritance
• Extend existing class
• Data Encapsulation
• Hide data access from outside
• Data Abstraction
• Hide implementation from outside
• Polymorphism (Overriding)