About 13,100,000 results
Open links in new tab
  1. Reverse a String using Stack - GeeksforGeeks

    Apr 4, 2025 · Follow the steps given below to reverse a string using stack. Create an empty stack. One by one push all characters of string to stack. One by one pop all characters from stack and put them back to string. Time Complexity: O (n) Only one traversal to push and one to pop so O (n)+O (n) = O (n).

  2. Reverse a string using a stack data structure | Techie Delight

    Dec 1, 2021 · This post will discuss how to reverse a string using the stack data structure in C/C++, Java, and Python using explicit stack and call stack.

  3. Java Program to Reverse a String using Stack - GeeksforGeeks

    Oct 21, 2020 · Push the character one by one into the Stack of datatype character. Pop the character one by one from the Stack until the stack becomes empty. Add a popped element to the character array. Convert character array to string. Return reversed string. Below is the implementation of the above approach.

  4. Reverse the Words of a String using Stack - GeeksforGeeks

    Aug 26, 2022 · Given a string str, your task is to reverse the order of the words in the given string. Note that str may contain leading or trailing dots(.) or multiple trailing dots(.) between two words. The returned string should only have a single dot(.) separating the words.

  5. Write a C Program To Reverse String using Stack - CodezClub

    Apr 11, 2017 · Write a C Program To Reverse String using Stack. Here’s simple Program To Reverse String using Stack in C Programming Language. Stack is an abstract data type with a bounded(predefined) capacity.

  6. Java Coding Challenge - Reverse a String using Stack - Java Guides

    In this blog post, we implemented a solution to reverse a string using a stack in Java. We walked through the logic step-by-step, explaining how the stack's LIFO principle helps reverse the order of characters.

  7. Reverse a String using Stack in Java - Techie Delight

    Apr 1, 2024 · This post will discuss how to reverse a string using Stack in Java. The following example demonstrates how to reverse a string with a Stack data structure in Java. Following are the complete steps: Create an empty stack of characters. Convert given string into character array using String.toCharArray() method and push each character of it into ...

  8. Java Program to Reverse a String Using Stack - Tpoint Tech

    Mar 17, 2025 · Push the elements/characters of the string individually into the stack of datatype characters. Pop the elements/characters individually from the Stack until the stack becomes vacant. Add a popped component to the character array. Convert character array to string. Return turned around the string.

  9. Reverse String using Stack - CodeCrucks

    Mar 13, 2023 · This article describes how to reverse a string using a stack. There exist many algorithms to reverse the string. The idea is to generate a new stack that is empty, and then transfer all of the characters from the string into the new stack.

  10. Reverse a string using stack in C++ - CodeSpeedy

    In this tutorial, we will learn how to reverse a string using stack in c++. Create an empty stack, push characters in the stack and then pop.

  11. Some results have been removed
Refresh