7 views

Original Title: Designing Algorithms (3)

Uploaded by Lulu Tojeen

- INDEX SORT
- A Unique Sorting Algorithm With Linear Time & Space Complexity
- Problem Solving PowerPoint CXC IT Section 2 Obj 6
- Introduction to Programming Seminar 2011
- algorithmsandflowcharts1 (2).ppt
- hello1
- Google Official Interview Sre
- Searching.pptx
- Ass 2
- PGDCA
- 01-00Intro-2x2
- Algorithms and Flowcharts 1
- Shri Sai Satcharita
- Algorithms and Flowcharts - 1
- subtraction algorithm annotated planning template
- Animal
- 2_Divide and Conquer
- GeolocationMeasurements_7congressURSI
- 110sort Malik Ch10
- lec2.ppt

You are on page 1of 22

must be formulated as an algorithm.

The analysis specification tells what the

operation does from the view point of

its clients, but the algorithm shows how it

is done.

Designing algorithms

The algorithm designer must :

Choose algorithms that minimize the cost of

implementing operations.

Select data structures appropriate for the

algorithms.

Define new internal classes and operations as

necessary.

Assign responsibility for operations

Choosing algorithms

Many operations are simple enough that the

specification in the functional model already

constitutes a satisfactory algorithm because

the description of what is done also shows

how it is done.

Many operations simply traverse paths in

the object-link network to retrieve or change

attributes or links.

Choosing algorithms

Choosing algorithms

object containing an Operation list , which

in turn contains a set of Operation entry

objects.

Here there is no need to write an algorithm

to find the class box containing a given

operation entry because the value is found

by a simple traversal of unique links.

Choosing algorithms

Non trivial algorithm is needed for two

reasons:

a) To implement functions for which no

procedural specification

b) To optimize functions for which a simple

but inefficient algorithm serves as a

definition

Choosing algorithms

Some functions are specified as declarative

constraints, without any procedural definition.

Most functions have mathematical or procedural

definitions

If simple definitions of an operation are inefficient,

more efficient algorithm is needed.

Choosing algorithms

For example, searching for a value in a set

of size n by scanning the set requires an

average of n/2 operations, where as a

binary search takes log n operations and a

hash search takes less than 2 operations

on average, regardless of the size of the

set.

Choosing algorithms

Considerations in choosing among

alternative algorithm include :

a) Computational Complexity

b) Ease of implementation and

understandability

c) Flexibility

d) Fine Tuning the Object Model

Choosing algorithms

a) Computational Complexity:

algorithm we have to think about how the

execution time grows with the number of input

values as well as the cost of processing each

input values..

For a bubble sort, algorithm requires time n 2

Most other algorithms, time n log n

n is the size.

Choosing algorithms

b) Ease of implementation and understandability:

performance on non critical operations if they

can be implemented quickly with a simple

algorithm.

Choosing algorithms

c) Flexibility

A highly optimized algorithm often sacrifices

readability and ease of change.

One possibility is to provide two

implementations of critical applications ,

can be implemented , quickly and used to

validate the system.

a complicated but efficient algorithm whose

correct implementation can be checked against

the simple one.

algorithm for picking objects in a

diagram could be implemented by

spatially sorting all the objects in

a large, flat data structure.

Choosing algorithms

d) Fine Tuning the Object Model:

If the object model were structured

differently, would there be any alternatives.

Choosing algorithms

Choosing algorithms

In Figure the original upper design each

diagram element contains a list of windows in

which it is visible. This is inefficient because

for each window, the operations on a set of

elements must be computed separately.

in lower design , each element belongs to one

sheet which may appear in any number of

windows. The image on the sheet can be

computed once and the copied to each window

as a bitmap operation. This reduction in

repeated operations is worth the extra level of

indirection.

During object design we must choose the

form of data structures that will permit

efficient algorithms.

The data structures do not add information

to the analysis model, but they organize it in

a form convenient for the algorithms that use

it.

data structures include arrays, lists,

queues, stacks, sets, dictionaries,

associations, trees, and many

variations on these, such as priority

queues and binary trees.

Operations

During the expansion of algorithms, new

classes of objects may be needed to hold

intermediate results.

New, low level operations may be

invented during the decomposition of high

level operations.

A complex operation can be defined in

terms of lower level operations.

These low-level operations must be

defined during object design because most

of them are not visible externally.

Operations may be assigned to the classes. But

the question is what class owns an operation?

If only one object is involved in the

operation we can tell that object to

perform the operation.

If more than one object is there we have

to decide which object plays the lead role

in the operation.

This can be done as follows

operations

Associate the operation with the target of

the operation, rather than the initiator

The object that is changed is the target of

the operation.

If the classes and associations form a star

about a central class, it is the target of the

operation.

How do you decide what class owns an

operation

When only one object is involved in the

operation tell the object to perform the

operation .

When more than one object, we must decide

which object plays the lead role in the operation.

We have to consider the following questions:

Is one object acted on while the other object

performs the action? It is best to associate the

operation with the target , rather than the initiator

Is one object modified by the operation, while

other objects are only queried for the information

they contain? The object that is changed is the

target.

