gdgf

© All Rights Reserved

8 views

gdgf

© All Rights Reserved

- CS2208 2 SET3
- Larry R. Nyhoff-ADTs, Data Structures, and Problem Solving with C++ (2nd Edition)-Prentice Hall (2004)
- 2019_Book_TheEverydayLifeOfAnAlgorithm.pdf
- An efficient line algorithm
- errpage.ps
- Assignments
- Binary Expression Trees
- UGC NET Computer Science and Applications Paper II Jun 10
- GenFam Algo and Meeting Notes
- Scimakelatex.15413.Anon.mous
- bstx
- Trees
- Red Black Trees
- eXpress: Guided Path Exploration for Efﬁcient Regression Test Generation
- lesson 3
- lec3_JWFILES
- gs_setpd.ps
- iterlevel2
- CAP_2013
- 1827.pdf

You are on page 1of 17

Louis-Nol Pouchet

pouchet@cse.ohio-state.edu

September 2010

888.11

Generalities on Algorithms:

Writing Algorithms

Algorithms

An algorithm is an effective method for solving a problem expressed as a

finite sequence of instructions.

well-defined input data to produce other data

OSU

Generalities on Algorithms:

Writing Algorithms

Algorithms are...

OSU

...

Writing Algorithms

Generalities on Algorithms:

A Few Rules

equations, ...)

I

I

I

I

I

OSU

... Always be consistent!

But called algorithms must be presented too

Writing Algorithms

Generalities on Algorithms:

A Syntax Proposal

I

I for all element Set do

I for iterator = lowerbound to upperbound step increment do

I while conditional do

I do ... while conditional

I if conditional then ... else

I case element in value :

I return value

I

I

OSU

break

continue

the output specification

Generalities on Algorithms:

Writing Algorithms

An example

Algorithm

algorithm gcd

input: integer a, b

output: greatest common divisor of a and b

if a = 0 then

return b

while b 6= 0 do

if a > b then

a = ab

else

b = ba

return a

OSU

Generalities on Algorithms:

Writing Algorithms

Another example

Algorithm

BuildSearchSpace: Compute T

Input:

pdg: polyhedral dependence graph

Output:

T : the bounded space of candidate multidimensional schedules

d 1

while pdg 6= 0/ do

Td createPolytope([1, 1],[1, 1])

for each dependence DR,S pdg do

WDR,S buildWeakLegalSchedules(DR,S )

Td Td WDR,S

end for

for each dependence DR,S pdg do

SDR,S buildStrongLegalSchedules(DR,S )

if

Td SDR,S 6= 0/ then

Td Td SDR,S

pdg pdg - DR,S

end if

end for

end do

OSU

Writing Algorithms

Generalities on Algorithms:

Recursive Algorithms

I

OSU

property at level n + 1

Writing Algorithms

Data Structures:

Vectors

OSU

Generic container with random access capability via the index of the

element

I Example: A[i], A[i][j][function(i,j)]

Writing Algorithms

Data Structures:

Stack: LIFO

I

I

I

Queue: FIFO

I

I

I

OSU

elt = pop(stack)

integer = size(stack)

elt = pop(queue)

integer = size(queue)

10

Writing Algorithms

Data Structures:

Graphs

I

I

I

I

I

OSU

list of nodes = getConnectedNodes(graph, node)

element = getNodeValue(graph, node)

element = getEdgeValue(graph, edge)

etc., and the associated functions to modify the graph structure

11

Writing Algorithms

Data Structures:

Trees

I

I

I

I

OSU

binary tree

search tree

...

12

Writing Algorithms

Data Structures:

I

I

4

Look in the litterature if a solution to this problem exists

or a mix

I

OSU

Depends on how you think, how easy it is to exhibit invariants, what is the

decomposition in sub-problems, ...

13

Data Structures:

Writing Algorithms

Reference

Introduction to Algorithms, by Thomas H. Cormen, Charles E. Leiserson,

Ronald L. Rivest, Clifford Stein

OSU

14

Writing Algorithms

Exercises:

Exercise 1

Input:

I

precedes y

Ouput:

I

OSU

15

Writing Algorithms

Exercises:

Exercise 2

Input:

I

returns a sub-matrix (a block) of the matrix starting at address X , of size

16 16 whose first element is at position i, j

Ouput:

I

OSU

16

Writing Algorithms

Exercises:

Exercise 3

Input:

I

I

The left subtree of a node contains only nodes with keys less than the

nodes key.

The right subtree of a node contains only nodes with keys greater than the

nodes key.

Both the left and right subtrees must also be binary search trees.

Output:

I

A

Exercise: write an algorithm which implements the above description

OSU

17

