Hi I need help with bubble sort ,Why doesnt work
Thanks

public void printList(){
		System.out.print(patientsList.get(0).getFirstName());
	      for(int i=0;i<patientsList.size();i++){
	       for(int j = 0; j < patientsList.size(); j++){
		for (int b=(j+1);b< patientsList.size(); b++){
	          int first=patientsList.get(j).getPriority();
	          int second=patientsList.get(b).getPriority();
		if(first>=second){
		int temp=first;
		first=second;
		second=temp;
		}
	 }
 }
	String fname = patientsList.get(i).getFirstName();
	String lname = patientsList.get(i).getLastName();
	int priority = patientsList.get(i).getPriority();
        System.out.println(fname + " "+lname+" "+priority);
			}

How many for loops does bubble sort use?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.