首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CPT204编程讲解、Java程序调试、algorithm语言程序辅导 解析Java程序|调试Matlab程序
项目预算:
开发周期:
发布时间:
要求地区:
CPT204 Hyflex
Erick Purwanto – May 2021
CPT204 Hyflex 2021
Lab 14 Task Sheet
Overview
Lab 14, the final part of the continuous assessment this semester, consists of 3 parts:
Part A, B and C.
In Part A, you will implement a data structure called Explicit Minimum Priority Queue.
You will then use this data structure to solve a problem called Maximum Attendance
in Part B. Finally, in Part C, you will have to solve three problems of various data
structures, problem-solving and object-oriented techniques that are derived from
Lab 1 – Lab 13.
Submit all your answers for parts A, B, and C to Learning Mall for grading on the
Submission Day.
Timeline
Week 1 – Week 13 Lab 1 – Lab 13
Week 13, Tuesday, Lab 14 Part A, B released
May 25, 2021 (Task Sheet, Skeleton Codes, Partial Test Cases)
Friday, June 4, 2021 Lab 14: Submission Day
- 13.00 - 14.00 CST Lab 14 Part A, B online submission open – closed
- Lab Group Schedule, Lab 14 Part C released
40 minutes Lab 14 Part C on-site, online submission open – closed
Outline
The rest of the task sheet will describe all the three parts and the Submission Day in
detail.
CPT204 Hyflex
Erick Purwanto – May 2021
Lab 14 – Part A
Explicit Minimum Priority Queue
Recall that in Lecture 13 and Lab 13, we have constructed a Minimum Priority Queue
Data Structure, and achieved amortized O(log n) time for add and delMin operations
implemented using resizable array.
In part A, you are to implement Explicit Minimum Priority Queue Data Structure using
ArrayList. It supports the same operations as the Minimum Priority Queue.
However, the priority is explicitly represented as an integer.
Priority Queue
Minimum Priority Queue supports fast removal of the smallest item in the data
structure. It should also support fast item addition.
To have a notion of smallest, either we implement the item to be comparable, or we
explicitly specify the priority of an item with a comparable value, for example an
integer.
Implemented naively using an array, we can achieve constant-time item addition but
linear-time smallest item removal; while on the other hand, using an ordered array,
constant-time removal but linear-time addition. Our goal is then to have an
implementation that can achieve fast running-time for both operations.
Binary Heap
Binary heap is a binary tree that is complete and satisfies the heap-property:
Complete: balanced binary tree, could be left-aligned at the bottom level.
Heap-property: parent’s item/priority is smaller or equal to the children’s.
For example:
CPT204 Hyflex
Erick Purwanto – May 2021
If we represent the binary heap by an array or an ArrayList, set the indices to start
at 1, and order the nodes containing the item and the priority by the heap-property:
There is no explicit links needed between parent node and the children
We can use the indices to access a node’s parent or children
o Parent of a node at index k is k/2
o Children of a node at index k is 2*k and 2*k + 1
For example:
You can then use the following ideas to implement the Minimum Priority Queue:
Item addition: add the new item at the end, then swap it with its parent
repeatedly until the heap-property is restored.
Minimum item removal: replace the minimum item at the root with the last
item, then swap it with the smallest children repeatedly until the heapproperty
is restored.
Part A: Explicit Minimum Priority Queue
In part A, your task is to complete an implementation of the Explicit Minimum Priority
Queue ExpMinPQ interface. It is similar to the MinPQ interface that we discussed and
implemented in Lecture 13 and Lab 13.
Specifically, you will have to implement the following constructor and methods:
1. public ALBinHeap() initializes an empty binary heap.
2. public void add(T item, int priority) adds a new item with its corresponding
integer priority to this binary heap.
It throws an IllegalArgumentException object if item is null.
There may be multiple items with the same priorities in the heap. If there are
two items with the same priority, you may break ties arbitrarily.
3. public T getMin() returns an item with a smallest priority on this binary heap.
It throws a NoSuchElementException object if this binary heap is empty.
CPT204 Hyflex
Erick Purwanto – May 2021
4. public T delMin() removes and returns an item with a smallest priority on
this binary heap.
It throws a NoSuchElementException object if this binary heap is empty.
In addition, you must follow the following rules:
You will implement a Binary Heap represented using an ArrayList. In addition,
there is another instance variable size, that stores the number of items in the
heap. You must not add any instance variables.
ArrayList and NoSuchElementException will be imported in the Learning Mall
Quiz. You must not import another libraries.
You must not use any external libraries, such as java.util.PriorityQueue.
All the methods must run in O(log n) time.
Failing any of the rules above will result in 0 marks.
The total marks of all the implementations in part A is 100 points, for passing all the
test cases.
Advice
The following advice may be found useful in implementing Part A:
1. Use the same Automated Regression Unit Testing and Integration Testing strategy
that you have been using in Lab 13. Note that with the use of explicit priority,
some input parameters may be different from the ones in Lab 13 test cases.
JUnit test cases is provided in ALBinHeapTest.java file.
2. Add more test cases, and create a good suite of test cases and practice the
Partitioning/Boundary, Black-box/White-box, and Coverage testing.
3. Debug with the help of the heapVisualize method provided in HeapVisualizer
.java file.
4. You may define your own private helper methods. Include them in each of your
submissions.
5. Do not define your own instance variables. They are not going to be used in the
hidden test cases and may cause unpredictable errors in the grading system.
CPT204 Hyflex
Erick Purwanto – May 2021
Lab 14 – Part B
Maximum Attendance
In part B, you are going to use the data structure you have developed in part A to
solve an interesting computational problem efficiently.
Maximum Attendance Problem
As a member of the university management team, you are given a list of the university
course activities which has been arranged and scheduled by your colleague. Each
course activity object stores a number of data including the activity day, the start time
the end time, and the number of students. Each course activity is at least 1 hour long.
Due the Covid-19 pandemic mitigation measure, there is a limit on how many
students can be inside the campus building at the same time. You are charged to
make sure that indeed the limit is not violated.
Your task is then to implement an algorithm for finding the largest number of
students attending some course activities at any particular same time.
Course Activity Representation
We represent the course activities with a class called CourseActivity.
These are the instance variables:
1. type. The type of the course activity in String.
2. courseCode. The code of the course in String.
3. day. The day the activity is scheduled on represented in int,
starting from 1 := Monday until 7 := Sunday.
4. startTime. The starting time of this course activity in int from 0 to 23.
5. endTime. The ending time of this course activity in int from 1 to 24.
6. numStudents. The number of students to attend the course activity in int.
7. roomCodeNumber. The room code number of a lecture hall, a tutorial classroom,
or a lab room in String.
CPT204 Hyflex
Erick Purwanto – May 2021
Part B: MaxAttendance
In part B, your task is to complete the skeleton code of the MaxAttendance class in
order to figure out what is the maximum attendance of students.
You are given two ALBinHeap objects from Part A as the instance variables:
private ALBinHeap
minPQ1
private ALBinHeap
minPQ2
You must use those Explicit Minimum Priority Queue implementation to solve the
Maximum Attendance problem efficiently.
You will have to implement in these constructor and method to complete the class:
1. public MaxAttendance(ArrayList
activities).
The constructor takes an ArrayList of CourseActivity to initialize the two binary
heap instance variables.
2. public int maxAttendance(). This method returns the solution to the Maximum
Attendance problem using the two binary heap instance variables.
Testing File and Test Case 1
You are given the following test case in MaxAttendanceTest.java file:
Input:
Course Activity 1: Monday, 10:00 - 11:00, 10 students
Course Activity 2: Monday, 14:00 - 16:00, 25 students
Course Activity 3: Monday, 15:00 - 17:00, 15 students
Course Activity 4: Tuesday, 09:00 - 11:00, 35 students
Output:
40
CPT204 Hyflex
Erick Purwanto – May 2021
Explanation:
The maximum number of student attending some course activities at the same day
and time happens on Monday at about 15:00.
In addition, you must follow the following rules:
You must use the two Explicit Minimum Priority Queue implementations, which
is implemented as ALBinHeap in your solution. You must not add any instance
variables.
ArrayList will be imported in the Learning Mall Quiz. You must not import
another libraries.
You must not use any external libraries, such as java.util.PriorityQueue.
Your algorithm must support multiple course activities scheduled at the same
time.
Your algorithm must run in O(N log N) time, where N is the total number of
course activities in the list.
Failing any of the rules above will result in 0 marks.
The total marks for part B is 100 points, for passing all the test cases.
Advice
The following advice may be found useful in implementing Part B:
1. Add more test cases using the Automated Regression Unit Testing and Integration
Testing strategy into the given testing file MaxAttendanceTest.java.
2. Create a good suite of test cases and practice the Partitioning/Boundary, Blackbox/White-box,
and Coverage testing.
3. You may define your own private helper methods. Include them in each of your
submissions.
4. Do not define your own instance variables. They are not going to be used in the
hidden test cases and may cause unpredictable errors in the grading system.
CPT204 Hyflex
Erick Purwanto – May 2021
Lab 14 – Part C
In part C, you are going to solve 3 questions, closely related to the works you have
done throughout the semester in Lab 1 – Lab 13. It is an open book lab test. You may
open the course pdf or bring hardcopies of course notes. You may open your source
codes in IntelliJ. You may open and review past course quizzes in Learning Mall.
Relative to the programming questions in the Lab Exercises, there will be 2 easy and
1 hard coding questions. There are multiple possible candidate questions for each
question with the same difficulty, you will be given one of them randomly.
While the specific questions are not going to be revealed here, the range of topics will
be given below. You can also practice by reviewing all your works in Lab 1 – Lab 13.
You will be able to access the questions in the respective Learning Mall Quizzes on the
Submission Day.
In addition, you must follow the following rules:
You must not communicate or share anything in any way with anybody other
than the staff at all.
You must not open any other websites.
You must not use any external libraries and you must follow the specific
instructions in any particular questions.
For online students, you must show your screen and your hands at any time
using a webcam.
Failing any of the rules above will result in 0 marks with no warnings given.
The marks for each question in part C is 100 points, for a total of 300 points.
Data Structure
List, ArrayList, MyList, SLList, DLList, ARList
Deque, LLDeque, ARDeque
Map, HashMap, HAMap
Set, ARSet, HASet
MinPQ, ARBinHeap
Disjoint Sets, Quick Find, Quick Union, Weighted Quick Union
Generic Data Structure of the above and their subclasses
CPT204 Hyflex
Erick Purwanto – May 2021
Object-oriented Features and Problem-solving Techniques
Empty Constructor, Default Constructor, Copy Constructor, Deep Copy
Iterative, Recursive, Recursion with Helper Method
Mutates, Not Mutate, Immutable
Resizing Array, Table Doubling/Halving
Checked/Unchecked Exception, Assertion
Iterator, Iterable, Enhanced For Loop, ToString
Interface, ADT, Interface Inheritance, Implementation Inheritance, Casting
Static/Dynamic Type, Dynamic Method Selection, Overloading, Overriding
Equality, Higher Order Functions, Comparator, Comparable, HashCode
CPT204 Hyflex
Erick Purwanto – May 2021
Lab 14 – Submission Day
The submission day is on Friday, June 4, 2021, in two separate time periods.
First, submit Part A and Part B online at 13.00 - 14.00 CST.
Second, submit Part C during your usual lab time according to your lab group
schedule. If you are returning students, come to and submit in the lab rooms; and
if you are non-returning students, submit online invigilated by a teacher using BBB.
At those times, open your CPT204 course page on Learning Mall.
Learning Mall Lab 14 Quiz Section
The quizzes will be accessible on June 4, 2021 : Part A, B at 13:00 CST; and Part C
10 minutes after your respective lab group starting time (16:00 or 17:00 or 18:00 CST).
You will see a similar section shown below.
Additionally for part C, you will also see a problem description and class/method
specification outlining each problem, similar to our lab sheets.
Some may include a skeleton code as well. You may want to copy paste the skeleton
code into your coding environment, so please have it ready.
CPT204 Hyflex
Erick Purwanto – May 2021
Learning Mall Quiz Submission
Part A and Part B. When the quiz open at 13:00 CST, you will see some additional
test cases. You may want to check your code against those test cases in your IDE first,
not in the Learning Mall Quiz.
You have 1 hour to test, debug — if needed, and submit your code. Submit your code
before the closing time at 14:00 CST. It is highly recommended to submit a few
minutes earlier to account for network transmission delay.
Part C. The quizzes will open 10 minutes after your lab group starts. You have to
complete the method or the class, as specified in the problem description and
specification in 40 minutes. You may use Check against the test cases multiple times.
In addition, you may include your private helper methods in the submission box.
Adding another elements, such as importing libraries, will result in 0 marks.
The first Check will have no penalty if failing the test cases. The subsequent Checks,
however, will each incur an additional 15% penalty, cumulatively for each incorrect
Check.
CPT204 Hyflex
Erick Purwanto – May 2021
Useful Tips for Submitting Your Work
1. We will release the lab seating arrangement before the Submission Day. If you are
a returning student, please make sure you prepare the IDE, the library and the
data structure files in your Windows account on the specific lab computer assigned
to you.
2. If you are a non-returning student, join our mock online submission session, to
help you prepare for the additional online invigilation rules.
3. If you are copy paste from your IDE, please double check the parenthesis,
class/method headers, etc., before clicking the Check or Finish Attempt button.
4. Test your code intensively before submitting your work.
5. Familiarize yourself with the error messages of the autograder systems that we
have seen throughout the semester.
Academic Integrity
This Lab 14 coursework assignment is individual work. Plagiarism (e.g. copying
materials from other sources without proper acknowledgement) is a serious academic
offence. Plagiarism and collusion will not be tolerated and will be dealt with in
accordance with the University Code of Practice on Academic Integrity. Individual
students may be invited to explain parts of their code in person, and if they fail to
demonstrate an understanding of the code, no credit will be given for that part of the
code.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!