Sei sulla pagina 1di 2

Chapter 1.

Introduction

Concept of Algorithm

a) It is a set of finite rules that precisely define a sequence of operations.


b) A finite sequence of instructions, each with a clear meaning which lead to the
solution of a problem

o-o However an algorithm can be in the form of:-

a) flow chart
b) Pseudocode
c) The actual program or code

Concept of data structure

a) It is the collection and organization of related data items in the computers memory.
b) A collection of variables, possibly of different data types

Example:-
info = record

name: string[25];

age: 0..100;
sex: (male, female);

end;

When a programmer creates an algorithm to solve a problem he also creates a data


structure that is manipulated by the algorithm.

Data Types (the set of values that the variable may assume)

a) Single Data Type:-Variables of such a type can assume 1 value at any time

1|Page
b) Structured Data Type:-Variables of such a type can assume 1 or more values at any
time
c) Abstract Data type (ADT) :- i) A set of data values and associated operations that are
precisely specified independent of any particular implementation.( To abstract is to
ignore some details of a thing in favor of others)
ii) An ADT is a formally specified set of values and associated operations,
independent from any particular implementation

Common examples of ADTs:


Built-in types: Boolean, integer, real, array
User-defined types: stack, queue, tree, list

2|Page

Potrebbero piacerti anche