Rashakil Fol 978 Super Senior Demiposter Team Colleague

Look, you just need an easy language class. Take French or Spanish, they're not that hard.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I mean the direct code.

google "openjdk hashmap code"

Here's your code. http://www.docjar.com/html/api/java/util/HashMap.java.html

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Python. You just want Python.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Does this mean that Josh is a university student? If so, they should be informed of his activities, which has resulted in the blacklisting of their IP address (they would not approve, I'm sure). Else, if he is not a student and is using their IP address without permission, he should face other consequences, n'est pas?

Why would they care?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

my question is
what does n - 1 mean (n minus 1)

That's the same kind of minus as the minus key on your calculator. Just put n - 1 into Mr. Calculator and you'll calculate running time.

what does n/2 mean (n over 2 or n divided by 2)

That's the same thing as n รท 2.

because stuff like this is being mentioned am soo confused when the being used i need to know what they mean, and why is it being used and when would you use them..

Yeah, it can get confusing, but you don't need to know this low level stuff. Just use your calculator.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

An API is a list of function declarations, or something in that spirit.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Well, the exact same thing happened with normal rep before (cough rashkil, cough). Its a bot targeting me, ad and happygeek. Its under staff discussion.

Well you better do something about it. It wouldn't be fair to stop me after 3 hours, when it was funny, but let these doodooheads go on for weeks and weeks.

sknake commented: I still don't like you .. but this is too funny. +1 +0
Rashakil Fol 978 Super Senior Demiposter Team Colleague

To heck with SAS. It is software that deserves to die.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Take Japanese and then you can get really freaking tired of all the otakus in your class.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Edit what? A string? What does editing a string have to do with measuring the distance of two strings? What are you trying to do? Why do you want to compute the distance?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Objects in C++ can't change their type. You can have a variable of some pointer-to-animal type and then assign a new pointer-to-animal to that variable though.

Rashakil Fol 978 Super Senior Demiposter Team Colleague
Rashakil Fol 978 Super Senior Demiposter Team Colleague

What kind of Lisp? Common Lisp? Use SLIME. Emacs Lisp? I guess not, because then you wouldn't need to ask.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If there are 32-bit instructions, that means there are 2^32 total values these instructions could have. If addresses are 12 bits, each 2-address instruction has 2^24 values it could have. So subtract the amount of values it could have from the total number of available values and that's how much you have left over.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The compiler doesn't see their bodies. The functions are already compiled into a library. Lookup detailed descriptions of how compiling and linking works -- this is the sort of thing where half-assed explanations will leave you uncomfortable and unsure.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Bugga - The Google Go language isn't in the Ubuntu synaptic package manager so tons of commands need to be done to install the Go compiler. And I can tell you now very few people would want to do that so this language will never be popular at this rate with a command line interface to install and an endless installation process depending on the OS. I might just stick with Java.

Honestly you deserve to be stuck with Java.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

For example, suppose you have a function

int f(int n) {
  if (n == 0) {
      return 1;
  }
  else {
      return n * f(n-1);
  }
}

We want to measure its cost. But before we do so, we'll say that its cost is O(t(n)) so that we can use it in the formula.

if (n == 0) { // O(1) conditional test
      // O(1)
  }
  else {
      // O(1) + t(n-1)
      return n * f(n-1);
  }

So t(0) = O(1) and t(n) = O(1) + t(n-1)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Don't use non-open source revision control systems. They're no good anymore. Use Mercurial. Don't use Subversion unless you have large binary files or the need to control permissions for subdirectories. If you don't want either of those things, Mercurial is superior to Subversion in virtually every way. Personally I use Git, but that's because I haven't used Windows lately.

When people recommend SVN, it's either because they need the two features I mentioned or because they'll see that SVN is the best for the way they manage source code, but this is only because they designed their practices for managing source code around the features of SVN.

For starters, Mercurial is absurdly faster than SVN for the important operations. Merging and branching in particular. If you look at projects that use Subversion, they only have a few branches! Why wouldn't they make a branch for every unit of change they make? SVN is or was just not good at that. Most SVN defenders I've seen will say that's not how they do their workflow. But the truth is that they didn't have the freedom to design their workflow in the first place. SVN has gained some improvements in branching and merging in response to the rapidly growing popularity Git and Mercurial, but it's still clunkier than them.

One thing I haven't bothered mentioning is that Git and Mercurial are distributed version control systems. That's not useful to many people, but it is one of the reasons why โ€ฆ

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Create a recursive formula for the time complexity and figure it out from there.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Take the sum and multiply by the step size. It's that easy.

Or see Simpson's method.

Edit: Gah, of course you have to have fractional endpoints. So treat the first and last segments specially.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

To represent an N-bit value whose value could be anything, you need.... N bits. Which eats up 2^N possible numbers. You have 2^20 available numbers.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

(I just highly doubt mathematical proofs interests you, but who knows).

It apparently does, if he's considering it.

I also think the probability of the linear algebra class sucking is higher than the intro to mathematical proofs class sucking. Math department tend to care about the latter. Sometimes, but of course not always, some throwaway prof gets thrown at the linear algebra class. Of course you can rule this risk out by looking at the listed professor.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Why don't you just count? Each two-address instruction eats up enough of the available instruction space to represent 2 addresses. Each one-address instruction eats up enough of the available instruction space to represent 1 address. If you don't understand what this means, ask.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The real value of a forum like Daniweb is in how it helps the people who search for problems in the future. The needs of the OP are immaterial.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I think this sort of thing should just be... intuitively straightforward. The only part that might not be is the question of how to deal with different operator precedences.

What is a program? It's merely a sequence of top level definitions!

<program> ::= <top-level-definition> <program> | <top-level-definition>

What is a top-level definition? And so on.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You need to explain your problem better. What is a subdomain? Why are "keys"? What about the binary tree lets you search efficiently? If it's just a binary tree, and not the more specific case of a binary search tree, you'll just have to search through the nodes linearly.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The reason it exists is because somebody put it there. Supporting the marking of threads as solved is like supporting the death penalty: innocent people will get executed, and threads with bad solutions will marked as solved.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Look, I could be trolling you back, or I could take your arguments to pieces, or quote recognized authorities and studies that confirm the lack of safety in C++, or point you to references on qualities of good programming language design... But would that get us anywhere? Would that make you accept any argument of any "authority" other than yourself? Or make you start talking to me on equal footing? Probably not.

The trouble with trying to argue with me is that you don't disagree with me about C++.

Edit: What you disagree with, apparently, is the practice of providing reasons for the things you say.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You don't know me, so you assume I don't know what I'm talking about. I'm not bashing about C++ because I don't know it. I'm doing it because I do know it. (I've been a C++ system programmer for 10+ years.)

I don't care about you or your appeal to self-authority. I'm going to assume you don't know what you're talking about because most people don't.

And stop having a chip on your shoulder, and I was comparing C++'s safety merits relative to Python's, because there are some.

To say "If you know how to use C++, it's a very safe language" is a no-statement. Everything, even assembler, is safe if "you know how to use it". That's not the point about safety in programming languages.

That's not true. Even if you "know how to use" assembler, there's still a high probability of yourself creating a memory error. Unless you're using a statically typed assembly language or something. If you "know how to use" C++, you can reduce the probability of memory errors in most of your code to zero. You of course have to restrict yourself to a subset of the language and standard library -- at mundane levels such as avoiding certain functions like std::vector's operator[], and at other levels such as using smart pointer types, avoiding pointers entirely, using non-cyclic data structures, just tolerating some copying, and avoiding STL-style iterators.

"C++ provides the best resource safety of any mainstream language"??? Yeah, dangling pointers, memory โ€ฆ

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Here's a nice review by somebody I consider smart: http://scienceblogs.com/goodmath/2009/11/googles_new_language_go.php

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Hey, you're right, it is easy for me.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You need to tell us the error message and what line it's on, and you need to use CODE tags for us to want to look more closely.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Let's look at this one. I'm going to ignore the swap for now.
Iteration2:

public static long dominoes(long x, long y){
		long temp;
		double koeficient = 0, faktor;
		for(long i=0; i<=x+y; i++){
			koeficient = 1;
			for(int j=1; j<y+1; j++){
				faktor = ((double)((i+1)-j)) / (double)j;
				faktor = koeficient * faktor;
				koeficient = faktor;
			}
		}	
		return (long)koeficient;
	}

Let's add annotations, giving the cost of each line.

public static long dominoes(long x, long y){
		long temp; // O(1)
		double koeficient = 0, faktor; // O(1)
		for(long i=0; i<=x+y; i++){
			// an O(1) cost for (i <= x+y) and (i++)
			koeficient = 1; // O(1)
			for(int j=1; j<y+1; j++){
				// an O(1) cost for (j < y+1) and (j++)
				faktor = ((double)((i+1)-j)) / (double)j; // O(1)
				faktor = koeficient * faktor; // O(1)
				koeficient = faktor; // O(1)
			}
		}	
		return (long)koeficient; // O(1)
	}

When we have successive statements with cost O(x) and O(y), their combined cost is O(x + y). Let's first remove the pieces of code that we've accounted for.

public static long dominoes(long x, long y){
		// O(1)
		// O(1)
		for(long i=0; i<=x+y; i++){
			// O(1)
			// O(1)
			for(int j=1; j<y+1; j++){
				// O(1)
				// O(1)
				// O(1)
				// O(1)
			}
		}	
		return; // O(1)
	}

You'll note that the lines of code don't modify i or j. If there was some line that said "i = i * i", we wouldn't want to delete that because it would affect the number of iterations of โ€ฆ

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Take Introduction to mathematical proof. It will make you a better, smarter programmer.

Another reason is that if you find yourself interested in graphics, it wouldn't be that hard to pick up the necessary linear algebra on your own. Linear algebra is not the hard part of graphics programming.

Edits:

- I think linear algebra is best learned in courses that use linear algebra to solve problems, not one that focuses on the subject itself. Introduction to mathematical proof may prepare you for such situations in similar or better ways than a linear algebra class would.

- Regarding discrete math: I think the Wikipedia article is a good place to start.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

not even if it's mixed with such excellent features as Python's. ;)

Sorry I'm not able to burst into enthusiasm. The statement alone, they would combine Python's development speed with the "safety of a compiled language like C or C++" is a farce. C++ is one of the unsafest languages out there. Not to mention the ugly syntax ;)

