pattern-finding

How can i find a pattern in an array of integers?

不羁岁月 提交于 2020-01-16 09:03:29
问题 A week ago I got my homework, where I have to write a function in C. The function gets a single array of positive integers, and it has to return the next number in the array. The arrays look something like this: {1,2,3,1,2,3,4,1,2,3,1,2,3,4,1,2,3,-1}; -1 means the end of the array. I know that the number which has to be returned by the function is 1, however, how can I code a pattern finding algorithm? I haven't found any solution on the internet, since every other question about pattern

Find a pattern image (binary file)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 18:37:48
问题 For string variable in DigitalMicrograph, we can find the position of a particular pattern using the "find" function: Number find( String str, String sub_str ) I would like to do the same but with image data. For example, I can create an image with image img := exprsize(1024, icol); and the pattern I want to find is image pattern := exprsize( 15, icol+64 ); In above case, we know the offset of pattern w.r.t. the data is at column number 64. A real case we won't have a such simple pattern (i.e

Find the largest convex black area in an image

…衆ロ難τιáo~ 提交于 2019-11-28 03:33:59
I have an image of which this is a small cut-out: As you can see it are white pixels on a black background. We can draw imaginary lines between these pixels (or better, points). With these lines we can enclose areas. How can I find the largest convex black area in this image that doesn't contain a white pixel in it? Here is a small hand-drawn example of what I mean by the largest convex black area: P.S.: The image is not noise, it represents the primes below 10000000 ordered horizontally. I'll sketch a correct, poly-time algorithm. Undoubtedly there are data-structural improvements to be made,

Find the largest convex black area in an image

落爺英雄遲暮 提交于 2019-11-27 19:14:51
问题 I have an image of which this is a small cut-out: As you can see it are white pixels on a black background. We can draw imaginary lines between these pixels (or better, points). With these lines we can enclose areas. How can I find the largest convex black area in this image that doesn't contain a white pixel in it? Here is a small hand-drawn example of what I mean by the largest convex black area: P.S.: The image is not noise, it represents the primes below 10000000 ordered horizontally. 回答1