Given an array of integer, find the number of int pair, so that for each pair a_i, a_j, the number between them, i.e. a_(i+1)...a_(j-1) are all smaller than or
I did search and looked at these below links but it didn't help . Point covering problem Segments poked (covered) with points - any tricky test cases? Need eff
I'm traning on codility now. Some tasks I can solve by myself, but with some tasks have problems. Difficulty of this task is <**>. It's medium, but I stal
I need to add a counter of total comparisons for my Insertion Sort program but I don't know why I'm getting a total of 0 comparisons! I know that the compariso
I want to convert a cyclic graph into an acyclic graph. Is there an pseudocode that can do this? I did try to search but most of them returned where mathematica
I am probably missing something simple here, but I was looking over some simple algorithms in C and have not been able to get the insertion sort in the code bel
I have been trying to solve a Java exercise on a Codility web page. Below is the link to the mentioned exercise and my solution. https://codility.com/demo/res
I was doing an example from Cracking the Coding Interview and I read that executing System.out.println(prefix); (where prefix is a String) would take "O(n) time
I'm reviewing the paper of Dorigo & Gambardella (1997) on the ant colony system (ACS). There are two pheromone updating rules: local updating and global upd
def min_heapify(A,k, n): left = 2*k +1 right = 2*k +2 n=int(len(A)) if left < n and A[left] < A[k]: smallest = left else:
I am trying the kattis problem ABC (https://open.kattis.com/problems/abc). It works fine on my local compiler, but when I submit, I can't pass all the cases. Ca
Yes, it is homework, but I ended up doing it in Java just to get it done, but now the python implementation is bothering me. I'm pretty sure I've implemented it
Big Omega is supposed to be the opposite of Big O, but they can always have the same value, because by definition Big O means: g(x) so that cg(x) is bigger or
I have a simple array. The array length always has a square root of an integer. So 16, 25, 36 etc. $array = array('1', '2', '3', '4' ... '25'); What I do, is
I have a simple array. The array length always has a square root of an integer. So 16, 25, 36 etc. $array = array('1', '2', '3', '4' ... '25'); What I do, is
The in-built Auto-Increment in MySQL doesn't meet my requirement so I'm thinking about making a new one. Here is my requirement: Create an increment serial num
I'm preparing for interviews and I'm trying to memorize Heap's algorithm: procedure generate(n : integer, A : array of any): if n = 1 then output
I want to make a Python program that will run a bisection method to determine the root of: f(x) = -26 + 85x - 91x2 +44x3 -8x4 + x5 The Bisection method is a
Does anyone have code to validate for validating Russian TAX Registration number (VAT). C# code will be great, but if someone have some other language it will b
Given an array of integers, what is the length of the longest subarray containing no more than two distinct values such that the distinct values differ by no mo