Write a C++ program to perform inorder traversal of the given tree.
struct Node* root = newNode(6); #include<iostream> using namespace std;struct node {int data;struct node *left;struct node *right;};struct node *createNode(int val) {struct…
Write a C++ program to create a queue using linked list implementation with values 15 20 25 30 35.Also write a function to print the first element in the queue.
#include<bits/stdc++.h> using namespace std; struct QNode {int data;QNode* next;QNode(int d){data = d;next = NULL;}}; struct Queue {QNode *front, *rear;Queue(){front =…
Write a C++ program to perform 7 push operations of values: 10 20 30 40 50 60 70 in order and then pop three elements and print the remaining stack.
#include<iostream> #include<stack> using namespace std; int main(){stack mystack;mystack.push(10);mystack.push(20);mystack.push(30);mystack.push(40);mystack.push(50);mystack.push(60);mystack.push(70); // Stack becomes 10,20,30,40,50,60,70 // Stack becomes 1, 2,3 }
Write a C++ program to search value 78 in an array arr[10]={23,34,45,56,67,78,89,90,101,110}
using binary search technique and print the index value where the element is found.
#include<iostream> using namespace std; int binarySearch(int[], int, int, int); int main(){int num[10] = {23,34,45,56,67,78,89,90,101,110};int search_num=78, loc=-1; loc = binarySearch(num, 0,…
Write a C ++ Program for creating a queue using array with 15 16 17 18 19 20 elements
and print its elements.
#include<iostream> #define MX5 using namespace std;int queue[MX];int front = -1,rear =-1;void enque(int item){if(rear==MX-1){cout<<“Queue is Full\n”; } else if(front == -1…
Write a C ++ Program for pushing 5 values 10 20 30 40 50 in a stack and print it.
#include<iostream> using namespace std; int main(){stack mystack;mystack.push(10);mystack.push(20);mystack.push(30);mystack.push(40);mystack.push(50); }