sorting - Algorithms to sort data from text files in ascending/descending order C# -
right, let me try explain stuck on , trying do! have multiple .txt files, large set of data inside them (one has days of week, dates, , others other data stocks) in descending order (so first piece of data of 1 .txt file matches first piece of data in .txt file).
i trying code read lines of text files (using file.readalllines), place read data big array (if possible) if user requests see data on "wednesday" or data in text files 01/03/1999 - 31/03/1999 , data show on command line (i added table - run code , you'll see mean) user has able search day or date , needs able sorted ascending , descending order using algorithm, in head, know need do, implementation struggle, i've tried array.list(), array.sort(), quicksort (wasn't useful @ all) , more have forgotten after 3 hours worth of trial , error.
i'm still quite new this, in terms of algorithms have explained it's @ least understandable open enough might others. if makes no sense, please ask questions , i'll answer them, might have confused myself in writing :p) in advance!
<!-- run code see table --> <table style="width:100%"> <tr> <td>date</td> <td>day</td> <td>open</td> <td>close</td> <td>difference</td> <td>volume</td> </tr> <tr> <td>01/03/1999</td> <td>monday</td> <td>312</td> <td>320</td> <td>...</td> <td>...</td> </tr> <tr> <td>10/03/1999</td> <td>wednesday</td> <td>301</td> <td>289</td> <td>...</td> <td>...</td> </tr> <tr> <td>19/03/1999/</td> <td>friday</td> <td>365</td> <td>342</td> <td>...</td> <td>...</td> </tr> </table>
you not need write or implement sorting algorithms this, matter of parsing data object form.
file.readalllines dumps every line of file array, , not enough organize data meaningful way. need parse html deserialize file list of objects.
this point in right direction in regard parsing html: what best way parse html in c#?
you'll need create class property each of data fields.
after have turned files objects, , have verified data contained in objects, should have list or array of these items. can use linq extension method orderby sort data.