Click here to Skip to main content
16,005,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to go about this... Pin
Neville Franks24-Sep-04 12:29
Neville Franks24-Sep-04 12:29 
AnswerRe: How to go about this... Pin
cmk24-Sep-04 13:35
cmk24-Sep-04 13:35 
AnswerRe: How to go about this... Pin
mirano24-Sep-04 23:58
mirano24-Sep-04 23:58 
Generalvalue duplication issue Pin
Paul Swet24-Sep-04 8:39
Paul Swet24-Sep-04 8:39 
GeneralRe: value duplication issue Pin
David Crow24-Sep-04 8:54
David Crow24-Sep-04 8:54 
GeneralRe: value duplication issue Pin
Arsalan Malik24-Sep-04 18:57
Arsalan Malik24-Sep-04 18:57 
GeneralRe: value duplication issue Pin
Paul Swet24-Sep-04 21:41
Paul Swet24-Sep-04 21:41 
GeneralRe: value duplication issue Pin
cmk24-Sep-04 22:28
cmk24-Sep-04 22:28 
If the array is sorted then use a binary search to check the value at each position against the value of the position :
if ( a[i] == i+1 ) then the duplicate is in the section greater than i
else the duplicate is in the section less than or equal to i.

If the array isn't sorted then allocate a temp array of size n and walk through the original putting 'check marks' in the temp array at the appropriate index (value-1). As soon as you find a value that has alreay been 'checked' you have your duplicate.


...cmk

Save the whales - collect the whole set
GeneralVisual C++ 2005 Beta Pin
Anonymous24-Sep-04 6:50
Anonymous24-Sep-04 6:50 
GeneralRe: Visual C++ 2005 Beta Pin
Alexander M.,24-Sep-04 12:24
Alexander M.,24-Sep-04 12:24 
GeneralRe: Visual C++ 2005 Beta Pin
Gary R. Wheeler24-Sep-04 16:15
Gary R. Wheeler24-Sep-04 16:15 
GeneralRe: Visual C++ 2005 Beta Pin
Anonymous26-Sep-04 9:37
Anonymous26-Sep-04 9:37 
QuestionHow to read image files with extensions which are not predefined in C# Pin
Kiran Satish24-Sep-04 6:16
Kiran Satish24-Sep-04 6:16 
GeneralActiveX C++ Button ctrl Pin
Andy H24-Sep-04 5:49
Andy H24-Sep-04 5:49 
GeneralRAS fucntions problem Pin
Muhammad Asif Khan24-Sep-04 4:57
Muhammad Asif Khan24-Sep-04 4:57 
GeneralRe: RAS fucntions problem Pin
vcplusplus24-Sep-04 9:01
vcplusplus24-Sep-04 9:01 
GeneralRe: RAS fucntions problem Pin
Alexander M.,24-Sep-04 12:26
Alexander M.,24-Sep-04 12:26 
GeneralRe: RAS fucntions problem Pin
Muhammad Asif Khan26-Sep-04 21:54
Muhammad Asif Khan26-Sep-04 21:54 
GeneralRe: RAS fucntions problem Pin
Ken Andrews27-Sep-04 7:15
Ken Andrews27-Sep-04 7:15 
Questionwould someone tell me if this is OK? Pin
BlackDice24-Sep-04 3:33
BlackDice24-Sep-04 3:33 
AnswerRe: would someone tell me if this is OK? Pin
Antony M Kancidrowski24-Sep-04 3:58
Antony M Kancidrowski24-Sep-04 3:58 
GeneralRe: would someone tell me if this is OK? Pin
BlackDice24-Sep-04 4:12
BlackDice24-Sep-04 4:12 
GeneralRe: would someone tell me if this is OK? Pin
Antony M Kancidrowski24-Sep-04 4:37
Antony M Kancidrowski24-Sep-04 4:37 
GeneralRe: would someone tell me if this is OK? Pin
David Crow24-Sep-04 4:42
David Crow24-Sep-04 4:42 
GeneralRe: would someone tell me if this is OK? Pin
BlackDice24-Sep-04 4:57
BlackDice24-Sep-04 4:57 

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.