## Search found 15 matches

Tue Oct 21, 2008 3:23 pm UTC
Forum: Coding
Topic: Creating infinite series
Replies: 5
Views: 1414

### Re: Creating infinite series

Well yeah, you could easily fake it with something like: (Pseudocode): For all values between 1 and 10: Print value Print "-" + value That is Print the numbers from 1 to ten and after each one print that number with a negative sign before it :P However, that's probably not what you're supp...
Wed Oct 15, 2008 11:46 pm UTC
Forum: Coding
Topic: Java Binary tree implemented using an array
Replies: 21
Views: 5587

### Re: Java Binary tree implemented using an array

Yeah, I've been thinking about this all day, and I have no idea what your prof is looking for really. So, I guess I can't really help. I'll keep thinking about it and post again if I can figure anything out. But good luck otherwise.

~ Chibu
Wed Oct 15, 2008 2:55 pm UTC
Forum: Coding
Topic: Help me with a simple java method?
Replies: 17
Views: 1939

### Re: Help me with a simple java method?

Here . But if you're going to go that route, you might as well just do: boolean isPowerOfTwo(int x) { return x > 0 && Integer.bitCount(x) == 1; } Yeah, I know. Basically, I just had it in my head so I typed it out. In short though, minty ice is learning about loops so none of these solution...
Wed Oct 15, 2008 2:52 pm UTC
Forum: Coding
Topic: Java Binary tree implemented using an array
Replies: 21
Views: 5587

### Re: Java Binary tree implemented using an array

Well, I know it's already been suggested, but if you're going to be working with all full or at least complete trees, then the correct way to store a binary tree (with no holes) in an array is to use the Parent = i, left = 2 * i, Right = 2 * i + 1 method. It's pretty easy. Have you asked your prof i...
Tue Oct 14, 2008 7:44 pm UTC
Forum: Coding
Topic: Help me with a simple java method?
Replies: 17
Views: 1939

### Re: Help me with a simple java method?

Dude, couldn't you do something like: boolean isPowerOfTwo(int x) { s = Integer.toBinaryString(x); return (x > 0 && s.indexOf('1') == s.lastIndexOf('1')) } I haven't actually tried it (don't have java installed on my fiance's box), and it's probably slower than the Rysto's method, but I thin...
Mon Oct 13, 2008 12:39 am UTC
Forum: Coding
Topic: How to approach difficult problems?
Replies: 25
Views: 3178

### Re: How to approach difficult problems?

Edit (again...): I apologize... I seem to have made a disastrous brain-not-working error. I left out a critical part... >_< You swap the value at i with the smallest value after it that is LARGER than the value at i ... So, the reason it starts repeating is becuase it swaps the 8 with the 7, but it...
Sun Oct 12, 2008 11:40 am UTC
Forum: Coding
Topic: How to approach difficult problems?
Replies: 25
Views: 3178

### Re: How to approach difficult problems?

I actually solved this problem accidentally. I happened to have the code lying around from my senior project for graduating from college which was about finding determinants of huge matrices. The entries were based on the points in a given Permutohedron . As such, I already had to have an efficient ...
Sun Oct 12, 2008 10:25 am UTC
Forum: Coding
Topic: Help Wanted
Replies: 36
Views: 82747

### Re: Help Wanted

Hi there, I'm looking for a job in Pittsburgh, Pa, USA. I personally specialize in web applications, though I can program pretty much anything. So, if anyone happens to know of anyone who needs someone to do some work, please feel free to let me know. I've been actively looking for about a two month...
Sun Oct 12, 2008 10:02 am UTC
Forum: Coding
Topic: Greasemonkey script for xkcd comics
Replies: 5
Views: 1669

### Re: Greasemonkey script for xkcd comics

lol, fair enough ^-^
Sat Oct 11, 2008 8:17 pm UTC
Forum: Coding
Topic: Help me with a simple java method?
Replies: 17
Views: 1939

### Re: Help me with a simple java method?

And it would be faster/more efficient since there is no looping going on. Wow, I definitely agree. That is a really sweet solution to the question. I wouldn't have ever thought of that >_< The only problem is that: We just started to learn about loops in my java class So, the problem should probabl...
Sat Oct 11, 2008 7:35 pm UTC
Forum: Coding
Topic: Help me with a simple java method?
Replies: 17
Views: 1939

### Re: Help me with a simple java method?

For your second Method, You'll probably want to make use of the Modular Division operator. It's used like +, -, *, and /. But the value given is the remainder after division. For example: 5 % 2 = 1 and 7 % 4 = 3 So if you have an input number n, you will probably want to check if n % 2 is equal to z...
Sat Oct 11, 2008 7:15 pm UTC
Forum: Coding
Topic: Getting the most recent comic
Replies: 24
Views: 93632

### Re: Getting the most recent comic

Hi everyone, I saw this thread and it looks like there are not many examples of how to get the most recent comic. So, in the past few minutes I decided to throw together a function in PHP that can be included in a website to display the most recent XKCD Comic. I'm not sure if this is useful to anyon...
Sat Oct 11, 2008 6:16 pm UTC
Forum: Coding
Topic: Greasemonkey script for xkcd comics
Replies: 5
Views: 1669

### Re: Greasemonkey script for xkcd comics

If you can upgrade Firefox to version 3, you won't have this problem. I think there was also a plugin for version 2 that fixes it. Oh cool. That makes sense. I know there is a plugin somewhere for Firefox 2, but I didn't want to look for it, and now I don't need to. And I'm not sure why I don't lik...
Sat Oct 11, 2008 6:00 pm UTC
Forum: Coding
Topic: Starting out
Replies: 18
Views: 1955

### Re: Starting out

I agree with the learning multiple languages sentiment, however I don't know that I'd personally recommend learning them at the same time. Pick one to begin with. I recommend using whatever language you can get setup with the easiest. Python and Java have pretty easy installers for windows. I actual...
Sat Oct 11, 2008 5:35 pm UTC
Forum: Coding
Topic: Greasemonkey script for xkcd comics
Replies: 5
Views: 1669

### Greasemonkey script for xkcd comics

Hi everyone, I was reading through comics this morning, and since I use Firefox, I kept getting annoyed by having to right-click and look at the image properties every time i wanted to read the comic's title tag (or more than the first few characters anyway). So, i decided it was more efficient to s...