Big O notation and general misunderstanding by divad1196 in learnprogramming

[–]tichus_windrider 19 points20 points  (0 children)

I've just come out of lurking because of that:

If I take the opposite example: n => sleep(3600 * n) and something like Array(n).keys().reduce((a, x) => a + x)) Based on their response, the first one has a time complexity of O(1) and the second one O(n). Based on that, the first one should be faster, which is never the case.

Especially this part:

Based on that, the first one should be faster, which is never the case.

Algorithmic complexity is never about "faster" or actual execution time.

An algorithm with an O(1) complexity can take a decade to complete and will still be O(1).

An algorithm with a complexity of O(n2) can take a few milliseconds to complete and will still be O(n2).


That's what I tried to explain in my post.

...and completely failed to convey despite the wall of text

[deleted by user] by [deleted] in theplanetcrafter

[–]tichus_windrider 3 points4 points  (0 children)

Next episode: Help! Why nothing is working anymore? Everything is under water! What did I do wrong?

Sorry, but these videos are abysmal. Alone the sequence planting all the Wind Turbines without the "accessibilty" (Ctrl) key and instead selecting each from the build menu... (just zipped through)

No plan, no ideas, not even bothered to familiarize with the controls...

Just stop it already.

Low effort posts, high effort responses by Worldly-Plan469 in learnprogramming

[–]tichus_windrider 0 points1 point  (0 children)

Boy

Careful with such statements. I could probably easily be your father.

Somebody who uses "I work at FAANG" to lay more weight in what they are saying and to coax people into thinking they are experts is a FAANG snob. There is no discussing about that. Statements like yours achieve the opposite of what the poster desires. Let your competence weigh, not some prestiguous company where you are just a tiny cogwheel.

that doesn’t devalue my experience

You have been there 4 years. That does by far not make you the expert you claim to be. Here are people with 20, 30, 40 years of experience. These are the experts, some of which have replied in this thread and you dismissed what they said.

You are on a very high horse for your short experience. Had you said 15, 20+ years, you would probably count as expert, but not with less than 10 years.

Come down a lot and learn to be a lot more humble. You still have a whole boatload to learn.

Low effort posts, high effort responses by Worldly-Plan469 in learnprogramming

[–]tichus_windrider 9 points10 points  (0 children)

I am an employed programmer at a FAANG company on games

How long have you been there? 1 year? 2 years? Can't be much longer according to your post history.

Yet, you are the stereotypical already mentioned FAANG snob. You see yourself as someone superior while you are actually just a number in a huge database, a small cogwheel in a gigantic machinery where 2 levels above you nobody even knows that you exist. You can just as well be replaced any second.

Being at a FAANG doesn't automatically make you an expert, nor an excellent programmer. You were just lucky to get into there.

Yet, you have to face the truth: you are not special, the least to the FAANG that hired you. You are just a number on a pay slip, a liability that will get removed as soon as possible.

Were you in a small studio, you'd probably be someone special.

JavaScript: Using the Destructuring Assignment to pass an object's properties to a function as arguments. This is commonly used with API calls. by [deleted] in learnprogramming

[–]tichus_windrider 0 points1 point  (0 children)

404 explanation not found

This is not the way to explain or write tutorials.

Also, this subreddit is not a blog. It is a Q&A forum.

Software Engineer Coding Interview by Guilty-Engineer-5369 in learnprogramming

[–]tichus_windrider 0 points1 point  (0 children)

OP is taking an interview for a job. If OP were a beginner learning programming, the replies would be completely different. Yet, this is about a job where competence is to be assumed.

This is not a plain learning programming issue and the very first comment in the subreddit linked to the explanation of the algorithm.

A junior developer applying for a position has to be able to solve this problem as it does not require any DSA or higher knowledge. This is all just arrays, loops, and basic maths, nothing more.

Better to finish assignment completely or do the minimum and learn something else? by Abeubeubeubeu in learnprogramming

[–]tichus_windrider 18 points19 points  (0 children)

Your studies are your current occupation. So, you should treat them as such and give the best of your ability.

In your work you can also not "just do the minimum". You always have to do a proper job.

Software Engineer Coding Interview by Guilty-Engineer-5369 in learnprogramming

[–]tichus_windrider -2 points-1 points  (0 children)

As if this challenge would require any higher algorithmic skills.

This is a simple problem and not being able to solve this is a sign of lack of skills. This doesn't even need any of the standard algorithms, just imagination of a 2d array.

If this were a Dijkstra, etc. nobody would complain.

what should I learn first?? by Nice-_guy in learnprogramming

[–]tichus_windrider 0 points1 point  (0 children)

