Data Structure in Java, please help

A forum to discuss Java programming related issues and concerns.
no avatar
Posts: 1
Joined: Wed Oct 10, 2012 5:00 am
Location: scottsdale

Data Structure in Java, please help

by baranbilgi » Wed Oct 10, 2012 5:04 am

I am trying to add comparison and swap, I am freak out, what am I supposed to do? I really dont have any idea, please someone help, I need missing part.

[/code]public class BubbleSort{
public static void main(String a[]){
int i;

int array[] = {21,33,7,25};

bubblesort(array, array.length);
for(i = 0; i <array.length; i++){
System.out.print(array[i]+" ");


public static void bubblesort( int a[], int N ){
int i, j, t=0;
for(i = 0; i < N; i++){
for(j = 1; j < (N-i); j++){
if(a[j-1] > a[j]){
t = a[j-1];

private static void SWAP(int i, int j) {
// TODO Auto-generated method stub


Return to JAVA Lobby