- 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
Karthikeya Boyini has Published 2383 Articles
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
301 Views
Let us set up a simple class that we'll use to define all these methods on. We'll create a container object to store the hash table and create a display function to display the table. Note that for collision resolution, we'll use chaining.The display function takes each entry (hashed value) ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
754 Views
When adding elements to a hash table the most crucial part is collision resolution. We're going to use chaining for the same. There are other algorithms you can read about here: https://en.wikipedia.org/wiki/Hash_table#Collision_resolutionNow let's look at the implementation. We'll be creating a hash function that'll work on integers only to keep ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
943 Views
To remove elements, we simply need to find them and remove them using a simple splice function call that removes elements in place from an array.Let us look at the implementation of the same − Exampleremove(key) { let hashCode = this.hash(key); for (let i = 0; i < ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
393 Views
Sometimes we need to combine containers together using a join function and get a new container. We'll write a static join method that takes in 2 HashTables and creates a new HashTable with all the values. For the sake of simplicity, we'll let the values from the second one override ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
412 Views
The tree represents hierarchical structures like organization hierarchy charts, file systems, etc. To put it more formally, a tree can be defined recursively (locally) as a collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
304 Views
A Binary Search tree exhibits a special behavior. A node's left child must have a value less than its parent's value and the node's right child must have a value greater than its parent value.We'll mostly focus on such trees in this section on trees.Operations on Binary Search TreesWe'll define ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
398 Views
A set is an abstract data type that can store certain values, without any particular order and no repeated values. It is a computer implementation of the mathematical concept of a finite set. Unlike most other collection types, rather than retrieving a specific element from a set, one typically tests ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
415 Views
Let's create a MySet class so that it doesn't hide the actual set class in JS. We'll create a container object that'll keep track of all our values that we add to the set. We'll also create a display function that prints the set for us. Exampleclass MySet { constructor() ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
106 Views
The delete method checks if a value already exists in the set, if it does, then it removes that value from the set. We can implement it as follows &minusl Exampledelete(val) { if (this.has(val)) { delete this.container[val]; return true; } return false; ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
470 Views
In the set that we implemented, we can create a for each function in our class and accept a callback that we can call on every element. Let's see how we can implement such a function − ExampleforEach(callback) { for (let prop in this.container) { callback(prop); ... Read More