java代做 | assignment – Cosc 2P

Cosc 2P

java代做 | assignment – 這是一個關于java的題目, 主要考察了關于java的內容,是一個比較經典的題目, 包括了java等方面, 這是值得參考的assignment代寫的題目

java代寫 代寫java

assignment 3

(Due date for assignment is Thursday November 21st,noon, Late date Monday November. 25th, noon)

Part A

代写essay,代写assignment,代写PAPER,留学生论文代写网Write a program which defines an array of integers of size 30. Seed this array with random integers in the range [0,99]. You can use the syscall 42 to achieve this. E.g.

array: .space 120 #4*

Once seeded write a procedure Sort which will accept the array, and its size as parameters. The procedure is to implement bubble sort to sort the array in increasing order.

代写essay,代写assignment,代写PAPER,留学生论文代写网Write a 2nd procedure Print which accepts the array and its size and prints it to the screen.

代写essay,代写assignment,代写PAPER,留学生论文代写网Your output should consist of the unsorted array followed by the sorted array.

代写essay,代写assignment,代写PAPER,留学生论文代写网The goal of this part is to properly construct activation records for each procedure. Use the conventions discussed in class.

Part B

Extend Part A to prompt the user for a number (target), the program is the search the array, and if the number is present you are to print present at index ? or not present. To determine the index, write a recursive binary search on the array. Your binary search should accept 4 parameters, array, target, left Index, right Index. If found, the procedure will return the index where target was found. If not found, a -1 is returned. Once again, be sure to use proper activation record construction using the conventions discussed in class.

Here is the binary search code in java 代写essay,代写assignment,代写PAPER,留学生论文代写网for your reference.

代写essay,代写assignment,代写PAPER,留学生论文代写网int Bsearch(TableType T, KeyType key, int lt, int rt) { int mid; mid = (lt+rt)/2; if (lt>rt) //Search unsuccessful return -1; else if (T[mid]==key) //Search successful return mid; else if (T[mid]>key) //Search item < mid return Bsearch(T,key,lt,mid-1); else //Search item > mid return Bsearch(T,key,mid+1,rt); }

Submission

代写essay,代写assignment,代写PAPER,留学生论文代写网This submission will be physically and electronically submitted. Thus, it will be your responsibility to ensure that it is printed and submitted in due course prior to the due date as listed above. Marks will be awarded for completion, correctness, and neatness. It is required that you fully document your code. For each program question be sure to include the sources listing and example output of your program.

Physically submit your assignment in the drop box outside of J332. The electronic submission will be via Sakai, be sure to submit on time.

 Your submission should be contained in a large (8.5 inch x 11 inch) envelope. Or a nicely
stapled set of sheets with the cover sheet as the first page.
 Cover Sheet completely filled out, available from:
"http://www.cosc.brocku.ca/forms/cover" Note: your assignment will not be marked
unless one is submitted with the assignment on the assignment due date. This should be
stapled to the outside of the envelope.
The End