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

Sorting

Scheduled Pinned Locked Moved C#
algorithmshelp
6 Posts 5 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.
  • S Offline
    S Offline
    sachees123
    wrote on last edited by
    #1

    Dear Frnds, I have got reg nos and marks. Now im supposed to allot rank. What i tried : LIST, SORTEDLIST, HASHTABLE, AND ARRAYLIST. from the above, sortedlist works but it sorts the key ie. reg nos and not the marks. help required.

    M T L D 4 Replies Last reply
    0
    • S sachees123

      Dear Frnds, I have got reg nos and marks. Now im supposed to allot rank. What i tried : LIST, SORTEDLIST, HASHTABLE, AND ARRAYLIST. from the above, sortedlist works but it sorts the key ie. reg nos and not the marks. help required.

      M Offline
      M Offline
      monstale
      wrote on last edited by
      #2

      Hi, did you try .Sort() after writing and before reading the collection? Pls send code if it doesn't help bye

      T 1 Reply Last reply
      0
      • S sachees123

        Dear Frnds, I have got reg nos and marks. Now im supposed to allot rank. What i tried : LIST, SORTEDLIST, HASHTABLE, AND ARRAYLIST. from the above, sortedlist works but it sorts the key ie. reg nos and not the marks. help required.

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        sachees123 wrote:

        from the above, sortedlist works but it sorts the key ie. reg nos and not the marks.

        it is because your key is registration no not marks. Also you can't have marks as key as there chance you are getting same marks twice or thrice or so on!

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
        Never mind - my own stupidity is the source of every "problem" - Mixture

        cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

        1 Reply Last reply
        0
        • M monstale

          Hi, did you try .Sort() after writing and before reading the collection? Pls send code if it doesn't help bye

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          monstale wrote:

          did you try .Sort() after writing and before reading the collection?

          .Sort will sort on key not on value, he need to change design of it application or do manually sorting!

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
          Never mind - my own stupidity is the source of every "problem" - Mixture

          cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

          1 Reply Last reply
          0
          • S sachees123

            Dear Frnds, I have got reg nos and marks. Now im supposed to allot rank. What i tried : LIST, SORTEDLIST, HASHTABLE, AND ARRAYLIST. from the above, sortedlist works but it sorts the key ie. reg nos and not the marks. help required.

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            read all about it[^]. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


            I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
            All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.


            1 Reply Last reply
            0
            • S sachees123

              Dear Frnds, I have got reg nos and marks. Now im supposed to allot rank. What i tried : LIST, SORTEDLIST, HASHTABLE, AND ARRAYLIST. from the above, sortedlist works but it sorts the key ie. reg nos and not the marks. help required.

              D Offline
              D Offline
              Dan Mos
              wrote on last edited by
              #6

              A List<T> where T implements IComparable<T> is the best one because it has flexibility in that you can provide custom IComparer(s) when calling the .Sort()method. Sure a Dictionary<key,value> is faster but just like the SortedList you can only sort/search based on the key.

              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