Insert(String Own XPrice,er.charAt(0)nothing, otherwise insert new Bike with owner=xOwner, price=xPrice, color=xColor to the tree (price 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:(B,9,4) (C,4,3) (D,8,6) (E,2,5) (F,6,7)
(C,4,3) (8,9,4) (Ε,2,5) (D,8,6) (F,6,7)
void f2() - Perform in-order traversal from the root but display to file f2.txt nodes with price<7 only. Hint: Copy the function inOrder(...) to function inOrder2(...) and modify it. Output in the file f2.txt must be the following:(D,7,2) (H,6,3) (1,5,4) (F,4,5) (C,3,6) (G,8,7) (E,2,8)
(H,6,3) (1,5,4) (F,4,5) (C,3,6) (E,2,8)
void f3()-Suppose the tree is not empty. Find the node p having largest price in the tree (i.e. p is the right-most node), then delete p. Output in the file f3.txt must be the following:(C,5,2) (D,2,1) (E,6,5) (F,1,3) (G,4,6) (H,3,4)
(C,5,2) (D,2,1) (E,6,5) (F,1,3) (H,3,4)
void f4()-Suppose the tree is not empty. Find the node p having largest price in the tree (i.e. p is the right-most node). If p has father f then rotate f to left about p. Output in the file f4.txt must be the following:
(C,5,2) (D,2,1) (E,6,5) (F,1,3) (G,4,6) (H,3,4)
2
(C,5,2) (D,2,1) (G,4,6) (E,6,5) (F,1,3) (H,3,4)
Zoom
+ 78%
Close