HTML DOM Map Object

AmitDiwan
Updated on 31-Jul-2019 14:04:54

221 Views

The HTML DOM Map Object in HTML represents the element.SyntaxFollowing is the syntax −Creating a elementvar mapObject = document.createElement(“MAP”)PropertiesHere, “mapObject” can have the following collections & properties −Collection/ PropertyDescriptionareasIt returns a collection of all elementsimagesIt returns a collection of all & elementsnameIt sets/returns the value of the name attribute for elementExampleLet us see an example for Map areas collection − Live Demo Map areas collection    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: ... Read More

Use of Math.asinh and Math.acosh Functions in JavaScript

vineeth.mariserla
Updated on 31-Jul-2019 14:04:10

182 Views

Math.asinh() and Math.acosh() functions are used to find the hyperbolic arc-sine and hyperbolic arc-cosine of a number respectively. These functions are static methods of Math, therefore they are always used as Math.asinh() and Math.acosh(), rather than as methods of a math object created.Math.asinh()This method is used to find the hyperbolic arc-sine of a number. It takes a number as a parameter and returns hyperbolic sine value.ExampleLive Demo document.write(Math.asinh(2)); document.write(""); document.write(Math.asinh(7)); Output1.4436354751788103 2.644120761058629Math.acosh()This method is used to find the hyperbolic arc-cosine of a number. It takes a number ... Read More

Use of Math.imul Function in JavaScript

vineeth.mariserla
Updated on 31-Jul-2019 13:44:55

190 Views

Math.imul( )Unlike other multiplying functions, the Math.imul() function returns the result of the C-like 32-bit multiplication of the two parameters. Its application is very high in projects like Emscripten. syntaxvar product = Math.imul(a, b);This method takes two numbers and gives out their multiplication value.Example-1In the following example, two normal integers were given as parameters to the method Math.Imul() and the obtained result is displayed as shown in the output.Live Demo document.write(Math.imul(3, 4)); document.write(""); document.write(Math.imul(-3, 4)); Output12 -12Example-2In the following example, c-like 32-bit values were given as parameters to ... Read More

Area of a Circle Inscribed in a Rectangle within a Semicircle

Arnab Chakraborty
Updated on 31-Jul-2019 13:38:21

183 Views

Let us consider one semicircle is given. Its radius is R. One rectangle of length l and breadth b is inscribed in that semi-circle. Now one circle with radius r is inscribed in the rectangle. We have to find the area of the inner circle.As we know biggest rectangle that can be inscribed within the semi-circle has length l and breadth b, then the equation of l and b will be like following −Now, the biggest circle that can be inscribed within the rectangle has radius r is like below −Example#include #include using namespace std; float innerCircleArea(float R){ ... Read More

Arc Length from Given Angle

Arnab Chakraborty
Updated on 31-Jul-2019 13:33:53

206 Views

Here we will see how to get the arc length from the given angle. One circle is given. The radius of the circle is given. Our task is to get the arc length using the radius and the angle. The angle is in degree.Here r and x is given. We have to find the value of L. The formula is like below −𝐿 = 2𝜋𝑟 ∗ (𝑥/360)Example#include using namespace std; float getArcLength(float r, float x){    return (2 * 3.1415f * r) * (x / 360.0f); } int main() {    float rad = 12.0f;    float angle = 45.0f;    cout

Anti-Clockwise Spiral Traversal of a Binary Tree

Arnab Chakraborty
Updated on 31-Jul-2019 13:31:46

318 Views

Here we will see one interesting problem. We have one binary tree. We have to traverse the tree in anti-clockwise manner. The traversal will be like below −The traversal sequence is 1, 8, 9, 10, 11, 12, 13, 14, 15, 3, 2, 4, 5, 6, 7AlgorithmantiClockTraverse(root)Begin    i := 1, j := height of the tree    flag := false    while i data = data;       this->left = NULL;       this->right = NULL;    } }; int getHeight(Node* root) {    if (root == NULL)    return 0;    //get height of left and right ... Read More

Check if N-th Fibonacci Number is Multiple of 10

Arnab Chakraborty
Updated on 31-Jul-2019 13:20:58

283 Views

Here we will see one efficient way to check whether the nth Fibonacci term is multiple of 10 or not. Suppose the Fibonacci terms are {0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987}. So here 15th (Counting from 0) Fibonacci term is divisible by 10. For 16 it will return true.One easiest method is generating Fibonacci numbers up to given term, and check whether it is divisible by 10 or not? But this solution is not good, because it will not work for larger terms.Another good approach is like below −Fibonacci terms ... Read More

Use of Math.clz32 Method in JavaScript

vineeth.mariserla
Updated on 31-Jul-2019 13:18:13

191 Views

Math.clz32()The Math.clz32() function returns the number of leading zero bits in the 32-bit binary representation of a number. In a binary representation, there are 32 numbers consisting of only 1's and 0's. This method scrutinizes through each and every element and returns the number of 0's.syntaxMath.clz32(number);Example-1In the following example, numbers 1 and 0 were passed into the Math.Clz32() function and the number of trailing zeroes were displayed in the output.Live Demo document.write(Math.clz32(1)); document.write(""); document.write(Math.clz32(0)); Output31 32Example-2In the following example, numbers 21 and 20 were passed into the ... Read More

Amazing Stuff with System in C/C++

Arnab Chakraborty
Updated on 31-Jul-2019 13:18:06

902 Views

Here we will see some amazing results by using the system() function in C or C++. The system function is present in Windows, Linux and MAC operating systems. This function is used to execute the system commands that can be written in Command line.Here we will see two usages if system function in C or C++. The first one is getting the IP configuration details using C++ program.Example#include #include using namespace std; int main() {    system("C:\Windows\System32\ipconfig"); }OutputWindows IP Configuration Ethernet adapter Local Area Connection:    Connection-specific DNS Suffix . : domain.name    Link-local IPv6 Address . . ... Read More

All Possible Strings of Any Length from a Given String

Arnab Chakraborty
Updated on 31-Jul-2019 13:14:53

804 Views

In this section we will see how to generate all possible strings of any length, this will take each combination of characters to make string. For example, if the string is ABC, then it will generate − {A, B, C, AB, BA, BC, CB, CA, AC, ABC, ACB, BAC, BCA, CAB, CBA}Let us see the example to get the idea.AlgorithmprintAllString(str)Begin    n := length of the string str    count is 2^n – 1    for each number 0 to count, do       sub_str := empty string       for j in range 0 to n, do ... Read More

Advertisements