r/computerscience • • Oct 03 '19

Help Please explain this gate to me... Help. Thanks.

Post image
169 Upvotes

r/computerscience • • Dec 28 '21

Advice Rules of Programming

168 Upvotes

Rob Pike's 5 Rules of Programming

#Rule 1.

*You can't tell where a program is going to spend its time.

Bottlenecks occur in surprising places, so don't try to second guess and

put in a speed hack until you've proven that's where the bottleneck is.*

#Rule 2.

*Measure. Don't tune for speed until you've measured, and even

then don't unless one part of the code overwhelms the rest.*

#Rule 3.

*Fancy algorithms are slow when n is small, and n is

usually small. Fancy algorithms have big constants. Until you know

that n is frequently going to be big, don't get fancy. (Even if n

does get big, use Rule 2 first.)*

#Rule 4.

*Fancy algorithms are buggier than simple ones, and

they're much harder to implement. Use simple algorithms as

well as simple data structures.*

#Rule 5.

*Data dominates. If you've chosen the right data

structures and organized things well, the algorithms will

almost always be self-evident. Data structures, not

algorithms, are central to programming.*

*Pike's rules 1 and 2 restate Tony Hoare's famous maxim

"Premature optimization is the root of all evil." Ken

Thompson rephrased Pike's rules 3 and 4 as "When in doubt,

use brute force.". Rules 3 and 4 are instances of the

design philosophy KISS. Rule 5 was previously stated by

Fred Brooks in The Mythical Man-Month. Rule 5 is often

shortened to "write stupid code that uses smart objects".*


r/computerscience • • Mar 13 '21

Article Scientists unlock mysteries of world's oldest 'computer'

Thumbnail
bbc.co.uk
168 Upvotes

r/computerscience • • Nov 24 '19

Is C++ still worth it in 2019/2020?

168 Upvotes

Hello! I am using C++ for 5 years now. I use it to build everything that I need - games, desktop and mobile applications, web applications, etc. I have coded in other languages as well, but I see that C++ is getting old and unused(from my perspective). What is your opinion? Should I stick to C++ or move on to another language?


r/computerscience • • Nov 18 '19

How do programming languages work in different "people" languages?

168 Upvotes

I've been doing code for some time now, and I just recently got back into learning Spanish. At some point, I realized how incredibly difficult it would be to code C++ the way I do if I didn't speak English as a native language. Does each programming language have its own human-language variant?


r/computerscience • • Nov 28 '24

How is it possible for one person to create a complex system like Bitcoin?

167 Upvotes

I’ve always wondered how it was possible for Satoshi Nakamoto, the creator of Bitcoin, to develop such a complex system like Bitcoin on their own.

Bitcoin involves a combination of cryptography, distributed systems, economic incentives, peer-to-peer networking, consensus algorithms (like Proof of Work), and blockchain technology—not to mention advanced topics like hashing, digital signatures, and public-key cryptography. Given how intricate the system is, how could one individual be responsible for designing and implementing all of these different components?

I have a background in computer science and I’m an experienced developer, but I find the learning curve of understanding blockchain and Bitcoin's design to be quite complex. The ideas of decentralization, immutability, and the creation of a secure, distributed ledger are concepts I find fascinating, but also hard to wrap my head around when it comes to implementation. Was Satoshi working alone from the start, or were there contributions from others along the way? What prior knowledge and skills would one person need to be able to pull something like this off?

I’d appreciate any insights from those with deeper experience in the space, particularly in areas like cryptographic techniques, distributed consensus, and economic models behind cryptocurrencies.

Thanks!


r/computerscience • • Jul 01 '21

Version 2 of my GPT-3 powered resume writer! Still makes tailored resumes easily, but now writes in bullet points and doesn't use pronouns

Thumbnail
gfycat.com
167 Upvotes

r/computerscience • • Feb 11 '21

Advice Where to begin learning Computer Science by yourself?

167 Upvotes

I want use the time I have at home to start learning Computer science but I do not know where to start. What topic do you guys think would be a good place to start?


r/computerscience • • Apr 02 '20

Hey guys! So I'm a newbie to C language and I've some doubts. I've to make a program where I make a right sided pyramid like the one shown in the picture and the height needs to be between one and eight (inclusive). I've only written just a bit of code and now I'm confused what I should do next.

Post image
167 Upvotes

r/computerscience • • Jul 17 '19

