1 DATA STRUCTURE “ STACK” SHINTA P STMIK MDP APRIL 2011.

Slides:



Advertisements
Presentasi serupa
STRUKTUR DATA array stack dan queue
Advertisements

STACK (Tumpukan) Tumpukan Koin Tumpukan Kotak.
Modul-8 : Algoritma dan Struktur Data
Pertemuan Struktur Data *Pohon Ekspresi *
STACK (TUMPUKAN).
Struktur Organisasi Data 2
Stack (Tumpukan) Sumber Kepustakaan : putuputraastawa.files.wordpress.com/.../pert_5_sta...
STACK.
Struktur Data (Data Structure) – IS 2313
STRUKTUR DATA (4) Array Stack(Tumpukkan) dan Queue (Antrian)
Algoritma dan Struktur Data
PERTEMUAN KE-5 Kamis, 7 Oktober Pemetaan Trianguler Array ABCDE FGHI JKL MN O A B C D E F G H I J K L M N O T(1,1)  S(1)T(2,1)  S(N+1) T(1,2)
PERTEMUAN KE-6 Senin, 11 Oktober Mengubah Infix  Postfix Ekspresi dibaca per karakter dari kiri ke kanan. Algoritma: 1)Jika dibaca tanda “(“ maka.
Struktur Data Stack.
Stack (Tumpukan).
STACK.
Lecture 5 Nonblocking I/O and Multiplexing Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Diberikan pada Kuliah Sela Teknik Informatika - Universitas Muhammadiyah Malang Tahun 2011.
ARRAY RUBY. PENDAHULUAN Ruby's arrays are untyped and mutable. The elements of an array need not all be of the same class, and they can be changed at.
Algorithm and Data Structures.
Linear Data Structures (Stack)
stack ==tumpukan== Tenia wahyuningrum st3 telkom purwokerto
Presented By : Group 2. A solution of an equation in two variables of the form. Ax + By = C and Ax + By + C = 0 A and B are not both zero, is an ordered.
STRUKTUR DATA (4) array stack dan queue
Pertemuan 7 stack jual [Valdo] Lunatik Chubby Stylus.
BAB 3 STACK (TUMPUKAN).
STACK.
Masalah Transportasi II (Transportation Problem II)
Stack Pertemuan 11.
 1. Explaining the definition of linear equation with one variable.  2. Explaining the characteristics of linear equation with one variable. 3. Determining.
PERTEMUAN KE-6 UNIFIED MODELLING LANGUAGE (UML) (Part 2)
Mata kuliah :K0362/ Matematika Diskrit Tahun :2008
Lecture 5 Stack Eka, Erick, Reddy © Sekolah Tinggi Teknik Surabaya 1.
9.3 Geometric Sequences and Series. Objective To find specified terms and the common ratio in a geometric sequence. To find the partial sum of a geometric.
Binary Search Tree. Sebuah node di Binary Search Tree memiliki path yang unik dari root menurut aturan ordering – Sebuah Node, mempunyai subtree kiri.
OPERATOR DAN FUNGSI MATEMATIK. Operator  Assignment operator Assignment operator (operator pengerjaan) menggunakan simbol titik dua diikuti oleh tanda.
Pengantar Teknik Kompilasi
Universitas Budi Luhur
Stack Stack adalah salah satu bentuk list dimana penghapusan dan pemasukan elemen hanya dapat dilakukan pada satu posisi yaitu di posisi akhir list. Posisi.
Binary Tree.
Chapt 04 : Stack Oleh : Yuli Praptomo PHS, S.Kom
Pertemuan 23 Sequence Diagram
Sapta Candra Miarsa,S.T.,M.T.
STRUKTUR DATA IMPLEMENTASI STACK.
STRUKTUR DATA IMPLEMENTASI STACK.
Struktur Data Stack Oleh Lutfi Budi Ilmawan
Matakuliah : T0534/Struktur Data Tahun : 2005 Versi : September 2005
STACK Denny Agustiawan,M.pd
Fondasi Pemrograman & Struktur Data
Linear Data Structures (Stack)
STACK 6.3 & 7.3 NESTED LOOP.
STRUKTUR DATA : STACK Sri marini.st.
STRUKTUR DATA IMPLEMENTASI STACK.
Stack (Tumpukan) Sumber Kepustakaan : putuputraastawa.files.wordpress.com/.../pert_5_sta...
Dasar-Dasar Pemrograman
STRUKTUR DATA 2014 M. Bayu Wibisono.
STACK Rohimah, S.Kom..
STRUKTUR DATA IMPLEMENTASI STACK.
STRUKTUR DATA IMPLEMENTASI STACK.
STACK HARJANTO SUTEDJO.
STACK Kuliah Struktur Data Pascal
STRUKTUR DATA IMPLEMENTASI STACK.
Master data Management
STRUKTUR DATA IMPLEMENTASI STACK.
STACK Rohimah, S.Kom..
STACK.
STRUKTUR DATA (3) STACK.
Contoh Implementasi Stack 1
BAB 3 STACK (TUMPUKAN).
Lesson 2-1 Conditional Statements 1 Lesson 2-1 Conditional Statements.
Transcript presentasi:

1 DATA STRUCTURE “ STACK” SHINTA P STMIK MDP APRIL 2011

2 Characteristics of a Stack A stack is a collection of elements, which can be stored and retrieved one at a time. Elements are retrieved in reverse order of their time of storage, i.e. the latest element stored is the next element to be retrieved. A stack is sometimes referred to as a Last-In-First-Out (LIFO) or First-In-Last-Out (FILO) structure. Elements previously stored cannot be retrieved until the latest element (usually referred to as the 'top' element) has been retrieved.

3 Characteristics of a Stack (Cont.) New nodes can only be added to the top of the stack Nodes may only be removed from the top of the stack The depth of a stack is the number of elements it contains It is therefore a last-in, first-out structure (LIFO)

4 Typical Operations on Stack : OPERATIONPRE-CONDITIONPOST-CONDITION push (Object item)stack not fullstack +1, item on top of stack pop()stack not emptystack –1, top item removed empty()nonestack same full() nonestack same

5 Manipulation of a Stack one two three fourfive one two three four one two three one two three top Stack with depth of 4 push(one) push(two) push(three) push(four) pop( ) Stack with depth of 3Stack with depth of 4 push(five)

6 Stack Application Reverse the line order of a text file Check to see if brackets match Evaluation of complex expressions (intermediate values stored) Activation stack (method calls) Recursion

7 Stack Applications (Cont.) When analyzing arithmetic expressions, it is important to determine whether an expression is balanced with respect to parentheses – (a+b*(c/(d-e)))+(d/e) => Infix Problem is further complicated if braces or brackets are used in conjunction with parenthesis Solution is to use stacks! => Postfix

8 Additional Stack Applications Consider two case studies that relate to evaluating arithmetic expressions – Postfix and infix notation Expressions normally written in infix form – Binary operations inserted between their operands A computer normally scans an expression string in the order that it is input; easier to evaluate an expression in postfix form

9 Additional Stack Applications (continued)

10 Additional Stack Applications (continued) Advantage of postfix form is that there is no need to group subexpressions in parentheses No need to consider operator precedence

11 Aplikasi Stack Notasi POSTFIX: Ekspresi penulisan matematis dimana operator berada disamping nilai data/elemen/variabel penampung data. Contoh : A + B * C = A B C * + notasi infix notasi postfix (Cont.)

12 Aplikasi Stack Algoritma Konversi INFIX ke POSTFIX 1. Jika simbol adalah ‘(‘, maka simbol tersebut kita push ke dalam stack. Level Operator : Level tertinggi : pangkat (^) Level menengah : kali (*) dan bagi (/) Level terendah : tambah (+) dan kurang (-) (Cont.)

13 Aplikasi Stack 2. Jika simbol adalah ‘)’, maka pop semua elemen stack sampai terakhir kali simbol ‘(‘ di push. Semua elemen tersebut menjadi output kecuali tanda kurung. 3. Jika simbol adalah operand, maka simbol tersebut langsung menjadi output. (Cont.)

14 Aplikasi Stack 4. Jika simbol adalah sebuah operator, maka : 1). Jika level operator TOP stack >= level operator simbol, maka elemen TOP stack kita pop. 2). Jika level operator TOP stack < operator simbol, maka operator simbol di push ke dalam stack. (Cont.)

15 Aplikasi Stack (Cont.) Simbol yang diproses((A+B)*C/D+E^F)/G; > TOP STACK > (((++(**//++^^ // (((( ((((((++ (( (( OUTPUT A B+ C*D/E F^+ G/

16 Aplikasi Stack Ubah notasi infix berikut menjadi notasi postfix. 1. ((P+Q^(R-S))/(T*(U+V)/W)) 2. (P-Q+(R/S^T)*(U-V+W)/X)*Y) Latihan : (Cont.)

17 NEXT LECTURE CLASS “QUEUE” 