Click here to Skip to main content
16,016,067 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Fixed Point vs. Floating Point Pin
cp987610-Sep-07 0:53
cp987610-Sep-07 0:53 
AnswerRe: Fixed Point vs. Floating Point Pin
Luc Pattyn10-Sep-07 1:16
sitebuilderLuc Pattyn10-Sep-07 1:16 
GeneralRe: Fixed Point vs. Floating Point Pin
Leslie Sanford10-Sep-07 13:14
Leslie Sanford10-Sep-07 13:14 
GeneralRe: Fixed Point vs. Floating Point Pin
Luc Pattyn10-Sep-07 13:30
sitebuilderLuc Pattyn10-Sep-07 13:30 
GeneralRe: Fixed Point vs. Floating Point Pin
cp987610-Sep-07 14:00
cp987610-Sep-07 14:00 
AnswerRe: Fixed Point vs. Floating Point Pin
Stuart Dootson11-Sep-07 22:56
professionalStuart Dootson11-Sep-07 22:56 
Questionalgorithm help!?! Pin
marvc17-Sep-07 6:11
marvc17-Sep-07 6:11 
AnswerRe: algorithm help!?! Pin
Luc Pattyn7-Sep-07 6:56
sitebuilderLuc Pattyn7-Sep-07 6:56 
The easy way (not the most efficient one!): sort the entire input collection, then
throw away all but the top 5.

The less expensive way: create an output collection, initially empty.
loop over all items in your input collection; compare them to the output collection,
if fewer than 5 items, add; if not, compare; if larger than the smallest, remove smallest and
add new one, otherwise skip. For best performance keep the output collection sorted all the
time.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]


this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google


GeneralRe: algorithm help!?! Pin
Dan Neely7-Sep-07 10:17
Dan Neely7-Sep-07 10:17 
GeneralRe: algorithm help!?! Pin
Luc Pattyn7-Sep-07 10:50
sitebuilderLuc Pattyn7-Sep-07 10:50 
GeneralRe: algorithm help!?! Pin
Daniel Grunwald7-Sep-07 11:42
Daniel Grunwald7-Sep-07 11:42 
GeneralRe: algorithm help!?! Pin
Luc Pattyn7-Sep-07 12:15
sitebuilderLuc Pattyn7-Sep-07 12:15 
AnswerRe: algorithm help!?! Pin
Russell'8-Sep-07 0:22
Russell'8-Sep-07 0:22 
QuestionMagic squares in matlab Pin
Rami Y.5-Sep-07 17:19
Rami Y.5-Sep-07 17:19 
AnswerRe: Magic squares in matlab Pin
Russell'5-Sep-07 22:26
Russell'5-Sep-07 22:26 
QuestionFRACTAL FORMULAS Pin
cyndy_northrup4-Sep-07 21:50
cyndy_northrup4-Sep-07 21:50 
AnswerRe: FRACTAL FORMULAS Pin
Russell'4-Sep-07 22:57
Russell'4-Sep-07 22:57 
GeneralRe: FRACTAL FORMULAS Pin
cyndy_northrup5-Sep-07 15:10
cyndy_northrup5-Sep-07 15:10 
GeneralRe: FRACTAL FORMULAS Pin
Russell'5-Sep-07 22:09
Russell'5-Sep-07 22:09 
AnswerRe: FRACTAL FORMULAS Pin
Luc Pattyn4-Sep-07 23:06
sitebuilderLuc Pattyn4-Sep-07 23:06 
Questioncontiguous bits algorithm. Pin
chandu0042-Sep-07 22:09
chandu0042-Sep-07 22:09 
AnswerRe: contiguous bits algorithm. Pin
Russell'2-Sep-07 22:44
Russell'2-Sep-07 22:44 
AnswerRe: contiguous bits algorithm. Pin
cp98762-Sep-07 22:48
cp98762-Sep-07 22:48 
GeneralRe: contiguous bits algorithm. Pin
chandu0042-Sep-07 23:14
chandu0042-Sep-07 23:14 
GeneralRe: contiguous bits algorithm. [modified] Pin
cp98763-Sep-07 0:04
cp98763-Sep-07 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.