IT/Software career thread: Invert binary trees for dollars.

  • Guest, it's time once again for the massively important and exciting FoH Asshat Tournament!



    Go here and give us your nominations!
    Who's been the biggest Asshat in the last year? Give us your worst ones!

Cad

scientia potentia est
<Bronze Donator>
25,866
50,842
I do think I have some kind of memory leak in there. It takes a bit too long computing for how simple it is.



Yeah I went over some arrays research when doing this before I realized I needed nested statements in order to fulfill his requirement. They look pretty simple to me because I am just looking at them as a spreadsheet starting from 0 both in length and width but I am sure I will screw my first one up.
You can't possibly have a memory leak when you're not dynamically allocating memory.
 

Cad

scientia potentia est
<Bronze Donator>
25,866
50,842
Why you using a double for your loop control variable? lol
 

Noodleface

A Mod Real Quick
38,376
16,293
I wonder if your problem is you keep redefining average at the end of the loop

I dont remember how it works, but I wonder if it's doing something strange with memory there
 

Cad

scientia potentia est
<Bronze Donator>
25,866
50,842
I don't see anything weird in your code though a_skeleton_03. Maybe it's just your dev environment. It runs instantly on my rackspace pos host.
 

Tenks

Bronze Knight of the Realm
14,163
607
While loops are pretty easy to write so there isn't a proper exit condition. Since most people are taught to write their for loops that are self-incrementing it is really hard to write an infinite with a for -- though technically possible of course.
 

Asshat wormie

2023 Asshat Award Winner
<Gold Donor>
16,820
30,968
We just brought double into our curriculum so instead of just using float or integer I said meh why not and put double in.

I know it won't have a decimal place.
Your Professor not taking points off for using a double as a loop counter is the best example of him being shitty. Try to avoid comparing doubles.