6. The worst case scenario in the quick sort occurs when the
array is partitioned to two equal sized subarray every time that a
recursive call takes place.
True
False
7.Suppose that we want to sort an array of n elements, where
each element is a string of at most 1000 characters. What is the
time requirement for applying radix sort to sort this array?
O(n2)
O(1000n)
O(l000logn)
O(nlogn)
8.Suppose we want to sort the following array of integers using...
Using the worst case scenario for a recursive insertion sort on
an array of 5 elements {5, 4, 3, 2, 1}
Determine a formula that counts the numbers of nodes in that
recursion tree. What is the Big O for execution time.
Determine a formula that expresses the height of the recursion
tree. What is the Big O for memory?
Sorting (quick)
Sort the array using quick sort. Write the array content after
each pass (i.e., from pass 1 to pass 7). Each pass is defined as
the completion of one partition. We always pick the first array
element as the pivot for each partition.
Write a program in Java to sort the given array using merge
sort, quick sort, insertion sort, selection sort and bubble sort
based on the input from the user which sorting technique they
wanted to use. Get the array size, array elements from the user,
and also display the sorted array along with the name of the
sorting technique used.
I have this program, it sorts a file using shell sort and quick
sort then prints amount of comparisons and swaps. I need to add the
insertion algorithm. Here is the code. The language is Java.
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
public class Sort
{
public static int numOfComps = 0,numOfSwaps = 0;
public static void main(String[] args)
{
try{
Scanner scanner = new Scanner(new
File("a.txt"));//your text file here
...
I have this program, it sorts a file using shell sort and quick
sort then prints amount of comparisons and swaps. I need to add the
bubble sort algorithm. Here is the code. The language is Java.
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
public class Sort
{
public static int numOfComps = 0,numOfSwaps = 0;
public static void main(String[] args)
{
try{
Scanner scanner = new Scanner(new
File("a.txt"));//your text file here
...