Professional Documents
Culture Documents
Lecture 1 - Introduction
Lecture 1 - Introduction
Lecture 1 - Introduction
COS3711
Lecture 1 ❖ Introduction
Based on chapter 1
of our recommended ❖ Overview of Data Structures
book
❖ Overview of Algorithms
❖ Lecture Summary
Important attributes of a computer program
[scalability] • Is the code able to solve problems for a large range of inputs?
Introduction
• in OOP, you built applications for a particular use case • add contacts to an
existing list
• each application required data storage • search a contact
• edit contact
• you created classes to store data information
• delete a contact
• You created objects based on those classes
• iterate over all
contacts in the
phone book
• Real applications require more than two or 3 objects
• perform some
kind of
• e.g. an application to stores contacts in a mobile phone transformation on
the data
Introduction
• programming all about:
• core programming problems easy to solve with correct data structure and algorithms
• Questions to ask:
• How well it stores the data in computer memory?
• specify how data is represented and stored, along with specific operations that can be
performed on that data
• Dictionaries
• Filing cabinets
• Library Cabinets
• In this course
• Concrete implementation of
Abstract Data Types – defining the
behavior and characteristics of our model
Data Structures in code
• Programmer’s tools
• Modeling
Real-world data storage
financial
personnel record inventory record
transaction record
• to describes an • to describe an • to describe an
actual human existing grocery actual check
being item written to pay
the electric bill
Programmer’s tools
compiler implementations
Java Virtual Machine
File system
General Programming
relational databases
to remember and folders indexes for tables to look collections
all of a using a tree data retrieval up identifiers (set,
program's structure. multi_set,
methods that map,
have been multi_map)
called but are are normally
not yet implemented
finished as red-black
trees
Modeling
Interfaces
Implementations:
abstract data types
concrete implementations
representing the data
of the interfaces
collections
• allows data collections to • enables reusable
be manipulated functionality
independent of the
representation details
Data Structures covered in our course
• Arrays
• Ordered Arrays
• Stacks
Standard data Structures already implemented
• Queues
• Java Collections Framework
• Linked Lists • C++ Standard Template Library (STL)
• Trees (binary, red black, 2-3-4) • Smalltalk's collection hierarchy
• Sets, Maps • Microsoft .NET framework
• Hash Tables
• Heaps
• Graphs
Overview of Algorithms
Overview of Algorithms
• sequence of steps that transform the input into the output when
solving a computational problem.
producing
predicting traffic
automatic ranking internet analyzing a
jams and road
movie/book search results genome
accidents
recommendations
Algorithms in real life
• It's important that the algorithms we use are efficient:
• users want to see the search results in a blink of an eye
Algorithm arrayMax(A,n):
Input: An array A storing 𝑛 ≥ 1 integers
currentMax ← 𝐴 0
for i ← 1 to 𝑛 − 1 do
if currentMax < 𝐴[𝑖] then
currentMax ← 𝐴[𝑖]
return currentMax
Determining the efficiency
• the correct choice of data structure + algorithms = major improvements in program efficiency