CSD201_-_PESP_2024_s_1_1500.webp
Izumi99

CSD201_-_PESP_2024_s_1_1500.webp

  • Media owner Izumi99
  • Ngày thêm
following:
(C,7,6) (D,6,7) (E,3,8) (F,7,9) (6,8,7) (H,4,9) (1,8,3)
(C,7,6) (D,6,7) (G,8,7) (E,3,8) (F,7,9) (H,4,9) (1,8,3)
void f4() - Suppose the list contains at least 6 elements and p is the 6th element in the list. Change the volume of p to 99, then sort all elements before p ascendingly by volume. The content of the output file f4.txt must be the following:
C,9,8) (D,11,12) (E,8,7) (F,1,2) (1,7,9) (J,6,8) (K,5,6) (L,9,8) (M,3,4)
( (F,1,2) (1,7,9) (E,8,7) (C,9,8) (D,11,12) (J,99,8) (K,5,6) (L,9,8) (M,3,4)
Question 2: (4 marks)
In this question you should complete some methods in BSTree.java file.
The class Bottle with 3 data members: maker, volume and color is given and you do not need to edit it.The BSTree class is a binary search tree of Bottle objects. The variable volume is the key of the tree, thus it must be unique. The following methods should be completed:
void insert(String xMaker, int xVolume, int xColor) - check if xMaker.charAt(0) == 'B' then do nothing, otherwise insert new Bottle object with maker=xMaker, volume=xVolume, color=xColor to the tree (volume and color can get arbitrary, even negative values).
void f1() Do not edit this method. Your task is to complete the insert(...) method above only.Output in the file f1.txt must be the following:
(A,7,9) (C,4,3) (D,8,6) (E,2,5) (Y,6,-7) (F,-6,7)
(F,-6,7) (E,2,5) (C,4,3) (Υ,6,-7) (Α,7,9) (D,8,6)
Zoom

+ 100%
Close
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
Izumi99
Ngày thêm
Lượt xem
1,825
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_PESP_2024_s_1_1500.webp
File size
252.3 KB
Dimensions
1920px x 863px

Share this media

Back
Bên trên Bottom