Implementing Own Stack in Java 3

Lets implement own Abstract Data Type : Stack. So stack is an abstract data type which support LIFO i.e last in first out. Lets now have a look what are the operation it will support: 1. new -> making a new stack 2. push -> insert an object 3. pop -> remove the top object ...

To find out whether your single linked list is circluar 2

Problem is : How to find out whether your single linked list is circluar. Lets have a look on the “The Tortoise and the Hare Algorithm”. Time Complexity :  O(n) Simultaneously go through the list by ones (slow iterator) and by twos (fast iterator) or there will be one slow pointer and one will be ...

Intersection of Two Linked Lists 1

The linked list L1 is  (1 -> 2 -> 3 -> 7 -> 8 -> 9 -> 4 -> 5 -> 6) having a length n and linked list L2 is (-1 -> -3 -> 9 -> 4 -> 5 -> 6) having a length m. So above both L1 and L2 are intersecting at ...

Design Pattern 1

Design Pattern We can divide design patterns into three board categories. 1. Creational Design Pattern: These are the ones that creates objects for you rather than instantiating them directly. This gives your program more flexibility in deciding which objects needs to be created for a given case. Ex:- Factory AbstartFactory Singelton Prototype 2. Structural Design ...

Loading Driver class before saying DriverManager.getConnection in JDBC call 4

These are some of the favorite lines we write for JDBC connectivity: In this particular example, I have used the MySQL driver to connect to MySQL database. This is also one of the favourite questions asked in interviews. First of all I can tell you what all questions can be asked in this topic: What ...