Circular Double Linked List Implementation in JavaTech by Sunny Srinidhi - January 10, 2020January 16, 20200 More in The Data Structures series. We'll continue our data structures journey with this post about how to implement a circular Double Linked List (DLL) in Java. This is very similar to the standard DLL with the only difference being the connection of the head with the tail. That means, we link the head the tail to each other, which we can visualise as a circle, because a circle has no start and no end. Because the head and the tail of the list are connected to each other, we can say that there is no start and no end. But of course, we have references to both the head and the tail, to make our traversal easy. If you have not
Using Google’s libphonenumber Library to Parse and Validate Phone NumbersTech by Sunny Srinidhi - January 9, 2020January 9, 20200 We all work with phone numbers in almost any project or product which has human users. And when the product is available to a global user base, it becomes very difficult to maintain valid phone numbers in the database. We need to make sure the phone numbers for different regions are of the proper length for their regions, add country codes, or remove them, and a lot of such validations. This could become a project of its own pretty soon. We had such an issue in one of our projects. When I was doing the research to find an easy to use and light weight tool so that I could outsource the smarts involved in this to, I came across the
Encrypting and Decrypting data in MongoDB with a SpringBoot projectTech by Sunny Srinidhi - January 8, 2020January 8, 20205 In quite a few applications, we'll have a requirement to keep the data in our databases encrypted so that even if somebody gets into the database, they might not understand what the data is. Encrypting is crucial in many applications. With the rise of NoSQL databases these days, we'll take a look at how we can encrypt data going into a MongoDB database from our Spring Boot application. We'll also see how we can decrypt that data after getting it from the database into our application. One thing you need to know before trying this on any production-grade application is that this will slow things down. There are two extra steps involved in this process - encrypting and decrypting the data.
An Intro to Affective ComputingData Science by Sunny Srinidhi - January 7, 2020January 7, 20200 Not a lot of us have heard of Affective Computing. Most people I have spoken to about this didn't know anything about Affective Computing. So I thought, I'll just write an intro, explaining what I have understood about the discipline and hopefully, will get to learn more from the comments. So let's get started. Affecting computing is all about understanding human emotions in a human-machine interface system and responding based on those emotions. Consider this, you get into an ATM vestibule to draw some cash, but you're tensed about getting late to your date, who is already waiting for you at the restaurant. If anybody sees you in this condition at the ATM vestibule, they'll be able to easily understand that
HashMap implementation in JavaTech by Sunny Srinidhi - January 3, 2020January 3, 20203 More in The Data Structures series. In our data structure series, we have already looked at a couple of ways in which we can implement a stack, and also Single Linked Lists (SLL) and Double Linked Lists (DLL). In this post, we'll see how we can implement our own HashMap and see a couple of examples of how we can use that HashMap. Let's get started. The HashMap Before we can start with the implementation of the HashMap, we need to understand how the stuff actually works. This is a combination of an array and a LinkedList. So it's a bit interesting. When we add an item to a HashMap, we provide a key and a value. The key will be used as a
Stack Implementation in Java using Linked ListsTech by Sunny Srinidhi - December 31, 2019January 3, 20201 More in The Data Structures series. In our previous Stack implementation post, we saw how we can implement a Stack data structure using an ArrayList. But as you can imagine, that's not the right way to implement a stack. A much better implementation is using a LinkedList. In this post, we'll see just that. If you've missed it, I've already written about how to implement Single Linked List (SLL) and Double Linked List (DLL), and I'd encourage you to check those two out first as we'll be using the same Linked List implementation here, and you can find more detailed Linked List explanation there. Assuming that you have done that, let's now move on to the Stack. The Node The first thing we have
Double Linked List Implementation in JavaTech by Sunny Srinidhi - December 30, 20192 More in The Data Structures series. In the previous post, we saw how we can implement Single Linked List in Java. In this post, we'll see how we can extend that and implement a double linked list. The difference between a Single Linked List (SLL) and a Double Linked List (DLL) is that in DLL we have links to both the previous and the next node in the list. In SLL, we only have a pointer to the next node. So in DLL, we have the advantage of traversing the list in both the forward and reverse direction. This adds a lot more flexibility in the linked list. This ins't very much difficult once we have the SLL implementation done. So let's
Single Linked List Implementation in JavaTech by Sunny Srinidhi - December 23, 2019December 23, 20191 More in The Data Structures series. In the previous post, we saw how a stack can be implemented in Java. But as that was the first data structures post on this blog, I used an ArrayList internally. In this post, we'll implement a simple Linked List in Java. Starting with this post, we'll be getting serious about these data structure implementations. So we'll write 100% custom implementation without using any built-in classes in Java. Also, I'm not going to explain how the data structures work. Which means, in this post, I'll not have illustrations like I had for the stack implementation post explaining each step. So we're going to jump right into the implementation from now on. The Node We know that any linked
Stack Implementation example in JavaTech by Sunny Srinidhi - December 20, 2019December 23, 20192 More in The Data Structures series. A stack is one of the most simplest data structure to understand. If you had data structures in your academia, you already know what it means. It’s a simple Last In First Out (LIFO) queue. What that means is the last element to enter the stack will be first element to go out of the stack. Let’s try to understand the concept first with a few illustrations. The concept Suppose we have an empty container which looks like the container shown in the image below: Empty stack That’s pretty simple to understand. Now suppose again that we “push” a string with value “string1” to this empty stack. The stack now looks like this: Stack with one element That’s pretty simple to
Optimising a fastText model for better accuracyData Science by Sunny Srinidhi - December 3, 2019December 19, 20190 More in The fastText Series. In our previous post, we saw what n-grams are and how they are useful. Before that post, we built a simple text classifier using Facebook’s fastText library. In this post, we’ll see how we can optimise that model for better accuracy. Precision and Recall Precision and recall are two things we need to know to better understand the accuracy of our models. And these two things are not very difficult to understand. Precision is the number of correct labels that were predicted by the fastText model, and recall is the number of labels, out of the correct labels, that were successfully predicted. That might be a bit confusing, so let’s look at an example to understand it better. Suppose for a sentence