SlideShare a Scribd company logo
CS 307 Fundamentals of 
Computer Science 
1
2 
CChhaapptteerr 33 
Abstract Data Types
3 
Data Structures 
 Data structure is a representation of data 
and the operations allowed on that data.
4 
Abstract Data Types 
 In Object Oriented Programming data and 
the operations that manipulate that data are 
grouped together in classes 
 Abstract Data Types (ADTs) or data 
structures or collections store data and allow 
various operations on the data to access and 
change it
5 
Why Abstract? 
 Specify the operations of the data structure 
and leave implementation details to later 
– in Java use an interface to specify operations 
 many, many different ADTs 
– picking the right one for the job is an important 
step in design 
– "Get your data structures correct first, and the 
rest of the program will write itself." 
-Davids Johnson 
 High level languages often provide built in 
ADTs, 
– the C++ STL, the Java standard library
6 
The Core Operations 
 Every Collection ADT should provide a way to: 
– add an item 
– remove an item 
– find, retrieve, or access an item 
 Many, many more possibilities 
– is the collection empty 
– make the collection empty 
– give me a sub set of the collection 
– and on and on and on… 
 Many different ways to implement these items each 
with associated costs and benefits
7 
Implementing ADTs 
 when implementing an ADT the operations 
and behaviors are already specified 
– think Java interface 
 Implementer’s first choice is what to use as 
the internal storage container for the 
concrete data type 
– the internal storage container is used to hold the 
items in the collection 
– often an implementation of an ADT 
– initially slim pickings for choice of storage 
containers: arrays anyone?
8 
The Grand Tour 
 Why study ADTs? 
 Why reimplement some of them? 
 How many of you will actually go out and 
create your own linked list ADT from 
scratch? 
 Remember, the primary goal is to learn how 
to learn how to use and create ADTs 
– also learn the behavior of some of the more 
conventional ADTs
9 
Bags and Sets 
 Simplest ADT is a Bag 
– items can be added, removed, accessed 
– no implied order to the items 
– duplicates allowed 
 Set 
– same as a bag, except duplicate elements not 
allowed 
– union, intersection, difference, subset
10 
Lists 
 Items have a position in this Collection 
– Random access or not? 
 Array Lists 
– internal storage container is native array 
 Linked Lists 
public class Node 
{ private Object data; 
private Node next; 
last 
} first
11 
Stacks 
 Collection with access only to the last 
element inserted 
 Last in first out 
 insert/push 
 remove/pop 
 top 
 make empty 
Data4 Top 
Data3 
Data2 
Data1
12 
Queues 
 Collection with access only to the item that 
has been present the longest 
 Last in last out or first in first out 
 enqueue, dequeue, front 
 priority queues and deque 
Front Back 
Data1 Data2 Data3 Data4
13 
Stacks and Queues in the 
Java Collection API 
 No queue in the Java collections ADT 
 Stack extends Vector (which is almost 
exactly like ArrayList) 
– Hmmm? 
 One reason the Java Collections Library is 
often said to be broken 
 no Queue in Collection API
14 
Trees 
 Similar to a linked list 
public class TreeNode 
{ private Object data; 
private TreeNode left; 
private TreeNode right; 
} 
Root
15 
Other Types of Trees 
 Binary Search Trees 
– sorted values 
 Heaps 
– sorted via a different algorithm 
 AVL and Red-Black Trees 
– binary search trees that stay balanced 
 Splay Trees 
 B Trees
16 
HashTables 
 Take a key, apply function 
 f(key) = hash value 
 store data or object based on hash value 
 Sorting O(N), access O(1) if a perfect hash 
function and enough memory for table 
 how deal with collisions?
17 
The Java Collection 
Interface 
boolean isEmpty() 
int size() 
boolean add(Object x) 
boolean contains(Object x) 
boolean remove(Object x) 
void clear() 
Object[] toArray() 
Iterator iterator()
18 
Generic Containers 
 ADTs or Collection classes should be 
generic 
– only write them once, hold lots or all types of 
data 
– Java achieves genericity through inheritance and 
polymorphism 
 ADTs have an internal storage container 
