EBK DATA STRUCTURES AND ALGORITHMS IN C
EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
bartleby

Concept explainers

Question
Book Icon
Chapter 4, Problem 1PA
Program Plan Intro

Program Plan:

  • In “main()” function
    • Declare variables “stackk1” and “stackk2” for two stacks and “char_ele” for character of string.
    • Initializing length of string “lengthh” and flag to check palindrome “flag_palleo” as “0”.
    • Read each character of string from keyboard and push it into “stackk1” and increment “lengthh” by one.
    • If length of string “lengthh” is even, pop half number of characters from “stackk1” and push it into “stackk2”.
    • If “lengthh” is odd, pop half number of characters from “stackk1” and push it into “stackk2”.And pop middle character of string from “stackk1”.
    • For half number of characters in string, compare tops of both stacks. If both are same then pop top of both stacks.
    • If tops of two stacks are not same, set flag value as “1” and break from loop.
    • Finally check the value of flag. If flag value is “1”, print the message that string is not palindrome.
    • If flag value “0”, print the message that string is palindrome.

Blurred answer
Students have asked these similar questions
I want to solve 13.2 using matlab please help
a) Show a possible trace of the OSPF algorithm for computing the routing table in Router 2 forthis network.b) Show the messages used by RIP to compute routing tables.
using r language to answer question 4 Question 4: Obtain a 95% standard normal bootstrap confidence interval, a 95% basic bootstrap confidence interval, and a percentile confidence interval for the ρb12 in Question 3.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage