Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Feb 2009
Offline Last Active May 03 2012 12:41 AM

Topics I've Started

Hashing to Multiple Unique Values

20 April 2012 - 11:44 PM

Ok, so excuse me for being a nub but I'm not having much luck searching wikipedia/the web for an answer to my problem.
I've been trying to implement a generalized cuckoo hashing schema with a scalable number of hash functions (this also has applications to my pre-existing bloom filter application if I can get this working). The problem I'm having is trying to "sample without replacement" in stats terms. I would like my hashes to all be unique locations in my table that way I don't waste time mapping twice to the same space. AFAIK this should also increase the uniformity of my functions since there are a triangular number fewer possibilities to choose from when sampling without replacement.

I've got a nice hash function already, and the ability to generate enough uniformly distributed bits to hash k times, it's just that I'm having trouble with the uniqueness aspect.

Also, if any clarification is needed, I will most surely provide it.

Dealing with (annoying) people (and their code)

05 November 2010 - 02:19 AM

Ok, so I've become sort of a lone ranger as far as coding goes. The main reason is my school is packed to the brim with contest coders, and I really can't stand the atmosphere they lend to programming. When talking to one of these contest coders I often find myself being talked down to, for instance:
(this is the first time I ran into this guy, in fact I was having a discussion about priority queues before he butted in)
Friend: So, what papers have you read lately? (I know, it's not the best for conversation but it was pretty late at night)
Me (to friend): Oh, not much, I've just been trying to get a good feel for what the best priority queue is for various fields. I think they're pretty interesting.
Contest Coder: (coming from nowhere) You think you know about priority queues? *ahem* Well, if you actually know about priority queues, you should have no trouble with the following problem... (goes on and on about a problem and the various time bounds I need my algorithm to run under, takes like 10 minutes)... oh wait, I forgot, you don't actually need priority queues for that one. Here, let me find the one I was thinking of... (whips out his laptop)
Me: No, it's fine, I'll just do the "interesting problem" you just told me about.
I get back to my dorm, and code it up.
Next week.
Contest Coder: So did you finish my problem?
Me: Yeah, what's your-
Contest Coder: Does it run under O(nlogn)?
Me: Yeah, I'm pretty sure, I've just got to try and remember my algorithm, hold on.
Contest Coder: You should ALWAYS remember the big-O times of algorithms you make.
Me (thinking): ... I finished it 20 minutes after you told me the problem. Then a week passed, with me coding up other things.
Me (talking): It runs in O(n) time.
Contest Coder: Ok, can you email me your answer?
Me: Yeah, what's your email?
Contest Coder: (gives his email) So, what language is it in?
Me: Java, because bluej makes prototyping really fast. Otherwise I'd have used c (knowing that most contest coders program in c).
Contest Coder: Yeah, Java sucks. And I thought about it, you don't really need Priority Queues for anything.
Me: Lol, good one.
Contest Coder: Yeah, I'm serious, what algorithm needs a priority queue?
Me: A*?
Contest Coder: What's that? I bet it doesn't need a priority queue.
Me: (Try to give an explanation with constant interjections by cc and eventually give up)... ok, I'm just bad at explaining things.

This is the typical conversation I get from contest coders (usaco, acsl) that & they dismiss any work that's long term saying stuff like "oh, that's trivial" when my current line of research really isn't (oddly enough, bettering A*).
Not to mention, when they ask for help on a bug they have, I open up their project and find it covered with global variables & branching (<- the newbs at contests mainly). I'm not saying all contest coders are bad, it's just that they should realize other ways of life, err, coding.
What's the best approach if I now have to teach a lot of them how to use blender and povray, and after that python (for use scripting)?

Multithreading, which one?

07 May 2009 - 03:21 AM

Ok, I am trying to get the most out of my current project, and so I decided that rather than optimize on a single core, why not add multiple cores? So with that in mind I looked for ways to do such a thing. It seems to be a necessity to have a library for this because afaik it's not implemented directly with MSVC++. So, after a while I came across the following. OpenMP - This seems to be one of the largest, yet *SHOCK* MSVC++ is running an out of date version! The current version 3.0 isn't supported and it only goes up to 2.5 . Since I want to get familiar with a library, and continue to use it in other projects, this seems suboptimal. I mean of course with the next release, maybe they'll use the current spec, but maybe not... Cilk++ - This looks the most abstracted of the three. It seems to have a semi-large community although it doesn't look like it's being used for real time optimizations. The idea of a scheduler seems clunky. Intel TBB - Sort of like an abstracted OpenMP it seems. I just wonder if this has some intel-induced limitations, or recquires omp 3. In general I'm aiming for the following in the order they appear: Portable (Windows, Mac, Linux) - We never know which'll come out on top... Fast (Real-time) - My preferred area of study. Community (Preferably large) - Small communities make for a cold, unfriendly feeling when developing. In general, my main concern with these are their speed, I'm pretty sure they're all portable.

Shuffling infinite loop[solved]

28 April 2009 - 06:44 PM

Thanks, this is solved. [Edited by - lefthandman on April 29, 2009 9:44:22 PM]


14 April 2009 - 04:50 PM

Ok, so as a project we were supposed to do something visually related to our topics and I decided it was a great opportunity to write a program. So, using only freeGlut, I embark on the task of creating a simple circle drawer. This drawer quickly evolves and I end up with this monster of a function:
	static void DrawCircly (float x, float y, int degrees, int direction, float radius)

		glBegin( GL_POINTS ); // OR GL_LINE_LOOP

		for(float angle = 360-(degrees+direction); angle < 360+direction; angle += 1) 
			glVertex3f((radius*cos(angle))+x, (radius*sin(angle))+y, 0 );


EDIT: oh yeah, lol. Ok, so that function doesn't allow you to move around the circle you created and it's origin in my main loop will always be 0. EDIT: Ok, it's the way I call the function that matters. Solved by myself.