– What is storing the stuff, 
– implementation vs. abstraction 
– in Java, usually holds Objects. Why?
19
CS 307 Fundamentals of 
Computer Science 
20 
Example - ArrayList java.util 
Class ArrayList 
java.lang.Object 
| 
+--java.util.AbstractCollection 
| 
+--java.util.AbstractList 
| 
+--java.util.ArrayList 
All Implemented Interfaces: 
Cloneable, Collection, List, Serializable 
void add(int index, Object element) 
Inserts the specified element at the specified position in this list. 
boolean add(Object o) 
Appends the specified element to the end of this list. 
void clear() 
Removes all of the elements from this list. 
boolean contains(Object elem) 
Returns true if this list contains the specified element. 
int indexOf(Object elem) 
Searches for the first occurence of the given argument, testing for 
equality using the equals method. 
boolean isEmpty() 
Tests if this list has no elements. 
Object set(int index, Object element) 
Replaces the element at the specified position in this list with the 
specified element. 
int size() 
Returns the number of elements in this list.

More Related Content

What's hot

Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
Kumar Gaurav
 
An Introduction to the C++ Standard Library
An Introduction to the C++ Standard LibraryAn Introduction to the C++ Standard Library
An Introduction to the C++ Standard Library
Joyjit Choudhury
 
Stl (standard template library)
Stl (standard template library)Stl (standard template library)
Stl (standard template library)Hemant Jain
 
Standard template library
Standard template libraryStandard template library
Standard template library
Sukriti Singh
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Hoang Nguyen
 
Collections In Java
Collections In JavaCollections In Java
Collections In JavaBinoj T E
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
ankitgarg_er
 
Java Collections
Java  Collections Java  Collections
Collections - Maps
Collections - Maps Collections - Maps
Collections - Maps
Hitesh-Java
 
Maps
MapsMaps
Standard template library
Standard template libraryStandard template library
Standard template library
Jancypriya M
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
karthikeyanC40
 
Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics
Hitesh-Java
 
collections
 collections collections
Java collection
Java collectionJava collection
Java collection
Arati Gadgil
 
Generics
GenericsGenerics
How to choose best containers in STL (C++)
How to choose best containers in STL (C++)How to choose best containers in STL (C++)
How to choose best containers in STL (C++)
Sangharsh agarwal
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
GauravPatil318
 
Collections framework in java
Collections framework in javaCollections framework in java
Collections framework in java
yugandhar vadlamudi
 

What's hot (20)

Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
An Introduction to the C++ Standard Library
An Introduction to the C++ Standard LibraryAn Introduction to the C++ Standard Library
An Introduction to the C++ Standard Library
 
Stl (standard template library)
Stl (standard template library)Stl (standard template library)
Stl (standard template library)
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Algo>Abstract data type
Algo>Abstract data typeAlgo>Abstract data type
Algo>Abstract data type
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Collections In Java
Collections In JavaCollections In Java
Collections In Java
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
 
Java Collections
Java  Collections Java  Collections
Java Collections
 
Collections - Maps
Collections - Maps Collections - Maps
Collections - Maps
 
Maps
MapsMaps
Maps
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics
 
collections
 collections collections
collections
 
Java collection
Java collectionJava collection
Java collection
 
Generics
GenericsGenerics
Generics
 
How to choose best containers in STL (C++)
How to choose best containers in STL (C++)How to choose best containers in STL (C++)
How to choose best containers in STL (C++)
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
Collections framework in java
Collections framework in javaCollections framework in java
Collections framework in java
 

Viewers also liked

SAP_Business_Object_Professional
SAP_Business_Object_ProfessionalSAP_Business_Object_Professional
SAP_Business_Object_ProfessionalKapil Verma
 
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris RechtThe Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Port
 
Global leader in real-time clearing
Global leader in real-time clearingGlobal leader in real-time clearing
Global leader in real-time clearing
Cinnober
 
PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012
Arun Gupta
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programming
TOPS Technologies
 
Developing With JAAS
Developing With JAASDeveloping With JAAS
Developing With JAASrahmed_sct
 
Static Analysis Primer
Static Analysis PrimerStatic Analysis Primer
Static Analysis PrimerCoverity
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arraystameemyousaf
 
A Short Intorduction to JasperReports
A Short Intorduction to JasperReportsA Short Intorduction to JasperReports
A Short Intorduction to JasperReportsGuo Albert
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RS
Arun Gupta
 
Introduction to Jasper Reports
Introduction to Jasper ReportsIntroduction to Jasper Reports
Introduction to Jasper Reports
Mindfire Solutions
 
Japer Reports
Japer ReportsJaper Reports
Japer Reports
joshipriya162
 
