Click here to Skip to main content
15,890,506 members
Home / Discussions / C#
   

C#

 
GeneralRe: GUID Pin
Charlie Williams24-Sep-04 12:23
Charlie Williams24-Sep-04 12:23 
GeneralA C# SQL question Pin
cemlouis24-Sep-04 10:12
cemlouis24-Sep-04 10:12 
GeneralRe: A C# SQL question Pin
tdciDoug24-Sep-04 10:29
tdciDoug24-Sep-04 10:29 
GeneralRe: A C# SQL question Pin
cemlouis24-Sep-04 10:48
cemlouis24-Sep-04 10:48 
GeneralRe: A C# SQL question Pin
tdciDoug24-Sep-04 11:05
tdciDoug24-Sep-04 11:05 
GeneralRe: A C# SQL question Pin
cemlouis25-Sep-04 12:56
cemlouis25-Sep-04 12:56 
Generalarray issue Pin
Paul Swet24-Sep-04 8:38
Paul Swet24-Sep-04 8:38 
GeneralRe: array issue Pin
tdciDoug24-Sep-04 10:27
tdciDoug24-Sep-04 10:27 
There are many ways you can go about doing this. There are a few questions you should look at first though. Is the array sorted? Can you define another data structure? Are you trying to keep the complexity below a certain level?

I might do something like the following:

for (int iSize = 0; iSize < yourArray.Count; iSize++)<br />
{<br />
while (yourArray[iSize] != iSize)<br />
{<br />
if (yourArray[iSize] == yourArray[yourArray[iSize]])<br />
{<br />
MessageBox.Show( "Duplicate value of " + yourArray[iSize].ToString() );<br />
iSize = yourArray.Count;<br />
break;<br />
}<br />
Swap(yourArray[iSize], yourArray[yourArray[iSize]]);<br />
}<br />
}


I didn't really test this, just pulled it off the top of my head real quick. It might work, but I can't give any guarantees.

Good luck
GeneralWeird Listbox Problem Pin
Jon G24-Sep-04 8:38
Jon G24-Sep-04 8:38 
GeneralScanning photos Pin
bobbiek24-Sep-04 8:15
bobbiek24-Sep-04 8:15 
Questionwhat is the purpose of a interface(not talking about guis) Pin
FocusedWolf24-Sep-04 7:53
FocusedWolf24-Sep-04 7:53 
AnswerRe: what is the purpose of a interface(not talking about guis) Pin
tajbender24-Sep-04 13:01
tajbender24-Sep-04 13:01 
AnswerRe: what is the purpose of a interface(not talking about guis) Pin
Marc Clifton24-Sep-04 14:21
mvaMarc Clifton24-Sep-04 14:21 
GeneralRe: what is the purpose of a interface(not talking about guis) Pin
FocusedWolf25-Sep-04 5:06
FocusedWolf25-Sep-04 5:06 
GeneralRe: what is the purpose of a interface(not talking about guis) Pin
Marc Clifton25-Sep-04 9:23
mvaMarc Clifton25-Sep-04 9:23 
Generalrich text bullets are not displayed in Crystal report. .net 2003 Pin
sundar_raj24-Sep-04 6:53
sundar_raj24-Sep-04 6:53 
GeneralC# Convolution Function Pin
ee9903524-Sep-04 6:27
ee9903524-Sep-04 6:27 
GeneralRe: C# Convolution Function Pin
yoaz26-Sep-04 3:59
yoaz26-Sep-04 3:59 
QuestionHow to read image files with extensions which are not predefined in C# Pin
Kiran Satish24-Sep-04 6:14
Kiran Satish24-Sep-04 6:14 
AnswerRe: How to read image files with extensions which are not predefined in C# Pin
Colin Angus Mackay24-Sep-04 6:54
Colin Angus Mackay24-Sep-04 6:54 
GeneralRe: How to read image files with extensions which are not predefined in C# Pin
Kiran Satish24-Sep-04 7:14
Kiran Satish24-Sep-04 7:14 
Generalfinding a record in a table Pin
steve_rm24-Sep-04 5:30
steve_rm24-Sep-04 5:30 
GeneralRe: finding a record in a table Pin
Heath Stewart24-Sep-04 6:44
protectorHeath Stewart24-Sep-04 6:44 
GeneralRe: finding a record in a table Pin
Brian Delahunty24-Sep-04 12:34
Brian Delahunty24-Sep-04 12:34 
GeneralRe: finding a record in a table Pin
Heath Stewart24-Sep-04 15:01
protectorHeath Stewart24-Sep-04 15:01 

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.