Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Sorting problem

Sorting problem

Scheduled Pinned Locked Moved C#
algorithmscsharpcssdata-structureshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    damir_tk
    wrote on last edited by
    #1

    Hi everybody. Can somebody direct me to a correct algorithm to solve the sort problem of the following array of data: ServerWeb.* ServerWebSomething1 ServerWebSomething2 ServerWeb3 ApplicationServer1 App.* ApplicationServer2 should be sorted as this: ApplicationServer1 ApplicationServer2 App.* ServerWebSomething1 ServerWebSomething2 ServerWeb3 ServerWeb.* The point is that the data is first sorted alphabetically, and then withing the similar types of data I need to get the data with more specific to the top and those less specific to the bottom. For instance, as ServerWeb.* covers all servers that starts with the "ServerWeb" it is the least distinctive, while ServerWebSomething1 is the most distinctive in that subgroup. This just puzzles me, I would appreciate any algorithm in any language if C# example is not available. Thanks.

    G 1 Reply Last reply
    0
    • D damir_tk

      Hi everybody. Can somebody direct me to a correct algorithm to solve the sort problem of the following array of data: ServerWeb.* ServerWebSomething1 ServerWebSomething2 ServerWeb3 ApplicationServer1 App.* ApplicationServer2 should be sorted as this: ApplicationServer1 ApplicationServer2 App.* ServerWebSomething1 ServerWebSomething2 ServerWeb3 ServerWeb.* The point is that the data is first sorted alphabetically, and then withing the similar types of data I need to get the data with more specific to the top and those less specific to the bottom. For instance, as ServerWeb.* covers all servers that starts with the "ServerWeb" it is the least distinctive, while ServerWebSomething1 is the most distinctive in that subgroup. This just puzzles me, I would appreciate any algorithm in any language if C# example is not available. Thanks.

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      What you need to do is to define a way to compare two of the values. If you just do that, you can then use any sorting algorithm. You can even make a class that implements ICompareable and use the SortedList class to sort them. What information does the names contain? How do you separate the different parts of information? Why is, for an example, "ServerWebSomething1" more distinctive than "ServerWeb3"? --- b { font-weight: normal; }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups