Computer Science, asked by wwwjoepauljopz, 3 months ago

A = 0, B = 0, C = 0

while (Pile 1 has more cards) {

Read the top card X from Pile 1

A, B, C = DoSomething(X, A, B, C)

Move X to Pile 2

}

Procedure DoSomething(Y, A, B, C) {

if (Y.ShopName == “SV Stores” and Y.TotalBillAmount > A) {

A = Y.TotalBillAmount

}

if (Y.ShopName == “Big Bazaar” and Y.TotalBillAmount > B) {

B = Y.TotalBillAmount

}

if (Y.ShopName == “Sun General” and Y.TotalBillAmount > C) {

C = Y.TotalBillAmount

}

return ([A, B, C])​

Answers

Answered by nancychaterjeestar29
0

Answer:

binarySearch(arr, x, low, high)

   if low > high

       return False

   else

       mid = (low + high) / 2

       if x == arr[mid]

           return mid

       else if x > arr[mid]      //if key is on the left side

           return binarySearch(arr, x, mid + 1, high)

       else                            

           return binarySearch(arr, x, low, mid - 1)

#SPJ2

Similar questions