I have a datagridview displayed on the screen. The user can change the end column called “Pareto” to any integer he/she likes. But there is a catch, all records are in a league.
The user also may wish to simply leave a number out and come back to it, so not allowing for a missing number isn’t possible.
Basically I need a method that checks if a column has a missing number from a non-sorted row, and also stores each number that’s missing into an array/list for me to output.
Normally I like these little logic questions But after the loops I’ve coded today my brain is burnt out… so any input would be great!
I originally thought about first getting the maximum records in the grid via count(no problem)
Then using it as the range from 1 – “maxCount”. Find all missing numbers. It sounded so simple until I thought about the fact it is not sorted.
Many thanks
Not clear the real work-flow, but..
The fact is that
DataGridViewis not sorted is a pureUIstuff. Yourdatacan be sorted and binded to theDataGridviaDataViewor any other intermidiateViewlayer.One time user inserts the value, you can execute binary-search (fastest available on sorted collection search) to find the value of interest.
EDIT
If you need to check the missed numbers among set of numbers from (1..500), first you can have all numbers sorted, like defined in my post in data-model.
after make
Hope this helps.