Chapter 1 - Intro To Data Structure
Chapter 1 - Intro To Data Structure
Chapter 1 - Intro To Data Structure
8 fundamental types
int : 32-bit signed two’s complement integer
float :32-bit floating-point number
double : 64-bit floating-point number
long :64-bit signed two’s complement integer
short :16-bit signed two’s complement integer
char :16-bit unicode character
boolean:boolean value – true or false
byte :8-bit signed two’s complement integer
Abstract Data Type (ADT)
Definition:
An ADT has
◦ A set of values (data)
◦ A set of operations (methods)
class Computer {
private int code;
private String brand;
private double price;
public Computer () { }
public Computer (int c, String b, double p) {…}
public int getCode () { return code; }
public String getBr () { return brand; }
public double getPr() { return price; };
Data Structure
is a particular way of storing and organizing data in a computer so it
can be used efficiently.
The choice on which data structure to be used for a system will affect
the system design and contribute to the effectiveness of that system.
2 types:
◦ Static – fix size (array, record)
◦ Dynamic – grow and shrink at runtime (list, queue, stack, binary
tree)
Data Structure
Static VS Dynamic Data Structure
ease of specification
On the other hand, if fewer data items are stored, then parts of
the static data structure remain empty, but the memory has
been allocated and cannot be used to store other data.
Data Structure
Advantages of Dynamic Data Structure
2 limitations:
Once an array is created its size cannot be altered
An array does not provide adequate support for insertion
and deletion operation
Data Structure Application
List
A dynamic data structure where size can be changed
A list is a collection of data stored sequentially
It supports insertion and deletion anywhere in the list
Conclusion:
Data structure is how we implement the data in an abstract data
type.