• Tidak ada hasil yang ditemukan

algorithms

N/A
N/A
Protected

Academic year: 2024

Membagikan "algorithms"

Copied!
16
0
0

Teks penuh

(1)

LECTURE 1

ALGORITHMS

By T.Aisha Alasmari – UQU

File Processing & Organization

(2)

: The Role of Algorithms in Computing

What are algorithms?

Why is the study of algorithms worthwhile?

What is the role of algorithms relative to other technologies used in computers?

In this chapter, we will answer these questions.

(3)

Algorithms:

An algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output.

An algorithm is thus a sequence of computational steps that transform the input into the output.

(4)

Algorithms:

We can also view an algorithm as a tool for solving a well-specified computational problem.

The algorithm describes a specific computational procedure for achieving that input/output

relationship.

(5)

Algorithms:

For example, one might need to sort a sequence of numbers into nondecreasing order.

Here is how we formally define the sorting problem:

For example, given the input sequence (31, 41, 59, 26, 41, 58), a sorting algorithm returns as output the sequence

(26, 31, 41, 41, 58, 59).

(6)

Algorithms:

Such an input sequence is called an instance of the sorting problem.

In general, an instance of a problem consists of the input needed to compute a solution to the problem.

(satisfying whatever constraints are imposed in the problem statement)

(7)

Algorithms:

Sorting:

A fundamental operation in computer science.

A large number of good sorting algorithms have been developed.

many programs use it as an intermediate step.

(8)

Algorithms:

Which algorithm is best for a given application depends on among other factors:

The number of items to be sorted.

The extent to which the items are already somewhat sorted.

Possible restrictions on the item values.

And the kind of storage device to be used: main memory, disks, or tapes.

(9)

Data structures:

A data structure is a way to store and organize

data in order to facilitate access and modifications.

No single data structure works well for all purposes.

And so it is important to know the strengths and limitations of several of them.

(10)

Efficiency:

Algorithms devised to solve the same problem often differ dramatically in their efficiency.

These differences can be much more significant than differences due to hardware and software.

(11)

Radix Sort:

Radix sort is the algorithm used by the card-sorting machines you now find only in computer museums.

(12)

Radix Sort:

Examble1:

The operation of radix sort on a list of seven 3-digit numbers.

(13)

Radix Sort:

The leftmost column is the input.

The remaining columns show the list after successive sorts on increasingly significant digit positions.

Shading indicates the digit position sorted on to produce each list from the previous one.

(14)

Radix Sort:

Exercise1:

Using a Radix Sort on the following list of English

words: COW, DOG, SEA, RUG, ROW, MOB, BOX, TAB, BAR, EAR, TAR, DIG, BIG, TEA, NOW, FOX.

(15)

Radix Sort:

(16)

The End

Referensi

Dokumen terkait

 Heat of combustion is reported as either net heating value ( lower heating value, LHV ) or gross heating valu e ( higher heating value, HHV ).  When methane burns, it produces

Based on these test results can be seen that the value range the maximum production which produces an average of the best fitness is 30.. Fitness obtained is

The economic literature on the measurement of the value of patents takes as an assumption that the value of any patent is reflected in the number of times the patent is cited, or

OR gate: a device that accepts the values of two or more Boolean variables as input and produces their Boolean sum as output AND gate: a device that accepts the values of two or

RL/ADP methods Domains Algorithms Value-based algorithms Computer Games Tabular Q-learning Industrial and Financial systems Q-learning with neural network Vehicle control and Robotics

An undirected graph, directed graph, minimum spanning tree Prim's algorithm, shortest path Dijkstra's algorithm, BFT, DFT - several algorithms which are used in this paper are some of

Analysis of Algorithms • Analysis is performed with respect to a computational model • We will usually use a generic uniprocessor random- access machine RAM  All memory equally

It takes two inputs, a superclass ob- ject and the object dispatching procedure of the subclass, and produces an in- stance of the subclass which is a procedure that takes a message as