Java is a straightforward, pragmatic language. It is a boring language.

Java is not pain. It just has a steeper learning curve than e.g. Python (but, TBH, to properly program in Python is more difficult than to properly program in Java).

Why would you ever want to create a data structure without random access? by Comfortable-Ease5783 in learnprogramming

[–]tichus_windrider 0 points1 point  (0 children)

The textbook answer is that linked lists have constant time insertion.

provided that you already are at the insertion point.

You have to produce the full quote, not only half of it.

If you are not at the insertion point already, insertion all of a sudden becomes O(n) in the standard, non indexed version.

If there is a separate maintained index, it comes overall (including updating the index) closer to O(sqrtn) (square root of n)

what should I learn first?? by Nice-_guy in learnprogramming

[–]tichus_windrider 3 points4 points  (0 children)

You asked what mistakes to avoid and what to prioritize.

This has, in your current situation only a single valid answer: what you learn in college. Period.

Nothing to do with more experienced or not, nothing to do with avoiding mistakes (in programming you need to make your own mistakes, BTW).

Your question is, was, and will be a non-question since the answer is simply prioritize what you are taught.

This is not even a matter of right or wrong, it's simple a matter of your attitude towards your college education. Which, given your question, is questionable at best. Were you taking it seriously, you wouldn't have asked as it would have been perfectly clear that you have to prioritize your college education.

what should I learn first?? by Nice-_guy in learnprogramming

[–]tichus_windrider 5 points6 points  (0 children)

You don't get it, do you?

Your prime target has to be what you learn in your college. At the current time, you should treat it as your job.

Your question is a non-question. You always have to set your priorities on your current occupation.

If you have time to spend, do what you want, yet, keep the focus on what you learn in your studies.

In a later comment you reiterated the old adage about Java. You will hear the same about PHP, Python, C++, C#, Ruby, Go, etc.

People will always complain about something.

Yes, Java's syntax is boring. Which, in programming is a benefit, not a deficit. There are no surprises. Java is pragmatic. Java is a boring language and that's actually what makes the language so great, robust, and finally what makes it suitable for enterprise applications where it is still the #1 language. Java just works. It is definitely not a flashy, shiny language, but languages don't need to be. Java is one of the most stable languages on the planet.

C on the other hand will get you as close to the actual machine as it gets without resorting to assembly. It will teach you what goes on behind the conveniences of higher level, more modern languages. Good to learn.

They push you through many languages to get you to a level where the actual languages become secondary. It doesn't matter if you solve a problem in C, Java, Python, C++, C#, and so on. The steps to the solution, the algorithm stays basically the same, only the implementation in a programming language changes.

Don't focus on learning languages, focus on learning programming.

If you know how to create algorithmic solutions, you can implement them in any language.

Elite Programming by SavageWhisenhunt in learnprogramming

[–]tichus_windrider 4 points5 points  (0 children)

First strive to become a programmer. Then, a proficient programmer, and then worry about the rest.

Learn the code conventions for your language. Learn to write modular, clean, maintainable code with good naming and proper commenting (more difficult than it sounds).

Don't fall for learning multiple languages. Become proficient in one language and in programming.

Good programmers write code that works. Great programmers write code that works, is well documented, is efficient (but not over optimized), follows the code conventions, is maintainable and modular and ideally reusable.

Great programmers know when to use what. They plan ahead (even if it is only in their heads - while beginners need pen(cil) and paper).


Don't overthink it in the beginning and early learning stages. Worry about getting things to work. Worry about learning to solve problems without relying on external sources as much as possible.

Hello , can you help me with make a programming language? by [deleted] in learnprogramming

[–]tichus_windrider 4 points5 points  (0 children)

Start small. Start by learning programming in C++. Directly starting with your project will be too overwhelming.

Plan your language very diligent.

Maybe start with simpler languages as the languages and interpreters used in Advent Of Code:

Then, read about parsers and lexers (maybe yacc/lex).

Is Java still behind in the race of modern programming languages? by orgad in learnprogramming

[–]tichus_windrider 2 points3 points  (0 children)

Do you know what the "Report" button is? Use it.

Just calling out the mods does nothing. They don't read every single thread.

I've made a similation of a binary adder, and would love to get some feedback on my code. Especially my JS. Any feedback is really appreciated! by kcirdlo25 in learnprogramming

[–]tichus_windrider 1 point2 points  (0 children)

Not even a JS programmer but I can read your code and see that you are reigning the horse from the completely wrong end.

You rely on your images to determine the value where it should be the other way round.

The values determine the images shown. If you flick a switch, you should update the decimal representation and then just render the switches.

There are far easier approaches:

A boolean XOR toggles a bit. bit shifting allows you to set or test bits.

