Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Data Structures Lecture 1

Similar presentations


Presentation on theme: "Advanced Data Structures Lecture 1"— Presentation transcript:

1 Advanced Data Structures Lecture 1
CSCI-255 Advanced Data Structures Lecture 1

2 Problem Solving Problem solving = Solution = algorithm?
Understanding the problem Designing a solution Implementing the solution Solution = algorithm? Are all algorithms equally good? Define “good” (i.e., what are the comparison criteria?)

3 Algorithm Efficiency There are often many approaches (algorithms) to solve a problem. How do we choose between them? Need to measure the cost of an algorithm The cost of a solution is the amount of resources that the solution consumes A solution is said to be efficient if it solves the problem within its resource constraints Space Time

4 Solution = algorithm + data organization
Any algorithm we come up with will have to manipulate data in some way The way we choose to organize our data directly affects the efficiency of our algorithm Solution = algorithm + data organization Both components are strongly interconnected

5 Organizing Data (cont’d)
Any organization for a collection of records can be searched, processed in any order, or modified The choice of data structure and algorithm can make the difference between a program running in a few seconds or many days Examples of data structures and algorithms that you have learned before: list, accessing the ith element, insert an element to the beginning of the list Talking about implementation of data organizations: arrays and linked list

6 Selecting a Data Structure
Select a data structure as follows: Analyze the problem to determine the resource constraints a solution must meet Determine the basic operations that must be supported. Quantify the resource constraints for each operation Select the data structure that best meets these requirements

7 Selecting a Data Structure (cont’d)
Each data structure has costs and benefits Rarely is one data structure better than another in all situations A data structure requires: Space for each data item it stores, Time to perform each basic operation, Programming effort

8 Selecting a Data Structure (cont’d)
Each problem has constraints on available space and time Only after a careful analysis of problem characteristics can we know the best data structure for the task Bank example: Open and close accounts  a few minutes Transactions  a few seconds

9 What this Course is About
Classic data structures Design, implementation, and use How to choose or devise the appropriate data structure for a problem Classic algorithms and how the choice of data structure affects their efficiency Understand how to measure the cost of a data structure or algorithm

10 Abstract Data Type A type is a collection of values
E.g., Boolean, Integer A data type is a type together with a collection of operations to manipulate the type E.g., Integer data type An abstract data type (ADT) is the realization of a data type as a software component. It does not specify how the data type is implemented

11 Abstract Data Type Major components:
The data The operations allowed on it These make up an Abstract Data Type (ADT) Each ADT operation is defined by its inputs and outputs Encapsulation: Hide implementation details

12 Example ADT An ADT for a list of integers might specify the following operations: Insert a new integer at a particular position in the list Return true if the list is empty Reinitialize the list Return the number of integers currently in the list Delete the integer at a particular position in the list From this description, the input and output of each operation should be clear, but the implementation has not been specified

13 Data Structure A data structure is the implementation of an ADT
Each operation associated with the ADT is implemented by or more subroutines in the implementation In an object-oriented language such as C++, an ADT and its implementation together make up a class Each operation associated with the ADT is implemented by a member function An object is an instance of a class, that is, something that created and takes up storage during program execution


Download ppt "Advanced Data Structures Lecture 1"

Similar presentations


Ads by Google