Below is the source code for bubble sort algorithm using java:-
//Bubble sort algorithm works by iterating the first element to the last element and then comparing the two adjacent elements and only swapping them if they are not in the correct order. Every iteration that we do places the next larger value to its correct place
package javaapplication3;
public class BubbleSort{
//The bubble method has been created which sorts the array
public static int[] bubble(int a[]){
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a.length-1-i; j++) {
if(a[j]>a[j+1])
{
int temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
System.out.print("Iteration number "+(i+1)+":- ");
printingArray(a);
}
return a;
}
//A printingArray method is created to print the sorted array
elements
public static void printingArray(int a[])
{
for (int i = 0; i <a.length; i++) {
System.out.print(a[i]+" ");
}
System.out.println();
}
//The main method which takes the input
public static void main(String args[]){
int a[]={101,23,18,34,7,71,49};
bubble(a);
}
}
Below is the screenshot with output:-

Below is the screenshot of the code:-

JAVA Implement a sorting algorithm of your choice and attach your working program with screenshots. please...
Objective: Implement a sorting algorithm. Description: Implement a radix sort in a Java class named RadixSort.java. Your program should receive its input from a file named "input.txt", which contains one integer per line. It should produce a sorted output file named "output.txt". Include a main method which demonstrates that your algorithm works.
Using Java programming language Your assignment is to implement a recursive reverse sorting algorithm. It should meet the following requirements: 1. The program shall graphically prompt the user for a file. 2. The program shall read the selected file which will contain 1 integer per line. 3. The program shall sort the values it reads from the file from largest to smallest. 4. The program shall write the values to an output file from largest to smallest in the same...
Need some help on this, thanks. Must be done in C language.
Homework 2: Sorting In the second homework you will implement two sorting algorithms of your choice. One sorting algorithm has O(n) complexity while the other has O(n.logn) complexity. The input is student data stored in a file. Student data has the format: Name ID GPA The key for sorting of the O(n) algorithm is the ID while the key for sorting of the O(n.logn) is GPA. Your code...
Need help with my Java Hw: Consider an algorithm that sorts an array of n elements by finding the smallest and largest elements and then exchanges those elements with the elements in the first and last positions in the array. Then the size of the array is reduced by two elements after excluding the two elements that are already in the proper positions, and the process is repeated on the remaining part of the array until the entire array is...
Please go to the Practice Exercises (at the end of Chapter 3 in your text on page 129) and do Exercise E 3.14 which asks you to compute and print the current season of the year depending on the month and day (input as integers). Be sure to review Java boolean operators, multi-way IF-ELSE statements, Switch statements, and String comparison methods before implementing your Java code. The algorithm for this program has been written for you and is included in...
You are working as the software developer and need to identify the best sorting algorithm. Please refer to the following URL: https://www.geeksforgeeks.org/sorting-algorithms/ You can pick any two-sorting algorithm. You need to determine which sorting algorithm is the best to sort the array of 10k elements. Use the following steps to help with your solution: Create C++ functions for any two-sorting algorithm. Write down the random array generation function to generate at least 10k elements. Pass the same array into both...
Sorting Threads Assignment Overview Write a multithreaded sorting program in Java which uses the merge sort algorithm. The basic steps of merge sort are: 1) divide a collection of items into two lists of equal size, 2) use merge sort to separately sort each of the two lists, and 3) combine the two sorted lists into one sorted list. Of course, if the collection of items is just asingle item then merge sort doesn’t need to perform the three steps,...
***Java Project***
Please upload the entire code and attach the screenshots of the
code. The screenshots help me to write the code, so please attach
that. Thank you so much. If you could use the comment to explain
the code, it would be perfect! Thank you so much~
Design and code a Swing GUl for a two-player tic-tac-toe (noughts and crosses) game on a 3 x 3 game board. The JFrame should use a BorderLayout with a JLabel in the...
Write algorithm for a program that will prompt user to enter x and y coordinates of two points : (x1, y1) and (x2, y2) the calculate the distance between these two points. For example, if the two points are as shown below, then distance d can be evaluated using the formula below. Formula for this distance d is:Submit printout - with your name on top. Question 2 Implement the algorithm above in Java Submit printout of source code - with your name on top. Also...
Benchmark Searching and Sorting Write a program that has an array of at least 20 strings that you will have your user enter. It should call a function that uses the linear search algorithm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then should call a function that uses the binary search algorithm to locate the same value. It should also keep...