For many of you, this might be a surprise that how you can sort or arrange items without comparing them with each other, but it's possible. There are some sorting algorithms that perform sorting without comparing the elements rather than making certain assumptions about the data they are going to sort. The process is known as non-comparison sorting and algorithms are known as the non-comparison-based sorting algorithms. Non-comparison sorting algorithms include Counting sort which sorts using key-value, Radix sort, which examines individual bits of keys, and Bucket Sort which examines bits of keys.
Saturday, June 28, 2025
Wednesday, February 5, 2025
Top 10 Websites for Coding Interview Preparation in 2025 - Best of Lot
Are you preparing for Coding Interviews? If yes then you might know that there are a number of free online resources to practice important topics for coding Interviews like data structure and algorithms, database and SQL, and others. These websites are equally useful for both, new programmers who are just learning the fundamentals and for experienced ones who are brushing up their coding skills for interviews. I have been sharing useful resources for programming and technical interviews for a long time in this book. In the past, I have shared some recommended online courses and books for coding interviews, as well as some of the frequently asked programming interview questions from tech companies (see here). But, my readers have been asking about some recommended websites for practicing programming challenges and coding interview questions.
Monday, July 1, 2024
Top 50 Java Programs from Coding Interviews
Coding problems are an integral part of any programming job interviews, and Java development interviews are no exception. I would even suggest you should never hire anyone without testing their coding skill, but coding is also an art, and more often than a good coder is also an excellent developer. If you look at tech giants like Amazon, Facebook, and Google they thoroughly test the coding skill of any developer they hire, notably Amazon who first send online coding exercises to filter Java programmers who can code from those who can't code. This online test usually gives you requirements and ask you to write a program in a limited time, usually 2 to 3 hours. The application should meet the output provided by the exercise itself. These type of tasks are very tough to crack if you don't have excellent coding skill.
Wednesday, May 29, 2024
3 ways to Find First Non Repeated Character in a String - Java Programming Problem Example
Write a Java program to find the first non-repeated character in a String is a common question on coding tests. Since String is a popular topic in various programming interviews, It's better to prepare well with some well-known questions like reversing String using recursion, or checking if a String is a palindrome or not. This question is also in the same league. Before jumping into the solution, let's first understand this question. You need to write a function, which will accept a String and return first non-repeated character, for example in the world "hello", except 'l' all are non-repeated, but 'h' is the first non-repeated character.
Sunday, September 24, 2023
Double Checked Locking on Singleton Class in Java - Example
Singleton class is quite common among Java developers, but it poses many challenges to junior developers. One of the key challenges they face is how to keep Singleton class as Singleton? i.e. how to prevent multiple instances of a Singleton due to whatever reasons. Double-checked locking of Singleton is a way to ensure only one instance of Singleton class is created through an application life cycle. As the name suggests, in double-checked locking, code checks for an existing instance of Singleton class twice with and without locking to double ensure that no more than one instance of singleton gets created.
Saturday, September 23, 2023
How to Find Largest of Three Integers in Java - Algorithm, Logic Example
One of the classical programs to build programming logic is, write a program to find the largest of three numbers. I am sure many of you have already done this exercise in a variety of languages including C, C++, C#, JavaScript, Perl, Ruby, PHP, etc. This time we will do it in Java. We will first learn the logic by understanding the flowchart of the largest of three numbers and then we will implement a solution using the ternary operator in Java. I love this program for its sheer simplicity and how it can help beginners to build logic. As always, you are not allowed to use any library function which can solve this problem directly, your main task is to build logic using primitive language tools e.g. operators.
Subscribe to:
Posts
(
Atom
)