--- Log opened Thu Jun 24 00:00:45 2010 |
00:07 | <@McMartin> | He said "non-clumsy" |
00:08 | <@McMartin> | Everything up to and including "hello world" is clumsy in Perl |
00:10 | | Derakon [Derakon@Nightstar-1ffd02e6.ucsf.edu] has quit [[NS] Quit: Leaving] |
00:16 | | Zed [Zed@Nightstar-e4835f03.or.comcast.net] has joined #code |
00:19 | | Attilla [Attilla@Nightstar-ff4a0e06.threembb.co.uk] has quit [[NS] Quit: ] |
00:24 | < Tarinaky> | So I was asked for my Qualifications for them (CS Department) to consider my enquiry. |
00:26 | < Tarinaky> | I'm not sure if it's a good thing or a bad thing that I mentioned my Microsoft Certified thingie :/ |
00:26 | | Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code |
00:27 | < Tarinaky> | MCP, Microsoft Certified Problem... |
00:27 | < Tarinaky> | :p |
00:27 | < PinkFreud> | McMartin: print "Hello, world!\n"; |
00:27 | < PinkFreud> | that's clumsy? :) |
00:27 | <@McMartin> | print "Hello, world!" |
00:27 | <@McMartin> | ^-- less clumsy. |
00:27 | < PinkFreud> | ahh. so C is clumsy as well. :) |
00:28 | < Tarinaky> | std::cout << "Hello, world!" << std::endl; |
00:28 | < PinkFreud> | that's pretty damn clumsy. :P |
00:29 | < Tarinaky> | I know. |
00:29 | < Tarinaky> | What a terrible language it must be to do a serious project in? |
00:29 | < Tarinaky> | The designers must have been having a laugh etc... etc... |
00:29 | < Tarinaky> | :p |
00:30 | < Tarinaky> | printf("%s","Hello, world!\n); //isn't much better either :/ |
00:31 | < Namegduf> | Ew |
00:31 | < Namegduf> | Why would you do that? |
00:31 | < Namegduf> | puts("Hello, world!\n"); |
00:32 | < Tarinaky> | Namegduf: puts automatically appends a new-line character. |
00:32 | < Namegduf> | THe compiler optimises away printf() without any format specifiers, but with just %s and a constant pointer fed in, I don't know. |
00:32 | < Namegduf> | Oh, then that's even better. |
00:32 | < Tarinaky> | At least according to this documentation. |
00:32 | < Tarinaky> | Anyway. I didn't know about puts. |
00:32 | | * Tarinaky doesn't, generally, do 'straight' C. |
00:42 | < Namegduf> | "%s", <string> is appropriate in some cases, but only when <string> is user or configuration specified and for some reason it already has to go through printf |
00:43 | < Namegduf> | As sending <string> through directly risks it containing format specifiers |
00:57 | | AnnoDomini [annodomini@Nightstar-53bd0d0d.adsl.tpnet.pl] has quit [[NS] Quit: Sleep.] |
01:06 | | shade_of_cpux is now known as cpux |
01:28 | | Orth [orthianz@Nightstar-7cabd69b.xnet.co.nz] has joined #code |
01:30 | | Orthia [orthianz@Nightstar-97da1f17.xnet.co.nz] has quit [Ping timeout: 121 seconds] |
01:33 | | Orthia [orthianz@Nightstar-630f0073.xnet.co.nz] has joined #code |
01:35 | | Orth [orthianz@Nightstar-7cabd69b.xnet.co.nz] has quit [Ping timeout: 121 seconds] |
01:55 | | Reiv [NSwebIRC@Nightstar-1055e8af.waikato.ac.nz] has joined #code |
01:55 | < Reiv> | ToxicFrog! Vornicus! |
01:56 | < Reiv> | How hard is it to make a heap sort? |
02:02 | <@McMartin> | I'm not either, but it's not terribly difficult |
02:02 | <@McMartin> | However, I question its utility |
02:03 | < Reiv> | I have decided to attempt an assignment I was too sick to do |
02:03 | <@McMartin> | Ah. |
02:03 | <@McMartin> | Yeah, Heapsort is straightforward, but its usual implementation is Kind Of Wacky. |
02:03 | < Reiv> | Or rather, am wondering if it's worth the effort. AKA how much of a headache is it likely to be if I try~ |
02:04 | <@McMartin> | Most places where you would ordinarily use a heapsort, you actually want a balanced tree |
02:04 | <@McMartin> | Hard to answer |
02:04 | < Reiv> | This'd be using an array 7 items long, and screwing around in that rather than actual objects. |
02:04 | <@McMartin> | It's got a few brainbending aspects, especially the part where it represents a tree as a single array. |
02:04 | < Reiv> | yeah, that's the bit I'm trying to figure. |
02:05 | < Reiv> | Chldren being [2n] and [2n+1], yes? |
02:05 | <@McMartin> | That depends on your language. That isn't quite how you'd do it in C. |
02:07 | < Reiv> | Java here |
02:07 | < Reiv> | And that was the way at least conceptually explained to us. |
02:08 | <@McMartin> | Yeah. But look what happens to your first element. |
02:08 | < Reiv> | So foo[1] has children foo[2] and foo[3]. foo[3] has children foo[6] and foo[7]. |
02:08 | < Reiv> | foo[0] you don't touch. |
02:08 | <@McMartin> | and foo[0], your *actual* first element... |
02:08 | <@McMartin> | Yeah, cheating~ |
02:09 | < Reiv> | Or on this case, use to track the size of the heap, 'cuz it shrinks) |
02:09 | <@McMartin> | Your teacher started on Pascal, I just know it. |
02:10 | < Reiv> | haha |
02:11 | < Reiv> | I believe he started on very barely the step up from punched paper >.> |
02:11 | | gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?] |
02:12 | < Reiv> | This is a bad way to do it? |
02:12 | < Reiv> | I'm mostly trying to think how you'd juggle everything inside it when sorting. |
02:13 | <@McMartin> | It's not a bad way to do it |
02:13 | < Reiv> | Perhaps a Swap(foo, foo) method, yes? |
02:13 | <@McMartin> | It's a little odd to be 1-indexing your arrays in Java, but as far as doing it, it works |
02:13 | < Reiv> | Then the hard part being to know which bits get swapped when~ |
02:13 | <@McMartin> | 'fraid not. Swap would require you to pass by name. |
02:14 | <@McMartin> | A normal swap takes 3 statements and is not a big deal. |
02:14 | < Reiv> | Sure, but it'd come up a lot, no? |
02:14 | | * Reiv thinks. |
02:14 | <@McMartin> | Think about what happens if you write your swap function and call it. |
02:16 | < Reiv> | Well, ok, you'd want Swap (Foo[i], Foo[j]); probably even just Swap(i,j) presuming the function is internal to the object and can get its hands on the array directly.. |
02:16 | <@McMartin> | Of all of those, only the latter has a chance of working. |
02:16 | <@McMartin> | swap (int i, int j) { ... assigns i and j ... returns, throwing i and j away entirely } |
02:22 | < Reiv> | right. |
02:22 | < Reiv> | hum. |
02:22 | < Reiv> | Fuggit, I'm having a go~ |
02:23 | < Reiv> | Remind me, what's the difference between an objects functions and its methods? |
02:23 | < Reiv> | public vs private is about it yes? |
02:23 | <@McMartin> | Canonically, "an object's functions" *are* its methods. |
02:23 | < celticminstrel> | ...isn't "method" just another term for "member function"? |
02:23 | < celticminstrel> | 3 |
02:24 | <@McMartin> | So if your class means something specific ask your TA~ |
02:24 | < Reiv> | Just checking~ |
02:32 | | Zed [Zed@Nightstar-e4835f03.or.comcast.net] has quit [Ping timeout: 121 seconds] |
02:33 | < Reiv> | OK, swapping machines BRB |
02:44 | | Reiv [NSwebIRC@Nightstar-1055e8af.waikato.ac.nz] has quit [[NS] Quit: Swapping machines.] |
02:46 | | Orthia [orthianz@Nightstar-630f0073.xnet.co.nz] has quit [Client closed the connection] |
02:53 | | Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed] |
02:54 | | Orthia [orthianz@Nightstar-b6a69aaa.xnet.co.nz] has joined #code |
02:59 | | Reiv [NSwebIRC@Nightstar-1055e8af.waikato.ac.nz] has joined #code |
02:59 | < Reiv> | That took longer than anticipated. |
02:59 | | * Reiv stabbinate. |
03:02 | | Zed [Zed@Nightstar-e4835f03.or.comcast.net] has joined #code |
03:04 | < Reiv> | Okay, so, heap sort. |
03:10 | < Namegduf> | That's the sorting algorithm I use for my clothes. |
03:15 | < Reiv> | snerk |
03:19 | < Reiv> | Man, it's been a /long/ time since I used arrays in Java. |
03:19 | | * Reiv hunts to find how you set the initial starting size~ |
03:20 | < Reiv> | private String heap[] = new String[8]; is the right way to do it, yes? |
03:22 | < celticminstrel> | Yeah... just one thing, I'd recommend putting the [] after String instead of after heap. It's not necessary though. |
03:28 | | * Reiv tries to figure what you'd be Deleting. You add new Strings, would you delete an existing String? I presume you're not meant to know how the String is being stored, you just want to remove a specific string. |
03:29 | < celticminstrel> | Uh, what? |
03:30 | < Reiv> | hm. |
03:31 | < Reiv> | Well, I came to the realisation I need my Heap to not only be a minheap, but also capable of being a replacable heap for balanced merge. |
03:31 | | * Reiv is trying to write an External Sort program. |
03:35 | | * Reiv is thus handcoding a Heap to work with accordingly. |
03:49 | < Reiv> | /me scratches his head. |
03:49 | < Reiv> | ... whoa |
03:49 | | * Reiv scratches his head. |
03:49 | < celticminstrel> | O_O |
03:49 | < Reiv> | OK, so I want to add things to my minheap. |
03:50 | < Reiv> | The way you do this is by sticking the item in the bottom-most spot on the tree, then sorting out whether the thing is in the correct place re its parents or not. |
03:50 | < Reiv> | How do I tell the maximum size of my tree? |
03:51 | <@Vornicus> | Keep It Hanging Around |
03:51 | < Reiv> | So store the size, hm |
03:52 | <@Vornicus> | There is no reason not to, you need to be able to access it /anyway/, and OH NOES 4 BYTES |
03:52 | < Reiv> | OK, so my min heap is an array. It has heap[0] reserved to track how big the heap currently is. |
03:53 | < Reiv> | The catch is, that was going to be used to track how big it was once I start /shrinking/ the array |
03:53 | < Reiv> | Er, the tree |
03:53 | < Reiv> | So unless I have a toggle that tracks whether or not this thing is Full, I may have a problem with my Inserts trying to overwrite unsorted data. |
03:54 | < Reiv> | (The minheap is going to be used to try and output sorted data from unsorted input in a Run until it can no longer keep sorting, then Heapify and start a new Run.) |
04:02 | <@Vornicus> | Um, why are you packing that in there too, is this a freaking assembler course? |
04:02 | <@Vornicus> | Use a struct, use a class. You don't have to be ridiculous about it. |
04:02 | < Reiv> | Mostly because I'm trying to manipulate a heap in an array, so it's easier to have the node n have children 2n and 2n+1 |
04:02 | < Reiv> | So you start it at 1, and this leaves you a free spot anyway. |
04:03 | < Reiv> | We're manually creating the heap. |
04:03 | < celticminstrel> | He's using Java, by the way. |
04:03 | | Reiv_ [NSwebIRC@Nightstar-1055e8af.waikato.ac.nz] has joined #code |
04:03 | < Reiv_> | Wrong button~ |
04:04 | < Reiv_> | We're manually creating the replacable minheap. |
04:04 | < Reiv_> | So I'm trying to figure out how the basic operations go. |
04:04 | <@Vornicus> | In /java/ |
04:04 | < Reiv_> | Correct. |
04:04 | < Reiv_> | http://www.cs.waikato.ac.nz/~tcs/COMP317/Assignments/assign3-2010.html |
04:05 | <@Vornicus> | If you're storing anything other than numbers in it, you won't be able to store the first blank index in the heap array at all. |
04:05 | < Reiv_> | Is the whole shebang; I'm just trying to get the minheap written, and written well enough to be actually satisfactory for a change. |
04:05 | < Reiv_> | Strings here |
04:05 | < Reiv_> | I figure this can bite me in the ass later. |
04:05 | <@Vornicus> | Then you can't store anything in the array other than strings. |
04:07 | | Reiv [NSwebIRC@Nightstar-1055e8af.waikato.ac.nz] has quit [Ping timeout: 121 seconds] |
04:08 | < Reiv_> | Bah, very well then |
04:08 | < Reiv_> | So anyway, regardless of all that |
04:08 | | * Reiv_ tries to figure out how the algorathm actually behaves. |
04:08 | <@Vornicus> | (also frankly heaps are almost as easy starting at 0) |
04:09 | < Reiv_> | (I will stick with 1 just for the sake of it) |
04:09 | <@Vornicus> | (k) |
04:25 | | Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has joined #code |
04:28 | < Reiv_> | http://pastebin.starforge.co.uk/312 - is SortHeap actually going to sort the heap as intended? |
04:28 | < Reiv_> | I want smallest values at the top, everything else to percolate down. |
04:29 | < Reiv_> | It is possible I should be going the other way, and percolating from the lowest values /up/ but |
04:29 | < Reiv_> | Er. Bottom-most values. |
04:29 | < Reiv_> | Min-heaps are annoying, because you go down the tree to get to higher numbers~ |
04:38 | | celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!] |
04:41 | | Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has quit [Client exited] |
04:45 | < Reiv_> | Okay, /that/ looks tidier. |
04:45 | < Reiv_> | I hope they do the same thing~ |
04:50 | < Reiv_> | http://pastebin.starforge.co.uk/313 - that looks a lot nicer. Is it going to behave, however? I wonder. |
04:50 | | JadeTranq [Smith@Nightstar-bbece9a8.dsl.teksavvy.com] has joined #code |
04:51 | | ToxicFrog` [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code |
04:53 | | ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds] |
04:53 | | SmithKurosaki [Smith@Nightstar-10ed2e18.dsl.teksavvy.com] has quit [Ping timeout: 121 seconds] |
05:11 | | Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has joined #code |
05:11 | < Reiv_> | blarg |
05:11 | < Reiv_> | How do I set a constant in Java? |
05:12 | < Reiv_> | It won't let me use Public Final Static type foo; |
05:12 | < Reiv_> | ... yes it will I just can't spell~ |
05:12 | < Reiv_> | Static has two Ts in it~ |
05:17 | <@Vornicus> | Pfff |
05:21 | < Reiv_> | ... wait a minute |
05:21 | < Reiv_> | Okay how do minheaps /work/? |
05:24 | < Reiv_> | I just realised I made a lovely little tree that sorts everything nicely. |
05:24 | < Reiv_> | The problem is, it wants the smallest value at the top doesn't it. |
05:24 | < Reiv_> | Next smallest on the left, one after that on the right. |
05:25 | < Reiv_> | Mine is just making a pretty little... sorted binary tree. >_> |
05:26 | | Orthia [orthianz@Nightstar-b6a69aaa.xnet.co.nz] has quit [Client closed the connection] |
05:27 | < Reiv_> | It's quite a nice little sorted binary tree, mind. |
05:31 | <@McMartin> | Heaps don't require sorting like that between the children; they only require that the two children are "larger" than the parent. |
05:31 | <@McMartin> | If you're sorting the other way, then "larger" actually means "smaller" |
05:34 | < Reiv_> | Heaps don't have to have the largest item be at the rightmost point of the bottom row? |
05:39 | < Reiv_> | I had thought that was a key component of the whole thing being sorted. |
05:39 | < Reiv_> | Top to bottom, Left to right. |
05:50 | | Orthia [orthianz@Nightstar-b6a69aaa.xnet.co.nz] has joined #code |
05:50 | < simon> | Reiv_, they're not sorted. |
05:50 | < simon> | Reiv_, they only have the heap property, not the sorted property. |
05:52 | < Reiv_> | Hrm. |
05:52 | < simon> | Reiv_, heapsort works by having a heap and then extracting the smallest element and re-heapifying the rest |
05:53 | < Reiv_> | Odd, but okay. *looks into it* |
05:53 | < Reiv_> | Aha. |
05:53 | < Reiv_> | But the key point there is that the heap has the smallest element at top? |
05:53 | < simon> | Reiv_, in a min-heap, yes |
05:54 | < simon> | if you insert an element into a min-heap, it doesn't matter which side it goes to as long as each root is the smallest element of its sub-heap (heap-property) |
05:55 | < Reiv_> | Okay. |
05:55 | < simon> | Reiv_, so searching a heap isn't an O(lg n) operation. |
05:56 | | Orthia [orthianz@Nightstar-b6a69aaa.xnet.co.nz] has quit [Connection reset by peer] |
05:58 | < Reiv_> | Hm, I see. |
05:58 | | * Reiv_ curses |
05:58 | < Reiv_> | Oh, duh |
05:58 | < Reiv_> | It's starting at the largest one and recursing down |
05:58 | < Reiv_> | But it's not actually looping through to check they /all/ behave right >_> |
06:00 | < simon> | which algorithm are you thinking of; re-heapification? |
06:02 | <@Vornicus> | If you have a built-in sort: a sorted heap is a heapy heap. |
06:02 | < simon> | :q |
06:02 | < simon> | d'oh |
06:04 | | Orthia [orthianz@Nightstar-b6a69aaa.xnet.co.nz] has joined #code |
06:05 | | Orthia [orthianz@Nightstar-b6a69aaa.xnet.co.nz] has quit [Client closed the connection] |
06:06 | <@Vornicus> | gnrk, fail |
06:07 | <@Vornicus> | When using a set for "unknown" and a number for "known", you have to check whether the "known" is not equal to your check value before trying to see if the number you're checking for is in the set. |
06:07 | <@Vornicus> | Which is a pain in the ass because suddenly you're doing type-checking. Fail fail fail. |
06:08 | < simon> | I take it your language doesn't do that? |
06:08 | < Reiv_> | Damn. How to do this recursively now ;_; |
06:08 | <@Vornicus> | No, no, it /does/, but I don't want to have to do it that way. |
06:09 | < Reiv_> | simon: I have a Sort algy to shuffle things, I wanted it seperate to the Heapification because you also use it when Inserting and Replacing items, AFAICT. |
06:09 | <@Vornicus> | cuz I go if board[row][col] == thing, and then I can't do board[row][col] != thing to get "known but wrong" because it'd also pass "unknown" |
06:10 | | Orthia [orthianz@Nightstar-b6a69aaa.xnet.co.nz] has joined #code |
06:10 | <@Vornicus> | but I can't try thing in board[row][col] first because that'd throw if I try it when something is "known" |
06:10 | <@Vornicus> | Reiv: Reheapification is a lot chaper than iterating the whole thing. |
06:11 | < Reiv_> | Vorn: In that case I have screwed up how to do reheapification. |
06:12 | <@Vornicus> | Most likely! |
06:12 | | Orthia [orthianz@Nightstar-b6a69aaa.xnet.co.nz] has quit [Client closed the connection] |
06:13 | | Orthia [orthianz@Nightstar-8a2665ee.xnet.co.nz] has joined #code |
06:13 | < Reiv_> | Okay, so how /does/ one heapify? |
06:14 | < Reiv_> | I have a SortHeap function that recursively checks if the number it's looking at is bigger than its parent, and swaps them if so. |
06:15 | < Reiv_> | My error was I was only seeding it with the very last value, so it was only going up that side of the tree and only going once. |
06:15 | < Reiv_> | If not iteration, how should I be doing it? |
06:16 | <@Vornicus> | http://en.wikipedia.org/wiki/Binary_heap <--- when adding or removing from a heap, you only ever need to bubble along one path. |
06:16 | <@Vornicus> | You'll have a reheapify algorithm for both directions. |
06:17 | <@Vornicus> | The starting heapify, you need to do the entire thing, but after that it's only one path, one direction. |
06:18 | < simon> | Reiv_, that seems like an inefficient way to sort a heap. |
06:18 | < Reiv_> | A single bottom-up won't cut it then? |
06:18 | < Reiv_> | simon: There's a better way? |
06:19 | < simon> | Reiv_, yes. imagine a max-heap: while (heapsize > 0) { exchange A[0] <-> A[heapsize]; heapsize--; maxheapify(A) } |
06:19 | < Reiv_> | Is there a negative i++; ? |
06:20 | < Reiv_> | i--; does not seem to be valid. |
06:20 | < simon> | Reiv_, I don't know which language you refer to. |
06:20 | < Reiv_> | Oh, nevermind |
06:20 | < Reiv_> | I'd buggered up, carry on. |
06:20 | < simon> | Reiv_, any visualisation of heapsort should show this rather intuitively. |
06:22 | < simon> | Reiv_, when A[heapsize] is put at the top of the heap, it's not a heap any more. maxheapify then bubbles it down somewhere appropriate until the heap is empty and the array instead contains the sorted elements. |
06:24 | < simon> | Reiv_, http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/Sorting/heapSort. htm has pseudocode for heapify. |
06:28 | | * Reiv_ looks into it. |
06:29 | < Reiv_> | http://pastebin.starforge.co.uk/314 would be wrong because it has a superflous check in it, yes? |
06:29 | < Reiv_> | (Yellow highlighted) |
06:30 | < Reiv_> | (Heapify is above, and uses a for loop) |
06:32 | <@Vornicus> | gnuh, this requires horrible reengineering to do properly. |
06:33 | < Reiv_> | ... is that mine or yours? >_> |
06:39 | < Reiv_> | ...hurm. My lecturer has said he wants to see my heap so he can have a better basis for marking the agretats off... |
06:39 | <@Vornicus> | Mine |
06:39 | < Reiv_> | I hadn't quite expected that. |
06:39 | | * Reiv_ goes from "Fooling around" to "Ohshit"~ |
06:40 | <@Vornicus> | agretats? |
06:40 | < Reiv_> | Er |
06:40 | < Reiv_> | I had a medical certificate for one of my assignments. |
06:41 | <@Vornicus> | aha |
06:41 | < Reiv_> | (Yes, I was in fact sick for two weeks) |
06:41 | < Reiv_> | He has to decide how to assign the grade off it now. |
06:41 | < Reiv_> | Another one I failed to hand in, mostly because I could never get heap working, so I could hardly finish the assignment that used the damn thing /twice/ |
06:42 | < Reiv_> | Now that I have finished my exam, I went back to the heap problem just to see if I could figure it out, because I was annoyed at my inability to do it right last time. |
06:42 | < Reiv_> | While corresponding with me over the agretat grade, he's now said he wants my heap to use as input. Which does not yet work. >.< |
06:43 | < Reiv_> | I, um, better get it going right quick. |
06:43 | | * Reiv_ really would rather not pass the course with a C. |
06:47 | | * Reiv_ sigh. Tries to figure out heapify some more. |
06:47 | < Reiv_> | My heapify actually works, but does so by iteration. Which is probably bad. |
06:48 | < Reiv_> | Also it doesn't technically need to go for half as long as it actually does. I guess I could fix that. |
06:49 | <@Vornicus> | Wait, which heapify |
06:49 | <@Vornicus> | The original, or the reheapify |
06:49 | <@Vornicus> | And while we're at it, the upward or downward reheapify |
06:56 | < Reiv_> | I currently only have an upward heapify which sorts out bubbling the smallest values to the top |
07:01 | <@Vornicus> | Does this thing start on an unheaped heap? |
07:01 | <@Vornicus> | You should have Three Functions. One for unheap to heap, one for reheaping after addition, one for reheaping after removal. |
07:06 | < Reiv_> | hm |
07:06 | < Reiv_> | Reshaping after addition and removal can be done with the same function as unheap to heap, no? |
07:07 | <@Vornicus> | Technically |
07:07 | <@Vornicus> | But you Don't Want To Do It That Way, because unheap to heap needs to iterate over the entire array, and reheaping after addition or removal only needs to walk one branch of the tree in one direction. |
07:07 | <@Vornicus> | A different direction for each, but that's okay. |
07:08 | < Reiv_> | hm, I suppose |
07:08 | < Reiv_> | ... though it's not even doing that. |
07:08 | | * Reiv_ stab |
07:16 | < Reiv_> | Vorn: http://pastebin.starforge.co.uk/315 |
07:17 | < Reiv_> | With Main() of heap.DeleteSmallest(); heap.PrintHeap(" Deleted"); heap.Insert("9"); heap.PrintHeap("Insert " + "9"); |
07:17 | < Reiv_> | Is outputting Unsorted: 9000 2 1 6 7 3 5 4 Sorted: 9000 1 2 4 7 3 5 6 Deleted: 9000 2 4 6 7 3 5 Junk:6 Insert 9: 9000 2 4 6 7 3 5 Junk:6 |
07:17 | < Reiv_> | Apparently I broke it~ |
07:19 | <@Vornicus> | Evidently! |
07:21 | < Reiv_> | It is apparently not inserting 9 at all? |
07:21 | < Reiv_> | And copying my 6 to the wrong place? |
07:21 | < Reiv_> | I am confused. |
07:28 | < Reiv_> | bah, I don't know |
07:28 | < Reiv_> | Heapify confuses me. |
07:30 | <@Vornicus> | mmmm, technically, full-heapify is the insert-reheapify, done repeatedly, while you increment your heap size without changing the actual array data |
07:30 | < Reiv_> | Oh, is that how you do it. |
07:31 | < Reiv_> | Okay, that makes sense. Hm. I should change that? |
07:31 | <@Vornicus> | If it doesn't work, change the hell out of it |
07:31 | < Reiv_> | OK |
07:32 | < Reiv_> | So I need a local size variable, and ... hm |
07:32 | < Reiv_> | I need to get Insert working right first, don't I. |
07:32 | < Reiv_> | No point refactoring Heapify when I don't even have the Insert heapify working yet~ |
07:35 | < Reiv_> | So, what's Insert meant to be doing again? |
07:35 | < Reiv_> | And how does Insert know if it's not about to do something Stupid like insert into a place that can't take the new value? |
07:44 | | * Reiv_ tries to figure it out. |
07:47 | < Reiv_> | The fuck. |
07:47 | < Reiv_> | if(heapSize <= heapAvailable) { is not triggering |
07:47 | < Reiv_> | With heapSize 6 and heapAvailable 7. |
07:47 | < Reiv_> | I have a print line stating this. |
07:48 | < Reiv_> | ... aha, that'd do it |
07:48 | < Reiv_> | So, um, why have you reset to 0 mister HeapAvailable? |
07:50 | < Reiv_> | oh, that'd do it. |
07:50 | < Reiv_> | hm |
07:54 | < Reiv_> | OK, heapify and Insert are now giving the correct strings. |
07:54 | < Reiv_> | Now to see if I can refactor Insert to do what it should have been doing all along? |
07:55 | < Reiv_> | Which is apparently heapify /upwards/ somehow. |
07:58 | | Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code |
08:06 | < Reiv_> | nope, that didn't work either. |
08:06 | | * Reiv_ pastes it and goes home, somewhat dejected over his course prospects. |
08:06 | < Reiv_> | Were the exam worth more, I'd have done fine. But 60% of the course is assignments, and I did not do well in the assignments. |
08:07 | < Reiv_> | Which means that, as it stands, my final grade for my final paper at university, will be... a C. If I'm lucky, a C+. |
08:07 | < Reiv_> | This is not going to help my job prospects. >.< |
08:07 | | Orthia [orthianz@Nightstar-8a2665ee.xnet.co.nz] has quit [Connection reset by peer] |
08:15 | | Orthia [orthianz@Nightstar-8a2665ee.xnet.co.nz] has joined #code |
08:15 | | Orthia [orthianz@Nightstar-8a2665ee.xnet.co.nz] has quit [Connection reset by peer] |
08:16 | | Orthia [orthianz@Nightstar-8a2665ee.xnet.co.nz] has joined #code |
08:43 | | AnnoDomini [annodomini@Nightstar-49021e91.adsl.tpnet.pl] has joined #code |
08:43 | | mode/#code [+o AnnoDomini] by Reiver |
08:44 | | Reiv_ [NSwebIRC@Nightstar-1055e8af.waikato.ac.nz] has quit [[NS] Quit: hoemtime] |
09:16 | | Alek [omegaboot@32F4F9.AFCB16.C1698A.2C83AC] has quit [[NS] Quit: ] |
09:17 | | Alek [omegaboot@Nightstar-c5f3565b.il.comcast.net] has joined #code |
09:21 | | Vornicus is now known as Vornicus-Latens |
10:40 | <@AnnoDomini> | Anyone here know how to use ncurses in Code::Blocks under Debian? |
10:43 | | gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code |
10:43 | <@AnnoDomini> | gnolam: You use Code::Blocks sometimes. How do I use ncurses in it under Debian? |
10:46 | <@AnnoDomini> | Also, what packages need to be installed for it to work? I have a few listed as installed that bear the ncurses prefix. |
10:51 | < gnolam> | Haven't the foggiest. |
10:51 | < gnolam> | Sorry. |
10:53 | < gnolam> | But the question should just be "How do I use ncurses". C::B has little to do with it. :) |
10:54 | <@AnnoDomini> | Yeah, well, I still have to figure out how to properly add -lncurses and shit to the compile string. |
10:55 | | Orthia [orthianz@Nightstar-8a2665ee.xnet.co.nz] has quit [Ping timeout: 121 seconds] |
10:59 | | Orthia [orthianz@Nightstar-b362cbc3.xnet.co.nz] has joined #code |
11:00 | <@AnnoDomini> | When I try to compile from command line, it returns "cannot find -lncurses". |
11:07 | <@AnnoDomini> | I think I solved that now. |
11:08 | | Tarinaky [Tarinaky@Nightstar-a269c2f6.adsl.virginmedia.net] has quit [Operation timed out] |
11:10 | <@AnnoDomini> | Okay, everything works now. |
11:10 | <@AnnoDomini> | Thanks for listening to me. |
11:15 | | Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has quit [Client exited] |
11:22 | | Tarinaky [Tarinaky@Nightstar-70cbe1b0.adsl.virginmedia.net] has joined #code |
12:32 | | cpux is now known as shade_of_cpux |
13:09 | | Orthia [orthianz@Nightstar-b362cbc3.xnet.co.nz] has quit [Connection reset by peer] |
13:16 | | Orthia [orthianz@Nightstar-b362cbc3.xnet.co.nz] has joined #code |
14:26 | | ToxicFrog` is now known as toxicFrog |
14:29 | | toxicFrog is now known as ToxicFrog |
14:31 | | Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed] |
14:31 | | Orth [orthianz@Nightstar-fac97da9.xnet.co.nz] has joined #code |
14:33 | | celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code |
14:33 | | Orthia [orthianz@Nightstar-b362cbc3.xnet.co.nz] has quit [Ping timeout: 121 seconds] |
16:39 | | Vornicus-Latens is now known as Vornicus |
17:07 | <@Vornicus> | I want it to be very easy to tell if something is "known" |
17:07 | <@Vornicus> | And I want it to be very easy tell what that known value is, and I want it easy to tell what's available for a particular unknown. |
17:08 | | * celticminstrel has no idea what you're talking about... |
17:11 | < Tarinaky> | Fuck. |
17:11 | < Tarinaky> | Fuck. Shit. Fuck. |
17:11 | < Tarinaky> | The CS Dept. don't want me :/ |
17:11 | < Tarinaky> | So, yeah. |
17:11 | < Tarinaky> | Fuck. |
17:11 | < Tarinaky> | -.- |
17:12 | < Alek> | :O |
17:12 | < Alek> | school or work? |
17:12 | < Tarinaky> | School. |
17:12 | <@Vornicus> | celmin: I'm writing a logic puzzle thing. |
17:12 | < Tarinaky> | The Physics dept are terminating me due to poor grades and the CS dept aren't able to offer me a place. |
17:12 | < Tarinaky> | So. |
17:12 | < Tarinaky> | Yeah. |
17:12 | < Tarinaky> | I'm pretty much fucked now :/ |
17:13 | <@Vornicus> | Each location can have a value, but if the value is not known, the location should have a list of possible values. |
17:14 | <@Vornicus> | Currently I'm using a number for "known" values and a set for unknown possibility-lists, but this makes it painful to write conditional code. |
17:14 | <@Vornicus> | hm |
17:14 | < PinkFreud> | Tarinaky: :( |
17:15 | | * Vornicus gnergs. |
17:15 | <@Vornicus> | Tarinaky: Suck. |
17:15 | | * Vornicus has been there and done that. |
17:16 | < Alek> | frigging windows update reset itself to auto-install. >_< |
17:17 | < Tarinaky> | Don't really know what I'm going to do now :/ |
17:17 | < Tarinaky> | Well, I do. |
17:17 | < Tarinaky> | But I don't really know how I'm going to cope with it. |
17:17 | < Tarinaky> | I mean. |
17:17 | < Tarinaky> | Yeah. |
17:17 | <@Vornicus> | I went home for a year and moped. And then I went back to school in a different place. |
17:17 | < Tarinaky> | :/ |
17:18 | < Tarinaky> | I don't have the privilage of being able to mope at home. |
17:18 | < PinkFreud> | Tarinaky: so skip that step. :) |
17:18 | < Tarinaky> | ATM my relationship with my mum is pretty close to deteriorating :/ |
17:18 | < Tarinaky> | PinkFreud: Don't have the option. :/ |
17:18 | < PinkFreud> | :( |
17:19 | < Tarinaky> | PinkFreud: I need to go back home to re-apply with UCAS. |
17:19 | < Tarinaky> | And. Yeah. |
17:20 | < Tarinaky> | I'm just really. Really. Torn up about it. |
17:20 | < Tarinaky> | Because I'm never going to see my friends again. |
17:20 | < Tarinaky> | And. |
17:20 | < Tarinaky> | Yeah. :/ |
17:20 | < Tarinaky> | Plus I don't know how I'm going to cope with a year of my mother. |
17:20 | < PinkFreud> | bleh :( |
17:38 | < Tarinaky> | Just. Yeah :/ |
17:39 | < Tarinaky> | My life feels like a bit of a fuckup. |
17:50 | | * Vornicus checks how he did this in his sudoku solver, determines it infeasible for this one: it generates a temporary available-move list. Which is /fine/, if the only things restraining the solution are rules, not clues. |
17:52 | | Orth [orthianz@Nightstar-fac97da9.xnet.co.nz] has quit [Client closed the connection] |
18:06 | | Orthia [orthianz@Nightstar-fac97da9.xnet.co.nz] has joined #code |
18:07 | <@Vornicus> | (the difference is: if the only things restraining the solution are /rules/, it is very easy to automatically apply the rules to the current state; with clues involved, each clue calculation is complicated enough that its result needs to be held on to. |
18:07 | | Orthia [orthianz@Nightstar-fac97da9.xnet.co.nz] has quit [Connection reset by peer] |
18:15 | | Orthia [orthianz@Nightstar-fac97da9.xnet.co.nz] has joined #code |
18:18 | | Orthia [orthianz@Nightstar-fac97da9.xnet.co.nz] has quit [Client closed the connection] |
18:24 | | Orthia [orthianz@Nightstar-fac97da9.xnet.co.nz] has joined #code |
18:42 | <@McMartin> | [band-name] Ryan says, "'; DROP TABLE Artists; --" |
18:42 | <@McMartin> | [band-name] Ryan says, "I like that, because being known as 'The Drop Table Artists' would actually work pretty well." |
18:42 | <@McMartin> | [band-name] Lucea says, "formerly known as Prince" |
18:53 | < gnolam> | <Tarinaky> PinkFreud: I need to go back home to re-apply with UCAS. |
18:53 | < gnolam> | ... yeah, I agree: you're pretty much screwed. |
18:54 | < Tarinaky> | Thanks for that :/ |
18:54 | | * Tarinaky is trying to not be crushingly depressed. |
18:54 | | * gnolam has had dealings with UCAS, and has found them to be the second most incompetent organization he's ever dealt with. |
18:54 | < gnolam> | (#1 being, of course, the Swedish National Service Administration) |
18:55 | < gnolam> | Tarinaky: but my condolences. |
18:55 | < gnolam> | I can sympathize more than you probably know. :) |
18:55 | < Tarinaky> | "Universities & Colleges Admissions Service"? |
19:00 | < gnolam> | The incompetent fucks who handle British higher education, yes. |
19:02 | < Tarinaky> | Ah. Well. |
19:02 | < Tarinaky> | :/ |
19:03 | < Tarinaky> | Even worse given I've got to do more chasing to get stuff like References again. |
19:03 | < Tarinaky> | And chase down my A2 slips. |
19:03 | < Tarinaky> | And eugh -.- |
19:10 | < gnolam> | A2? Those are some enormous slips. ;-) |
19:11 | < Tarinaky> | :/ |
19:11 | < Tarinaky> | You know what I meant. |
19:11 | < Tarinaky> | And I'm really fucking down -.- |
19:18 | <@McMartin> | Actually, can you help out an ignorant colonial? I don't know what an A2 is. |
19:18 | <@McMartin> | Beyond gnolam's joke |
19:27 | < gnolam> | I actually have no idea either. |
19:28 | < gnolam> | My contacts with UCAS (cursed be their name and may all their horses get spavin) was thankfully mostly limited to their financial department. |
19:29 | < Tarinaky> | McMartin: The second half of an A-Level. |
19:29 | < Tarinaky> | An A-Level being a 2-year post-16 qualification. |
19:29 | < gnolam> | And I knwo [sic] little about the British pre-university educational system. |
19:29 | < Tarinaky> | Taken as a precursor to University. |
19:30 | < Tarinaky> | It's split into two halves because if you do the first year you get an AS-Level out of it. |
19:30 | < Tarinaky> | If you do the full 2-year stint you get an A-Level. |
19:34 | <@McMartin> | I'm vaguely familiar with O- and A-Levels from my own days at University. |
19:35 | <@McMartin> | So an A2 slip is the proof you've completed it? |
19:39 | < Tarinaky> | Well, I meant my grades. |
19:39 | < Tarinaky> | And the bits of paper that say I have them. |
19:40 | < Tarinaky> | Since when I went through UCAS as Sixth-Form they handled all of that. |
19:40 | < Tarinaky> | The Uni got my grades before I did. |
19:40 | | * McMartin nods |
19:56 | | JadeTranq is now known as SmithKurosaki |
19:57 | < Tarinaky> | I just wish there was something I could do to stay on here so I can stay with my friends and stuff :/ |
20:23 | | Orthia [orthianz@Nightstar-fac97da9.xnet.co.nz] has quit [Ping timeout: 121 seconds] |
20:42 | | crem [moo@Nightstar-8ca3eea7.adsl.mgts.by] has joined #code |
20:46 | | Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has joined #code |
21:58 | <@Vornicus> | I .../could/ just keep two structures around, one of knowns and one of possibility lists. But I'm not a huge fan of that! |
22:11 | | Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code |
22:12 | | Attilla [Attilla@Nightstar-e28e7906.threembb.co.uk] has joined #code |
22:12 | | mode/#code [+o Attilla] by Reiver |
22:21 | | aoanla [AndChat@37647E.0002A6.6691A5.5F687B] has joined #code |
22:47 | | aoanla [AndChat@37647E.0002A6.6691A5.5F687B] has quit [[NS] Quit: ] |
22:48 | | Derakon [Derakon@Nightstar-1ffd02e6.ucsf.edu] has joined #code |
22:48 | | mode/#code [+o Derakon] by Reiver |
22:48 | <@Derakon> | You know how every once in awhile I go through and look for dead code to remove from the programs I maintain? |
22:49 | <@AnnoDomini> | Yes. |
22:49 | <@Derakon> | I removed a function readGLviewport from one of the modules awhile back. It's not called by anything in the program code. |
22:49 | <@Derakon> | But it turns out it is called by a library that the program uses, which just assumse that the object it's handed has that function implemented on it. |
22:49 | <@Derakon> | Er, assumes. |
22:49 | <@McMartin> | Yay duck typing! |
22:49 | <@Derakon> | There's no documentation on the function itself stating this, of course. |
22:50 | <@Derakon> | First I knew about it was a biologist complaining that the "save screenshot of this canvas" menu option was broken. |
22:50 | <@Derakon> | (Note that the library was written by the same guy who wrote the program) |
22:56 | <@Derakon> | Anyway, I'm writing a program that creates its own SSH connections; that's a first for me. |
22:56 | <@Derakon> | (paramiko Python library makes it pretty easy though) |
23:06 | | * Derakon spends 20 minutes trying to figure out why his put() calls are failing with an EOFError, only to discover it's because he's closing the connection beforehand. ?.? |
23:07 | < Tarinaky> | I'm starting to worry about whether I'll be able to get a place on a CS course and even more - if I'll be able to pass :/ |
23:07 | < Tarinaky> | Anyone able to comfort me? |
23:08 | < Tarinaky> | Because my mind is running in circles and I'm getting really messed up now. |
23:08 | < Tarinaky> | :/ |
23:08 | <@Derakon> | Sounds like you need to take a break and just not think about that for a bit. |
23:08 | <@Derakon> | Since the thinking you're doing isn't accomplishing anything constructive. |
23:08 | < Tarinaky> | A break doing ehat? |
23:08 | <@Derakon> | Read a book? Watch a movie? Play a game? |
23:08 | < Tarinaky> | I'm going to be spending the next year thinking about going to Uni. |
23:08 | <@Derakon> | Heck, go outside and get some exercise. |
23:09 | < Tarinaky> | :/ |
23:09 | < Tarinaky> | Oh. |
23:09 | < Tarinaky> | Shortterm I just can't think about anything else. |
23:09 | < Tarinaky> | I've been trying to watch everything. |
23:09 | < Tarinaky> | But yeah. :/ |
23:09 | <@Derakon> | Sure you can. |
23:09 | < Tarinaky> | I'm too consumed by everything. |
23:09 | <@Derakon> | You're making excuses. You're more in control of your own thought processes than you think you are. |
23:10 | <@Derakon> | Breathe in, breathe out, relax, and find something to do that requires your concentration. |
23:25 | | shade_of_cpux is now known as cpux |
23:31 | < Tarinaky> | Eugh. Gotta go and return some library books tomorrow. |
23:31 | < Tarinaky> | Fun! |
23:32 | | * Derakon reads up on basic shell scripting. |
23:32 | <@Derakon> | For loops, for example, iterating over arguments. |
23:36 | <@Derakon> | ...this is disgustingly whitespace-sensitive. |
23:37 | <@Derakon> | You have to put spaces around your while loop conditional's brackets? |
23:38 | < Tarinaky> | Is this basic as in the adjective or BASIC? |
23:38 | < Tarinaky> | Because bash scripts are, by their very nature, pretty hackish anyway. |
23:39 | <@Derakon> | As in the adjective. |
23:39 | <@Derakon> | Bash is a programming language; it just doesn't appear to be a very elegant one. |
23:40 | < Tarinaky> | It's only a programming language in the sense that a kitchen knife is a flat-head screwdriver. |
23:40 | < Tarinaky> | It's a hack, but sometimes it's easier than getting the toolbox out. |
23:41 | <@Derakon> | Hee. "For the July 4th weekend, (insert name) and I are celebrating our 5th anniversary with a 5-day trip to LA (this is going to scale brilliantly!)" |
23:56 | | Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has quit [Client exited] |
--- Log closed Fri Jun 25 00:00:46 2010 |