computer-science

How can some NP-Complete problems be also NP-Hard?

≯℡__Kan透↙ 提交于 2019-12-11 09:15:25
问题 I'm trying wrap my heard around P, NP, NP-Complete and NP-Hard in an intuitive way so that I don't have to remember their definitions. In the following image (the left hand scenario, P != NP), there's an overlapping area between NP-Complete and NP-Hard. Does it mean that some problems are both NP-Complete and NP-Hard? I find that contradictory, according to this particular answer: What are the differences between NP, NP-Complete and NP-Hard?. The table in the above link says an NP-Complete

Is a variable declaration the same as a variable's binding?

谁说我不能喝 提交于 2019-12-11 08:54:05
问题 MDN documentation states: let bindings are created at the top of the (block) scope containing the declaration, commonly referred to as "hoisting". Unlike variables declared with var, which will start with the value undefined, let variables are not initialized until their definition is evaluated. Accessing the variable before the initialization results in a ReferenceError. The variable is in a "temporal dead zone" from the start of the block until the initialization is processed. Is the " let

Artifcial Neural Networks for prediction

淺唱寂寞╮ 提交于 2019-12-11 04:39:19
问题 I have been looking at reasearch papers that attempt to predict stock price. I have noticed in these papers that the activation function is applied to the output using one of the following types of activation function. Unipolar sigmoid, Bipolar sigmoid, Tan hyperbolic, Radial basis function. My question If one of the above types of activation function is applied to the output then how can it be used to predict stock price i.e. a value like $103.56? Because most of these functions have min or

Implementing has-list in scheme

对着背影说爱祢 提交于 2019-12-11 04:14:27
问题 how can you implement a Scheme function has-list recursively, which tests whether a list contains other list as an element. For example (has-list '(1 2 3)) should return false, and (has-list '(1 2 (3 4) 5)) should return true. 回答1: If your implementation has something like ormap , then: (define (has-list? l) (ormap list? l)) Using or as in Dan D.'s answer will not work. 回答2: A list has a list as an element iff it is not the empty list and either its first element is a list or the rest of the

Finding curves in a dataset

妖精的绣舞 提交于 2019-12-11 03:46:47
问题 Let's say I have a dataset that contains x y values of a function such as sin(x) and a range. How do I detect the curves in this dataset (the peaks and troughs of the sin function in this)? 回答1: Given a set of (x,y) coordinates of sufficient size you can fit any kind of function you like to it, a sine function, a high- (or low-) degree polynomial, linear, exponential, splines, anything at all. Getting a good fit is the tricky part. You should really have an idea of the kind of function that

Py2Exe detected as virus. Alternatives?

孤街醉人 提交于 2019-12-11 01:11:09
问题 So, I created a python program. Converted to exe using Py2Exe, and tried with PyInstaller and cx_freeze as well. All these trigger the program to be detected as virus by avast, avg, and others on virustotal and on my local machine. I tried changing to a Hello World script to see if the problem is there but the results are exactly the same. My question is, what is triggering this detection? The way in which the .exe is created? If so, are there any other alternatives to Py2exe, Pyinstaller, cx

Writing on a separate lines in a text file

旧城冷巷雨未停 提交于 2019-12-11 00:26:48
问题 import random device = input("What device do you have? Phone or PC(laptop included). If other please specify ").upper() make = ("") model= ("") verison = ("") memory = ("") if device == ("PHONE"): make = input ("what make of phone do you have? Iphone or Samsung or other").upper() if make == ("IPHONE"): model == input("What model is your iPhone 6 or 7. If other plese spectify") if device != ("PHONE") or ("PHONE") or (""): make =input("what make is your " + str(device)).upper() model = input(

UTF-8 vs UTF-16 and UTF-32 conversion confusion

孤街浪徒 提交于 2019-12-11 00:21:50
问题 I'm kinda confused about conversion of unicode characters into hexadecimal values. I'm using this website to get hexadecimal value for characters. (https://www.branah.com/unicode-converter) If I put "A" and convert then I get something like: 0041 --> UTF-16 00000041 --> UTF-32 41 --> UTF-8 00065 --> Decimal Value This above output makes sense because we can convert all these hexadecimal values into 65. Now, If i put "Я" (without quotes) and convert it then I get values like. 042f --> UTF-16

What happens when I divide by zero?

夙愿已清 提交于 2019-12-10 21:02:01
问题 Now I'm not asking about the mathematical answer of dividing by zero, I want to what my computer does when it tries to divide by zero? I can see different answers depending on what level we look at? Looking at a high-level I expect the language specification may just say "hey you can't do that throw an error" Looking at an assembly level, will the CPU try to call the divide instruction when we try to divide by 0? If it does that'll take us to the machine code level. What happens now? Now if

How to find MAC address on Windows 7? [closed]

你离开我真会死。 提交于 2019-12-10 20:16:32
问题 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 5 years ago . i can find the MAC address of my machine with command ipconfig /all on command prompt. Everywhere on net says physical address is MAC address. Here is the result of command ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : XXXX Primary Dns Suffix . . . . . . . : XXXX Node Type . . . . .