## Buy/Download all MCQ Ebook
>>>**Click Here**<<<

## Data Structure Questions and Answers-Pancake Sort

## Click on any option to know the CORRECT ANSWERS

Question 1 |

What is the time complexity for a given pancake sort given it undergoes "n" flip operations?

O(n) | |

O(n ^{2}) | |

O(n ^{3}) | |

O(2n) |

**Aptitude test Questions answers**

Question 1 Explanation:

Most sorting algorithms try to sort making the least number of comparisons but in pancake sort we try to sort using as few reversals as possible. Because the total number of flip operations performed in a pancake sort is O(n), the overall time complexity is O(n

^{2}).Question 2 |

Which operation is most essential to the process of pancake sort?

Flip the given data | |

Find the largest of given data | |

Finding the least of given data | |

Inserting something into the given data |

**HRM Questions answers**

Question 2 Explanation:

When we use pancake sort, we sort the array to find the largest, and then flip the array at that point to bring that value to the bottom of the pancake stack. The size of the array that we are dealing with is then reduced and the process continues. Flip operation is the most important function in the pancake sort technique.

Question 3 |

There is one small error in the following flip routine. Find out which line it is on.

1 void flip(int arr[], int i) 2 { 3 int t, init = 0; 4 while (init < i) 5 { 6 t = arr[init]; 7 arr[i] = arr[init] ; 8 arr[i] = t; 9 init++; 10 i--; 11 } 12 }

Line 3 | |

Line 5 | |

Line 7 | |

Line 9 |

**Biology Questions answers**

Question 3 Explanation:

After initialization of the array titled arr; for each while loop iteration of increasing init, we should make arr[init]=arr[i]. This makes sure that the changes will be made in order to flip the order of the array that was to be flipped. Here in line 7 it has been written in reverse and is incorrect.

Question 4 |

How many flips does the simplest of pancake sorting techniques require?

3n-3 flips | |

2n-4 flips | |

2n-3 flips | |

3n-2 flips |

**UPSC test Questions answers**

Question 4 Explanation:

The minimum number of flips required to sort any stack of n pancakes has been shown to lie between 1.087n and 1.636n. using average of that 1.36n and extracting that for values of n>1. We have 1.36, 2.72, 4.08 etc. This matches best with 2n-3 which is equal to 1, 3, 5, 7, 9, etc. An upper bound of 2n-3 comes by iteratively using the next largest element in its correct place using two flips.

Question 5 |

Pancake Sorting appears in which of the following?

Frequency Scaling | |

Storage Virtualization | |

Parallel Processing | |

Neural Networking |

**Arab culture Questions answers**

Question 5 Explanation:

Pancake Sorting finds application in educational use not to mention parallel processing networks by providing optimal routing algorithms between networks.

There are 5 questions to complete.