I think that quote is referring to type safety. Not to mention monkey-patch safety. If you know how to use C++, it's a very safe language. C++ provides the best "resource safety" of any mainstream language.

Go is a variant of C and has a type system very similar to C's. I think it's a great place to start -- it doesn't have exceptions, so the behavior of things is very predictable. I can imagine projects where I'd normally use C, but now I'd use Go. And Go has room to grow.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

4I just get tired of watching you post and complaining about what other people say, -rep them, down vote them, and generally antagonize people because you want to be an ass that day all the while you're contributing little.

I just don't want people to mark threads solved.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I suspect if this were looked in to you would find Rashakil Fol behind it.

That's just crazytalk.

See you on IRC.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I also forgot to ask before... What is the time complexity of BigInteger (in Java)?

Addition is O(n) where n is the number of bits in the BigInteger, and multiplication depends on the algorithm used: http://en.wikipedia.org/wiki/Multiplication_algorithm . That depends on the Java implementation. I don't know about division.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Please do us a favor and contribute or shut up.

Why do you get so butthurt when you see people with different worldviews than yours?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Well, I like it. In particular, slices, rather than pointer arithmetic, is simply The Right Thing.

I have been looking for a good safe systems programming language, and it seems like garbage collection is the practical thing to do. The other option is Cyclone, which I don't like.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Actually, at the risk of sounding whiny, I retract my statement. But I still believe that new members misuse the down vote system to "spite vote"

