About 3,380,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 · The toString() method of the StringBuilder class is the inbuilt method used to return a string representing the data contained by StringBuilder Object. A new String object is created and initialized to get the character sequence from this StringBuilder object and then String is returned by toString

  4. Reverse Using Stack | Practice | GeeksforGeeks

    You are given a string s , the task is to reverse the string using stack. Examples: Input: s ="GeeksforGeeks" Output: skeeGrofskee Input: s ="Geek" Output: keeG Constraints:1 ≤ s.length () ≤ 100.

    Missing:

    • Data Structures

    Must include:

  5. Write a Program to Reverse a String Using Stack

    Write a C, C++ program to reverse a string using Stack data structure. In this question, A string is input by a user and our program will reverse a string using a Stack. Stack is an abstract data type in which push (insertion) and pop (deletion) operations can be done at one end.

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

    Apr 11, 2017 · Here’s simple Program To Reverse String using Stack in C Programming Language. What is Stack ? Stack is an abstract data type with a bounded (predefined) capacity. It is a simple data structure that allows adding and removing elements in a particular order.

  7. Reverse a String using Stack Data Structure - Java Guides

    In this article, we will discuss how to reverse a string using stack operations. This program uses stack operations to reverse a word (string). First, we push each character to the stack, then we will pop each char from the stack. public String reverseWord (String word) { StringBuilder stringBuilder = new StringBuilder ();

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

    Reversing a string is a classic coding challenge often asked in technical interviews. One of the most efficient ways to solve this problem is by using a stack. A stack follows the Last In, First Out (LIFO) principle, making it an ideal data structure for reversing elements.

  9. Java Program to Reverse a String Using the Stack Data Structure

    Sep 10, 2024 · The Stack is a sequential data structure that operates according to the LIFO (Last In First Out) tenet, meaning that the one that was added last is the one that is extracted first. Approach: Insert each character one at a time into the datatype character stack. Pop each character from the stack one at a time until the stack is empty.

  10. 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 ...

  11. Some results have been removed
Refresh