# ds handout.pdf - Data Structures and Algorithms Analysis 1...

• 87

This preview shows page 1 - 3 out of 87 pages.

1 Data Structures and Algorithms Analysis 1. Introduction to Data Structures and Algorithms Analysis A program is written in order to solve a problem. A solution to a problem actually consists of two things: A way to organize the data Sequence of steps to solve the problem The way data are organized in a computers memory is said to be Data Structure and the sequence of computational steps to solve a problem is said to be an algorithm. Therefore, a program is nothing but data structures plus algorithms. 1.1. Introduction to Data Structures Given a problem, the first step to solve the problem is obtaining ones own abstract view, or model , of the problem. This process of modeling is called abstraction. The model defines an abstract view to the problem. This implies that the model focuses only on problem related stuff and that a programmer tries to define the properties of the problem. These properties include The data which are affected and The operations that are involved in the problem.
2 With abstraction you create a well-defined entity that can be properly handled. These entities define the data structure of the program. An entity with the properties just described is called an abstract data type (ADT). 1.1.1. Abstract Data Types An ADT consists of an abstract data structure and operations. Put in other terms, an ADT is an abstraction of a data structure. The ADT specifies: 1. What can be stored in the Abstract Data Type 2. What operations can be done on/by the Abstract Data Type. For example, if we are going to model employees of an organization: This ADT stores employees with their relevant attributes and discarding irrelevant attributes. This ADT supports hiring, firing, retiring, … operations. A data structure is a language construct that the programmer has defined in order to implement an abstract data type. There are lots of formalized and standard Abstract data types such as Stacks, Queues, Trees, etc. Do all characteristics need to be modeled? Not at all It depends on the scope of the model It depends on the reason for developing the model 1.1.2. Abstraction Abstraction is a process of classifying characteristics as relevant and irrelevant for the particular purpose at hand and ignoring the irrelevant ones. Applying abstraction correctly is the essence of successful programming