C++ Program to Solve Tower of Hanoi using Binary Value

This C++ program displays the solution to the Tower of Hanoi problem using the base-2 representation of the move number with the following rules:- There is one binary digit (bit) for each disk. The most significant (leftmost) bit represents the largest disk. A value of 0 indicates that the largest disk is on the initial … Read more

advertisement

C++ Program to Solve Tower of Hanoi using Stacks

This C++ program displays the iterative solution to the Tower of Hanoi problem. Tower Of Hanoi consists of three rods and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at … Read more

advertisement

C++ Program to Implement Stack using Two Queues

This C++ program implements a stack data structure using two queue data structures. A stack data structure foolows the principle of LIFO(Last Element in First Element Out). Here is the source code of the C program to displays the popped values from a stack in LIFO mode. The C++ program is successfully compiled and run … Read more

advertisement

C++ Program to Evaluate an Expression using Stacks

This C++ program, using a stack data strucure, computes value of postfix expression which pushes operands and pops these values on encountering an operator. Here is the source code of the C++ program to display the value of the postfix expression given as input. This C++ program is successfully compiled and run on DevCpp, a … Read more

advertisement

C++ Program to Convert Decimal Number to Binary using Stacks

This C++ program, using a stack, displays the bits of a binary number when the corresponding decimal number is entered as input. Here is the source code of the C++ program to display a linked list in reverse. The C program is successfully compiled and run on DevCpp, a C++ compiler. The program output is … Read more

advertisement

C++ Program to Check for Balanced Parentheses using Stack

This C++ program, using a stack data strucure, computes whether the given parantheses expression is valid or not by checking whether each parentheses is closed and nested in the input expression. Here is the source code of the C++ program to display if it is a balanced expreesion or an invalid string. This C++ program … Read more

advertisement

C++ Program to Implement Stack

This C++ Program demonstrates operations on Stack. Here is source code of the C++ Program to demonstrate Stack operations. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. /* * C++ Program To Implement Stack using Linked List */#include<iostream>#include<cstdlib>using namespace std; /* * Node Declaration */struct node{ int info; struct … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.