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

  • Home
  • SEARCH
  • 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 7403669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:08:36+00:00 2026-05-29T05:08:36+00:00

I am developing an algorithm to reorder packets in a transmission. Each packet has

  • 0

I am developing an algorithm to reorder packets in a transmission. Each packet has an associated sequence number in [0, 256). The first packet’s sequence number can take on any one of those values, after which the next packet takes the next value, and the next packet the value after that, and so forth (rolling over after 255).

The sequence numbers of the packets, in the correct order, would appear as follows, where “n” is the first packet’s sequence number:

n, n+1, n+2, …, 254, 255, 0, 1, 2, …, 254, 255, 0, 1, 2, …, 254, 255, 0, 1, …

Each packet is given a timestamp when it arrives at its destination, and they all arrive approximately in order. (I don’t have an exact figure, but given a list of packets sorted by arrival timestamp, it is safe to say that a packet will never be more than five spots away from its position in the list indicated by its sequence number.)

I feel that I cannot have been the first person to deal with a problem like this, given the prevalence of telecommunications and its historical importance to the development of computer science. My question, then:

  1. Is there a well-known algorithm to reorder an approximately-ordered sequence, such as the one described above, given a cyclically-changing key?

  2. Is there a variation of this algorithm that is tolerant of large chunks of missing items? Let us assume that these chunks can be of any length. I am specifically worried about chunks of 256 or more missing items.

I have a few ideas for algorithms for the first, but not for the second. Before I invest the man-hours to verify that my algorithms are correct, however, I wanted to make sure that somebody at Bell Labs (or anywhere else) hadn’t already done this better thirty years ago.

  • 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-29T05:08:36+00:00Added an answer on May 29, 2026 at 5:08 am

    I don’t know if this solution is actually used anywhere, but here is what I would try (assuming no missing packets, a maximum “shuffeling” of five positions, and a maximum sequence number of 255):

    n = 0;
    max_heap h = empty;
    while( true ) do
      while( h.top().index != 0 ) do
        p = next_packet;
        i = n - p.seq;
        if( i > 0 ) i = i - 255;
        h.add( i, p );
      done
    
      p = h.pop();
      n = n + 1;
      p.increase_indexes( 1 );
      // Do something with it
    done
    

    Basically in the priority queue we store how many packets there are between the last handled packet and the packets still waiting to be handled. The queue will stay very small, because packets are handled as soon as they can, when they come in. Also increasing the keys will be very simple, since no reordering of the heap is necessary.

    I am not sure how you could adapt this to missing packets. Most likely by using some timeout, or maximum offset, after which the packtets are declared the “next” and the heap is updated accordingly.

    I do not think this problem is possible at all however, if you miss more than 256 packets. Take the subsequences

    127,130,128,129
    

    There could be several causes for this

    1) Packets 128 and 129 were out of order and should be reordered

    2) Packets 128 and 129 were lost, then 253 packtets were lost, so the order is correct

    3) A mixture of 1 and 2

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

Sidebar

Related Questions

I'm developing an algorithm to parse a number out of a series of short-ish
Just for kind of fun I'm developing almost every algorithm (if possible) shown in
Developing a .NET WinForms application: how can I check if the window is in
I'm having some trouble developing an algorithm to determine the minimum of a list
I am working on developing a lossless compression algorithm using MATLAB. I would like
I'm developing a web application similar to Digg and I need an algorithm which
I am developing a rotate-around-axis algorithm in 3 dimensions. My inputs are the axis
I am having some trouble developing a suitably fast binning algorithm in Mathematica. I
I am developing an android messaging application. Is there a good spam filtering algorithm
I'm taskd with developing a packing algorithm for parts bought from our online store.

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.