#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<<"...
Monday, September 14, 2020
Thursday, April 23, 2020
undefined
202
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
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
// 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
// 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
// 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
// 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
...
Wednesday, September 26, 2018
#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...