Question:medium

Sequence the given process for checking whether a string is a palindrome or not, using a deque:
(A) Load the string into the deque.
(B) Continuously remove characters from both ends.
(C) Compare the characters.
(D) Determine if the string is a palindrome based on the comparisons.

Show Hint

A deque allows efficient removal of characters from both ends, making it an ideal data structure for palindrome checking.
Updated On: Feb 16, 2026
  • (A), (B), (C), (D)
  • (A), (B), (D), (C)
  • (B), (A), (C), (D)
  • (C), (B), (D), (A)
Show Solution

The Correct Option is A

Solution and Explanation

Step 1: Load the string into the deque.
Initialize a deque with the input string. This data structure facilitates efficient character removal from both extremities.
Step 2: Remove characters from both ends.
Iteratively extract characters from the front and rear of the deque.
Step 3: Compare the characters.
Evaluate if the extracted characters from opposing ends are identical.
Step 4: Determine if it’s a palindrome.
If all character comparisons yield matches, the string is classified as a palindrome.
Step 5: Conclusion.
The procedural order is established as:1. (A) String Loading → 2. (B) Character Extraction → 3. (C) Character Comparison → 4. (D) Palindrome Verification.
Final Answer: \[\boxed{\text{The correct sequence is (A), (B), (C), (D).}}\]
Was this answer helpful?
0


Questions Asked in CUET (UG) exam