Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:programming:algorithms [2012/05/21 09:37] raivo.sellen:programming:algorithms [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Algorithms and Flowchart====== +====== Algorithms and flowchart====== 
-<note important>Translation needed</note> + 
-The algorithm is a step-by-step instruction, guideline or rule to performe some action or reach the solution for given problem. Flowchart is one of the way to represent algorithm graphically, where graphical elements like boxes, squares, circles, and arrows connecting them represent flow of control. Every element can represent on step in the instructions. +The algorithm is a step-by-step instruction, guideline or rule to perform some action or reach the solution for given problem. Flowchart is one of the way to represent algorithm graphically, where graphical elements like boxes, squares, circles, and arrows connecting them represent flow of control. Every element can represent on step in the instructions. 
      
 Simplified flowchart elements: Simplified flowchart elements:
  
-===== Start =====+==== Start ====
  
 Circle. Circle.
Line 11: Line 11:
 {{:method:algorithms:algus.png|}} {{:method:algorithms:algus.png|}}
  
-===== End =====+==== End ====
  
-Filled circel inside bigger circle.+Filled circle inside bigger circle.
  
 {{:method:algorithms:lopp.png|}} {{:method:algorithms:lopp.png|}}
  
-===== Action or expression =====+==== Action or expression ====
  
-Rectangle. Inside rectangle a name of the action, name of the sub-routine or short decsiption can be written. Similar actions can be included into one general action.+Rectangle. Inside rectangle a name of the action, name of the sub-routine or short description can be written. Similar actions can be included into one general action.
  
-{{:method:algorithms:tegevus.png|}}+{{:images:programming:algorithm_action.png|}}
  
-===== Sequence =====+ 
 +==== Sequence ====
  
 Arrow, by pointing next activity. Arrow, by pointing next activity.
Line 29: Line 30:
 {{:method:algorithms:nool.png|}} {{:method:algorithms:nool.png|}}
   
-===== Condition / Decision ====+==== Condition / Decision ====
- +
-Diamond (rhombus). Inside diamond is a logical expression and in most cases two arrows are drawn out from diamond. One is when logical expression results True (Yes/1) and other when expression result is False (No/0). Always bot arrows have to be labeled. In special case only one arrow can be used as output from diamond. The case is when logical expression can clearly result only one solution, e.g. True. This is the case where for example endless cycle is used in program code (e.g. //while (true)//). +
  
-{{:method:algorithms:kontrollplokk.png|}}+Diamond (rhombus). Inside diamond is a logical expression and in most cases two arrows are drawn out from diamond. One is when logical expression results True (Yes/1) and other when expression result is False (No/0). Always both arrows have to be labeled. In special case only one arrow can be used as output from diamond. The case is when logical expression can clearly result only one solution, e.g. True. This is the case where for example endless cycle is used in program code (e.g. //while (true)//)
  
-===== Data exchange =====+{{:images:programming:algoritmid_if.png|}}
  
-Trapezoid. Inside trapetzoid a name or activity is described. In robotics it is usually used to communicate with sensors and user. For simplification also normal rectangle action can be used instead of trapezoid.+<pagebreak> 
 +==== Data exchange ====
  
-{{:method:algorithms:andmevahetus.png|}}+Trapezoid. Inside trapezoid a name or activity is described. In robotics it is usually used to communicate with sensors and user. For simplification also normal rectangle action can be used instead of trapezoid.
  
- ===== Examples =====+{{:images:programming:data_exchange.png|}}
  
-Voodiagrammide koostamiseks võib kasutada tavalist kontoritarkvara nn MS Word või MS Excel, OpenOffice/LibreOffice Writer või Calc, kuid mugavam on kasutada spetsiifilisi programme nn MS Visio või OpenOffice/LibreOffice Draw+ ==== Examples ====
  
-Mikrokontrollerite tarkvara algoritmide voodiagrammidel üldjuhul programmi lõppu ei ole ja kogu tegevus on ühes lõputus tsüklis. Lõputu tsükli väljumistingimus ei saa kunagi tõeseks ja sellepärast on lubatud selle tähistamine rombigamillel on ainult üks väljund. tingimus ise on märgitud lihtsalt true või 1. Diagrammide koostamisel tuleks jälgidaet kui programmis on hargnemised, siis saab see olla ainult läbi rombi (tingimuslause). Koondumised võivad olla ka mujal.+Drawing flowchart diagrams one can use common office suits like MS Word or MS Excel or OpenOffice/LibreOffice Writer or Calc but better results can be get by using special programs like MS VisionOpenOffice/LibreOffice DrawGoogle draw or some special diagram creating software.
  
-Järgnevad näited illustreerivad plokkide kasutamist algoritmi juuresEsimene näide on lihtne ilma tsüklite ja sisendite kontrollita algoritm ühekordse tegevuse teostamiseks.+Flowcharts describing microcontroller software usually do not have ends, instead whole main activity in an endless cycleThe exit condition of the endless cycle will never be true and therefore this is the case where condition block (diamond) can be represented only on exiting arrow. Condition it self can be notes simply True or 1. Creating diagrams it is important to keep in eye on the fact that if the program has forks, it can be done only through the diamond object. Junctions (two arrows are joining) can be described by special symbol, but in simple cases, one may simply have an arrow point to another arrow instead.
  
-{{:method:algorithms:naide1.png|}}+<pagebreak> 
 +Following examples illustrate the use of flowchart elements for describing simple algorithm. First example is simple routine by describing one way flow without any cycle or decision points.
  
-Järgnev diagramm kirjeldab süsteemi, mis kontrollib 1 m ala ja kui kontrollitavasse alasse siseneb objekt, käivitab kümneks sekundiks alarmi. alarm töötab niikaua, kui objekt on kontrollitavast alast väljunud+{{:images:programming:algorithm_example1.png|}} 
 +<pagebreak> 
 +Following example describes a system which detects 1 m area and if an object entering into inspected area an alarm is triggered for a 10 seconds. Alarm is working until the object is left from the inspected area.
  
-{{:method:algorithms:naide2.png?550|}}+{{:images:programming:algorithm_example2.png?550|}}
en/programming/algorithms.1337593078.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0