# cstut9b - If(list[j< list[minIndex To if(list[j>...

This preview shows pages 1–2. Sign up to view the full content.

<stdlib.h> for rand( ), <time.h> for true randomness rand_int(1,365) gives random numbers from 1 to 365. size of array = 1000,but only fills up “numElem” random numbers. Using a function to fill up the array with random numbers from 1 to 365 Size of array = MAX, but only fills up “numElem” random numbers

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Selection sort program: arranges the array from smallest number to largest number To do from largest to smallest, change line 64
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: If (list[j] < list[minIndex]) To if (list[j] > list[minIndex]) To check “same” consecutive numbers in the array (must sort first), returns true if there are any duplicates of the same number. Using the program in main function: prints the probability of “numElem” people having “same” similar birthdays Have to multiple by 1.0 first to convert to double form...
View Full Document

## This note was uploaded on 01/09/2012 for the course ELECTRICAL 1221 taught by Professor Tan during the Spring '11 term at National University of Singapore.

### Page1 / 2

cstut9b - If(list[j< list[minIndex To if(list[j>...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online