0% menganggap dokumen ini bermanfaat (0 suara)
12 tayangan9 halaman

Algoritma Perhitungan Lingkaran

Dokumen ini membahas tentang runtunan (sequence) dalam algoritma dan struktur data. Runtunan adalah aksi-aksi yang dilakukan secara berurutan dalam algoritma. Dokumen ini memberikan contoh runtunan untuk menghitung luas dan keliling lingkaran beserta flowchart dan pseudocode-nya.

Diunggah oleh

Susan
Hak Cipta
© All Rights Reserved
Kami menangani hak cipta konten dengan serius. Jika Anda merasa konten ini milik Anda, ajukan klaim di sini.
Format Tersedia
Unduh sebagai PPTX, PDF, TXT atau baca online di Scribd
0% menganggap dokumen ini bermanfaat (0 suara)
12 tayangan9 halaman

Algoritma Perhitungan Lingkaran

Dokumen ini membahas tentang runtunan (sequence) dalam algoritma dan struktur data. Runtunan adalah aksi-aksi yang dilakukan secara berurutan dalam algoritma. Dokumen ini memberikan contoh runtunan untuk menghitung luas dan keliling lingkaran beserta flowchart dan pseudocode-nya.

Diunggah oleh

Susan
Hak Cipta
© All Rights Reserved
Kami menangani hak cipta konten dengan serius. Jika Anda merasa konten ini milik Anda, ajukan klaim di sini.
Format Tersedia
Unduh sebagai PPTX, PDF, TXT atau baca online di Scribd

Computer Science, University of Brawijaya

Putra Pandu Adikara, [Link]

Algoritma dan Struktur Data


Runtunan (Sequence)
Runtunan (Sequence)

 aksi-aksi dalam algoritma yang dikerjakan secara


berurutan
 pada flowchart digambarkan sebagai kumpulan
proses (segi empat)
 Banyak digunakan pada proses perhitungan atau
mengerjakan rumus
 contoh :
A1. Aksi 1
A2. Aksi 2
A3. Aksi 3
Contoh

Dibahas:
1. Perhitungan luas lingkaran
2. Perhitungan keliling lingkaran
Contoh Lain:
 Menghitung kuadrat suatu bilangan
 Menghitung luas bidang datar
 Menghitung volume benda
 Konversi mata uang
 Konversi suhu (°C  °R, °C  °F, °C  °K, dan
sebaliknya)
Contoh 1: Flowchart

 Keliling Lingkaran
start

Input r

kel = 2 *pi * r

Output kel

stop
Contoh 1: Pseudocode

Deklarasi cost
1 double r, kel; 2
2 const pi = 3.14; 1
Deskripsi
3 r  input; 1
4 kel  pi * 2 * r; 1
{rumus hitung keliling} 0
5 output  kel; 1

Running time :
T(n) = ∑ cost
=6
Contoh 1: Source Code

 Keliling lingkaran
program kellingk;
uses crt;
const
pi = 3.14
var
r, kel: real;
begin
WriteLn('Berapa ukuran jari-jari = ‘);
ReadLn(r);
kel := 2 * pi * r;
WriteLn('Keliling lingkaran = ', kel);
end.
Contoh 2: Flowchart

 Luas Lingkaran
start

Input r, pi

Luas = pi * r * r

Output luas

stop
Contoh 2: Pseudocode

Deklarasi
1 double r, luas;
2 const pi  3.14;
Deskripsi
3 r  input;
4 luas  pi * r * r; {rumus hitung luas}
5 output  luas;
Contoh 2: Source Code

 Luas lingkaran

program luaskel;
const
pi = 3.14;
var
r, luas: real;
begin
WriteLn('Berapa ukuran jari-jari = ');
ReadLn(r);
luas := pi * r * r;
ReadLn('Luas lingkaran = ', luas);
end.

Common questions

Didukung oleh AI

Both pseudocode and source code for calculating a circle's circumference express the same sequence of actions: setting constants, taking input, computing the circumference, and outputting the result. Pseudocode is structured with 'Declares' and 'Descriptions' for clarity, using a more natural language style, while the source code uses Pascal syntax, implementing the same logic in a form executable by a machine .

Flowcharts implement sequence by organizing steps in linear order using rectangular blocks connected with arrows to indicate the direction of process flow. Each block denotes a particular operation like input, calculation, or output, ensuring processes are executed sequentially, as shown in the circumference and area calculation examples .

A flowchart for calculating the circumference of a circle includes specific processes such as 'Start', 'Input r', 'Calculate circumference as kel = 2 * pi * r', and 'Output kel', followed by 'Stop'. Rectangular boxes represent these processes, demonstrating a sequential order of actions .

Sequential actions in algorithms can be applied to complex real-world problems such as process automation, where tasks are completed in specified order to ensure efficiency, or in web development for sequential form processing. Each stage of input, data processing, and outcome can be mapped clearly using sequences for scalability and ease of debugging .

Algorithmic sequences are adaptable to various calculations by structuring operations systematically, making them reusable for tasks like currency conversion or matrix operations. Factors influencing adaptability include complexity, variable types, and operation dependencies, which must align with task requirements to ensure effective sequence execution .

The running time of the circumference calculation pseudocode is computed by summing the costs of individual operations within the algorithm, obtaining an overall cost of 6. This measure is significant because it quantifies the algorithm's efficiency, helping developers understand and optimize resource consumption and execution time .

Sequences in algorithms refer to a series of actions executed in order. They are depicted as a set of processes in flowcharts and are commonly used in calculations or executing formulas. Examples include performing arithmetic operations, converting units, and calculating properties like area or volume .

Pseudocode serves as a bridge between logic and programming language syntax, simplifying complex algorithms into understandable steps without programming specifics. It aids in concept visualization, making it an educational tool for teaching algorithm design and logical thinking across varied programming environments, enhancing learning efficiency and coding ability .

In the pseudocode for calculating the circle's area, input operations receive the radius, a crucial variable for calculations, while output operations present the calculated area to the user. These steps facilitate interaction between the algorithm and the user, completing the calculation process by gathering necessary data and showing results .

Using constants like pi in calculations for circle measurements ensures consistency, accuracy, and ease of readability throughout the algorithm. It allows for a standardized value to be used in formulas, reducing errors and simplifying the process of making adjustments across multiple instances of the calculation .

Anda mungkin juga menyukai