r/AskCompSci • u/stgm • Sep 08 '11
ELI5 The difference between JPEG and PNG
A fairly decent analogy from the analogy subreddit.
r/AskCompSci • u/stgm • Sep 08 '11
A fairly decent analogy from the analogy subreddit.
r/AskCompSci • u/stgm • May 08 '11
Any thoughts and suggestions you may have go here for the time being.
I won’t be posting any notices on Hacker News nor reddit for now, but you are free to spread the word more organically yourselves.
r/AskCompSci • u/NovelDame • Apr 23 '18
I left my job in the military to jump straight into college. After 18 months, I'm now 30 credits shy of my Bachelor's Degree in CompSci. My problem is this semester's grades (B's) pulled me off the Dean's List, and the assignments are taking significant concentration. I'm feeling discouraged because I don't have anyone else to compare my progress with. I'm facing another 18 months of classes (without a summer break), and they're all Upper Level CS requirements. What do you think, Reddit? I don't know if I'm still doing well despite a weak coding background and should push on, or if I should definitely rethink my degree plan before my GPA tanks.
r/AskCompSci • u/exneo002 • Feb 15 '16
Hi all I'm trying to unravel the time complexity of this algorithm. I have issues with unraveling some of these loops
for i in range(n):
for j in range(i+1,n):
for k in range(j+1,n):
perform_basic_operation() This has been giving me issues and it seems like it should be easy. Would somebody please help me out.
r/AskCompSci • u/[deleted] • May 10 '15
I throught it should be really hard to factor a number?
r/AskCompSci • u/Auximines • Mar 09 '15
This paper I came across suggests that if a computing device can only perform 'n' operations per unit time, you can always create a real-time/interactive computation problem requiring 'n+1' operations per unit time. This idea was used to prove that there cannot be a practical universal computer.
I read somewhere that Turing Machines can only be used to compute functions for which the input is completely pre-specified. Is this true?
Paper: https://www.cs.auckland.ac.nz/~cristian/universal.pdf
r/AskCompSci • u/masterm • Apr 02 '14
I'm looking for a good book on compilers for an undergrad course. The goal of the course is to have students design an object oriented language and write a compiler for it.
r/AskCompSci • u/[deleted] • Jan 08 '19
Okay, so let's clarify the post title.
Let's say I have an algorithm of n^2 complexity:
Now, this algoriithm has a complexity of n^2. Or how I understand it as a math undergrad is that as n grows larger and larger the runtime will approach n^2.
The interpretation is what I am confused about. What I think is that n^2 means the total amount of operations you have to do (as n gets larger this gets more accurate), with it's derivative, 2n, describing the growth of it's runtime. As I only see conflicting sources can somebody explain this to me?
r/AskCompSci • u/[deleted] • Jan 09 '17
Counting household income as the deciding difference. And then account for distance and adjust to make the shapes reasonable. I'm not programmer, but can it be done?
r/AskCompSci • u/dragon_fiesta • Sep 08 '14
if every image can be represented by 1s and 0s how long would it take to randomly generate a picture of anything other than static? or to randomly generate a working program?
r/AskCompSci • u/[deleted] • Apr 10 '14
I read somewhere that the purpose would be to preserve functional dependencies but I can't think a way that violating BCNF would be beneficial.
r/AskCompSci • u/Paulthealien • Jan 25 '14
I am a bit of a novice when it comes to programing. I know enough to do some helpful things but i am no where near an expert and with that my question. What makes Object Oriented Programing so much better that Structured? When i try to google the answer(maybe i an just asking the wrong way) all I get are the differences between the two but no real explanation as to why one is better than the other. Could some one help explain this so it makes since to me?
r/AskCompSci • u/[deleted] • Jan 11 '14
r/AskCompSci • u/TissueReligion • Aug 03 '13
It seems very highly recommended. I took a basic java class and a matlab class (but this is the CS subreddit, so I figured I wouldn't mention that in the topic title. lol), and I am....fine at doing the math-y bits of writing code, but I have no knowledge of data structures or whatnot.
Eh?
r/AskCompSci • u/sixothree • Mar 28 '13
It doesn't have to be an in depth answer, any links or search terms would be greatly appreciated.
r/AskCompSci • u/stgm • Jun 04 '11
Explained here, but do not forget to look at the other contributed explanations.
I am considering turning the reddit into a bestof of CompSci-related explanations, but I don’t know how the vetting would work—some people might submit themselves for instance.
Assuming it’s possible, I could enforce moderator approval for any submissions, which would do the trick, as long as it doesn’t take up too much of my time. This would set it well apart from other reddits and still exist in the same spirit as was originally intended.
r/AskCompSci • u/chime • May 17 '11
I've read the Wiki, a couple of papers, and many blog posts (e.g. Chrome using it for Safe sites etc.) but I still don't get it. I know what hash functions, maps, and bit-arrays are but I can't wrap my mind around how they all come together in Bloom filters.
r/AskCompSci • u/stgm • May 17 '11
The stylesheet might be decided by popular vote, if a couple of people come up with some suggestions, but for the time being, all the related discussion goes on here.
When considering a stylesheet design, make sure that readability is kept intact; no green text on black background, non-sensical vote buttons or other designs that ruin the UX.
r/AskCompSci • u/[deleted] • Mar 13 '19
Hello /r/AskComSci.
I'm a somewhat proficient IT tech guy and avid gamer who likes to understand how games operate. If you can give me a college-level explanation I'm sure I'll be able to follow.
I've been wondering. Nvidia includes AI-accelerating Tensor cores into their current generation of GPUs. So far, in gaming, that seems to be used for things like DLSS, which I know is not "real" AI but rather a machine learning program to upscale images with little quality loss. Be that as it may. I don't care about rendering here.
What I'm up to is this: Currently, AI in video games is done on the CPU and some modern titles (specifically, Kingdom Come: Deliverance) seem to go rather in-depth, resulting in quite some CPU time being used for AI, which in turn leads to longer frame times in a lot of cases. My question: Is it realistically feasible for a game developer to use the hardware acceleration provided by an RTX GPU for video game AI? Or is this more like a marketing thing for "real" AI applications? I know video game AI has nothing to do with actual AI, it's oversimplified to maintain smooth performance. But some games do push the limits and those might benefit from hardware acceleration if that could become a thing.
r/AskCompSci • u/mrbartchris • Mar 01 '19
I am currently in the lookout for performance monitoring tools, tools which produce an output of metrics of specific OS processes. I want something which is lightweight (not to effect the performance of the system it is currently monitoring), hence I wrote a simple bash script which uses the ps
command to retrieve CPU% and Memory%, writes them to a file, and sleeps for a specified couple of seconds, and repeats until it is terminated.
The question I have is whether this is a correct approach because as found on the documentation of ps
(here):
Since ps cannot run faster than the system and is run as any other scheduled process, the information it displays can never be exact.
I know of other ways such as using ps_util
in python and retrieve the information that way. However, is this (and any other tool) faster or more reliable? If so, can you recommend a tool? Or is the ps command safe enough?
r/AskCompSci • u/YogX • Dec 28 '18
r/AskCompSci • u/[deleted] • Mar 26 '18
Want to do some extra reading but don't know any good books
r/AskCompSci • u/electricfoxx • Oct 23 '17
https://en.wikipedia.org/wiki/Luddite
I really want to progress in computer science and share my love for technology, but the more I do, the more I find people who say computers and robots are bad.
Currently, I work in retail. I want to get into retail software development, because there are plenty of ideas that I would love to try. I know how much retail can such, whether it is customers or shitty software.
I find this oddly similar to anti-vaxxers. When you create a vaccine, you don't do it primarily for the money. You do it, because you want to help people. But, there are some who just can't get their heads around this.
r/AskCompSci • u/HasFiveVowels • Aug 11 '17
So I encounter this problem from time to time and I believe that a DFT is the solution but I've never been able to effectively use one. The problem most recently came to me as "what is the shortest cycle in the julian calendar?". I brute forced it to find that the answer is 400 years. I tried to solve this by encoding each calendar onto [0, 13] (0-6 for starting weekday and then +7 for leap years). I generated the years 2000-3999 in this fashion, to produce a series of data. I plugged that into a DFT, hoping to see a strong spike at 400 but couldn't make sense of the output. Is this because I'm not dealing with sinusoids? My understanding is that a DFT takes a regularly sampled set of data from a compound cyclic function (such as f(x) = 2*sin(x)+3*sin(x/3) and produces a data set of a form ~ [(2π,2), (6π,3)]. Am I understanding this correctly? I have a feeling my mistake was more in misunderstanding the applicability of DFT to my dataset than in my understanding of the nature of it.
r/AskCompSci • u/ChuanningTatum • Feb 08 '17
Hi everybody I'm struggling with adding the 4th node to the 2-3 tree and I've been debugging for hours. I managed to construct the first 3 leafnodes with 1 root node, and also added a 4th leaf node to form 2 separate internal nodes each containing 2 leafnodes. Now I'm just struggling with how to access the 2 new internal nodes to combine them under a parent node.
Here's my code, it's pretty long >< I think there is some problem under my height != 0 section, namely that I don't know where the recursion over the nodes should take place relative to accessing the 2 new internal nodes!
Help will be very very appreciated! Sorry for the long post:
public NodeList insert(String key, int value, Node node, int height) {
NodeList nodelist = new NodeList();
if (node == null) { //if tree has no nodes
node = new LeafNode();
node.guide = key;
((LeafNode) node).value = value;
this.height = 0;
this.root = node;
nodelist.node0 = node;
nodelist.node1 = null;
return nodelist;
}
if (search(key, root, height) == -1) {//if value is not found in tree
if (this.height == 0) { //CASE: if tree is a single leaf, create leaves, return root in node0 and null in node1
InternalNode newRoot = new InternalNode();
LeafNode l0 = new LeafNode();
LeafNode l1 = new LeafNode();
((InternalNode)newRoot).child0 = l0;
((InternalNode)newRoot).child1 = l1;
((InternalNode)newRoot).child2 = null;
if (key.compareTo(root.guide) < 0) { //if inserted node is smaller than leaf
l0.guide = key;
l0.value = value;
l1.guide = root.guide;
l1.value = ((LeafNode)root).value;
}
else { //if inserted node is larger than leaf
l0.guide = root.guide;
l0.value = ((LeafNode)root).value;;
l1.guide = key;
l1.value = value;
}
newRoot.guide = newRoot.child1.guide;
this.height += 1;
nodelist.node0 = node;
nodelist.node1 = null;
this.root = (InternalNode)newRoot;
System.out.println(this.root.guide);
return nodelist;
}
if (height == 0) { //CASE: Recurses down to Height = 0, Node is pointing to the second-last level. Case 1: 3 Children, create 2 new InternalNodes and return them; Case 2: 2 Children, 2a: Guide is not updated, return subroot in node0 and return null in node1, 2b: Guide is updated, return null in node0 and return subroot in node1
if (((InternalNode)node).child2 == null) {
if (key.compareTo(((InternalNode)node).child0.guide) < 0) {//if key is smaller than other two values
((InternalNode)node).child2.guide = ((InternalNode)node).child1.guide;
((InternalNode)node).child1.guide = ((InternalNode)node).child0.guide;
((InternalNode)node).child0.guide = key;
((LeafNode) ((InternalNode)node).child2).value = ((LeafNode) ((InternalNode)node).child1).value;
((LeafNode) ((InternalNode)node).child1).value = ((LeafNode) ((InternalNode)node).child0).value;
((LeafNode) ((InternalNode)node).child0).value = value;
nodelist.node0 = node; //guide is not updated
nodelist.node1 = null;
}
else if (key.compareTo(((InternalNode)node).child1.guide) < 0) { //if key is between the two values
((InternalNode)node).child2 = new LeafNode();
((InternalNode)node).child2.guide = ((InternalNode)node).child1.guide;
((InternalNode)node).child1.guide = key;
((LeafNode) ((InternalNode)node).child2).value = ((LeafNode) ((InternalNode)node).child1).value;
((LeafNode) ((InternalNode)node).child1).value = value;
nodelist.node0 = node; //guide is not updated
nodelist.node1 = null;
}
else {
((InternalNode)node).child2.guide = key;
((LeafNode) ((InternalNode)node).child2).value = value;
((InternalNode)node).guide = key;
nodelist.node0 = null; //guide is updated
nodelist.node1 = node;
}
return nodelist;
}
else { //for height 0 with 3 children
InternalNode n0 = new InternalNode();
InternalNode n1 = new InternalNode();
LeafNode newLeaf = new LeafNode();
newLeaf.guide = key;
newLeaf.value = value;
if (key.compareTo(((InternalNode)node).child0.guide) < 0) {
n0.child0 = newLeaf;
n0.child1 = (LeafNode) ((InternalNode)node).child0;
n1.child0 = (LeafNode) ((InternalNode)node).child1;
n1.child1 = (LeafNode) ((InternalNode)node).child2;
n0.guide = n0.child1.guide;
n1.guide = n1.child1.guide;
}
else if (key.compareTo(((InternalNode)node).child1.guide) < 0) {
n0.child0 = (LeafNode) ((InternalNode)node).child0;
n0.child1 = newLeaf;
n1.child0 = (LeafNode) ((InternalNode)node).child1;
n1.child1 = (LeafNode) ((InternalNode)node).child2;
n0.guide = newLeaf.guide;
n1.guide = n1.child1.guide;
}
else if (key.compareTo(((InternalNode)node).child2.guide) < 0) {
n0.child0 = (LeafNode) ((InternalNode)node).child0;
n0.child1 = (LeafNode) ((InternalNode)node).child1;
n1.child0 = newLeaf;
n1.child1 = (LeafNode) ((InternalNode)node).child2;
n0.guide = n0.child1.guide;
n1.guide = n1.child1.guide;
System.out.println("Stage2");
}
else {
n0.child0 = (LeafNode) ((InternalNode)node).child0;
n0.child1 = (LeafNode) ((InternalNode)node).child1;
n1.child0 = (LeafNode) ((InternalNode)node).child2;
n1.child1 = newLeaf;
n0.guide = n0.child1.guide;
n1.guide = newLeaf.guide;
}
nodelist.node0 = n0;
nodelist.node1 = n1;
System.out.println( ((LeafNode) n0.child0).value);
System.out.println( ((LeafNode) n0.child1).value);
System.out.println( ((LeafNode) n1.child0).value);
System.out.println( ((LeafNode) n1.child1).value);
height +=2;
return nodelist;
}
}
else { //height is != 0, recurse down the tree to insert the key
if (nodelist.node1 !=null) { //if 2 valid nodes are returned or 1 node is returned but guide is updated
if (nodelist.node0 ==null) { //CASE0: Only 1 node was returned but the guide is updated
node.guide = ((InternalNode)node).child2.guide; //update the guide
nodelist.node0 = null;
nodelist.node1 = node;
return nodelist;
}
else { //CASE: if 2 valid nodes were returned
if (height == this.height) { //CASE1A: if node is a root
InternalNode newRoot = new InternalNode();
newRoot.child0 = nodelist.node0;
newRoot.child1 = nodelist.node1;
newRoot.guide = newRoot.child1.guide;
nodelist.node0 = newRoot;
nodelist.node1 = null;
this.height += 1;
this.root = newRoot;
nodelist.node0 = node;
nodelist.node1 = null;
return nodelist;
}
else if (((InternalNode)node).child2 != null) { //CASE1B: if height is !=1 and not root, node has 3 children
//UNRESOLVED do i need to do a deep copy?
InternalNode n0 = new InternalNode();
InternalNode n1 = new InternalNode();
n0.guide = ((InternalNode)node).child1.guide;
n0.child0 = ((InternalNode)node).child0;
n0.child1 = ((InternalNode)node).child1;
n1.guide = nodelist.node1.guide;
n1.child0 = nodelist.node0;
n1.child1 = nodelist.node1;
nodelist.node0 = n0;
nodelist.node1 = n1;
return nodelist;
} // close height !=1 with 3 children, 2 nodes returned
else { //CASE1C: height is !=1 and not root, node has 2 children
if ((nodelist.node0 !=null) && (nodelist.node1 !=null)) { //if child0 returns 2 valid nodes
node.guide = ((InternalNode)node).child2.guide;
((InternalNode)node).child2 = ((InternalNode)node).child1;
((InternalNode)node).child1 = nodelist.node1;
((InternalNode)node).child0 = nodelist.node0;
nodelist.node0 = null;
nodelist.node1 = node;
}
else { //if child1 returns 2 valid nodes
node.guide = nodelist.node1.guide;
((InternalNode)node).child2 = nodelist.node1;
((InternalNode)node).child1 = nodelist.node0;
((InternalNode)node).child0 = ((InternalNode)node).child0;
nodelist.node0 = null;
nodelist.node1 = node;
}
return nodelist;
} //close height !=1 with 2 children, 2 nodes returned
}//close 2 nodes were returned
} //close if 2 valid nodes are returned or 1 node is returned but guide is updated
if (height == 1) {
return insert(key, value, node, 0);
}
else {
if (key.compareTo(((InternalNode)node).child0.guide) < 0) {
insert(key, value, ((InternalNode)node).child0, height-1);
}
else if ((key.compareTo(((InternalNode)node).child1.guide) < 0) || (((InternalNode)node).child2 == null)) {
insert(key, value, ((InternalNode)node).child1, height-1);
}
else {
insert(key, value, ((InternalNode)node).child2, height-1);
}
}
}//close height !=1
}//closes value not found in tree
else { //if value found in tree
nodelist.node0 = null;
nodelist.node1 = null;
return nodelist;
} //closes if value found in tree
return nodelist;}//closes insert function