Architecture of message oriented middleware
Architecture of message oriented middlewareArchitecture of message oriented middleware
Architecture of message oriented middlewareLikan Patra
 
MOM - Message Oriented Middleware
MOM - Message Oriented MiddlewareMOM - Message Oriented Middleware
MOM - Message Oriented Middleware
Peter R. Egli
 
Rest API Security
Rest API SecurityRest API Security
Rest API Security
Stormpath
 
Aranya Low Cost Housing
Aranya Low Cost HousingAranya Low Cost Housing
Aranya Low Cost Housing
Ankita Kolamkar
 
Transaction processing system
Transaction processing systemTransaction processing system
Transaction processing systemJayson Jueco
 
Concurrency Errors in Java
Concurrency Errors in JavaConcurrency Errors in Java
Concurrency Errors in Java
Coverity
 

Viewers also liked (18)

SAP_Business_Object_Professional
SAP_Business_Object_ProfessionalSAP_Business_Object_Professional
SAP_Business_Object_Professional
 
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris RechtThe Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
 
Global leader in real-time clearing
Global leader in real-time clearingGlobal leader in real-time clearing
Global leader in real-time clearing
 
PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programming
 
Developing With JAAS
Developing With JAASDeveloping With JAAS
Developing With JAAS
 
Static Analysis Primer
Static Analysis PrimerStatic Analysis Primer
Static Analysis Primer
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays
 
A Short Intorduction to JasperReports
A Short Intorduction to JasperReportsA Short Intorduction to JasperReports
A Short Intorduction to JasperReports
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RS
 
Introduction to Jasper Reports
Introduction to Jasper ReportsIntroduction to Jasper Reports
Introduction to Jasper Reports
 
Japer Reports
Japer ReportsJaper Reports
Japer Reports
 
Architecture of message oriented middleware
Architecture of message oriented middlewareArchitecture of message oriented middleware
Architecture of message oriented middleware
 
MOM - Message Oriented Middleware
MOM - Message Oriented MiddlewareMOM - Message Oriented Middleware
MOM - Message Oriented Middleware
 
Rest API Security
Rest API SecurityRest API Security
Rest API Security
 
Aranya Low Cost Housing
Aranya Low Cost HousingAranya Low Cost Housing
Aranya Low Cost Housing
 
Transaction processing system
Transaction processing systemTransaction processing system
Transaction processing system
 
Concurrency Errors in Java
Concurrency Errors in JavaConcurrency Errors in Java
Concurrency Errors in Java
 

Similar to Core & advanced java classes in mumbai

Lecture 4 - Object Interaction and Collections
Lecture 4 - Object Interaction and CollectionsLecture 4 - Object Interaction and Collections
Lecture 4 - Object Interaction and Collections
Syed Afaq Shah MACS CP
 
Ii pu cs practical viva voce questions
Ii pu cs  practical viva voce questionsIi pu cs  practical viva voce questions
Ii pu cs practical viva voce questions
Prof. Dr. K. Adisesha
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
Debasish Pratihari
 
Collection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshanCollection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshan
Zeeshan Khan
 
4 gouping object
4 gouping object4 gouping object
4 gouping object
Robbie AkaChopa
 
01-intro_stacks.ppt
01-intro_stacks.ppt01-intro_stacks.ppt
01-intro_stacks.ppt
soniya555961
 
Topic12ADTS_GenericDataStructures.ppt
Topic12ADTS_GenericDataStructures.pptTopic12ADTS_GenericDataStructures.ppt
Topic12ADTS_GenericDataStructures.ppt
BlackSeraph
 
Topic12ADTS_GenericDataStructures.ppt
Topic12ADTS_GenericDataStructures.pptTopic12ADTS_GenericDataStructures.ppt
Topic12ADTS_GenericDataStructures.ppt
MeenakshiPatel13
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
Yonas D. Ebren
 
Collections and generic class
Collections and generic classCollections and generic class
Collections and generic class
ifis
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
talha ijaz
 
Advanced Java - UNIT 3.pptx
Advanced Java - UNIT 3.pptxAdvanced Java - UNIT 3.pptx
Advanced Java - UNIT 3.pptx
eyemitra1
 
Collections
CollectionsCollections
Collections
bsurya1989
 
Collections in java
Collections in javaCollections in java
Collections in javakejpretkopet
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections framework
Ravi Chythanya
 
Java Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsJava Course 4: Exceptions & Collections
Java Course 4: Exceptions & Collections
Anton Keks
 
