Rashakil Fol 978 Super Senior Demiposter Team Colleague

C#.net isn't a language.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

what about something in c or c++. are those "portable" launguages?

Can you use C or C++ on different kinds of computers?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Find the n-1th element of the tail of the linked list.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

That depends whether you're interested in cryptography or cryptography engineering.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

There is nothing left to explain.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

It means you can use it on different kinds of computers.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

What ideas have you considered and why did you discard them?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

What ideas have you considered and why did you reject them?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I just don't want to be limited by the pre-defined types.

You can define your own types easily enough, no?

For example, I want to make a 1kb integer or one that is dynamic and has no limits.

You're contradicting yourself. A 1kB integer has limits. An integer that is dynamic and has no limits won't always be 1kB.

And this (an integer type with no limits) is easy enough to implement in C# or C++, and you don't even have to use pointers. Here are some straightforward skeletons -- adding signedness and other operators, and fixing whatever bugs accidentally left in this code, are left as an exercise to the reader.

C#:

class BigInt {
  UInt32[] data;

  private BigInt(UInt32[] data) {
    this.data = data;
  }

  public BigInt(UInt32 x) {
    data = new UInt32[] { x };
  }

  public static BigInt operator+(BigInt x, BigInt y) {
    int xn = Length(x.data);
    int yn = Length(y.data);
    int n = xn < yn ? yn + 1 : xn + 1;
    UInt32[] ret = new UInt32[n];
    bool carry = false;
    for (int i = 0; i < n; ++i) {
      UInt32 xd = i < xn ? x.data[i] : 0;
      UInt32 yd = i < yn ? y.data[i] : 0;
      UInt32 xd_yd = xd + yd;
      UInt32 s = xd_yd + (carry ? 1 : 0);
      ret[i] = s;
      carry = (xd_yd < xd || s < xd_yd);
    }
    return new BigInt(ret);
  }

