Langsung ke konten utama

Postingan

Link ke website ISTN

istn.ac.id
Postingan terbaru

Program Java Sorting List

Ini Codenya: Github public class sortinglist {     node head;     node sorted;       class node     {         int val;         node next;           public node(int val)         {             this.val = val;         }     }       void push(int val)     {         node newnode = new node(val);         newnode.next = head;         head = newnode;     }       void insertionSort(node headref)     {         sorted = null;         node current = headref;         while (current != null)         {                 node next = current.nex...

Program Java Insert List Bilangan dengan Linked List

Ini Codenya: Github class LinkedList {       static Node head1, head2;       static class Node {           int data;         Node next;           Node(int d) {             data = d;             next = null;         }     }       Node addTwoLists(Node first, Node second) {         Node res = null;         Node prev = null;         Node temp = null;         int carry = 0, sum;           while (first != null || second != null)         {             sum = carry + (first != null ? first.data : 0)                     + (second != null ? second.data : 0); ...

Program Java Operasi Pecahan

Ini Codenya: Github public class Fraction {     int numerator;     int denominator;     public Fraction(int numr, int denr) { numerator = numr; denominator = denr; reduce();     }     public int getNumerator() { return numerator;     }     public void setNumerator(int numerator) { this.numerator = numerator;     }     public int getDenominator() { return denominator;     }     public void setDenominator(int denominator) { this.denominator = denominator;     }     public int calculateGCD(int numerator, int denominator) { if (numerator % denominator == 0) {              return denominator;         } return calculateGCD(denominator, numerator % denominator); }     void reduce() { int gcd = calculateGCD(numerator, denominator); numerator /= ...

Program Java Double Linked List Traversal

Ini Codenya: Github public class Doublelinkedlist { Node head; class Node { int data; Node prev; Node next; Node(int d) { data = d; } } public void push(int new_data) { Node new_Node = new Node(new_data); new_Node.next = head; new_Node.prev = null; if (head != null) head.prev = new_Node; head = new_Node; } public void InsertAfter(Node prev_Node, int new_data) { if (prev_Node == null) { System.out.println("The given previous node cannot be NULL "); return; } Node new_node = new Node(new_data); new_node.next = prev_Node.next; prev_Node.next = new_node; new_node.prev = prev_Node; if (new_node.next != null) new_node.next.prev = new_node; } void append(int new_data) { Node new_node = new Node(new_data); Node last = head; new_node.next = null; if (head == null) { new_node.prev = null; head = new_node; return; } while (last.next != null) ...

Program Java Adt tanggal

ini Codenya: Github import java.util.Scanner; public class Adttanggal {         public static void main(String[] args) {         Scanner input = new Scanner(System.in);         int hari = 0;         int tanggal,bulan,tahun,kabisat;         String bln = null ;                 String nama_bulan [] = {"Januari","Februari","Maret","April","Mei","Juni","Juli",               "Agustus","September","Oktober","November","Desember"};                 System.out.print("Masukkan Tanggal : ");         tanggal = input.nextInt();         System.out.print("Masukkan Bulan : ");         bulan = input.nextInt();         System.out.print("Masukkan Tahun : ");         tahu...

Program Python Aplikasi Penambahan Bilangan Array

Ini Codenya: Github x = [22, 46, 32] z = [42, 15, 17] # Menghitung jumlah nilai semua array xTotal = sum(x) zTotal = sum(z) jumlah = xTotal + zTotal print("Jumlah Nilai Kedua Array :", jumlah) # Menggabungkan data dari kedua array print("Gabungan Array") print(x + z)