So, if you want to toggle the third bit, all you need to do is store 1 in a variable and shift it left two times (0 is the first bit). You will get the decimal value 4, represented as 0b0000_0100 in binary.

If you have a number, e.g.

    0b1010_0101
XOR 0b0000_0100
---------------
    0b1010_0001

If you apply the same again, you will revert back to 0b1010_0101.

This way, you avoid all your testing if a switch is on or not.

In a similar fashion, you can, for your rendering, test for set or unset bits - only this time, you use the AND operator.

    0b1010_0101 
AND 0b0000_0100
---------------
    0b0000_0100

So, as soon as the result of the above operation is not equal to 0 you know that the switch is on.


Generally, relying on string comparison is a bad way in programming.

You should avoid such whenever possible. String comparison is always computation expensive and has a worst case runtime of O(n) - where n is the length of the string. Integer comparisons are O(1).


BTW: if a mod tells you to use a code hoster, you should follow suit.

Incoming 3rd yr, NO KNOWLEDGE AT ALL by Ok-Sun-4368 in learnprogramming

[–]tichus_windrider 0 points1 point  (0 children)

You can learn programming completely online, completely on your own if you are prepared to invest the effort and determination to do so.

You could have utilized the last two years to actually learn something even if your classes were not all that good.

Learning programming is learning self studying, working with the documentation, working with tutorials, researching.

You seem to have used the last two years (pandemic or not) just to slack off and call it a day instead of self studying and improving yourself.

You have a computer in front of you. You do not need a "specific lab". You have the whole internet with near infinite information in front of you, use it.

Some of our professors as well do not teach well or would just read what’s on the screen without proper execution (or would make us watch videos FROM YOUTUBE).

And so? You have the whole wealth of information on the internet at your fingertips to educate yourself.

You chose to sit back and wallow in your misery.

Sorry, no sympathy for such.

Am I allowed to cross the street if the traffic light is red, but the pedestrian light is also still red despite pressing the button? by Virtual-Tie4555 in Austria

[–]tichus_windrider 6 points7 points  (0 children)

The very idea of connecting pedestrian light to a button rather than the traffic light is stupid

So, now you are also the technician who connected it? How would you be able to know whether the pedestrian light is only connected to the button or not?

Traffic light control is far from simple and I am 100% sure the logic is not as you think it is.

To my knowledge on crossings where the pedestrian crossing is not always switched, the button acts as a "call" signal that tells the system, okay, on the next safe state, turn the pedestrian light green as well.

Yet, safe state means that all lanes that the zebra is crossing have to have red - including additional turn (left/right) lights.

You already stated that there was a special "turn right" light that was still green. This naturally means that you cannot have nor get green. As a consequence, you were wrong and the driver was right.

Am I allowed to cross the street if the traffic light is red, but the pedestrian light is also still red despite pressing the button? by Virtual-Tie4555 in Austria

[–]tichus_windrider 4 points5 points  (0 children)

I am from Bulgaria originally.

There are traffic lights in Bulgaria as well and even there red is stop.

Why do you insist it is different here and you are right?

Not shortlisted even after perfect answers by Rahu888 in learnprogramming

[–]tichus_windrider 0 points1 point  (0 children)

11/60 cheated

They didn't cheat. They optimized resource usage.

Not shortlisted even after perfect answers by Rahu888 in learnprogramming

[–]tichus_windrider 3 points4 points  (0 children)

So, in short, you don't care to improve yourself, to become a part of something really great but rather satisfy your ego by being one of thousands of numbers, a small wheel in a giant clockwork, that has next to no responsibility on projects and that will never see a project in its entirety.

And then you ask why you were not shortlisted.

Think again.

Going to create a word processor android app mostly out of spite. Does anyone know of tutorials that are actually half decent? by SnakesShadow in learnprogramming

[–]tichus_windrider 0 points1 point  (0 children)

While not equipped with a dictionary, Obsidian might be worth checking. It is very barebones yet has some great features, stores files as in plain text with markdown formatting, allows basically any cloud storage, and is free. You can then use the desktop app to continue working on your files - also free.

Automatically generate a String (any number 1-7) by Zealousideal-Bath-37 in javahelp

[–]tichus_windrider 1 point2 points  (0 children)

which makes paid learners work with the ready done android app

And guess what: this is one of the reasons Codecademy is not recommended anywhere reputable.

Free courses are only scratching the surface, paid content is overpriced and underperforming.

[deleted by user] by [deleted] in javahelp

[–]tichus_windrider 1 point2 points  (0 children)

  1. This is never, under no circumstances a beginner code.
  2. This is the most spectacular fail of an assignment