kuis online 07
TRANSCRIPT
-
8/18/2019 Kuis Online 07
1/23
Kuis Online 07 - Linked List
Review of attempt 5
Started on Sunday, 17 April 2016, 09:35 PM
Completed on Sunday, 17 April 2016, 09:42 PM
Time taken 6 mins 45 secs
Marks 18/20
Grade 90 out of a maximum of 100 (90%)
estion1
ks: 1pleksitas operasi get(index) pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion2 ks: 1
Chanek membuat program yang menyimpan daftar nama pada antrian di Linked List. Untuk mencari nama orang dengan nomor antrian tertentu
a kompleksitas dari program Pak Chanek adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion3 ks: 1
asi dari linked list yang node terakhirnya menyimpan referensi node pertama disebut dengan .... linked list.
wer:
cular
ect
rks for this submission: 1/1.
estion4 ks: 1
lass Node> {
T element;
Node next;
Node prev;
Node(T e, Node p, Node n) {
-
8/18/2019 Kuis Online 07
2/23
element = e;
next = n;
prev = p;
}
ass SortedDLL> {
protected Node head;
protected Node tail;
protected int size;
public SortedDLL() {
size = 0;
head = tail = new Node(null, null, null);
}
public void insert(T value) {
Node current = head;
if (current.next == null) {
current.next = new Node(value, head, tail);
tail.prev = current.next;
} else {
boolean check;
// TODO: isi nilai check
while (check) {
current = current.next;
// TODO: update nilai check
}
Node tmp = current.next;
current.next = new Node(value, current, tmp);
tmp.prev = current.next;
size++;
}
}
public void print() {
Node current = head;
-
8/18/2019 Kuis Online 07
3/23
boolean check2;
// TODO: isi nilai check2
while (check2) {
current = current.next;
System.out.println(current.element);
// TODO: update nilai check2
}
}
e di atas adalah implementasi dari Sorted Doubly Linked List. Agar elemen terurut dari elemen terkecil ke elemen terbesar maka code untukggantikan '// TODO: isi nilai check' ataupun '// TODO: update nilai check' adalah ..e : silahkan tulis kode sesuai dengan kaidah penulisan bahasa Java yang baik)toh: a.b == c.d && c.f(a) >= 1 || a != b
wer:
rrent.next != tail && value.compareTo(current.next.element) > 0
ect
rks for this submission: 1/1.
estion5 ks: 1
lass Node> {
T element;
Node next;
Node prev;
Node(T e, Node p, Node n) {
element = e;
next = n;
prev = p;
}
ass DLL> {
protected Node head;
protected Node tail;
protected int size;
public DLL() {
size = 0;
-
8/18/2019 Kuis Online 07
4/23
head = tail = new Node(null, null, null);
}
public void delete(Node a) {
// TODO: membuat node sebelum node setelah node a menjadi node sebelum a [1]
// TODO: membuat node setelah node sebelum node a menjadi node setelah a [2]
// TODO: membuat node a menjadi node sebelum a [3]
}
// TODO: Implementasi lain dari Doubly Linked List
skan code untuk melakukan TODO yang pertama ([1]) di dalam method delete. Jawab dengan kaidah penulisan yang benartoh: a.b = c.d;
wer:
next.prev = a.prev;
ect
rks for this submission: 1/1.
estion6 ks: 1
pleksitas dari insert/delete node di tengah-tengah Doubly Linked List jika pointer node diketahui adadalah ..
ose one answer.
a. O(n )
b. O(n^2)
c. O(n log n)
d. O(1)
e. O(log n)
ect
rks for this submission: 1/1.
estion7 ks: 1
pleksitas operasi find pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion8 ks: 1
bihan linked list dibandingkan dengan array list adalah elemen dapat terletak pada lokasi memory yang saling berjauhan
wer:
-
8/18/2019 Kuis Online 07
5/23
True False
ect
rks for this submission: 1/1.
estion9 ks: 1
ed list yang node terakhir menyimpan referensi dari node pertama adalah _______ linked list.
wer:
cular
ect
rks for this submission: 1/1.
estion10 ks: 1
ed List hanya bisa diimplementasikan di Object Oriented Programming Language karena membutuhkan prinsip Encapsulation
wer:
True False
ect
rks for this submission: 1/1.
estion11 ks: 1
pleksitas operasi add last pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
rrect
rks for this submission: 0/1.
estion12 ks: 1
pleksitas operasi delete last pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion13 ks: 1
ed list yang tiap list node menyimpan referensi node sebelum dan sesudahnya adalah _______ linked list.
wer:
oubly
ect
rks for this submission: 1/1.
estion14 ks: 1
hod di bawah ini yang biasanya tidak ada pada iterator linked list adalah
ose one answer.
a. zeroth()
b. insertFirst(x)
c. first()
-
8/18/2019 Kuis Online 07
6/23
d. insert(x)
e. remove(x)
ect
rks for this submission: 1/1.
estion15 ks: 1
pleksitas operasi add last pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion16 ks: 1
uk mengimplementasikan sorted linked list, elemennya harus mengimplement interface ...
wer:
omparable
ect
rks for this submission: 1/1.
estion17 ks: 1
rasi(int index)
h efisien dijalankan pada sebuah Linked list dibandingkan Array list.
wer:
True False
ect
rks for this submission: 1/1.
estion18 ks: 1
pleksitas operasi get(index) pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion19 ks: 1
us manakah yang akan sangat berguna apabila program mengimplentasikan Linked List?
ose one answer.
a. Melakukan pencarian pada sebuah daftar bilangan terurut
b. Membalik sebuah daftar bilangan
c. Menghapus bilangan terakhir dari sebuah daftar bilangan
d. Menghapus bilangan pertama pada sebuah daftar bilangan kemudian bilangan kedua menjadibilangan pertama, bilangan ketiga menjadi bilangan kedua, dst.
e. Mengurutkan sebuah daftar bilangan dari bilangan yang paling kecil hingga yang paling besar
ect
rks for this submission: 1/1.
-
8/18/2019 Kuis Online 07
7/23
estion20 ks: 1
pleksitas operasi delete last pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
rrect
rks for this submission: 0/1.
Kuis Online 07 - Linked List
Review of attempt 6
Started on Sunday, 17 April 2016, 09:43 PM
Completed on Sunday, 17 April 2016, 10:08 PM
Time taken 25 mins 20 secs
Marks 17/20
Grade 85 out of a maximum of 100 (85%)
estion1 ks: 1
lass Node> {
T element;
Node next;
Node prev;
Node(T e, Node p, Node n) {
element = e;
next = n;
prev = p;
}
ass DLL> {
protected Node head;
protected Node tail;
protected int size;
public DLL() {
-
8/18/2019 Kuis Online 07
8/23
size = 0;
head = tail = new Node(null, null, null);
}
public void delete(Node a) {
// TODO: membuat node sebelum node setelah node a menjadi node sebelum a [1]
// TODO: membuat node setelah node sebelum node a menjadi node setelah a [2]
// TODO: membuat node a menjadi node sebelum a [3]
}
// TODO: Implementasi lain dari Doubly Linked List
skan code untuk melakukan TODO yang pertama ([1]) di dalam method delete. Jawab dengan kaidah penulisan yang benartoh: a.b = c.d;
wer:
next.prev = a.prev;
ect
rks for this submission: 1/1.
estion2 ks: 1
a tidak bisa melakukan algoritma Binary Search untuk mencari data pada Linked List yang berisi elemen-elemen terurut
wer:
True False
ect
rks for this submission: 1/1.
estion3 ks: 1
pleksitas dari insert/delete node di tengah-tengah Doubly Linked List jika pointer node diketahui adadalah ..
ose one answer.
a. O(n^2)
b. O(n log n)
c. O(1)
d. O(log n)
e. O(n )
ect
rks for this submission: 1/1.
estion4 ks: 1
pleksitas operasi find pada linked list yang hanya menyimpan reference first adalah O(..).
-
8/18/2019 Kuis Online 07
9/23
wer:
ect
rks for this submission: 1/1.
estion5 ks: 1
ed list merupakan rantai dari objek bertipe ListNode. Setiap ListNode berisikan data beserta data dari objek ListNode berikutnya.
wer:
True False
ect
rks for this submission: 1/1.
estion6 ks: 1
gkapilah kode berikut untuk menyisipkan ListNode tmp di tengah-tengah listmp = new ListNode();
p.element = x;
_______ = current.next; // baris 1
______ = tmp; // baris 2
aja!
wer:
rrect
rks for this submission: 0/1.
estion7 ks: 1
pleksitas operasi add last pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion8 ks: 1
asi dari linked list yang menyimpan referensi node sebelum dan sesudahnya disebut dengan .... linked list.
wer:
oubly
ect
rks for this submission: 1/1.
estion9 ks: 1
pleksitas operasi add last pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion10 ks: 1
-
8/18/2019 Kuis Online 07
10/23
hod di bawah ini yang biasanya tidak ada pada iterator linked list adalah
ose one answer.
a. first()
b. zeroth()
c. remove(x)
d. insertFirst(x)
e. insert(x)
ect
rks for this submission: 1/1.
estion11 ks: 1
dapat membuat linked list yang hanya menyimpan pointer first saja tanpa membuat pointer last
wer:
True False
ect
rks for this submission: 1/1.
estion12 ks: 1
lass Node> {
T element;
Node next;
Node prev;
Node(T e, Node p, Node n) {
element = e;
next = n;
prev = p;
}
ass SortedDLL> {
protected Node head;
protected Node tail;
protected int size;
public SortedDLL() {
size = 0;
head = tail = new Node(null, null, null);
}
-
8/18/2019 Kuis Online 07
11/23
public void insert(T value) {
Node current = head;
if (current.next == null) {
current.next = new Node(value, head, tail);
tail.prev = current.next;
} else {
boolean check;
// TODO: isi nilai check
while (check) {
current = current.next;
// TODO: update nilai check
}
Node tmp = current.next;
current.next = new Node(value, current, tmp);
tmp.prev = current.next;
size++;
}
}
public void print() {
Node current = head;
boolean check2;
// TODO: isi nilai check2
while (check2) {
current = current.next;
System.out.println(current.element);
// TODO: update nilai check2
}
}
e di atas adalah implementasi dari Sorted Doubly Linked List. Agar elemen terurut dari elemen terkecil ke elemen terbesar maka code untukggantikan '// TODO: isi nilai check' ataupun '// TODO: update nilai check' adalah ..e : silahkan tulis kode sesuai dengan kaidah penulisan bahasa Java yang baik)toh: a.b == c.d && c.f(a) >= 1 || a != b
wer:
rrent.next != tail && value.compareTo(current.next.element) > 0
-
8/18/2019 Kuis Online 07
12/23
ect
rks for this submission: 1/1.
estion13 ks: 1
pleksitas operasi get(index) pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion14 ks: 1
lass Node> {
T element;
Node next;
Node prev;
Node(T e, Node p, Node n) {
element = e;
next = n;
prev = p;
}
ass SortedDLL> {
protected Node head;
protected Node tail;
protected int size;
public SortedDLL() {
size = 0;
head = tail = new Node(null, null, null);
}
public void insert(T value) {
Node current = head;
if (current.next == null) {
current.next = new Node(value, head, tail);
tail.prev = current.next;
} else {
-
8/18/2019 Kuis Online 07
13/23
boolean check;
// TODO: isi nilai check
while (check) {
current = current.next;
// TODO: update nilai check
}
Node tmp = current.next;
current.next = new Node(value, current, tmp);
tmp.prev = current.next;
size++;
}
}
public void print() {
Node current = head;
if (head.next == null) {
System.out.println("EMPTY");
} else {
boolean check2;
// TODO: isi nilai check2
while (check2) {
current = current.next;
System.out.println(current.element);
// TODO: update nilai check2
}
}
}
e di atas adalah implementasi dari Sorted Doubly Linked List. Agar method print dapat mencetak element pertama hingga terakhir dengan benara code untuk menggantikan '// TODO: isi nilai check2' ataupun '// TODO: update nilai check2' adalah ..e : silahkan tulis kode sesuai dengan kaidah penulisan bahasa Java yang baik)toh: a.b = c.d;
wer:eck = value.next
rrect
rks for this submission: 0/1.
estion15 ks: 1
-
8/18/2019 Kuis Online 07
14/23
pleksitas operasi delete last pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion16 ks: 1
pleksitas operasi get(index) pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
rrect
rks for this submission: 0/1.
estion17 ks: 1
rasi(int index)
h efisien dijalankan pada sebuah Linked list dibandingkan Array list.
wer:
True False
ect
rks for this submission: 1/1.
estion18 ks: 1
uk mengimplementasikan sorted linked list, elemennya harus mengimplement interface ...
wer:
omparable
ect
rks for this submission: 1/1.
estion19 ks: 1
Chanek membuat program yang menyimpan daftar nama pada antrian di Linked List. Untuk mencari nama orang dengan nomor antrian tertentua kompleksitas dari program Pak Chanek adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion20 ks: 1
pleksitas operasi delete last pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
ect
rks for this submission: 1/1.
Kuis Online 07 - Linked List
Review of attempt 7
-
8/18/2019 Kuis Online 07
15/23
Started on Sunday, 17 April 2016, 10:12 PM
Completed on Sunday, 17 April 2016, 10:23 PM
Time taken 10 mins 26 secs
Marks 20/20
Grade 100 out of a maximum of 100 (100%)
estion1
ks: 1
hod di bawah ini yang biasanya tidak ada pada iterator linked list adalah
ose one answer.
a. insert(x)
b. remove(x)
c. insertFirst(x)
d. first()
e. zeroth()
ect
rks for this submission: 1/1.
estion2
ks: 1
pleksitas operasi add last pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion3
ks: 1
pleksitas operasi add (int position) pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
-
8/18/2019 Kuis Online 07
16/23
ect
rks for this submission: 1/1.
estion4
ks: 1
pleksitas operasi delete last pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion5
ks: 1
lass Node> {
T element;
Node next;
Node prev;
Node(T e, Node p, Node n) {
element = e;
next = n;
prev = p;
}
ass SortedDLL> {
protected Node head;
protected Node tail;
protected int size;
public SortedDLL() {
size = 0;
head = tail = new Node(null, null, null);
}
public void insert(T value) {
Node current = head;
if (current.next == null) {
-
8/18/2019 Kuis Online 07
17/23
current.next = new Node(value, head, tail);
tail.prev = current.next;
} else {
boolean check;
// TODO: isi nilai check
while (check) {
current = current.next;
// TODO: update nilai check
}
Node tmp = current.next;
current.next = new Node(value, current, tmp);
tmp.prev = current.next;
size++;
}
}
public void print() {
Node current = head;
boolean check2;
// TODO: isi nilai check2
while (check2) {
current = current.next;
System.out.println(current.element);
// TODO: update nilai check2
}
}
e di atas adalah implementasi dari Sorted Doubly Linked List. Agar elemen terurut dari elemen terkecil ke elemen terbesar maka code untuk
ggantikan '// TODO: isi nilai check' ataupun '// TODO: update nilai check' adalah ..
e : silahkan tulis kode sesuai dengan kaidah penulisan bahasa Java yang baik)
toh: a.b == c.d && c.f(a) >= 1 || a != b
wer:
rrent.next != tail && value.compareTo(current.next.element) > 0
ect
rks for this submission: 1/1.
estion6
-
8/18/2019 Kuis Online 07
18/23
ks: 1
us manakah yang akan sangat berguna apabila program mengimplentasikan Linked List?
ose one answer.
a. Menghapus bilangan terakhir dari sebuah daftar bilangan
b. Mengurutkan sebuah daftar bilangan dari bilangan yang paling kecil hingga yang paling besar
c. Menghapus bilangan pertama pada sebuah daftar bilangan kemudian bilangan kedua menjadibilangan pertama, bilangan ketiga menjadi bilangan kedua, dst.
d. Membalik sebuah daftar bilangan
e. Melakukan pencarian pada sebuah daftar bilangan terurut
ect
rks for this submission: 1/1.
estion7
ks: 1
gkapilah kode berikut untuk menyisipkan ListNode tmp di tengah-tengah list
mp = new ListNode();
p.element = x;
_______ = current.next; // baris 1
______ = tmp; // baris 2
aris 2 saja!
wer:
rrent.next
ect
rks for this submission: 1/1.
estion8
ks: 1
pleksitas operasi get(index) pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion9
ks: 1
-
8/18/2019 Kuis Online 07
19/23
dapat membuat linked list yang hanya menyimpan pointer first saja tanpa membuat pointer last
wer:
True False
ect
rks for this submission: 1/1.
estion10
ks: 1
asi dari linked list yang node terakhirnya menyimpan referensi node pertama disebut dengan .... linked list.
wer:
cular
ect
rks for this submission: 1/1.
estion11
ks: 1
uk mengimplementasikan sorted linked list, elemennya harus mengimplement interface ...
wer:
omparable
ect
rks for this submission: 1/1.
estion12
ks: 1
pleksitas operasi get(index) pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion13
ks: 1
pleksitas operasi delete last pada linked list yang menyimpan reference first dan last adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion14
-
8/18/2019 Kuis Online 07
20/23
ks: 1
pleksitas operasi find pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion15
ks: 1
rasi
(int index)
h efisien dijalankan pada sebuah Linked list dibandingkan Array list.
wer:
True False
ect
rks for this submission: 1/1.
estion16
ks: 1
Chanek membuat program yang menyimpan daftar nama pada antrian di Linked List. Untuk mencari nama orang dengan nomor antrian tertentu
a kompleksitas dari program Pak Chanek adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion17
ks: 1
lass Node> {
T element;
Node next;
Node prev;
Node(T e, Node p, Node n) {
element = e;
next = n;
prev = p;
}
-
8/18/2019 Kuis Online 07
21/23
ass DLL> {
protected Node head;
protected Node tail;
protected int size;
public DLL() {
size = 0;
head = tail = new Node(null, null, null);
}
public void delete(Node a) {
// TODO: membuat node sebelum node setelah node a menjadi node sebelum a [1]
// TODO: membuat node setelah node sebelum node a menjadi node setelah a [2]
// TODO: membuat node a menjadi node sebelum a [3]
}
// TODO: Implementasi lain dari Doubly Linked List
skan code untuk melakukan TODO yang pertama ([1]) di dalam method delete. Jawab dengan kaidah penulisan yang benar
toh: a.b = c.d;
wer:
next.prev = a.prev;
ect
rks for this submission: 1/1.
estion18
ks: 1
ed list yang tiap list node menyimpan referensi node sebelum dan sesudahnya adalah _______ linked list.
wer:
oubly
ect
rks for this submission: 1/1.
estion19
ks: 1
-
8/18/2019 Kuis Online 07
22/23
pleksitas operasi add last pada linked list yang hanya menyimpan reference first adalah O(..).
wer:
ect
rks for this submission: 1/1.
estion20
ks: 1
lass Node> {
T element;
Node next;
Node prev;
Node(T e, Node p, Node n) {
element = e;
next = n;
prev = p;
}
ass SortedDLL> {
protected Node head;
protected Node tail;
protected int size;
public SortedDLL() {
size = 0;
head = tail = new Node(null, null, null);
}
public void insert(T value) {
Node current = head;
if (current.next == null) {
current.next = new Node(value, head, tail);
tail.prev = current.next;
} else {
boolean check;
-
8/18/2019 Kuis Online 07
23/23
// TODO: isi nilai check
while (check) {
current = current.next;
// TODO: update nilai check
}
Node tmp = current.next;
current.next = new Node(value, current, tmp);
tmp.prev = current.next;
size++;
}
}
public void print() {
Node current = head;
if (head.next == null) {
System.out.println("EMPTY");
} else {
boolean check2;
// TODO: isi nilai check2
while (check2) {
current = current.next;
System.out.println(current.element);
// TODO: update nilai check2
}
}
}
e di atas adalah implementasi dari Sorted Doubly Linked List. Agar method print dapat mencetak element pertama hingga terakhir dengan benar
a code untuk menggantikan '// TODO: isi nilai check2' ataupun '// TODO: update nilai check2' adalah ..
e : silahkan tulis kode sesuai dengan kaidah penulisan bahasa Java yang baik)
toh: a.b = c.d;
wer:
rrent.next != tail
ect