To calc the root we will use here the Newton Raphson Method. In this case, Newton’s formula is to approximate Sqrt(x) by … More

# Tag: Algorithms

# An algorithm which check a array and perform operations

Problem Given an array and an integer number perform the operations to increase or set the max value where if the value … More

# An algorithm which returns the number of integers divisible by N in an sequenced interval [Y..Z].

Following the solution. public int algo(int Y, int Z, int N) { if ( Z==0 ) { return 1; } … More

# An algorithm to find the smallest positive integer that does not occur in a given array.

Following examples. [1, 3, 6, 4, 1, 2, 7] then return 5 [-1, 1, 2, 3] the return 4 [−1, … More

# An algorithm that checks if the values of an array form one or two numerical sequences starting from 1

If the values of the array can form one or two numerical sequences then return 1 otherwise return 0. For example … More

# An algorithm to find the min value of the difference between the sum of all numbers from all possible two parts to which it can be divided

The solution is the min absolute value of |(A[0] + … + A[D-1]) – (A[D] + … + A[N-1])| where A … More

# An algorithm to find the missing number in a progressive sequence [1 .. (N + 1)]

Solution public int gauss(int[] sequence) { long lastValue = sequence.length + 1; long total = (lastValue * (lastValue + 1)) … More

# An algorithm which calculates the minimal quantity of steps to walk from a point to another.

Knowing that A is the starting point B is the destination point D is the step size Assume that A, … More

# What is the Big-O?

The big-o notation is a relative representation of the complexity of an algorithm. In simple words, it means that this … More

# An algorithm that turns an integer into binary and returns the biggest amount of zeros in the ranges which are between the character “1” of it.

import java.util.*; class Algorithm { public int[] algorithm(int Num) { return Arrays.stream( Integer .toBinaryString(Num) // turn to binary .replaceAll(“(^0+|0+$)”, “”) … More