  public static BigInt operator*(BigInt x, BigInt …
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Here's a branch prediction algorithm:

1. Assume the conditional jump won't jump.

That's it.

Here's another.

1. Assume it will do what it did last time.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Factor.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The quality and content of CS programs varies significantly from school to school.

Go read the course descriptions of your school to see what the programs have to offer, and go read what other people think of the quality the programs.

IT programs train people to be computer janitors.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You shouldn't need to ask other people if a proof is incorrect if you understand how logic works.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

> Hi, could you walk with me through solving this problem

No, there are more important things than solving this problem. Your ability to think clearly is at stake.

> On one hand it would seem it belongs to RE since its blocked by a constant, on the other hand all input is required to be blocked by the running time of c.

I don't know how to parse this statement. What does "blocked by a constant" mean? It's an ambiguous thing to say and you should be saying things unambiguously.

> My guess is that its not in RE\R nor in R, since how can you run a machine on all possible inputs when inputs are infinite and check whether on all those inputs the machine stopped after time C.

Here, you're saying wrong things. Inputs are not infinite, because, with Turing machines, inputs are finite. The set of inputs is (countably) infinite. Why are you saying "inputs" when you should be saying "set of inputs"? You're casually mixing up the two terms. I don't know why you're doing this. Either you don't understand the distinction between having a given type of thing versus having a set whose elements are a given type of thing (which seems improbable), or you don't feel like holding thoughts in your mind correctly or writing them correctly. The same goes for your "blocked by a constant" statement. It takes effort to be rigorous and clear, when you have …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

First I'm not everybody
Then I don't like the way you put your parentheses because one cannot match opening and closing parentheses at a glance
Finally, you do as you wish and I'll do as I wish!

It doesn't matter. After using Lisp for a while you'll end up changing your mind and deciding that the way everybody else does it is better.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

My guess is that its not in RE\R nor in R, since how can you run a machine on all possible inputs when inputs are infinite

My point is that the relevant part of the inputs are not infinite.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You didn't understand what I was saying. Read it again.

iamthwee commented: yes +11
Rashakil Fol 978 Super Senior Demiposter Team Colleague

A great first post!

The key here is to notice that during the first C timesteps, a Turing machine's behavior can only be affected by the first C elements of input.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

When I use the term, it means what aspire1 said, except that you can shift the elements N places, for some value of N.

Either way, "many rotations" gets the same meaning, and the combined effect of many rotations is the same as that of one of rotation, or a small number of aspire1's variety.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Write your own code, how do you expect to learn without training?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Never mind, someone helped me figure out the problem - it seems the second IF was never evaluated, and i should have instead used the ELSE part of the first IF.

No, both IFs were evaluated. The result of the first was discarded.

I would have suggested the following:

(defun enlarge ( x ) 
  (cond
    ( (< x 0) (- x 1) )
    ( (> x 0) (+ x 1) )
    ( T nil )
  )
)

You should stop being a special snowflake and put your parentheses where everybody else puts them.

(defun enlarge (x)
  (cond
    ((< x 0) (- x 1))
    ((> x 0) (+ x 1))
    (t nil)))
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Database administration seems well defined to me.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

No.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You could try reading the algorithm for AVL tree insertion. If you can't read an algorithm and then manually interpret its steps out on paper, you should study something other than computer science.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Why would employers care? It's not like they're going to ask you for your transcript.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

An example:
I made a replied to a post in the C++ forum and let the OP know that the reason for their error was that the variable they were trying to use (and was coming up with a random number) was uninitialized and/or unassigned. The next reply was "I'm not sure I understand what you mean exactly." Now, that could have been because I didn't delve deeply into the post, just let them know that an uninitialized variable is filled with junk and needs to be initialized or assigned before it can really be used.

DaniWeb and similar sites get a biased sample of students, attracting an excess of troglodytes who can't figure things out for themselves or learn things on their own. The idea of looking up a term on Google or the very technique of formulating a Google search is beyond their skill set. You would expect any reasonably intelligent person to be able to understand any subject just by reading a book or a jumping through a nest of Wikipedia articles about the subject, and by thinking and rereading when necessary, but apparently some people are incapable of manipulating logical thoughts and instead learn how to do things through repeated exposure and pattern-matching and having somebody tell them what to do. These students, unless cured of their problem, tend to do poorly at computer science, and would do poorly at math, except that math teachers have designed their courses and tests in a way that …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Just compute the following integral.

[tex]\int_0^n \int_0^{i^2} \int_0^j 1 dk dj di[/tex]

And here's how you do it.

[tex]\int_0^n \int_0^{i^2} \int_0^j 1 dk dj di = \int_0^n \int_0^{i^2} j dj di = \int_0^n \frac{i^4}{2} di = \frac{n^5}{10} [/tex]

But that's kind of not relevant. The point of expressing the sum in terms of integrals is not that it gives you an exact number of instructions -- it's that the big O expressions of an integral on an interval are going to be the same as those of the Reimann sum.

[tex]\int_0^n \int_0^{i^2} \int_0^j 1 dk dj di \in \int_0^n \int_0^{i^2} \int_0^j O(1) dk dj di = \int_0^n \int_0^{i^2} O(j) dj di = \int_0^n O(i^4) di = O(n^5)[/tex]

Rashakil Fol 978 Super Senior Demiposter Team Colleague

What, do you expect somebody to figure out what needs to be done? Why don't you explain the problem you're having?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Just compute the following integral.

[tex]\int_0^n \int_0^{i^2} \int_0^j 1 dk dj di[/tex]

mrnutty commented: Cool +5
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Not stupid ... Just less informed than you

No, it's really a question of stupidity, because you'd have to have a seriously questionable understanding of what you can do with computation if you have to wonder whether programs could take input in other languages.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

-2 Rep lotrgandalf. Why are you talking about repping?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Just show that you can simulate a TM on a URM. That means a URM can run anything a TM can run, because it can just pass the input through the TM.

Then show that you can simulate a URM with a TM. This shows the same thing in the other direction.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Learn to code.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

So, Ax Ey P(x,y) would not be the same as Ey Ax P(x,y).

I don't understand why is that so and the lecture doesn't mention it much. Can anyone here explain why?

Read the sentences. "For all x, there exists y such that P(x,y)." "There exists y such that for all x, P(x,y)." They obviously have different meanings.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Go look at the generated assembly.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Two wrong answers, we have here.

Nick Evan commented: O god, you're right. I misread the original post :( +12
kvprajapati commented: N/A +9
Rashakil Fol 978 Super Senior Demiposter Team Colleague

So it's not reading from a string, it's just taking an sexpr?

Okay then.

Have parse-exp either return its input, unmodified, or report an error. Make sure it precisely checks for valid or invalid code.
Have unparse-exp just be (lambda (x) x) .
Write your own comprehensive test cases and see what your code gets wrong.

Edit: Right now your checks for correctness of the input are weak. For example, your code throws the wrong kind of exception for (lambda (()) 3) . You shouldn't be relying on your intermediate datastructure's guards at all, or if you decide to go that way, you should catch its exceptions and throw the right kind of exception.

Generally speaking you already seem to be at the point where you should write test cases and break your code. And make another pass at your code and reason rigorously about whether your code catches every edge case.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You can solve it in two balances for as many as nine balls.

As long as you have more more than two.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The inner loop should run sqrt(n) times. Is that the same as n^0.5 times?

Is the sqrt(n) the same as n^0.5? Are you really asking that? Okay, yes it is.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

How many times does it run through the inner loop?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I used INTERCAL because it's the most flexible general-use business language.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Actually C is mid-level language, not low-level.

You're arguing over the definition of a subjective term whose meaning is relative to one's yardstick. Oh, I'm sorry, you're not arguing, you're merely contradicting. It's all about the supremacy of your opinion over others' opinions, isn't it. Or what is it?

C is a low-level language. You are wrong and I am right. The end.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Of course they print nothing. That's not what the questions are asking, is it.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Hello all, my name is Corey, I am new to DaniWeb, and new to programming. I am very interested in software and java programming, to eventually make it into my profession. I am starting college in the Fall, and want to get a head start.

The best way to get a head start is to go to http://docs.python.org/tutorial/ and start programming.

My first question is: How is video game programming different from other types of programming? Are there certain elements of programming that I would need to learn that would not already be involved in regular programming courses at colleges?

Yes. Program some video games, and you'll find out what you need to learn. Generally speaking, programming is not something a class will teach you. It's not like you can go to a class and get taught how to program. You might go to a class, but you'll end up being the one teaching yourself how to code.

My second question is: Where should I get started? What language should I learn first, or are there multiple languages I should start with?

Okay, I just answered that above.

Good starting points in general for someone who wishes to become a software engineer.

Programming. The only way to get decent at programming is by doing it. The only way to get good is by doing it. Start now. Go to http://docs.python.org/tutorial/ and download Python and start programming.

Good literature for purchase on these …

Rashakil Fol 978 Super Senior Demiposter Team Colleague
4c4,5
<        x = x + M[i][i]
---
> 	for j in range(3):
> 		x = x + M[i][j]
4c4
< 	for j in range(3):
---
> 	for j in range(i):
6c6
< print x
---
> print x
\ No newline at end of file
4,6c4,5
< 	for j in range(i):
< 		x = x + M[i][j]
< print x
\ No newline at end of file
---
>        x = x + M[i][i]
> print x
Rashakil Fol 978 Super Senior Demiposter Team Colleague

>> This is complete nonsense. You can't say "O(log(n)) < f(n)".

Why not ? Why can't a function be bounded by another function.

Functions can be bounded by other functions, but there's no way to make sense of the notation you're using.

For starters, you never really defined what O(...) < f(n) means. You're just throwing notation around. It would be fine if the meaning of the notation could be inferred, but here it can't be. Does, in your example, the statement "O(log(n)) < f(n)" mean that f(n) is "not" O(log(n))? Or does it mean that f(n) is omega(log(n))? That's lowercase omega. Or does it mean that f(n) is not O(log(n)) and is Omega(log(n))? There's no natural way to interpret that notation. There is with "f(n) <= O(n)", though. It clearly means that f(n) is O(n), and can also be written "f(n) = O(n)". There's no other meaning it could have.

If you want to say that f(n) grows no faster than n and no slower than log(n), one way to say that would be to say, "f(n) is O(n) and Omega(log(n))." Another way _might_ be to say "Omega(log(n)) <= f(n) <= O(n)". You could also say "Theta(log(n)) <= f(n) <= Theta(n)" and that would be understandable, because there's no way to misinterpret that statement. To say something is "less than or equal to" a Theta notation expression can only imply the meaning of O notation. People usually don't say things like that, because it's gross, and because …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You are trying to measure BigO(), Big ) measures the growth rate of an algorithm. For example say there is a function f(n) , and that it follows the following inequality :

O( log(n) ) < f(n) < O(n)

the above inequality says that the function f(n) is bounded on top by
O(n), that means its worst performance is O(n). That O(n) is bigO(n).

This is complete nonsense. You can't say "O(log(n)) < f(n)". That doesn't make any sense. It only makes sense to say that functions are less than or equal to big O bloboids, such as the statement, "f(n) <= O(log(n))".

def is_bst(root):
    
    a = b = True
    
    if not(root.left or root.right):
        return True
    
    if root.left:
        a = root.left.data < root.data and is_bst(root.left)
        
    if root.right:
        b = root.right.data > root.data and is_bst(root.right)
        
    return a and b

This algorithm is incorrect, by the way.

Its respect to the number n. Which is the size of the function.

Wat. No it's not.

thanks, I understand big-O (I've seen it used in math), but I don't understand the actual analysis of "growth rate". What is the growth rate with respect to?

The running time of the function is described with respect to some measurement of the "size" of the input. Often the measurement is the number of elements in the data structure, or the amount of memory used, or something with multiple variables. For example, a function that counts the number of spaces in a string …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

How is this connection achieved?

On Unix systems, when you launch a program from a shell, the shell forks off a process and the process inherits the shell's open standard input and standard output streams. When you run a command like ./foo > outfile , the shell forks, opens the file for writing, moves its file descriptor to replace the standard output stream, and then executes foo. When you run a chain of commands separated by pipes, the shell creates the pipes and forks off the processes, in some order.

From the process's perspective, they're just (on Unix systems) the file descriptors numbered 0 and 1. Those file descriptors point to the standard input and standard output streams (I forget which is which, though). The file descriptors might, for example, be pipes that are listened to by a terminal emulator, which renders the data on the screen, or they might be channeling data to some other program launched on the same command line, or they might be file descriptors for open files. You can in fact, at least on Unix systems, alter what your standard input and standard output streams point to, in the middle of your program.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Another place might be classes that are completely internal to your library, like pure abstract classes.

So you're repeating what I just said.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Making variables non-private is only an issue for public APIs.