Q18Comprehension4 Marks13 Apr 2025
Passage
Based on the above data, answer the given subquestions.
The following pseudocode is executed using the "Shopping Bills" dataset.
```
itemD = {}, costD = {}
while(Pile 1 has more cards){
Read the top card X in Pile 1
itemD = updateDict(itemD, X)
Move X to Pile 2
}
foreach i in keys(itemD){
B = 1000000, items = []
foreach j in keys(itemD[i]){
if(itemD[i][j] == B){
items = items ++ [j]
}
if(itemD[i][j] < B){
B = itemD[i][j]
items = [j]
}
}
costD[i] = items
}
Procedure updateDict(D, Y)
if(not isKey(D, Y.ShopName)){
D[Y.ShopName] = {}
}
foreach A in Y.ItemList{
if(isKey(D[Y.ShopName], A.Item)){
D[Y.ShopName][A.Item] = D[Y.ShopName][A.Item] + A.Cost
}
else{
D[Y.ShopName][A.Item] = A.Cost
}
}
return(D)
End updateDict
```
What will itemD[i][j] represent?