computer-science

What symbols are used after base 36

南楼画角 提交于 2019-12-04 23:49:27
Since Hex (base 16) uses 0-9A-F, and (I'm assuming here) Base 17 uses 0-9A-G and so on. What symbols are used once 0-9A-Z are all used up. There is no standard answer for your question. "Base 36" is coincidentally convenient to talk about because: Hexadecimal conventionally uses 0-9a-f, so it's "obvious" to keep going through the alphabet. The Roman/ASCII alphabet runs out of steam at 'z'. Base 36 (regardless of how you represent it) is mildly interesting from a Mathematical perspective because 36 has so many divisors. However, there's no universally-accepted convention for what sequence of

Looking for languages that are not Turing complete

吃可爱长大的小学妹 提交于 2019-12-04 20:39:13
问题 I know a little about what is a turing-machine and a turing-complete language, but to understand better, could someone give examples of languages that are not Turing complete? (maybe even machines that are not Turing, as well?) 回答1: Regular expressions, in the formal definition, consisting only of: concatenation ( ab ) unbounded repetition ( a* ) alternation ( a|b ) grouping ( (ab)|(cd) ) can only recognise regular languages. A Turing-complete programming language can recognise recursively

Algorithm for deleting one element in an single linked list with O(1) complexity

余生颓废 提交于 2019-12-04 20:23:06
问题 I'm a student of computer science in Germany. My professor gave use the following question to think about: 'Given a reference to a node in a single linked list (which is not the last node). Give an algorithm to delete this element from the list which has O(1) complexity while maintaining the integrity'. I thought about this, but I'm pretty sure, that there is no such algorithm. since it is a single linked list, you must loop through every node in the list until you reach the node which should

Create a java program to solve quadratic equations

二次信任 提交于 2019-12-04 19:14:32
This question was migrated from Mathematics Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . Solving a quadratic equation I have the following written down so far. I am not sure on how to introduce the second method public static void main(string args[]){ } public static double quadraticEquationRoot1(int a, int b, int c) (){ } if(Math.sqrt(Math.pow(b, 2) - 4*a*c) == 0) { return -b/(2*a); } else { int root1, root2; root1 = (-b + Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a); root2 = (-b - Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a); return Math.max(root1, root2);

Given a set S, find all the maximal subsets whose sum <= k

情到浓时终转凉″ 提交于 2019-12-04 19:01:46
问题 This is a Facebook interview question I came across at an online portal. Given a set S, find all the maximal subsets whose sum <= k. For example, if S = {1, 2, 3, 4, 5} and k = 7 Output is: {1, 2, 3} {1, 2, 4} {1, 5} {2, 5} {3, 4} Hints: Output doesn't contain any set which is a subset of other. If X = {1, 2, 3} is one of the solution then all the subsets of X {1} {2} {3} {1, 2} {1, 3} {2, 3} are omitted. Lexicographic ordering may be used to solve it. Any ideas how could this be solved? 回答1:

Recursive Sets vs Recursive Functions

北慕城南 提交于 2019-12-04 17:16:05
What s the difference between a recursive set and recursive function? Josef Grahn Recursive functions and recursive sets are terms used in computability theory. Wikipedia defines them as follows: A set of natural numbers is said to be a computable set (also called a decidable, recursive, or Turing computable set) if there is a Turing machine that, given a number n, halts with output 1 if n is in the set and halts with output 0 if n is not in the set. A function f from the natural numbers to themselves is a recursive or (Turing) computable function if there is a Turing machine that, on input n,

Minimum repetitions in merged array of characters

时间秒杀一切 提交于 2019-12-04 16:56:09
Suppose I have two arrays and I want to merge them so that the merged array has the minimum amount of repetitions . For example [ 'x', 'x' ] is a repetition. arr1 = [ 'x', 'd', 'd', 'm', 'f', 'm' ] arr2 = [ 'd', 'd', 'x', 'f', 'f', 'm' ] The only condition is that in the merged array, the elements from arr1 and arr2 must appear in their respective orders within arr1 and arr2 . Below is an example of the merged array with 0 repetitions while maintaining this condition. merged = [ 'd', 'x', 'd', 'x', 'd', 'f', 'd', 'm', 'f', 'm', 'f', 'm' ] I'm trying to relate this problem to popular dynamic

What are strongly connected components used for?

 ̄綄美尐妖づ 提交于 2019-12-04 16:16:27
问题 I have found several algorithms that explain how to find strongly connected components in a directed graph, but none explain why you would want to do this. What are some applications of strongly connected components? 回答1: You should check out Tim Roughgarden's Introduction to Algorithms course on Coursera. For every algorithm he goes over, he explains some applications of it. Very useful, and makes one see the value of studying algorithms! The use of strongly connected components that I

What is the difference between monotonicity and the admissibility of a heuristic?

做~自己de王妃 提交于 2019-12-04 15:50:51
问题 I'm reading over my AI textbook and I'm curious about what the difference is between monotonicity and admissibility of heuristics (I know they aren't mutually exclusive). As far as I can tell, an admissible heuristic simply means you are ensured to get the shortest path to a solution if one exists. What I'm struggling with is the concept of the monotonic property. Can someone describe this to me in a way I might understand? Similarly, how can I determine if a given heuristic is monotonic

Reason for end around carry to do [closed]

拈花ヽ惹草 提交于 2019-12-04 15:24:15
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I know that the r-1 complement for r-base number should do end around carry if the highest bit has carry. But I cannot figure out why it should do it. I merely can think about it is the reason may be about the two representations for zero. ex: 1 1 1 0 (-1) 0 1 0 1 (+5) =============== 10 0 1 1 =====>(0 1 0 0) I just can explain it from the result that because its sum is positive, and 1's complement has two