Monday, September 14, 2020

undefined 202

C++ Program for Preorder, Inorder, PostOrder traversal in Binary Tree

#include <iostream>using namespace std;struct Node{ int data; Node *left; Node *right;};Node *root=NULL;Node* createNode(int value){ Node *newnode = new Node; newnode->data = value; newnode->left = NULL; newnode->right = NULL; return newnode;}void inOrder(Node *node){ if (node == NULL) return; else { inOrder(node->left); cout<<node->data<<"...

Thursday, April 23, 2020

undefined 202

Arrays and basic functions associated with Array in JavaScript

About Arrays in JavaScript: An array is a list of elements which is to store a large amount of element under a single name. The length of the array in JavaScript is not fixed. => Let's define an array with numbers stored form 1 to 5. let number = [1, 2, 3, 4, 5]; => You can define an array with string...

Wednesday, April 22, 2020

undefined 202

How to create Function in JavaScript

What are the Functions? The function is a set of statement that perform some particular task. How to use Functions in JavaScript? For that first, you have defined a function and then call it to use it. Function definition: The function definition is done by using the function keyword that the name of the function...

Friday, March 13, 2020

undefined 202

Program of Stack using Array in C++

// Stack With array #include <iostream> using namespace std; int stack[100]; int top = -1; void push(int x) { if (top == 99) { cout<<"\nOverflow"; } else { stack[++top] = x; } } void pop() { if (top == -1) { cout<<"\nUnderflow"; } else { cout<<"\n"<<stack[top]<<"...

Wednesday, March 11, 2020

undefined 202

Program of Binary Search in C++

// Binary Search #include<iostream> using namespace std; int binary(int arr[], int size, int item){     int beg = 0, last = size - 1, mid;   while (beg <= last){         mid = (beg + last) / 2;         if (arr[mid] == item)     return...
undefined 202

Program of Linear Search in C++

// Linear Search #include<iostream> using namespace std; void linear(int arr[], int size, int item){     for(int i = 0; i < size; i++) {     if(arr[i] == item) {     cout<<"\nElement "<<item<<" Found at index "<<i;     return; } } ...
undefined 202

Program of Insertion Sort in C++

// Insertion Sort #include<iostream> using namespace std; void insertion(int arr[], int size) { int temp, j; for(int i = 1; i <= size - 1; i++) {         temp=arr[i];         j=i-1;         while((temp < arr[j]) && (j >= 0)) {  ...

Saturday, January 12, 2019

undefined 201

Books Review Website

Wednesday, September 26, 2018

undefined 201

Collatz Conjecture Program in C++

#include<iostream> using namespace std; int collatz(int n) { if (n == 1) { return 0; } else if(n % 2 == 0) { return 1 + collatz(n / 2); } else { return 1 + collatz(3 * n + 1); } } (adsbygoogle = window.adsbygoogle || []).push({}); int main(void) { int num; cout<<"\n Enter any...
Page 1 of 41234Next