Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 960335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:10:01+00:00 2026-05-16T01:10:01+00:00

Actually, this is not specific to SQL, and I doubt conversation pattern is the

  • 0

Actually, this is not specific to SQL, and I doubt “conversation pattern” is the correct name, but I could not think of a better caption.

To simplify, imagine you got a vast stream of ints. The task is to detect an A.{1;max_n}A pattern: An int satisfies the pattern if it is followed by n (> 0) other ints, then the original int again, while n <= max_n.

Example:

...
1
4 <--
7 \
3  > n = 3
3 /
4 <--
2
...

Here, the int 4 is repeated with 3 arbitrary ints in-between, so for max_n <= 3 the pattern is satisfied for the value 4.

The question is, how can I detect which integers in the huge dump of data follow this pattern? I’m mostly interested in the algorithm itself, but an example in SQL or C# would be welcome, too.

The naive idea I came up with is to first gather a list or all distinct ints, then check the pattern in a straightforward way for each of them, but that would lead to a performance bottleneck.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:10:01+00:00Added an answer on May 16, 2026 at 1:10 am

    You can hold some dictionary (C#) or map (C++) structure where will be saved position of first occurrence of numbers.

    Then for every number you should check if it present in map. If yes – you should compare position difference with maximum position difference occurred before. Otherwise you should save the number and its position in map.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may not be Devise specific but I'm wondering how to add an additional
actually this is not hang status, i mean..it slow response, so in that case,
i have a very simple question, actually this is not the question, this is
For some reason, this code does not actually draw my bitmap file... or show
This deals with WordPress plugin development. Even if a user has not actually signed
I haven't actually done this yet, and maybe I don't need to, but it
Note: Not sure if SO has a specific DB site so I'm putting this
So, this is actually this question is my current keystone. I'm working on refactoring
I'm very new to trigger function. Actually this is the first time I'm using
I m Using a calendar.js file to implement calendar in my App. Actually this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.