## Convert Number to base 3 String Representation

Objective: Given a number convert it to base 3 representation. Example: N = 35 Base 3 representation: 1022 N = 50 Base 3 representation: 1212 Approach: Till the number is greater than 0, keep...

Objective: Given a number convert it to base 3 representation. Example: N = 35 Base 3 representation: 1022 N = 50 Base 3 representation: 1212 Approach: Till the number is greater than 0, keep...

Objective – Given three sides of triangle, write a program to find the area of a triangle. Heron’s Formula for finding area of triangle: First find the semi parameter of a triangle using formula,...

Objective: Given a number, write a program to find factorial of that number. What is Factorial Number? In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. The value of...

Objective: Given a String, write a recursive program to reverse it. Example: Original String: tutorial horizon Reversed String: noziroh lairotut Approach: Take the first character out of the string, add it to the end...

Objective: Given a number, find the sum of all of the digits in the number. Example: Number = 3045 Sum = 3+0+4+5 = 12 Number = 231 Sum = 2+3+1 = 7 Approach: Initialize...

Objective– Given a string, write an algorithm to find the character in string which occurs maximum number of times. If more than one character has maximum and same count then print all of them...

We have already discussed about Graph basics. We recommend reading this before you continue to read this article. What is Weighted Graph? A Graph is called weighted graph when it has weighted edges which...

Objective: Given a graph, do the depth first traversal using recursion. Earlier we have seen DFS using stack. In this article we will see how to do DFS using recursion. (Recursion also uses stack...

Earlier we had discussed in Graph Representation – Adjacency Matrix and Adjacency List about Graph and its different representations and we read Graph Implementation – Adjacency List .In this article we will implement graph...

Class Pair<Key, Value> – A convenience class to represent name-value pairs. pair stores a key-pair value. Two Pair objects are considered equal if key and value of one pair is matching with second key....

Earlier we had discussed in Graph Representation – Adjacency Matrix and Adjacency List about Graph and its different representations. In this article we will see the better (use inbuilt class of LinkedList) way to...

Java Deque Interface – It’s a linear collection. The Deque interface is a subtype of the util.Queue interface. Deque is acronym of “Double Ended Queue” means it supports insertion and removal of data from both...

Objective: Given ‘n’ Nuts and ‘n’ Bolts of different sizes. There is one-to-one mapping between nuts and bolts. Write an algorithm to find all matches between nuts and bolts Note: This problem can also be...

Objective: Given two numbers x and y. write an algorithm to find the number of bits which are to be flipped to convert number x to y. Example x = 10, Y = 20 x...

Objective: Given an array which contains even and odd integers. Write an algorithm to separate even and odd numbers. Example int [] arrA = {1,2,3,4,6,8,7,12}; Output: [12, 2, 8, 4, 6, 3, 7, 1] Approach:...

%d bloggers like this: