Sorting
-
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.
-
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.
-
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.
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" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
Hi, did you try
.Sort()
after writing and before reading the collection? Pls send code if it doesn't help byemonstale 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" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
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.
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.
-
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.
A
List<T>
where T implementsIComparable<T>
is the best one because it has flexibility in that you can provide custom IComparer(s) when calling the.Sort()
method. Sure aDictionary<key,value>
is faster but just like theSortedList
you can only sort/search based on the key.