Data structures in c#
Data structures in c#Data structures in c#
Data structures in c#
SivaSankar Gorantla
 
Java 103 intro to java data structures
Java 103   intro to java data structuresJava 103   intro to java data structures
Java 103 intro to java data structures
agorolabs
 
Java Unit 2 (Part 2)
Java Unit 2 (Part 2)Java Unit 2 (Part 2)
Java Unit 2 (Part 2)
SURBHI SAROHA
 
Collections - Lists & sets
Collections - Lists & setsCollections - Lists & sets
Collections - Lists & sets
RatnaJava
 

Similar to Core & advanced java classes in mumbai (20)

Lecture 4 - Object Interaction and Collections
Lecture 4 - Object Interaction and CollectionsLecture 4 - Object Interaction and Collections
Lecture 4 - Object Interaction and Collections
 
Ii pu cs practical viva voce questions
Ii pu cs  practical viva voce questionsIi pu cs  practical viva voce questions
Ii pu cs practical viva voce questions
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Collection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshanCollection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshan
 
4 gouping object
4 gouping object4 gouping object
4 gouping object
 
01-intro_stacks.ppt
01-intro_stacks.ppt01-intro_stacks.ppt
01-intro_stacks.ppt
 
Topic12ADTS_GenericDataStructures.ppt
Topic12ADTS_GenericDataStructures.pptTopic12ADTS_GenericDataStructures.ppt
Topic12ADTS_GenericDataStructures.ppt
 
Topic12ADTS_GenericDataStructures.ppt
Topic12ADTS_GenericDataStructures.pptTopic12ADTS_GenericDataStructures.ppt
Topic12ADTS_GenericDataStructures.ppt
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
 
Collections and generic class
Collections and generic classCollections and generic class
Collections and generic class
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Advanced Java - UNIT 3.pptx
Advanced Java - UNIT 3.pptxAdvanced Java - UNIT 3.pptx
Advanced Java - UNIT 3.pptx
 
Collections
CollectionsCollections
Collections
 
Collections in java
Collections in javaCollections in java
Collections in java
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections framework
 
Java Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsJava Course 4: Exceptions & Collections
Java Course 4: Exceptions & Collections
 
Data structures in c#
Data structures in c#Data structures in c#
Data structures in c#
 
Java 103 intro to java data structures
Java 103   intro to java data structuresJava 103   intro to java data structures
Java 103 intro to java data structures
 
Java Unit 2 (Part 2)
Java Unit 2 (Part 2)Java Unit 2 (Part 2)
Java Unit 2 (Part 2)
 
Collections - Lists & sets
Collections - Lists & setsCollections - Lists & sets
Collections - Lists & sets
 

More from Vibrant Technologies & Computers

Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5
Vibrant Technologies & Computers
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
Vibrant Technologies & Computers
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
Vibrant Technologies & Computers
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
Vibrant Technologies & Computers
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
Vibrant Technologies & Computers
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
Vibrant Technologies & Computers
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
Vibrant Technologies & Computers
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
Vibrant Technologies & Computers
 
Data ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housingData ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housing
Vibrant Technologies & Computers
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
Vibrant Technologies & Computers
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
Vibrant Technologies & Computers
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
Vibrant Technologies & Computers
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
Vibrant Technologies & Computers
 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
Vibrant Technologies & Computers
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
Vibrant Technologies & Computers
 
Sas - Introduction to designing the data mart
Sas - Introduction to designing the data martSas - Introduction to designing the data mart
Sas - Introduction to designing the data mart
Vibrant Technologies & Computers
 
Sas - Introduction to working under change management
Sas - Introduction to working under change managementSas - Introduction to working under change management
Sas - Introduction to working under change management
Vibrant Technologies & Computers
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
Vibrant Technologies & Computers
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
Vibrant Technologies & Computers
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
Vibrant Technologies & Computers
 

More from Vibrant Technologies & Computers (20)

Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
 
Data ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housingData ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housing
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
 
Sas - Introduction to designing the data mart
Sas - Introduction to designing the data martSas - Introduction to designing the data mart
Sas - Introduction to designing the data mart
 
Sas - Introduction to working under change management
Sas - Introduction to working under change managementSas - Introduction to working under change management
Sas - Introduction to working under change management
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
 

Recently uploaded

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 

Recently uploaded (20)

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 