I just automatically downvote every one of your posts. It's like when a girl punches you -- it means she loves you. Except I'm not a girl. And I don't love you. You're the closest thing to serkan we've got, though. Well, sknake is closer, I suppose... the names are practically anagrams. I'll tell you what -- I'll downvote all of sknake's posts I see, instead.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Well, since you're unwilling to think, I'm not going to do it for you.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

This poll is rubbish, how the hell am i winning?

You are popular the way Bill O'Reilly is popular.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

First, start working on it. Then, after you've shown some progress, you'll have an easier time convincing somebody to help you.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

this is stupid... :(

yeah

why did i pay for this? :(

Why would you pay for something stupid? Maybe you are stupid :P

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Firstly, me...secondly, a fair few of the solvers i've seen here on the boards.

Really, you and other people? Who would have thought?

Marking a thread as solved indicates to others that the problem no longer requries attention,

No, it indicates that people think it no longer requires attention, but adds a presumption of the correctness of the answer -- and frequently a thread's OP isn't qualified to judge that matter.

and a reminder to mark seems to be a very common closing comment.

So?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

which type of tool is using to calculate for time complexity?

your brain

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Remember to mark the thread as solved.

Who cares?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Just remove a letter from the first string, print that letter, and do a recursive call. Of course, you'll want to do this for each letter.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If you're writing production software, you should use openssl or gpg or whatever -- you shouldn't be calling cryptography routines yourself, and especially you shouldn't be writing them, unless you know what you're doing. And if you're wondering if you know what you're doing or not, then you don't. Of course, how does one learn then? Well, if you want to play around, though, be my guest :). There are implementations of the various SHA-2 algorithms online -- just search for "SHA-256 implementation" on a search engine, for example.