- CS2208 2 SET3Uploaded bykaliappan45490
- Larry R. Nyhoff-ADTs, Data Structures, and Problem Solving with C++ (2nd Edition)-Prentice Hall (2004)Uploaded byBruno Díaz
- 2019_Book_TheEverydayLifeOfAnAlgorithm.pdfUploaded byJefry 0816
- An efficient line algorithmUploaded byapi-3754855
- errpage.psUploaded byfassura
- AssignmentsUploaded byroyanirudh99
- Binary Expression TreesUploaded byNandaShivani
- UGC NET Computer Science and Applications Paper II Jun 10Uploaded byaditya
- GenFam Algo and Meeting NotesUploaded byUmme Rabab Syed
- Scimakelatex.15413.Anon.mousUploaded bymdp anon
- bstxUploaded bycarlone77
- TreesUploaded byShubham Gupta
- Red Black TreesUploaded bySalatyel Fellipe
- eXpress: Guided Path Exploration for Efﬁcient Regression Test GenerationUploaded byKunal Taneja
- lesson 3Uploaded byapi-297910907
- lec3_JWFILESUploaded bySravan Kumar
- gs_setpd.psUploaded byIsaiah Garcia
- iterlevel2Uploaded byakg299
- CAP_2013Uploaded byrakesh_200003
- 1827.pdfUploaded bysrinjoy chakravorty
- Week 1Uploaded byRendon Perlas
- Planing and Acting in Real Word SummaryUploaded bySandu Ciprian
- Scimakelatex.3964.KilUploaded byLK
- DIMA Programacion 01 ConceptschiwaUploaded byAmnael Ho
- Synthesis of Fibre Optic CablesUploaded byianforcements
- DaghameenArmanPaper_CRF_542Uploaded byUbiquitous Computing and Communication Journal
- Fusion, Propagation, And Structuring in Belief NetworksUploaded byAman Alvi
- Splay TreesUploaded byJorge Venturola
- L05extraSteps in Program Development - RevisionUploaded by2012reshmi
- 1.4. What is Programming- — Problem Solving With Algorithms and Data StructuresUploaded byErr33

- MathsUploaded byAakash Verma
- session_buddy_export_2018_07_12_10_05_54Uploaded byAakash Verma
- Soln5Uploaded byAakash Verma
- CodeUploaded byAakash Verma
- Gratings and Prism SpectrometerUploaded byAakash Verma
- Transition Metal Chem Part 2-NomenclatureUploaded byAakash Verma
- bfc03Uploaded byAakash Verma
- Admission FormUploaded byAakash Verma
- LaTeX_T1Uploaded byAakash Verma
- TDC AssignmentUploaded byAakash Verma
- rnoti-p1351Uploaded byAakash Verma
- 804035913Uploaded byAakash Verma
- boUploaded byEman Rabi
- emUploaded byAakash Verma
- INSTRUCTIONS FOR FILLING OF PASSPORT APPLICATION FORM AND SUPPLEMENTARY FORM - ApplicationformInstructionBooklet-V3.0.pdfUploaded byAakash Verma
- Calculus Cheat Sheet IntegralsUploaded byhyd arnes
- uga_hamilUploaded byAakash Verma
- Eterno Dg LeafletUploaded byAakash Verma
- How to Study MathUploaded byRizka Amalia
- List of Courses-SemV VIIUploaded byAakash Verma
- PS5Uploaded byAakash Verma
- Spherical Coords NoteUploaded byAakash Verma
- Order ConfirmationUploaded byAakash Verma
- Oneplus Service Centres IndiaUploaded byAakash Verma
- ftUploaded byMeng-Yu Lin
- Quantum ChemistryUploaded bydead_knight
- Linear Coupled OscillatorsUploaded byanonymousxx

- SABIR HUSSAIN 8 Kuba Way, Markham, Ontario Canada, L3S 4T5Uploaded byArslan Khan
- CoaxUploaded byPhátTrần
- dataUploaded byJyotiprakash Patra
- OM PPTUploaded byBhavani Singh Rathore
- WP Business WargamingUploaded byErin Louise Sasa
- Ching v. Land Bank of the Philippines 201 SCRA 190Uploaded byalyssa habanez
- lesson 6Uploaded byapi-309578342
- Cyberspace Operations Concept Capability Plan 2016-2028Uploaded byImpello_Tyrannis
- Adams v Superior Quicksilver 02-22-10Uploaded byLegal Writer
- TM-9-2320-280-20-2Uploaded byAngel Torres
- 62739592 No Easy Walk to Freedom Nelson MandelaUploaded bytheodros
- SPMT BrochureUploaded byAnonymous qT66pyK
- Altair 5Uploaded byCarlos Guevara
- Insurance OmbudsmanUploaded byVivek Gupta
- 05-External_music-03.pdfUploaded bySamuel Mares Palafox
- Order Statistics Theory Amp MethodsUploaded bySumathi Mathi
- Enabling Innovation in NetworkingUploaded byAlyssa
- Institute of Distance Education University of MadrasUploaded byrajpsenthil5564
- 1st Addenda Corrigendum Vol-III Road Bridge Works Schedule 2014Uploaded bysananda
- FinanceUploaded bySaagar Karande
- CIM Certificate_ Top Ten Assignment Tips for the Integrated Communications ModuleUploaded bydale2741830
- 31426238 Insurance ProjectUploaded byRajat Bansal
- F.13 GL Account Automatic ClearingUploaded byMillionn Gizaw
- NIKE case studyUploaded byArjun Varanasi
- hpe-general capabilities learning areaUploaded byapi-287660266
- 5Min FR InternetUploaded bynamavaya
- Siemens Sitrans FX300 VortexUploaded by1234567890
- Intercompany Setup and CycleUploaded bydpraveen1_apps
- E2126_A7N8X-XEUploaded byLeandro Karlos Mendes
- Structural Analysis and DesignUploaded byVon DeVoir