1,474 Answered Questions for the topic computer programming
Computer Programming Web Design
05/26/19
What are the responsibilities of a web developer?
How to determine whether a language is LL(1) LR(0) SLR(1)?
Is there a simple way to determine whether a grammar is LL(1), LR(0), SLR(1)... just from looking on the grammar without doing any complex analysis? For instance: To decide whether a BNF Grammar is...
more
05/25/19
Why is number of bits always a power of two?
We have 8-bit, 16-bit, 32-bit and 64-bit hardware architectures and operating systems. But not, say, 42-bit or 69-bit ones.Why? Is it something fundamental that makes 2^n bits a better choice, or...
more
05/24/19
What's "P=NP?", and why is it such a famous question?
The question of whether P=NP is perhaps the most famous in all of Computer Science. What does it mean? And why is it so interesting?
Comparing two Calendar objects?
I want to compare two Calendar objects to see if they both contain the same date. I don't care about any value below days.I've implemented this and I can't think about any case where it should...
more
Calling base class overridden function from base class method?
public class A { public void f1(String str) { System.out.println("A.f1(String)"); this.f1(1, str); } public void f1(int i, String str) { ...
more
How would you access Object properties from within an object method?
What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method?I know that from outside of the object you should use a...
more
05/24/19
Efficiently finding the intersection of a variable number of sets of strings?
I have a variable number of ArrayList<String>'s that I need to find the intersection of. A realistic cap on the number of sets of strings is probably around 35 but could be more. I don't want...
more
The consequences and pros/cons of flushing the stream in c++?
I have recently read an article which stated that using `\ ` is preferable to using `std::endl` because `endl` also flushes the stream. But when I looked for a bit more information on the topic I...
more
05/24/19
What is fuzzy logic?
I'm working with a couple of AI algorithms at school and I find people use the words Fuzzy Logic to explain any situation that they can solve with a couple of cases. When I go back to the books I...
more
How to write a simple database engine?
I am interested in learning how a database engine works (i.e. the internals of it). I know most of the basic data structures taught in CS (trees, hash tables, lists, etc.) as well as a pretty good...
more
The shortest path between two integers by adding or subtracting?
You are given two integers a and b. You want to find the shortest sequence of operations necessary to transform a into b, where at each step you are allowed to add or subtract 5, 7, or 12. For...
more
The recognizing power of "modern" regexes?
What class of languages do real modern regexes actually recognise?Whenever there is an unbounded length capturing group with a back-reference (e.g. `(.*)_\\1`) a regex is now matching a non-regular...
more
05/24/19
Why is (a | b ) equivalent to a - (a & b) + b?
I was looking for a way to do a BITOR() with an Oracle database and came across a suggestion to just use BITAND() instead, replacing BITOR(a,b) with a + b - BITAND(a,b).I tested it by hand a few...
more
Computer Programming
05/20/19
shift bits or other way to reverse equation
(A * 4) + (B * 32) + (C * 128) + (D * 2048) = 2252how to reverse this equation and get the values of A, B, C and D? please help, i've been thinking for days.. thanks in advance.
Computer Programming
05/13/19
What Is Tail Call Optimization?
Very simply, what is tail-call optimization? More specifically, Can anyone show some small code snippets where it could be applied, and where not, with an explanation of why?
Computer Programming
05/13/19
Generate all unique substrings for given string?
Given a string `s`, what is the fastest method to generate a set of all its unique substrings? Example: for `str = "aba"` we would get `substrs={"a", "b", "ab", "ba", "aba"}`.The naive algorithm...
more
05/12/19
Write a program to implement the DBSCAN algorithm using python. Graphically visualise the cluster outputs with each cluster points given in different colours.
The input will be a chameleon data set. And also check the quality measure using Homogenity and seperation
Computer Programming
05/08/19
What is a lambda (function)?
For a person without a comp-sci background, what is a lambda in the world of Computer Science?
Computer Programming
05/06/19
Choice of programming language for learning data structures and algorithms?
Which programming language would you recommend to learn about data structures and algorithms? There are some books out there that are programming language-agnostic (written from a Mathematical...
more
Computer Programming
05/05/19
Why should hash functions use a prime number modulus?
A long time ago, I bought a data structures book off the bargain table for $1.25. In it, the explanation for a hashing function said that it should ultimately mod by a prime number because of "the...
more
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.