General Why do Computer Science students seem so unfocused in class

167 Upvotes

I am a Senior CS major at a fairly large university (Approx 35k students) and In my upper-level CS classes 300-400 level it seems like my fellow classmates including myself just never listen to what the professors are saying. Do any other CS students notice this also? What is the reasoning that no one seems to be listening to material that seems fairly important?


r/computerscience • • Jan 01 '25

Discussion 365-in-1 exact cover problem puzzle

Thumbnail
gallery
166 Upvotes

I was given this puzzle which kind of fascinates me as this is a 365 in 1 exact cover problem ! I am wondering how the author (who is no mathematician and no computer scientist) could have come up with it.


r/computerscience • • Feb 28 '22

Did anyone else struggle with the calculus part of their computer science degree?

166 Upvotes

I am in my second semester of computer science and i pass every class easily and i love the programming classes but these calculus classes are killing me. I'm resorting to rewatching all my recorded lectures and re-doing all the problems to make sure i get it. Just finished my first exam and got a 65% which really had me in a bad mood for a few days. There's no way i'm going to give up because i know for sure this is what i want to do, but i just get frustrated with the difficulty of the advanced math sometimes because i know i will probably never use most of it in the course of a job as a developer/programmer. Yes i understand it's good for learning to problem solve and yes i understand that I may end up programming things like video games/ robotics that DO need some advanced mathematics. I am just not happy with how esoteric it all feels because I can't see how any of the mathematics is applied to the real world. It's like learning things in a vaccum. That's why i did great in physics in high school but struggle with calculus now. I need practical examples of problem solving to really solidify my knowledge of something. Anyone else feel disdain for the calculus during their degree?


r/computerscience • • May 10 '19

Any other CS students have no problem actually writing code, but struggle with tracing code, answering logic based questions, or really just paper and pencil CS exams in general?

166 Upvotes

r/computerscience • • Sep 04 '26

In the beginning, there was SMTP

Post image
165 Upvotes

And finally, I've decided to write about good ole SMTP., also known as Simple Mail Transfer Protocol.