- INDEX SORTUploaded byAI Coordinator - CSC Journals
- A Unique Sorting Algorithm With Linear Time & Space ComplexityUploaded byesatjournals
- Problem Solving PowerPoint CXC IT Section 2 Obj 6Uploaded byLincoln Foster
- Introduction to Programming Seminar 2011Uploaded bycraig burey
- algorithmsandflowcharts1 (2).pptUploaded byrajivkumarinsan
- hello1Uploaded byLavanya
- Google Official Interview SreUploaded byKang-Li Cheng
- Searching.pptxUploaded bymsurfudeen6681
- Ass 2Uploaded byPeter Simpson
- PGDCAUploaded byNand Dubey
- 01-00Intro-2x2Uploaded byHyunJong Lee
- Algorithms and Flowcharts 1Uploaded byjbabe123
- Shri Sai SatcharitaUploaded byKokila Ambigae
- Algorithms and Flowcharts - 1Uploaded byAli Gh
- subtraction algorithm annotated planning templateUploaded byapi-400542088
- AnimalUploaded bybhatti19
- 2_Divide and ConquerUploaded byAbeera Gohar
- GeolocationMeasurements_7congressURSIUploaded byskouti9
- 110sort Malik Ch10Uploaded bysachinsr099
- lec2.pptUploaded bypaksmiler
- Why zombies can't write significant source code: The Knowledge Game and the Art of Computer ProgrammingUploaded byFederico Gobbo
- UNIV QNS SPLIT UP.docxUploaded byJagan Nathan
- Bab 3 Perancangan Sistem Tgs KlmpkUploaded bySuhendra Hadi
- Deconstructing MMORPGs with PaoloUploaded byJason Curry
- coding questions.docxUploaded byKaivalya Dabhadkar
- A17DS1Uploaded byManish Kinwar
- Advanced ProgrammingUploaded byJames Pawlak
- Sorting Types 2Uploaded bySorin Bogdan
- research methodologyUploaded byMAHMOUD KHALOUF Khalouf
- The Index Sorting AlgorithmUploaded byEditor IJRITCC

- Programming Languages 1Uploaded byLulu Tojeen
- Java Programming Lab Part 1Uploaded byLulu Tojeen
- mod5Uploaded byLulu Tojeen
- mod4Uploaded byLulu Tojeen
- Handling Global Resources(6)Uploaded byLulu Tojeen
- Java Remote Method InvocationUploaded byLulu Tojeen
- Design of Associations(7)Uploaded byLulu Tojeen
- OOMDmodule_3__1Uploaded byNeethu Rachal George
- mod1Uploaded byLulu Tojeen
- mod1Uploaded byLulu Tojeen
- Names,VariablesUploaded byLulu Tojeen
- Implementation of Control(5)Uploaded byLulu Tojeen
- _Here to Help You__ Computer Networks_ InterviewUploaded byLulu Tojeen
- OOMD module_2__3Uploaded bySujay Ps
- Sensor NetworksUploaded byLulu Tojeen
- PendulumUploaded byLulu Tojeen
- ChemistryUploaded byLulu Tojeen
- Module 1Uploaded byLulu Tojeen
- eeeUploaded byLulu Tojeen
- ABC 6567 DefUploaded byNeelakandan Pradeesh Kumar
- Application of DSP in Video CompressionUploaded byLulu Tojeen
- Computer Graphics Question paperUploaded byLulu Tojeen
- DBMS notesUploaded byLulu Tojeen
- DBMS notesUploaded byLulu Tojeen
- OOMD question paper MG universityUploaded byLulu Tojeen
- Compiler Construction PaperUploaded byLulu Tojeen
- A Single Camera Based Floating Virtual KeyboardUploaded byLulu Tojeen
- MC1704_Computer_Graphics_and_Multimedia_SystemUploaded byAbhinav Rana

- VI-04 Parametric Methods_2007Uploaded byAamir Habib
- Bisection MethodUploaded byDarren Pinto
- LaplaceUploaded byUddipto Sen
- AlgebraUploaded byMomo Itachi
- Bsc Math Syllabus of Physical SciencesUploaded bydhondi1990
- Association Rules in RUploaded byYeshwanth Babu
- Rt 41033112016Uploaded byvarma
- McGrawHill Functions 11 Unit 5Uploaded byblabdude123
- AJC H2 Math 2013 Prelim P1 SolutionsUploaded bynej200695
- Series BuenoUploaded byRoyer Velasquez Mamani
- A Step by Step Backpropagation Example – Matt MazurUploaded byAndres Tuells Jansson
- Mathematical StructureUploaded bysgxrgsys
- Syllabus BeginnerUploaded byMahesh Gondi
- formula_xm f2Uploaded byNurul Binti Yusof
- DLL_MATHEMATICS 6_Q3_W6 (1).docxUploaded byTreshiel Johnwesley
- [SPM] Casio Scientific Calculator Guide (fx-570MS)Uploaded byFeudalism
- m3 EnrichmentUploaded byMADHAVI BARIYA
- Math_126 1010 SyllabusUploaded byJordan Jones
- M3Uploaded byvinu_kb89
- Mathematical Logic a Course With Exercises, Part 1 by Rene Cori and …(1)_ORIGINALUploaded bycristanch0
- MatricesUploaded byAbhishekJain
- KOMPUTASI NUMERIKUploaded byHendraanggayuwono
- Add maths Project selangor 20150ri.pdfUploaded byKogilan Bama Daven
- Math 151 Homework 05.pdfUploaded byNafiur Rahman
- MIT8_01SC_coursenotes05Uploaded bysupermenbetmen
- clustextUploaded bytyler rinker
- Math CoursesUploaded byLaina Emmanuel
- Coord Transforms in Cadastral Surveying.pdfUploaded byulastuna2001
- Dynamic Pickup and Delivery ProblemsUploaded byVuong Bui Viet
- Advanced Concepts in Fuzzy Logic and Systems With Membership Uncertainty - STARCZEWSKIUploaded byLuiz Carlos da Silva