Expected result:
7U019, 7-Up, Carton of 24 cans, 320ml, 168.000 PS021, Pepsi, Carton of 24 bottles, 390ml, 175.000
MD033, Mirinda, Carton of 24 cans, 320ml, 168.000
SP005, Schweppes, Carton of 24 cans, 320ml, 220.000
2C017, Coca-Cola, Carton of 24 bottles, 600ml, 218.000
MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
b. f2(): Write your code to insert a new_node (given in the file) after the second node (which index is 1) of the current list.
Expected result:
PS021, Pepsi, Carton of 24 bottles, 390ml, 175.000 MD033, Mirinda, Carton of 24 cans, 320ml, 168.000
SR007, Sprite, Carton of 24 bottles, 390ml, 112.000
SP005, Schweppes, Carton of 24 cans, 320ml, 220.000
2C017, Coca-Cola, Carton of 24 bottles, 600ml, 218.000 MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
c. f3(): Find the first node in the linked list that has softdrink's make start with 'M', if such a node is found, then set the price of softdrink in this node to 159.0.
Expected result:
PS021, Pepsi, Carton of 24 bottles, 390ml, 175.000
MD033, Mirinda, Carton of 24 cans, 320ml, 159.000
SP005, Schweppes, Carton of 24 cans, 320ml, 220.000 2C017, Coca-Cola, Carton of 24 bottles, 600ml, 218.000
MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
d. f4(): Sort the linked list in an ascending order according to softdrink's code.
+ 100%
Zoom
Close