Windows folders search filter algorithm

I'm wondering if someone knows about the filter algorithm used by windows when searching for files with name containing a given string. I will start with the example in this image: I have a folder that contains 5 sub-folders sorted alphabetically....
more »

2017-02-14 21:02 (0) Answers

Using the find algorithm

I have an assignment that I am working on that has the function outline provided. I am supposed to return the position of the found item if it is found or -1 if not. Here is that outline code: int linearSearch( const vector<int>& inputVec,...
more »

2017-02-12 03:02 (1) Answers

neighbor searching algorithm

I have a STL file that contains the coordinates (x,y,z) of 3 points (p0, p1, p2) of a triangle. these triangle represent a 3D surface f(x,y,z). The STL file might have over a 1000 triangles to represent a complex geometry. for my application, I nee...
more »

2017-02-10 14:02 (2) Answers

Sum of contigous subsequences in an array

Given the following array: tab = [80,12,14,5,70,9,26,30,8,12,16,15] I want to compute the sum of all possible sequences of size 4 as follow: S1=80+12+14+5=111 S2=12+14+5+70 =101 S3=14+5+70+9 =98 .... I have implmented a short program on python...
more »

2017-02-09 10:02 (6) Answers

Lempel-Ziv-Welch decompression non-existent index

I have an implementation off the LZW compression/decompression algorithm and for the most part have it squared away. However, I have encountered a problem with one of the files that I am testing. Below is the text for said file #include "bits.h" in...
more »

2017-02-09 08:02 (1) Answers

algorithm for shifting the array element

I need a algorithm which will pop the array element from the first index and push the next element (from the original array at last index) until the matching set of elements found. Like below: Original array : {10,20,30,40,50,60,70,80,90,100,110,12...
more »

2017-02-07 08:02 (1) Answers

Permutations maintaining order of some elements

Looking for an implementation in Python but I can probably translate from anything. If I have the string "cats ", which is the word cats followed by four spaces, how can I find all of the possible permutations that maintain the order of the word c...
more »

2017-02-07 05:02 (7) Answers

Implementing minimax algorithm in Javascript

As a personal exercise I'm trying to implement a minimax based tic-tac-toe game. I've been studying examples in a variety of languages I have found online. My implementation is at a point where it seems like its working but then the AI loses in certa...
more »

2017-02-06 08:02 (1) Answers

Heuristic for Sudoku Cube

What would be a good heuristic for Sudoku Cube(3x3) ? For Rubik's Cube where you have colours, heuristic can be decided easily but in Sudoku Cube where there is no idea what number is going to set up for which side, What is a good heuristic that can ...
more »

2017-02-05 16:02 (0) Answers

How do I know if an array represents sine wave?

I'm working with accelerometer and collecting data for past few seconds. The motion I want to detect can be represented as sine wave in terms of values I'm getting from motion sensor. So to make it sure, I want a way to check if the data returned fro...
more »

2017-02-05 09:02 (1) Answers

Implement a method for ordered_vowel_words

I've been going over some of the many coding interview questions. I was wondering about implementing an ordered_vowel words method. I'm working on algorithm question to implement this method for purposes of the understanding algorithm. I have the be...
more »

2017-01-29 09:01 (2) Answers

Generating time from numbers

I have numbers as x,y,z, and w. I am trying to create max possible time in 24 hours format. Example: My approach is to sort the all numbers. Then for hours check the number less than equal 2, then for next digit in hour, check number less then equal...
more »

2017-01-25 22:01 (6) Answers

Preferred Sequence Algorithm in T-SQL

EXPLANATION I'm using SQL Server 2012. I need to write algorithm to decide sequence of producing products depending on their setup times. What I mean: for example we need to produce 4 products: A B C D I have a matrix (table Changeover) filled wit...
more »

2017-01-25 13:01 (1) Answers

Searching if trie set is contained in a word

Say I have 2 sets: Set A: ['hi', 'there', 'hire', 'hih', 'hih543'] Set B: ['hihow', 'himan, 'fsdko45'] Now, these sets in reality each contain close to million elements each. What I need to do in a nutshell, is filter the set B, in this way 1) ...
more »

2017-01-25 13:01 (1) Answers

What is the best algorithm to solve this puzzle?

So I came across this question: How many numbers are there from 1 to 1000 which are not divisible by the digits 2, 3 and 5? It seems pretty easy at first, so I wrote a quick python program to solve it: count = 0 for number in range(1,1000): if...
more »

2017-01-25 12:01 (8) Answers

Heap for fast insertion and deletion O(log n)

I'm trying to find an algorithm that has a few properties described below: Use an array as storage (cache friendly). Only store unsigned integers. No values are associated. Insert and delete an ith item should be in order of O(log n) time. Keep th...
more »

2017-01-22 00:01 (2) Answers

Why Quick sort code is breaking stability?

Below is the partition() logic used by qSort(), static void qSort(List *list, int low, int high, compareTo compare){ if(high <= low){ return; // no partition for sub array of size 1 } int pivotIndex = partition(list, low, high, compare...
more »

2017-01-19 01:01 (2) Answers

Algorithm for itertools.combinations in Python

I was solving a programming puzzle involving combinations. It led me to a wonderful itertools.combinations function and I'd like to know how it works under the hood. Documentation says that the algorithm is roughly equivalent to the following: def c...
more »

2017-01-17 11:01 (3) Answers