- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Sai Subramanyam has Published 102 Articles
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
4K+ Views
DFS visits the child vertices before visiting the sibling vertices; that is, it traverses the depth of any particular path before exploring its breadth. A stack (often the program's call stack via recursion) is generally used when implementing the algorithm.Following is how a DFS works −Visit the adjacent unvisited vertex. ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
234 Views
Here is the complete implementation of the BinarySearchTree Class −Exampleclass BinarySearchTree { constructor() { // Initialize a root element to null. this.root = null; } insertIter(data) { let node = new this.Node(data); // Check if the ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
241 Views
To balance itself, an AVL tree may perform the following four kinds of rotations −Left rotationRight rotationLeft-Right rotationRight-Left rotationThe first two rotations are single rotations and the next two rotations are double rotations. To have an unbalanced tree, we at least need a tree of height 2. With this simple ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
592 Views
Here is the complete implementation of the AVL Tree Class −Exampleclass AVLTree { constructor() { // Initialize a root element to null. this.root = null; } getBalanceFactor(root) { return this.getHeight(root.left) - this.getHeight(root.right); } getHeight(root) ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
1K+ Views
A graph is a pictorial representation of a set of objects where some pairs of objects are connected by links. The interconnected objects are represented by points termed as vertices, and the links that connect the vertices are called edges.Formally, a graph is a pair of sets (V, E), where ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
149 Views
Each element in a tree is a node. We need to define a node before we proceed to define a binary tree as a tree consists of nodes. We'll create a very simple node definition that has 3 properties, namely: left, right and data.left − This holds the reference to ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
570 Views
The first insertion in a newly created binary tree creates a node at the root. Further insertions will be inserted according to the binary search tree property of left children being smaller than parent and right ones being greater than parents.Let us look at how we can implement this algorithm ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
278 Views
In a Binary Search Tree, if we look at the property that the left child is always smaller than the parent, we will find that if we keep iterating towards the left child till we reach a node with no left child, we'll basically find the smallest element in the ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
Sai Subramanyam
250 Views
We've kind of already implemented this in our put method. Let us look at it again in isolation.Exampleget(key) { let hashCode = hash(key); for(let i = 0; i < this.container[hashCode].length; i ++) { // Find the element in the chain if(this.container[hashCode][i].key === ... Read More