|
| |||||||||
| Tags: sharepoint, site definition, windows application |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| How to find a mode in an Array set
I have some custom SharePoint site definitions but i heard that if we wanted to deploy it we have to make use of SharePoint wsp solution packages, which i have tried but it does not show anything. I have also read that a method involving hashing could be a good way to find the mode of an array of floating point numbers. Is this correct and how do it related to me. |
|
#2
| |||
| |||
| Re: How to find a mode in an Array set
First create a second array with a size of the range of your first array. So, if your array has numbers 0 to 100 in it, the array should have 101 slots. it seems the obvious way to implement this using a hash table would be to use the number as a key, and as the value stored, use a frequency counter. |
|
#3
| |||
| |||
| Re: How to find a mode in an Array set
Return sourceIndex if you want to know where the first occurrence of the element is, or sourceElement if you want to know the "value" of the element. The mode of an array of numbers is the number m in the array that is repeated most frequently. If more than one number is repeated with equal maximal frequencies, there is no mode. Code: for (int k = 0; k <array.length; k++){
for (int j = k + 1; j < array.length; j++){
if (array[k] == array[j]){
count++;
k++; // <-------------------------
}
} |
|
#4
| ||||
| ||||
| Re: How to find a mode in an Array set
it always comes true and the return value is termed 0. However, without that statement and the condition that there cannot be a '0 mode' the program works fine. I would advise against using a hash, as it assumes exact comparisons -- never a good assumption on floating-point numbers. What if your array contains some elements 0.2(00000000) and 0.2(00000001), which really should be considered equal, but aren't because they came from different calculations? |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to find a mode in an Array set" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unable to find the sleep mode on Toshiba Satellite R15 laptop | Nereus | Portable Devices | 5 | 26-03-2010 02:21 PM |
| Unable to find elements of a given type in an array in C# | Kasper | Software Development | 4 | 09-02-2010 06:46 PM |
| Assigning an array to an array | MACE | Software Development | 3 | 18-11-2009 05:19 PM |
| How to find second largest value from array | Jaheel | Software Development | 3 | 18-11-2009 11:42 AM |
| To find key in array for Javascript. | Austinage | Software Development | 3 | 31-07-2009 09:13 PM |