Presentation is loading. Please wait.

Presentation is loading. Please wait.

REEM ALMOTIRI Information Technology Department Majmaah University.

Similar presentations


Presentation on theme: "REEM ALMOTIRI Information Technology Department Majmaah University."— Presentation transcript:

1 REEM ALMOTIRI Information Technology Department Majmaah University

2 Lecture 1 Introduction to Data

3 1. What is data structure? Data: Data are simply collection of facts and figures. Data are values or set of values. A data item refers to a single unit of values. Data items that are divided into sub items are group items; those that are not are called elementary items. For example, a student’s name may be divided into three sub items – [first name, middle name and last name] but the ID of a student would normally be treated as a single item.

4 1. What is data structure?

5 Data Structure: In computer science, a data structure is a particular way of storing and organizing data in a computer’s memory so that it can be used efficiently. Data may be organized in many different ways; the logical or mathematical model of a particular organization of data is called a data structure. The choice of a particular data model depends on the two considerations first; it must be rich enough in structure to mirror the actual relationships of the data in the real world. On the other hand, the structure should be simple enough that one can effectively process the data whenever necessary.

6  data structures: - are a collection of data elements whose organization is characterized by accessing operations that are used to store and retrieve the individual data elements.  data structures features:- 1. they can be decomposed in to their "component elements" 2. the arrangement of the element is a feature of the structure that affect show each element is accessed 3. both the arrangement of the elements and the way to be accessed can be encapsulated

7  data Encapsulation:-  another word for surround is encapsulate  data Encapsulation means that the physical representation of a programs data is surround  the user of the data doesn't see the implementation but deals with the data only in terms of its logical picture- its abstraction.

8 data structures has three different levels:- 1. application (or user) level: away of modeling real life in a specific context. 2. abstract (or logical) level : an abstract collection of elements and its corres ponding set of accessing operations. 3. implementation level : aspecific representation of the structure and its accessing operation in a programming language

9  abstract level:-  a one -dimensional array is a structured composite data type mode up of a finite,fixed - size collection of ordered means that there is a first element, a second element and soon.  finite indicates that there is also a last element.  fixed size means the size of the array must be known at a compile time, but it doesn't mean that all the stats in the array must conation meaning full elements.

10 1. What is data structure? Structured dataSimple data Record Set Array String File Boolean Character Integer Real

11 2. Types of Data Structure Data Structure Linear Non-Linear -Array -Stack -Queue -Linked Lists -Tree -Graph

12 Linear Data Structure

13  1.Array  2.Stack  3.Queue  4.Linked List

14 Array An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier. That means that, for example, five values of type int can be declared as an array without having to declare 5 different variables (each with its own identifier). Instead, using an array, the five int values are stored in contiguous memory locations, and all five can be accessed using the same identifier, with the proper index.

15 Array For example, an array containing 5 integer values of type int called foo could be represented as: where each blank panel represents an element of the array. In this case, these are values of type int. These elements are numbered from 0 to 4. Like a regular variable, an array must be declared before it is used. A typical declaration for an array in C++ is: type name [elements]; where type is a valid type (such as int, float...), name is a valid identifier and the elements field (which is always enclosed in square brackets []), specifies the length of the array in terms of the number of elements.

16 One DimentionArray

17 Declaration of Array Data type array name[index]; Example: int list[10]; char num[15]; float hat[20];

18 Data type array-name[size]; Example: int num[10]; num[0]references the first element in the array. num[9]references the last element in the array. Creating Array

19 Once an array is created, its size is fixed. It cannot be changed. For Example, int arr[10]; You can not insert any number to arr[11] location because it is not initialized. Length of Array

20 Declaring, creating, initializing in one step : int my Array[5] = {1, 2, 3, 4, 5}; int studentAge[4]; studentAge[0] = 14; studentAge[1] = 13; studentAge[2] = 15; studentAge[3] = 16; Initializing Array

21 Two-dimensional (2D) arrays are indexed by two subscripts, one for the row and one for the column. Two dimensional Array


Download ppt "REEM ALMOTIRI Information Technology Department Majmaah University."

Similar presentations


Ads by Google