Jump to content

A different type of Sort


Recommended Posts

Hello

I have been trying to figure this out for a while, but I keep getting it wrong.

I have some binary strings like this:

0b00000000000000000000000000000000

0b00000000000000000000000000000001

0b00000000000000000000000000000010

0b00000000000000000000000000000011

0b00000000000000000000000000000100

0b00000000000000000000000000000111

0b00000000000000000000000000001001

0b00000000000000000000000000001111

0b00000000000000000000000000110000

0b00000000000000000000000001000100

0b00000000000000000000000010000001

0b00000000000000000000000010001001

0b00000000000000000000000011110001

0b00000000000000000000000100000001

0b00000000000000000000001000000000

0b00000000000000000000001000000001

0b00000000000000000000001111110011

0b00000000000000000000011000000001

0b00000000000000000000111100100000

0b00000000000000000001000000000001

0b00000000000000000001111000000001

0b00000000000000000011000000000001

0b00000000000000000111000000000001

0b00000000000000000111111000000001

0b00000000000000001111000000000011

0b00000000000000001111000000100001

0b00000000000000111111000001000000

0b00000000000001111111000001000001

0b00000000000011111111000001000010

I want to sort them so the ones form Sawtooth shapes like this

0b00000000000000000000000000000000

0b00000000000000000000000000000001

0b00000000000000000000000000000010

0b00000000000000000000000000000011

0b00000000000000000000000000000100

0b00000000000000000000000000000111

0b00000000000000000000000000001111

0b00000000000000000000000000001001

0b00000000000000000000000000110000

0b00000000000000000000000011110001

0b00000000000000000000001111110011

0b00000000000000000000111100100000

0b00000000000000000000000001000100

0b00000000000000000000000010000001

0b00000000000000000000000010001001

0b00000000000000000000000100000001

0b00000000000000000000001000000000

0b00000000000000000000001000000001

0b00000000000000000000011000000001

0b00000000000000000001111000000001

0b00000000000000000111111000000001

0b00000000000000000001000000000001

0b00000000000000000011000000000001

0b00000000000000000111000000000001

0b00000000000000001111000000000011

0b00000000000000001111000000100001

0b00000000000000111111000001000000

0b00000000000001111111000001000001

0b00000000000011111111000001000010

Can you suggest a good algorithm?

Thanks & Regards Tom Bodine

tbodine

Link to comment
Share on other sites

The problem description is pretty meaningless without context. Like how you define "sawtooth". What on earth is this for?

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...