ݺߣ

ݺߣShare a Scribd company logo
/*
* Bai 1
*/
/*
* c1
*/
public static LinkedList<Integer> sapXep(int[]
a){
LinkedList<Integer> result = new
LinkedList<>();
for(int i=0; i<a.length; i++){
result.add(a[i]);
}
Collections.sort(result);
return result;
}
/*
* Bai 2
*/
public static int sizeIter(Iterator<Integer>
iter){
int result = 0;
while(iter.hasNext()){
iter.next();
result++;
}
return result;
}
public static int random(Iterator<Integer> iter){
int result = 0;
Iterator<Integer> another = iter;
int size = Test.sizeIter(another);
int randomIndex = new Random().nextInt(size);
int i = 0;
while(iter.hasNext()){
if(i == randomIndex){
result = iter.next();
break;
}else{
iter.next();
i++;
}
}
return result;
}
/*Bai3
*
*/
public static ArrayList<Integer>
duongCheo(int[][] a){
ArrayList<Integer> result = new
ArrayList<>();
if(a.length == a[0].length){
for(int i =0; i<a.length; i++){
result.add(a[i][i]);
}
}else{
result = null;
}
return result;
}
Ad

Recommended

The Features of The Holy Prophet (SAW) - [Urdu]
The Features of The Holy Prophet (SAW) - [Urdu]
Martinkay99
Refrigerated Centrifuge
Refrigerated Centrifuge
acmasindia
DzԾ구조
DzԾ구조
Jong Woo Rhee
JBA-Profile
JBA-Profile
Urmish Antani
Cuestionario de informatica completo
KarenCoronel
Cuestionario de informatica
tatyajila
Web2.0
Web2.0
Surabhi Bhargav
Certificate document
Certificate document
Brendon Enriquez
Ashley Brown CELTA Certificate-2
Ashley Brown CELTA Certificate-2
Ashley Brown
How to for blog students
How to for blog students
dp2004
ET booklet 3-10-14_24_f
ET booklet 3-10-14_24_f
Vicky Hail
Felino Mendiola Jr - CV
Felino Mendiola Jr - CV
Felino Jr. Mendiola
Plagiarism class activity
Plagiarism class activity
dhirazain
Abstract
Abstract
Surabhi Bhargav
Cuestionario de informatica completo
KarenCoronel
Mindfulness s
Pepi Alvarez Cruzado
Gazetteer of Russia. Part: Populated places A-F.pdf
Gazetteer of Russia. Part: Populated places A-F.pdf
peivhau
Flashcards Animais brasileiros Ilustrado Verde.pdf
Flashcards Animais brasileiros Ilustrado Verde.pdf
PriscilaRibeiro803210
Aylanmadan olinadigan soliq.2025 yil.pdf
Aylanmadan olinadigan soliq.2025 yil.pdf
ilxomislomov2020
наказ про зарахуваннядо 1 класу kg72 2025
наказ про зарахуваннядо 1 класу kg72 2025
AleksSaf
History for the class 12 students and class 10
History for the class 12 students and class 10
suseelasudarmani
Reportàge on Kaliningrad LEMONDE.3PAG.pdf
Reportàge on Kaliningrad LEMONDE.3PAG.pdf
Stefano Lariccia
15 June 2025 PS - 15 June 2025 PS - 15 June 2025 PS -
15 June 2025 PS - 15 June 2025 PS - 15 June 2025 PS -
ssuser787edf
pdf-p-classtruncatedtext-module-lineclamped-85ulhh-style-max-lines5topik-tema...
pdf-p-classtruncatedtext-module-lineclamped-85ulhh-style-max-lines5topik-tema...
Ifa Nofalia
Gazetteer of Russia. Part: Populated places G-Krasno.pdf
Gazetteer of Russia. Part: Populated places G-Krasno.pdf
peivhau
cambios_emocionales en los traumas presentes en adolescentes
cambios_emocionales en los traumas presentes en adolescentes
vivianyarenivallecil

More Related Content

Viewers also liked (10)

Web2.0
Web2.0
Surabhi Bhargav
Certificate document
Certificate document
Brendon Enriquez
Ashley Brown CELTA Certificate-2
Ashley Brown CELTA Certificate-2
Ashley Brown
How to for blog students
How to for blog students
dp2004
ET booklet 3-10-14_24_f
ET booklet 3-10-14_24_f
Vicky Hail
Felino Mendiola Jr - CV
Felino Mendiola Jr - CV
Felino Jr. Mendiola
Plagiarism class activity
Plagiarism class activity
dhirazain
Abstract
Abstract
Surabhi Bhargav
Cuestionario de informatica completo
KarenCoronel
Mindfulness s
Pepi Alvarez Cruzado
Ashley Brown CELTA Certificate-2
Ashley Brown CELTA Certificate-2
Ashley Brown
How to for blog students
How to for blog students
dp2004
ET booklet 3-10-14_24_f
ET booklet 3-10-14_24_f
Vicky Hail
Plagiarism class activity
Plagiarism class activity
dhirazain
Cuestionario de informatica completo
KarenCoronel