Core & advanced java classes in mumbai

  • 1. CS 307 Fundamentals of Computer Science 1
  • 2. 2 CChhaapptteerr 33 Abstract Data Types
  • 3. 3 Data Structures  Data structure is a representation of data and the operations allowed on that data.
  • 4. 4 Abstract Data Types  In Object Oriented Programming data and the operations that manipulate that data are grouped together in classes  Abstract Data Types (ADTs) or data structures or collections store data and allow various operations on the data to access and change it
  • 5. 5 Why Abstract?  Specify the operations of the data structure and leave implementation details to later – in Java use an interface to specify operations  many, many different ADTs – picking the right one for the job is an important step in design – "Get your data structures correct first, and the rest of the program will write itself." -Davids Johnson  High level languages often provide built in ADTs, – the C++ STL, the Java standard library
  • 6. 6 The Core Operations  Every Collection ADT should provide a way to: – add an item – remove an item – find, retrieve, or access an item  Many, many more possibilities – is the collection empty – make the collection empty – give me a sub set of the collection – and on and on and on…  Many different ways to implement these items each with associated costs and benefits
  • 7. 7 Implementing ADTs  when implementing an ADT the operations and behaviors are already specified – think Java interface  Implementer’s first choice is what to use as the internal storage container for the concrete data type – the internal storage container is used to hold the items in the collection – often an implementation of an ADT – initially slim pickings for choice of storage containers: arrays anyone?
  • 8. 8 The Grand Tour  Why study ADTs?  Why reimplement some of them?  How many of you will actually go out and create your own linked list ADT from scratch?  Remember, the primary goal is to learn how to learn how to use and create ADTs – also learn the behavior of some of the more conventional ADTs
  • 9. 9 Bags and Sets  Simplest ADT is a Bag – items can be added, removed, accessed – no implied order to the items – duplicates allowed  Set – same as a bag, except duplicate elements not allowed – union, intersection, difference, subset
  • 10. 10 Lists  Items have a position in this Collection – Random access or not?  Array Lists – internal storage container is native array  Linked Lists public class Node { private Object data; private Node next; last } first
  • 11. 11 Stacks  Collection with access only to the last element inserted  Last in first out  insert/push  remove/pop  top  make empty Data4 Top Data3 Data2 Data1
  • 12. 12 Queues  Collection with access only to the item that has been present the longest  Last in last out or first in first out  enqueue, dequeue, front  priority queues and deque Front Back Data1 Data2 Data3 Data4
  • 13. 13 Stacks and Queues in the Java Collection API  No queue in the Java collections ADT  Stack extends Vector (which is almost exactly like ArrayList) – Hmmm?  One reason the Java Collections Library is often said to be broken  no Queue in Collection API
  • 14. 14 Trees  Similar to a linked list public class TreeNode { private Object data; private TreeNode left; private TreeNode right; } Root
  • 15. 15 Other Types of Trees  Binary Search Trees – sorted values  Heaps – sorted via a different algorithm  AVL and Red-Black Trees – binary search trees that stay balanced  Splay Trees  B Trees
  • 16. 16 HashTables  Take a key, apply function  f(key) = hash value  store data or object based on hash value  Sorting O(N), access O(1) if a perfect hash function and enough memory for table  how deal with collisions?
  • 17. 17 The Java Collection Interface boolean isEmpty() int size() boolean add(Object x) boolean contains(Object x) boolean remove(Object x) void clear() Object[] toArray() Iterator iterator()
  • 18. 18 Generic Containers  ADTs or Collection classes should be generic – only write them once, hold lots or all types of data – Java achieves genericity through inheritance and polymorphism  ADTs have an internal storage container – What is storing the stuff, – implementation vs. abstraction – in Java, usually holds Objects. Why?
  • 19. 19
  • 20. CS 307 Fundamentals of Computer Science 20 Example - ArrayList java.util Class ArrayList java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractList | +--java.util.ArrayList All Implemented Interfaces: Cloneable, Collection, List, Serializable void add(int index, Object element) Inserts the specified element at the specified position in this list. boolean add(Object o) Appends the specified element to the end of this list. void clear() Removes all of the elements from this list. boolean contains(Object elem) Returns true if this list contains the specified element. int indexOf(Object elem) Searches for the first occurence of the given argument, testing for equality using the equals method. boolean isEmpty() Tests if this list has no elements. Object set(int index, Object element) Replaces the element at the specified position in this list with the specified element. int size() Returns the number of elements in this list.