Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

java project

Jstorm1000
Jstorm1000 


finding the k smallest number in an array generated randomly. two bare bone classes are given where you fill out the method. Attachments Tags Clarifications

Answers

Project 1

felo
felo 



Finding the K-th Smallest Item in an Array

SEE ATTACHED FOR SOLUTION WITH A WORKING SCREENSHOT.
ALSO COMPLETE ZIP FILE
Attachments
KSmallTester.java (2 K) Download Preview
public static void randFillArray(int[] array) { Random random = new Random(); for (int i = 0; i < SIZE_OF_ARRAY; i++) array[i] = random.nextInt(100); } public static void main(String argv[]) { int k = 1, kthSmallest = 0; int[] array = new

KthSmallest.java (3 K) Download Preview
the textbook. return lastS1; // the index of the pivot element } /***************************************************************************** * This method takes the position of which the user whats the number off and * * an array along with the index of the first and last numbers and

KSMALL.png (96 K) Download Preview

CIS 181 PROJECT#1.zip (7 K) Download





Preview
ToDo: Read input k and print out the k-th smallest item of the array. // Note that your program should allow finding k-th smallest item from // an array // continuously (i.e., more than once) , refilling the array, and // exiting the //

Preview
{ static ArrayList<Integer> s1 = new ArrayList<Integer>(); static ArrayList<Integer> s2 = new ArrayList<Integer>(); private static void swap(int[] theArray, int i, int j) { int temp = theArray[i]; theArray[i] = theArray[j]; theArray[j] = temp; } /********************************************************************************* * This method

Screenshots
Screenshot
Purchase Answer