computer-science

Why do Computers use Hex Number System at assembly language?

醉酒当歌 提交于 2019-12-30 07:51:13
问题 Why do computer use Hex Number System at assembly language? Why don't they use any other number system like binary, octal, decimal? What thing forced computer designer to use hex system at assembly? Why it looked so beneficial to them? 回答1: Well it doesn't make a difference how you represent them but as we know that humans don't understand binary numbers, they are only to make the computer's life easier as it works on only two states true and false. So in order to make binary numbers

Can call-with-current-continuation be implemented only with lambdas and closures?

我们两清 提交于 2019-12-30 00:32:22
问题 Does anyone know if call/cc can be implemented with just lambdas and closures? It seems that call/cc interrupts the program's flow (like an exception) but lambdas and closures can't do that. Therefore I think call/cc can't be implemented via lambdas and closures. Any more ideas? 回答1: The question is not particularly clear, since what exactly does "implemented with just lambdas and closures" mean? In any case, continuations can be used in any language with closures by manually writing in

the significance of java RMI please? [closed]

不羁岁月 提交于 2019-12-29 05:46:49
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Why do people use RMI, or when should I use RMI? I read those tutorials about RMI on oracle's website.But it doesn't provides enough

Is there a difference between foreach and map?

最后都变了- 提交于 2019-12-27 12:11:38
问题 Ok this is more of a computer science question, than a question based on a particular language, but is there a difference between a map operation and a foreach operation? Or are they simply different names for the same thing? 回答1: Different. foreach iterates over a list and applies some operation with side effects to each list member (such as saving each one to the database for example) map iterates over a list, transforms each member of that list, and returns another list of the same size

Is there a difference between foreach and map?

醉酒当歌 提交于 2019-12-27 12:11:08
问题 Ok this is more of a computer science question, than a question based on a particular language, but is there a difference between a map operation and a foreach operation? Or are they simply different names for the same thing? 回答1: Different. foreach iterates over a list and applies some operation with side effects to each list member (such as saving each one to the database for example) map iterates over a list, transforms each member of that list, and returns another list of the same size

What are the total number of possible ordered trees with N nodes?

强颜欢笑 提交于 2019-12-25 05:27:05
问题 For example for N=3, we can find easily by listing them all, but when asked for any arbitrary N value I am facing problem. 回答1: If you are looking at binary trees then, as mcdowella said, Choose(2n,n)/(n+1) (Catalan number) is the answer. If you are looking at arbitrary trees then it is probably n. n^(n-2) = n^(n-1), but I am not totally sure. Prufer's algo tells us that there are n^(n-2) labeled trees and any of the nodes can be made a root, thus we get the number n^(n-1). 回答2: This is

work out f(n), the exact number of unit-time operations each procedure requires as a function of the input size n

ε祈祈猫儿з 提交于 2019-12-25 02:52:35
问题 I have these 2 questions - I believe one was posted earlier - but was unanswered. I think I have answered 2nd one correctly ... Any suggestions ? work out f(n), the exact number of unit-time operations each procedure requires as a function of the input size n (i) for i<-1 to n do for j<-1 to 2n-i do //a unit cost operation ------------------------------ (i) this is i the one i need some help on. (ii) for i <-1 to n do for j <- 2 to (n+i) do // a unit cost operation for i: 1 to n do: for j: 2

How to prove the evenly partition is the best case for quick sort algorithm?

泪湿孤枕 提交于 2019-12-25 00:52:56
问题 Why we say the bestcase for quicksort is that "each time we perform a partition we divide the list into two nearly equal pieces"? And how to prove this is exactly the so called "best case"? 回答1: Take array of length 2^N (for simplicity). Compare number of operations for the case of perfect partitions at every stage ( N into N/2+N/2 ) and for the case of division of segment length N into 1 and N-1 回答2: I created a program rather than trying to do an analysis. I compared the case of 1/2, 1/2

Big-O notation of T(sqrtn) + 5

自古美人都是妖i 提交于 2019-12-24 20:29:21
问题 I face a question: T(N) = T(sqrt(N)) + 5. I am wondering can I solve it in this way? T(N) = O(sqrt(N)) + O(5) Since O(5) = O(1) is a constant, we can ignore it. So the big O notation of T(N) is O(N^(1/2)) . Or can I just say its notation is O(N) as there is no big difference between O(N) and O(sqrt(N)). Thank you! 回答1: Edit: I made a mistake in the original answer, assuming that n is a power of 2 and reducing the recurrence to 1, 2, 4, ... n, which is wrong. I apologize for the misleading.

MIPS jump instruction delay slot

一曲冷凌霜 提交于 2019-12-24 20:27:01
问题 I found in the net something about jump instruction (j, jr, jal): Always use a delay slot (A noop on the next offset) when using Jump commands Is it correct? I can't understand why should i use noop after jump. Source 来源: https://stackoverflow.com/questions/47423368/mips-jump-instruction-delay-slot