Quadtrees in Data Structure

Arnab Chakraborty
Updated on 08-Jan-2020 10:21:11

4K+ Views

Quadtrees are trees implemented to efficiently store data of points on a two-dimensional space. In this tree, each node has maximum four children.We can build a quadtree from a two-dimensional area implementing the following stepsThe current two dimensional space is divided into four boxes.If a box consists of one or more points in it, build a child object, storing in it the two dimensional space of the box.If a box does not contain any points, do not build a child for it.Perform recursion for each of the children.Quadtrees are implemented in image compression, where each node consists of the average ... Read More

Range Trees in Data Structure

Arnab Chakraborty
Updated on 08-Jan-2020 10:20:27

4K+ Views

A range tree is defined as an ordered tree data structure to hold a list of points. It permits all points within a given range to be efficiently retrieved, and is typically implemented in two or higher dimensions. It is same to a kd-tree except with faster query times of O(logd n + k) but worse storage of O(n logd-1 n), with d indicating the dimension of the space, n indicating the number of points in the tree, and k indicating the number of points retrieved for a given query. Range trees may be differentiated with interval trees: instead of ... Read More

What is Onclick Event in JavaScript

vanithasree
Updated on 08-Jan-2020 10:19:53

680 Views

The onClick event is the most frequently used event type, which occurs when a user clicks the left button of the mouse.ExampleYou can put your validation, warning etc., against this event type.Live Demo                                         Click the following button and see result                          

Pascal's Triangle in C++

AmitDiwan
Updated on 08-Jan-2020 10:15:49

6K+ Views

Pascal’s triangle is an array of binomial coefficients. The top row is numbered as n=0, and in each row are numbered from the left beginning with k = 0. Each number is found by adding two numbers which are residing in the previous row and exactly top of the current cell. It is also being formed by finding (𝑛𝑘) for row number n and column number k.Suppose the input is 10, then the output will be like −               1               1 1             ... Read More

Halfedge Data Structure

Arnab Chakraborty
Updated on 08-Jan-2020 10:13:08

825 Views

IntroductionA HDS for template parameters or halfedge data structure (abbreviated as HalfedgeDS) is defined as an edge-centered data structure capable of maintaining incidence information of vertices, edges and faces, such as for planar maps, polyhedra, or other orientable, two-dimensional surfaces embedded in random dimension. Each edge is broken into two halfedges with opposite orientations. Each halfedge stores one incident face and one incident vertex. One incident halfedge is stored for each face and each vertex. Reduced variants of the halfedge data structure can eliminate some of this information, such as the halfedge pointers in faces or the storage of faces ... Read More

What are Label Statements in JavaScript

karthikeya Boyini
Updated on 08-Jan-2020 09:16:48

4K+ Views

JavaScript label statements are used to prefix a label to an identifier. A label can be used with break and continue statement to control the flow more precisely. A label is simply an identifier followed by a colon (:) that is applied to a statement or a block of code. We will see two different examples to understand how to use labels with break and continue.ExampleYou can try to run the following code to use labels to control the flow, with break statementLive Demo                    document.write("Entering the loop! ");   ... Read More

Break a Loop in JavaScript

Ankitha Reddy
Updated on 08-Jan-2020 08:31:10

446 Views

The break statement is used to break a loop and continue executing the code, which is after the loop.ExampleYou can try to run the following code to break a loop in JavaScriptLive Demo                          var text = "";          var i;          for (i = 0; i < 5; i++) {             if (i === 2) {                break;             }             text += "Value: " + i + "";          }          document.getElementById("test").innerHTML = text;           OutputValue: 0 Value: 1

Bitwise XOR Assignment Operator in JavaScript

Abhinaya
Updated on 08-Jan-2020 07:51:50

348 Views

It performs XOR operation on the right operand with the left operand and assigns the result to the left operand.ExampleYou can try to run the following code to learn how to work with Bitwise XOR Assignment OperatorLive Demo                    var a = 2;   // Bit presentation 10          var b = 3;   // Bit presentation 11          document.write("(a ^= b) => ");          document.write(a ^= b);          

Redirect Website After Certain Amount of Time Without JavaScript

Anvi Jain
Updated on 08-Jan-2020 07:06:18

6K+ Views

To redirect from an HTML page, use the META Tag. With this, use the http-equiv attribute to provide an HTTP header for the value of the content attribute. The value of the content is the number of seconds; you want the page to redirect after.Through this, you can automatically redirect your visitors to a new homepage. Set the content attribute to 0, if you want it to load immediately.ExampleThe following is an example of redirecting current page to another page after 2 seconds.Live Demo           Redirection                     This page will redirect in 2 seconds.    

Get Difference Between Two Numbers Using JavaScript Function

Arjun Thakur
Updated on 08-Jan-2020 06:46:47

9K+ Views

Use Math.abs() inside a JavaScript function to get the difference between two numbers in JavaScript.ExampleYou can try to run the following code to get the difference of numbersLive Demo                    var num1, num2;          num1 = 50;          num2 = 35;          var difference = function (num1, num2){             return Math.abs(num1 - num2);          }          document.write("Difference = "+difference(num1,num2));              

Advertisements