| 09-23-2007, 09:17 PM | #1 |
I am working on a function that may set an array's size very well into the googleplex's, but only 500 values would actually be set. Is that possible? For example... Code:
set Array[3] = 1 set Array[91394221018440104820048043125389514389149138135581304831908510395189399315891580589189581395035011350893895190190589390951891589103135] = 2 Done! Really those 2 are it... I'm working on a sort function. I've wrote out 4 different methods, and they all pretty much suck, but my favorite would need this. |
| 09-23-2007, 09:39 PM | #2 |
Dear god. What the hell could you need such a large number for?! And no, you can't go above the index 8191. Array indexes go from 0-8191. |
| 09-23-2007, 09:54 PM | #3 |
Hmm, well that sucks... guess i'll have to use the adjust method. For sorting I would need it, i'm trying to make a sort function. The 'space' method needs a array half of 2 to the power of the size of the array that is being sorted. It would be the fastest way, but I guess at the same time it's also breaking some physical laws. |
| 09-23-2007, 10:16 PM | #4 |
I am not sure what the heck are you talking about? Isn't O(nlog(n)) enough for sorting performance anyways? |
| 09-23-2007, 11:24 PM | #5 |
What is "O(nlog(n))"... I'm talking about sorting an array in order. 9 1 7 2 would become 1 2 7 9 or 9 7 2 1 I've come up with 5 different ways of doing it... Looping, which would be looping through the entire array to find the closest value to the previous, and then looping again to find all the copies of that value. Adjust, where each value is sorted one by one, and all values already sorted would have to be constantly moved to make room. Space, where the array covers every possible sorting arrangement. Values are just filled in. Grouping, a mix of Looping and Space. And one that combines Adjust with Space. Didn't name it . I think this one may be the best though. My problem is that there seems to be no efficient way of sorting... |
| 09-24-2007, 12:02 AM | #6 |
You don't have to reinvent the wheel . http://en.wikipedia.org/wiki/Quicksort Although I prefer heap sort personaly . If you are dealing with small array sizes, like 1000, even the intuitive and easy to code insertion sort will work: http://en.wikipedia.org/wiki/Insertion_sort |
| 09-24-2007, 12:07 AM | #7 |
reinvent the wheel is always fun, but wont take you any further |
| 09-24-2007, 01:23 AM | #8 |
You need n log n sorts in JASS just because of the op limit. Even then you will need tricks to make it past ~300, but that's a lot better than ~50. |
| 09-24-2007, 05:52 PM | #9 |
Reinventing the wheel is fun. Well looping looks like heapsort, grouping looks like quicksort, adjust like insertion, and the one I almost settled on looks like library sort. Guess eventually I would have re-invented all of them. So would library sort be the nicest? |
| 09-24-2007, 05:54 PM | #10 |
looping is bubble sort , doubt your looping thing is heapsort, are you using such a nice tree structure in a method you then called 'looping' |
| 09-24-2007, 06:18 PM | #11 |
No, doesn't look like bubble sort. Bubble sort is just like constantly throwing the values in the direction you want them to go, right? But yea, heapsort is definitely better though. I looked and looping is much more like 'Selection Sort', which is the predecessor to heap. Would library sort work well in your opinion? |
