computer-science

Differences between User and Kernel modes

What are the differences between User Mode and Kernel Mode, and why & how do you activate either (use cases?). ...

What are different storages available/used to/by a program during execution time?

Typically when you run any program, during execution time what are different storages available to it and what are they used for? I understand stack and heap. Also, I know that value types go in stack whereas ref types go in heap. But, I have also come across terms like program counter, instruction pointer. What do they mean? BOUNTY: T...

Pumping lemma for CFLs

This isn't a programming question, but I don't know of any good places on the Internets to ask computer science questions. Sorry if this is too off-topic. I'm reviewing some old CS material and I'm stuck on the following: Let L = { x in {a,b}* | x has an equal number of a's and b's} I know this is a context free language because I ca...

Which Computer Science Concept Do you Value the Most?

For some reason, I notice that I end up using a lot of finite state machines at work. In particular, when I'm implementing a custom TCP/serial protocol, they are very helpful and produce a very robust output (in my opinion). My days in CS classes are long behind me. As such my recollection of the stuff I learned there is fuzzy. I was...

How do you "get it" when it comes to proofs?

When we start getting into algorithm design and more discrete computer science topics, we end up having to prove things all of the time. Every time I've seen somebody ask how to become really good at proofs, the common (and possibly lazy) answer is "practice". Practicing is all fine if you have the basics down, but how do you get into ...

Emerging areas in Computer Science

Hi guys, probably in other countries things are like here in Brazil, and in the end of the college degree in Computer Science you have to develop, document and present a final project in some area. I'm just about to finish the course and I haven't started the project yet, well, I did it a lot of times but I wouldn't decide about what to ...

How to determine the height of a recursion tree from a recurrence relation?

How does one go about determining the height of a recursion tree, built when dealing with recurrence run-times? How does it differ from determining the height of a regular tree? edit: sorry, i meant to add how to get the height of the recursion tree from the recurrence relation. ...

Can someone explain how Big-Oh works with Summations?

I know this isn't strictly a programming question, but it is a computer science question so I'm hoping someone can help me. I've been working on my Algorithms homework and figuring out the Big-Oh, Big-Omega, Theta, etc, of several algorithms. I'm proving them by finding their C and N0 values and all is going well. However, I've come a...

Is it possible to construct a turing-complete language in which every string is a correct program?

Is it possible to construct a turing-complete language in which every string is a correct program? Any examples? Even better, any real-world examples? Precisions: by "correct" I mean "compiles", although "runs without error" and "runs without error, and finishes in finite time" would be interesting questions too :) By string I mean an...

What is a "set" in C++? When are they useful?

I'm having a hard time conceptualizing c++ sets, actually sets in general. What are they? How are they useful? ...

Why can I "fold" a range of integers into one half the size without losing information?

I'm trying to understand a paper on lossless compression of floating point numbers and get stuck on one particular step where the authors map a signed integer from a certain range into a range of half the size, losing information that I would think is required. I have a feeling that the authors are using some standard technique which is ...

Industrial partitioning problem

We're talking about metal products factory. There is machine which cuts long iron bars to smaller parts which are later used for creating various products. For example, I have requirement to produce bars of following length and quantity: 2 pieces of 248mm, 5 of 1150mm, 6 of 2843mm, 3 of 3621mm. That is the partitioning output. O...

How much math do you use as a computer scientist?

I am sure many developers here -- at least the ones who were formally trained -- took a fair amount of math courses in the university. Some minored in mathematics. The curriculum usually included Calculus (level 1, 2 and 3), linear algebra, probability/statistics. As a computer scientist, I have barely used any math whatsoever in the la...

Most efficient way to encode 2 positions between 0 and 64?

I have 64 bit values that I want to compress by exploiting the fact that only a portion somewhere in the middle contains data and before and after that are zeroes. Say the actual data is l bits long and padded with n 0s in front and m 0s at the end such that n + l + m = 64. Instead of transmitting / storing 64 bits, I can transmit l bit...

How to become computer scientist Online?

I think I am good at programming, so will call myself computer engineer in the sense that to solve a problem I do find good solutions but I wouldn't say I have deep knowledge of computer science as such, which I do want to learn, but I do not want to buy any book a) they are heavy b) they are costly So what online resources you think I ...

How can I write a program to generate a sorting decision tree?

In class we were given a simple decision tree for sorting 3 elements (a,b,c). While looking at this, it makes sense to me. I was able to follow it. However, I now have to make a decision tree for 4 elements (a,b,c,d) and the number of leafs just shot up to 24. I'm struggling approaching the decision tree in a methodical way that h...

How does one make a Zip bomb?

This question about zip bombs naturally led me to the Wikipedia page on the topic. The article mentions an example of a 45.1 kb zip file that decompresses to 1.3 exabytes. What are the principles/techniques that would be used to create such a file in the first place? I don't want to actually do this, more interested in a simplified "how...

Should I get a math degree or a CS degree?

I'm 18 years old and going to community college. I got an A+ in my data structures class, but the biggest thing I've ever programmed on my own was a tool to solve a 3d maze toy of my brother's. I'm a little worried that I don't have enough passion for programming to succeed in it. Majoring in math would give me time to try out open so...

What are the most valuable parts of Computer Science studies for Cocoa developers?

What are the most valuable parts of Computer Science studies for Cocoa developers? Another way I might word this question is: If I’m not going to go to school for Computer Science but want to be a developer working primarily with Cocoa, what are the things I should make sure I learn that I otherwise might miss by being self-taught, an...

Core principles, rules, and habits for CS students

No doubt there is a lot to read on blogs, in books, and on Stack Overflow, but can we identify some guidelines for CS students to use while studying? For me these are: Finish your course books early and read 4-5 times more material relative to your course work. Programming is the one of the fastest evolving professions. Follow the bl...