Twas the night before... some night in November 1981 (I couldn't find the exact date), Jonathan Postel published RFC 788 while working at the U niversity of Southern California’s Information Sciences Institute. And what was RFC 788? Titled "Simple Mail Transfer Protocol", it was the first round of rules and specification laid out for computers to follow when sending emails from one mail server to another.

Unlike my dive into FTP, I was able to find a more accurate date for the birth of our modern day SMTP. In August 1982, Jon Postel (again) published a revised and updated Simple Mail Transfer Protocol in the well known RFC 821. So, some could argue that the creation of (our modern day) SMTP was in 1982, though, I would argue that it was in 1981, and was improved upon.

Now, about Mr. Jon Postel... it turns out he was quite influential amoung network researchers and helped develop, define, and document many internet tools and techs. Like enough that I should do a seperate article just about him and his career. (Maybe? let me know) Some of those include: SMTP, TCP/IP, RFCs, IANA, and more. The man was busy.

In regards to SMTP, he was 38/39 years old when he published RFC 788/821 and worked as a research scientist at USC's Information Sciences Institute. He was working on ARPANET/Internet protocols and serving as a central figure in the RFC process. When I was reading about this, I also saw the name Paul Mockapetris, who was also at ISI around this time, and later on developed the first SMTP email server there before going on to invent DNS. (DNS would be a cool one to write about also).

Let's end today by answering the simple question... why was SMTP created? Well, before SMTP, emails already existed. And different systems could already handle the mail in different ways, but there was no standard set of rules. And like literally everything in computer science, things become easier to do when you have a nice tidy set of rules that everyone can follow. And so, in simple terms , Jon gave the computers the following rules:

-Identify who a message is from
-Identify who it is going to
-Transfer the message
-Relay it through other mail servers if needed
-Confirm whether delivery succeeded or failed

I think I'll wrap up here today. Let me know your thoughts and if you have any other suggestions. I'm quite enjoying these historic dives. I kind of want to write about RFCs, Paul, and this guy some more... well, anywyas... Catch ya later!


r/computerscience • • May 17 '24

Article Computer Scientists Invent an Efficient New Way to Count

Thumbnail
quantamagazine.org
165 Upvotes

r/computerscience • • Mar 02 '21

Is it still coding, if you spend hours debugging?

165 Upvotes

I am a true novice in this field and feel like I spend most of my time debugging shit programs that I create. Is it even programming if you are not writing lines of code? Just curious, because I am getting my ass whipped on the simplest of programs. I believe it's because I got a terrible background in math, which I am working on. But yeah just wanted to vent. Any insight is always appreciated.

Edit: Thanks for all the replies homies. This was really unexpected, and very encouraging. I am learning Java in school and trying to learn python/spring on the side, for those who were curious. Stay safe and happy coding.

Edit 2: This is the code I am working on. I am trying to do a simple lottery output and cannot get the correct result. package lottery;

import java.util.Scanner;

public class Lottery {

public static void main(String[] args) {

// Generate a lottery

int lottery = 456;

// Prompt the user to enter a guess

Scanner input = new Scanner(System.in);

System.out.print("Enter your lottery pick (three digits): ");

int guess = input.nextInt();

// Get digits from lottery

int lotteryDigit1 = 4;

int lotteryDigit2 = 6;

int lotteryDigit3 = 6;

// Get digits from guess

int guessDigit1 = 4;

int guessDigit2 = 5;

int guessDigit3 = 6;

System.out.println("The lottery number is " + lottery);

// Check the guess

if (guess == lottery)

System.out.println("Exact match: you win $10,000");

else if

((guessDigit1 == lotteryDigit2 && guessDigit2 == lotteryDigit1 && guessDigit3 == lotteryDigit3)

|| (guessDigit1 == lotteryDigit2

&& guessDigit1 == lotteryDigit3 && guessDigit3 == lotteryDigit1)

|| (guessDigit1 == lotteryDigit3

&& guessDigit2 == lotteryDigit1 && guessDigit3 == lotteryDigit2)

|| (guessDigit1 == lotteryDigit3

&& guessDigit2 == lotteryDigit2 && guessDigit3 == lotteryDigit1)

|| (guessDigit1 == lotteryDigit1

&& guessDigit2 == lotteryDigit3 && guessDigit3 == lotteryDigit2))

System.out.println("Match all digits: you win $3,000");

else

System.out.println("Sorry, no match");

}

}

Any hints/suggestions are welcome, hell even some snarky remarks as long as it helps me move forward.

Prof sent me the "correct" which was if (g1 == l1 && g3 == l2 && g2 == l3 ||

g2 == l1 && g1 == l2 && g3 == l3 ||

g2 == l1 && g3 == l2 && g1 == l3 ||

g3 == l1 && g1 == l2 && g2 == l3 ||

g3 == l1 && g2 == l2 && g1 == l3)

System.out.println("Match all digits: you win $3,000");

That didn't work either.


r/computerscience • • Dec 04 '20

Help What does the highlighted part means

Post image
165 Upvotes

r/computerscience • • Nov 03 '19

Discussion Classic movie titles and dialogues as Linear Temporal Logic specifications

165 Upvotes

r/computerscience • • Dec 14 '18

General Sad life

Post image
165 Upvotes

r/computerscience • • Apr 22 '25

Discussion Did we miss something focusing so much on Turing/Von Neumann style computers?

164 Upvotes

I know that quantum computers have been around for a little while, but that's not what I'm talking about. I'm talking about perhaps an alternative classical computer. What would we have come up with if we didn't have Turing or Von Neumann? Was there a chance it'd be better or worse? I know Turing was one monumentally brilliant man, I'm just not sure if we could've done any better.

edit: Why are you guys upvoting this. I've come to realize this is a very stupid question.


r/computerscience • • Mar 15 '21

I think I accidentally started a movement - Policing the Police by scraping court data - *An Update*

Thumbnail self.privacy
164 Upvotes

r/computerscience • • Feb 26 '21

Announcement Club For CS Personal Projects

164 Upvotes

Hi everyone!

I'm making a club that meets every Thursday at 7:10 PM (EST) and the goal of the club is to work on personal projects. Computer science related personal projects are extremely helpful to put on resumes! They also help a lot when you can talk about them during job interviews.

Apart from jobs, side projects are really great for learning new things.

Join to talk about future personal projects or ones that you're currently working on. Any skill level is welcome! Please let me know if you are interested in joining so I can send you the zoom link!

Edit: I'm glad many people seem interested!! I made a discord server: https://discord.gg/u2y8jbk3RW and r/independentHackers


r/computerscience • • Apr 22 '25

Is this correct? If not, how would you make it correct?

Post image
163 Upvotes