algorithm

In Oracle, why are the columns of type LONG created last?

This Oracle documentation page mentions ... columns of type LONG are created last but doesn't say why. What can the reason be to store them at the end of a row? ...

Guidelines require to solve a mathematical intensive (or machine learning?) problem

Hello, The problem I have has got me puzzled. The problem is explained below, There is a container, for example lets say which has a volume of "V". The container needs to be filled with various types of boxes, where each type has a unique size (volume), for example lets say Box Type A - has a volume of K Box Type B - has a volume of L...

Minimal cyclic shift algorithm explanation

I have recently came up against this code lacking any comment. It finds minimal cyclic shift of word (this code specifically returns its index in string) and its called Duval algorithm. Only info I found describes algorithm in few words and has cleaner code. I would appreciate any help in understanding this algorithm. I have always found...

Scale a list of numbers to be between -1.0 and 1.0

This should be an easy one: I have a list of numbers. How do I scale them to be between -1.0 and 1.0 such that the smallest value is -1.0 and the largest is 1.0? ...

Binary search implementation with actors in scala?

Hi, So I have such problem in Scala, I need to implement binary search with the help of actors, with no loops and recursion, preferably with concurrency between actors. Of course it has no sense, but the problem is as follows. I think that it will be nice to have one actor-coordinator,which coordinates the work of others. So input data ...

time, space complexity and O notation problem

Possible Duplicate: Plain English explanation of Big O I can't find any sufficient help for learn or understand about O-notation, and how learn about time or space complexity. So please suggest me , where can I start this. Its really need to me, for now these time.So please give me solution quick. Thanks a lot in advance. ...

Algorithm for edge intersection?

Given Polygon P which I have its verticies in order. and I have a rectangle R with 4 verticies how could I do this: If any edge of P (line between adjacent vertexes) intersects an edge of R, then return TRUE, otherwise return FALSE. Thanks * * * * ...

What does this algorithm do?

I'm trying to find if a rectangle intersects a concave polygon. I found this algorithm: double determinant(Vector2D vec1, Vector2D vec2){ return vec1.x*vec2.y-vec1.y*vec2.x; } //one edge is a-b, the other is c-d Vector2D edgeIntersection(Vector2D a, Vector2D b, Vector2D c, Vector2D d){ double det=determinant(b-a,c-d); doubl...

SQLite & C# ] How can I control the number of people editing a db file?

Hi, I'm programming a simple customer-information management software now with SQLite. One exe file, one db file, some dll files. - That's it :) 2~4 people may be going to run this exe file simultaneously and access to a database. Not only just reading but frequent editing will be done by them too. Yeahhh now here comes the one of ...

Enumerate all n-gram subwords in a phase

Any existing function that can handle this problem? Input: A B C output: {A},{B}, {C}, {A B}, {B C}, {A B C} note that {A C} or {C A} are not valid output. ...

How to iterate a dict of dynamic "depths" in python?

I have a dict data structure with various "depths". By "depths" I mean for example: When depth is 1, dict will be like: {'str_key1':int_value1, 'str_key2:int_value2} When depth is 2, dict will be like: {'str_key1': {'str_key1_1':int_value1_1, 'str_key1_2':int_value1_2}, 'str_key2': {'str_key2_1':int_value2_1, '...

Sum of numbers making a sequence

While watching the rugby last night I was wondering if any scores were impossible given you can only score points in lots of 3, 5 or 7. It didn't take long to work out that any number greater than 4 is attainable. 5=5, 6=3+3, 7=7, 8=3+5, 9=3+3+3, 10=5+5 and so on. Extending on that idea for 5, 7 and 9 yields the following possible score...

Generating Device-Specific Serial Number

I would like to be able to generate unique serial numbers for each Android device for use in unlocking an application. How could I do this? EDIT: The reason is I want to revamp a paid application and provide users who have paid for the old version, which will have a different package name, a way to obtain the full version by downloadin...

2D pattern search algorithms

I need to learn about 2D pattern searching algorithms. Tips and links greatly appreciated. More to the point: Given a matrix of M[m,n] with values in K example 000000000000 000001000000 010100010010 = M, K = {0, 1} 010100010001 101111010111 and a matrix L[i, j] with values in K + {X} representing a "shape" example, the shape of...

Cutting Stock Problem

Does anyone know how to implement the algorithm for this problem using the Knapsack algorithm? The method I'm using at present makes extensive use of LINQ and Collections of Collections and a few Dictionaries. For those who dont know what I'm talking about check out The Cutting Stock Problem. ...

Search query and keyword phrase algorithm

I am looking for an algorithm that will efficiently separate a search string into an array of known search phrases. For instance, if I type "Los Angeles pizza" it needs to know I am looking for "los Angeles" and "pizza", not "Los" and "Angeles pizza". This is for a specialized search application, assume I have a dictionary of all phras...

Bounded Knapsack Problem set-up. Want: a list of all possible packings

Rather than optimize anything, I want to list all the possible - including "incomplete" - packings of the knapsack. Of course, I could loop through all subsets of the set of objects and pick the ones satisfying the weight constraint (can be improved by placing an upper bound on the size of the subsets to look through), but I'd really lik...

How to split a string into words. Ex: "stringintowords" -> "String Into Words" ?

What is the right way to split a string into words ? (string doesn't contain any spaces or punctuation marks) For example: "stringintowords" -> "String Into Words" Could you please advise what algorithm should be used here ? ! Update: For those who think this question is just for curiosity. This algorithm could be used to camеlcase do...

Operator precedence 'pow' and 'root'

I am writing a little home-made calculator for integers and it includes two binary operators, 'pow' and 'root'. The 'pow' operator evaluates (left operand) ^ (right operand), and the 'root' operator finds the largest number n such that n ^ (left operand) <= (right operand). Assuming this isn't an absurd thing to do, what should the prec...

Algorithm: What is the fastest way to check for set inclusion?

Having an array of N sets, what is the fastest way to generate the inclusion graph of these sets? ...