## Multiply with power of 2 without using pow() or * operator

Objective: Given a number n and k, Calculate n * k2 without using pow() or *operator. Example: N = 3, k = 4 N*k2 = 48 Approach: Bit Manipulation Left shift the number N...

Skip to content# Category: Software Development Engineer (SDE)

## Multiply with power of 2 without using pow() or * operator

## Find Number of reverse pairs in an array

## Calculate Logn base r – Java Implementation

## Max Flow Problem – Introduction

## Dijkstra Algorithm Implementation – TreeSet and Pair Class

## Check if Given Number is power of 2.

## Heap Sort – Java Implementation

## Find no of reverse pairs in an array which is sorted in two parts in O(N)

## Dijkstra’s – Shortest Path Algorithm (SPT) – Adjacency List and Priority Queue – Java Implementation

## Check if given number is Prime – O(√N) Solution – Java Program

## Print First N Prime Numbers – Java Code

## Dijkstra’s – Shortest Path Algorithm (SPT) – Adjacency List and Min Heap – Java Implementation

## Swap two numbers using Bitwise XOR Operator

## Dijkstra’s – Shortest Path Algorithm (SPT) – Adjacency Matrix – Java Implementation

## Fizz Buzz Challenge – Java Implementation

@tutorialhorizon

Objective: Given a number n and k, Calculate n * k2 without using pow() or *operator. Example: N = 3, k = 4 N*k2 = 48 Approach: Bit Manipulation Left shift the number N...

Objective: Given an array of integers A[],find no of reverse pairs means no of (i, j) pairs where i < j and A[i]>A[j]. This problem is also asked as Count Inversions in an array....

Objective: Given a number n and r, write a program to calculate Logrn Example: N = 32, r =2 Log232= 5 N = 64, r = 4 Log464= 3 Approach: Without using built-In function-...

Max Flow Problem- Maximum flow problems find a feasible flow through a single-source, single-sink flow network that is maximum. This problem is useful for solving complex network flow problems such as the circulation problem. The maximum value...

Earlier we have seen what Dijkstra algorithm is is and how it works. In this article we will see its implementation using adjacency list and TreeSet. Example: Implementation – Adjacency List and Priority Queue...

Objective: Given a number, write a program to find if number is power of two. Example: N = 5 Output: false. N = 8 Output: true (23) N = 512 Output: true (29) Approach:...

What is Heap Sort?? Heap sort is comparison based sorting algorithm. Heap sort is considered as improved selection sort, it divides the input into sorted and unsorted region. The improvement from selection sort is...

Objective: Given an array of integers A[] which is sorted in two parts (both parts are individually sorted), find no of reverse pairs means no of (i, j) pairs where i belongs to the...

Earlier we have seen what Dijkstra’s algorithm is and how it works. In this article we will see its implementation using adjacency list and Priority Queue. Prerequisites: Adjacency List Priority Queue Dijkstra’s Algorithm basics...

Objective: Given a number, write a program to check if the number is prime or not. Prime Number: A number is called a prime number when number is not divisible by 1 or by...

Objective: Given a number N, write a program to print first N prime numbers. What is Prime number:?? A prime number (or a prime) is a natural number greater than 1 that cannot be...

Earlier we have seen the basics of Dijkstra algorithm. In this article we will see its implementation using adjacency list and Min Heap. We strongly recommend reading the following articles Dijkstra algorithm and how...

Objective– Given two numbers, swap both the numbers using XOR operators. Example: X = 4, Y = 8 Output: X = 8, Y= 4 Approach: XOR operator There are many ways to swap two...

Earlier we have seen what Dijkstra’s algorithm is and how it works. In this article we will see its implementation using adjacency matrix. We strongly recommend reading – Dijkstra algorithm and how it works....

Objective: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which...

%d bloggers like this: