Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rjesenje Bubble Sorta Linkane Liste U Pametnijem Jeziku Od C++-a

20 views
Skip to first unread message

robert.b...@gmail.com

unread,
Jan 23, 2017, 4:39:10 PM1/23/17
to
import java.lang.*;
import java.io.*;
import java.math.*;
import java.util.*;

class bubblesort
{
public static LinkedList<Integer> v;
public static void main(String args[])
{
int i, j ,k, n=30;
Random r = new Random();
v = new LinkedList<Integer>();
for(i=0; i<n; i++)
{
v.add(r.nextInt(100));
}
System.out.println();
System.out.print(v);
System.out.println();
j=first_rec(0,n);
System.out.print(v);
}
public static int first_rec(int i, int n)
{
if(i==n)return 0;
second_rec(i, i, n);
i++;
first_rec(i, n);
return 1;
}
public static int second_rec(int i, int k, int n)
{
int m, t;
if(k>=n)return 0;
m=v.get(i);
t=v.get(k);
if(m>t)
{
v.set(i, t);
v.set(k, m);
}
k++;
second_rec(i, k , n);
return 1;
}

}


LP, Robert Bralic...;)

robert.b...@gmail.com

unread,
Jan 23, 2017, 5:08:45 PM1/23/17
to
Jeziku Koji Ne Prati Tolika Laz Ko C++....;)
0 new messages