Munchlax He who eats


 Age : 16 Joined : 14 Feb 2008 Posts : 31 Location : In Sinnoh Job/hobbies : Eating Projects : Heavenly Divine Mana Sword Tales of Mana: The Manaful Journey for Mana
| Subject: Bah, tests Tue Apr 22, 2008 2:04 pm | |
| Man, if anyone knows me they know that I hate going over UIL or competition tests right after I finish. The reason for that is because before you get your test graded, you have that lingering sense of hope and/or confidence that you did well. If you grade your test or have your test score spoiled immedietly after you do it, that sense of hope is lost (but if you did do well, kudos).
A feeling even worse than having your hope shattered is being completely stumped by a test question and then immedietly upon turning the test in, arriving to the correct solution.
Imagine feeling that feeling, like, 4 times in a row.
Yeah, enough emo rant.
So I completely bombed my CS AB free response test. It was ridiculously easy too. Of course that's speaking in hindsight but really those problems were really friggin' easy. But of course I'm Munchlax and can only do decently on ungraded things.
Inb4 "(wheeze) Hahahaha, Munchlax" and "You're so fat" jokes.
| Spoiler: | | | Questions were (won't make sense to ppl who didn't take the test):
2a. Big-O times for add(String element) and getUniqueElements()?
add would have been O(n) because it just for-looped through the arraylist, I got that one thankfully >_>
getUniqueElements would have been O(n log n) because it used a merge sort. My smart self said it was O(n) because I thought merge sorts were just O(log n) and not O(n log n) making the method O(n+log n) -> O(n).
2b. Write the FastStringBag class with add(String element) being O(log n) and getUniqueElements() being O(n)
This is where it gets sad. For some reason, I forgot that I can FRIGGIN USE METHODS THAT AREN'T LISTED (facepalm) and spent like 30 minutes forgetting how to write a binary search. Of course even though I got the search correct (I think, probably not actually), add still wouldn't have been O(log n) because I used a freaking arraylist as my data structure (which most of the class did as well, haha). The correct code should've used a TreeMap, and should have went something like this (I think -_-;; ):
| Code: |
public void add(String element) { //entries is the TreeMap variable that holds the values you //add if(entries.keySet().contains(element)) entries.set(element,entries.get(element)+1); else entries.put(element,1) }
|
and getUniqueElements should've looked simply like
| Code: | public String[] getUniqueElements() { String[] ans = new String[entries.keySet().size()]; int count = 0;
for(String a: entries.keySet()) ans[count++] = a;
return ans;
}
|
Question 3 was a GridWorld problem where you had to write a TimidCritter. I didn't really get to this question because, as you know, I spent a majority of the time phailing at CompSci and being unable to write a binary search that STILL would have been the incorrect answer. It still wasn't particularly difficult though. TimidCritter had to store its first 10 moves, then repeat the moves backwards for moves 11-20, then repeat the entire process from there (erasing any rocks or other normally indestructible actors in the spaces in went). That's it.
It was pretty simple, but since I had no time (-_-;; ) I rushed and fudged the move methods and ended basically with a pile of junk and wasted ink. Go me.
//setRantMode(false);
The code above is correct right Michael? I'ma feel pretty damn stupid if even kinda going over the test I still got them wrong -_-;;
|
|
|
Java_illiterate1337 Illiterate


 Age : 15 Joined : 19 Feb 2008 Posts : 46 Location : Alderaan Job/hobbies : sleeping... Projects : World domination, nuking Africa..
| Subject: Re: Bah, tests Wed Apr 23, 2008 5:09 pm | |
| Welcome to my world Eric... _________________ The most powerful weapon on earth is the human soul on fire. ~ Ferdinand Foch ~ |
|
Marth Developer


 Age : 17 Joined : 13 Feb 2008 Posts : 161 Job/hobbies : Breaking Eric's Java
| Subject: Re: Bah, tests Thu Apr 24, 2008 11:00 am | |
| well, if it's any consolation, half the class bombed it too lol _________________ I lol at illiterate nubs  |
|
FOOGUMS Member


 Joined : 04 Sep 2008 Posts : 3 Job/hobbies : Animtin' on mah flashes
| Subject: Re: Bah, tests Yesterday at 4:32 pm | |
|  |
|
Temujin Illiterate


 Age : 15 Joined : 01 Apr 2008 Posts : 55 Location : In the steppes of Mongolia Job/hobbies : Crushing lesser mortal(s) Projects : Hydroelectric Powered Missile Defense System
| Subject: Re: Bah, tests Yesterday at 4:33 pm | |
| rofl andrew, we are both very late _________________ "Circumstances rule men; men do not rule circumstances." -Herodotus |
|