This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from os import system | |
| data_bansos = { | |
| "123123" : { | |
| "Nama Lengkap" : "Ali", | |
| "Alamat" : "Kudus", | |
| "Pekerjaan" : "Guru", | |
| "Gaji" : "2000000", | |
| "Anggota Keluarga" : "3" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string.h> | |
| using namespace std; | |
| struct Node { | |
| char nama[30]; | |
| Node *next; | |
| }; | |
| Node *head = NULL, *tail = NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string.h> | |
| using namespace std; | |
| struct Node { | |
| char nama[30]; | |
| Node *next; | |
| }; | |
| Node *head = NULL, *tail = NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Kontak(object): | |
| def __init__(self, nama, nomor): | |
| self.nama = nama | |
| self.nomor = nomor | |
| from pustaka import * | |
| kontak = [] | |
| def main(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Stack: | |
| def __init__(self): | |
| self.items = [] | |
| def isEmpty(self): | |
| return self.items == [] | |
| def push(self, item): | |
| self.items.append(item) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Stack: | |
| def __init__(self): | |
| self.items = [] | |
| def isEmpty(self): | |
| return self.items == [] | |
| def push(self, item): | |
| self.items.append(item) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ascending (data terurut menaik) | |
| def selectionSort(mylist): | |
| for i in range(len(mylist)-1, 0, -1): | |
| max = 0 | |
| for j in range(1, 1+1): | |
| if mylist[j] > mylist[max]: | |
| max = j | |
| temp = mylist[i] | |
| mylist[i] = mylist[max] | |
| mylist[max] = temp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ascending (data terurut menaik) | |
| def bubbleSort(mylist): | |
| for i in range(len(mylist)-1, 0, -1): | |
| for j in range(i): | |
| if mylist[j] > mylist[i]: | |
| temp = mylist[j] | |
| mylist[j] = mylist[j+1] | |
| mylist[j+1] = temp | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Program Kontak | |
| # List Kontak | |
| namaKontak = ['Naufal', 'Hazim'] | |
| noTelepon = ['08123456789', '08987654321'] | |
| def daftarKontak(): # fungsi untuk menampilkan kontak yang tersimpan di list kontak | |
| print('Daftar Kontak:') | |
| for i in range(len(namaKontak)): | |
| print('Nama: {}'.format(namaKontak[i])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def insertionSrt(data): | |
| for x in range(1, len(data)): | |
| isi = data[x] | |
| pos = x | |
| while pos > 0 and data[pos-1] < isi: | |
| data[pos] = data[pos-1] | |
| pos = pos-1 | |
| data[pos] = isi |
NewerOlder