Recently uploaded (10)

Gazetteer of Russia. Part: Populated places A-F.pdf
Gazetteer of Russia. Part: Populated places A-F.pdf
peivhau
Flashcards Animais brasileiros Ilustrado Verde.pdf
Flashcards Animais brasileiros Ilustrado Verde.pdf
PriscilaRibeiro803210
Aylanmadan olinadigan soliq.2025 yil.pdf
Aylanmadan olinadigan soliq.2025 yil.pdf
ilxomislomov2020
наказ про зарахуваннядо 1 класу kg72 2025
наказ про зарахуваннядо 1 класу kg72 2025
AleksSaf
History for the class 12 students and class 10
History for the class 12 students and class 10
suseelasudarmani
Reportàge on Kaliningrad LEMONDE.3PAG.pdf
Reportàge on Kaliningrad LEMONDE.3PAG.pdf
Stefano Lariccia
15 June 2025 PS - 15 June 2025 PS - 15 June 2025 PS -
15 June 2025 PS - 15 June 2025 PS - 15 June 2025 PS -
ssuser787edf
pdf-p-classtruncatedtext-module-lineclamped-85ulhh-style-max-lines5topik-tema...
pdf-p-classtruncatedtext-module-lineclamped-85ulhh-style-max-lines5topik-tema...
Ifa Nofalia
Gazetteer of Russia. Part: Populated places G-Krasno.pdf
Gazetteer of Russia. Part: Populated places G-Krasno.pdf
peivhau
cambios_emocionales en los traumas presentes en adolescentes
cambios_emocionales en los traumas presentes en adolescentes
vivianyarenivallecil
Gazetteer of Russia. Part: Populated places A-F.pdf
Gazetteer of Russia. Part: Populated places A-F.pdf
peivhau
Flashcards Animais brasileiros Ilustrado Verde.pdf
Flashcards Animais brasileiros Ilustrado Verde.pdf
PriscilaRibeiro803210
Aylanmadan olinadigan soliq.2025 yil.pdf
Aylanmadan olinadigan soliq.2025 yil.pdf
ilxomislomov2020
наказ про зарахуваннядо 1 класу kg72 2025
наказ про зарахуваннядо 1 класу kg72 2025
AleksSaf
History for the class 12 students and class 10
History for the class 12 students and class 10
suseelasudarmani
Reportàge on Kaliningrad LEMONDE.3PAG.pdf
Reportàge on Kaliningrad LEMONDE.3PAG.pdf
Stefano Lariccia
15 June 2025 PS - 15 June 2025 PS - 15 June 2025 PS -
15 June 2025 PS - 15 June 2025 PS - 15 June 2025 PS -
ssuser787edf
pdf-p-classtruncatedtext-module-lineclamped-85ulhh-style-max-lines5topik-tema...
pdf-p-classtruncatedtext-module-lineclamped-85ulhh-style-max-lines5topik-tema...
Ifa Nofalia
Gazetteer of Russia. Part: Populated places G-Krasno.pdf
Gazetteer of Russia. Part: Populated places G-Krasno.pdf
peivhau
cambios_emocionales en los traumas presentes en adolescentes
cambios_emocionales en los traumas presentes en adolescentes
vivianyarenivallecil
Ad

Kt2

  • 1. /* * Bai 1 */ /* * c1 */ public static LinkedList<Integer> sapXep(int[] a){ LinkedList<Integer> result = new LinkedList<>(); for(int i=0; i<a.length; i++){ result.add(a[i]); } Collections.sort(result); return result; } /* * Bai 2 */ public static int sizeIter(Iterator<Integer> iter){ int result = 0; while(iter.hasNext()){ iter.next(); result++; } return result; } public static int random(Iterator<Integer> iter){ int result = 0; Iterator<Integer> another = iter; int size = Test.sizeIter(another); int randomIndex = new Random().nextInt(size);
  • 2. int i = 0; while(iter.hasNext()){ if(i == randomIndex){ result = iter.next(); break; }else{ iter.next(); i++; } } return result; } /*Bai3 * */ public static ArrayList<Integer> duongCheo(int[][] a){ ArrayList<Integer> result = new ArrayList<>(); if(a.length == a[0].length){ for(int i =0; i<a.length; i++){ result.add(a[i][i]); } }else{ result = null; } return result; }