C++ Mistakes Noobs Make (and how to prevent them)

Поділитися
Вставка
  • Опубліковано 16 чер 2024
  • A compilation of various mistakes commonly made in C++ programming, as well as competitive programming in general. I explain what they are, what causes them, and what you can do to try to avoid them in the future.
    Stuff I said would be here:
    "Excess precision": codeforces.com/blog/entry/78161
    More info on sorting comparator ("strict weak ordering"): www.boost.org/sgi/stl/StrictW...
    Blog on hashing: codeforces.com/blog/entry/62393
    Blog on rand(): codeforces.com/blog/entry/61587
    C++ documentation site: en.cppreference.com/
    Overview slides: docs.google.com/presentation/...
    If I forgot to put anything here, please let me know.
    Topics covered:
    Intro 00:00
    Uninitialized variables 01:31
    Index out of bounds 03:04
    I/O optimizations (and misusing them) 05:23
    Over/underflow 09:34
    Handling floats, precision errors 12:47
    Handling modulo 15:46
    Multiple test cases, global variables 17:00
    Shadowing 20:33
    Operator precedence 21:21
    Mishandling sorting comparators 22:39
    Some extra STL/built-in stuff 23:43
    General tips & outro 26:07
  • Наука та технологія

КОМЕНТАРІ • 48

  • @ColinGalen
    @ColinGalen  2 роки тому +36

    Very late on schedule. Sorry about that. For some reason, my video editing program decided to go crazy and crash a bunch of times, as well as run at a solid 2 FPS when previewing the video. So... definitely not using that editor again.

    • @abhaypatil2000
      @abhaypatil2000 2 роки тому +1

      Come to linux. You will love it. Much more reliable that windows

    • @boundless-sher
      @boundless-sher 2 роки тому

      @@abhaypatil2000 colin uses mac not windows though

    • @abhaypatil2000
      @abhaypatil2000 2 роки тому

      @@boundless-sher which macos has ms paint and notepad++???

    • @ColinGalen
      @ColinGalen  2 роки тому

      @@abhaypatil2000 I just switched to mac a couple of videos ago. Most of my past videos were on a windows though.

    • @subhashsaran4943
      @subhashsaran4943 2 роки тому

      . ,, , तारक मेहता का उल्टा चश्मा@@abhaypatil2000

  • @pranavrajveer3767
    @pranavrajveer3767 2 роки тому +8

    Hey Colin, This video was quite nice and helped me very much figure out many things which i treated as a black box since I was too lazy to read the documentation..
    These types of videos do make many unknown thngs meaningful.
    It would be nice if you could continue these type of video series.
    ✌️

  • @georgedrooj8800
    @georgedrooj8800 2 роки тому +3

    wow man i would love to see more of these and algo lectures

  • @boundless-sher
    @boundless-sher 2 роки тому +12

    ah im one of those people who blindedly copy pasted fast i/o without know things i should know about it. thanks colin!

  • @vaalarivan_p
    @vaalarivan_p 2 роки тому +5

    25:17 . i cant forget that mistake which i did on a contest which costed me more than an hour!! i didnt know that was a mistake till then!! Thanks for the video BTW!!

  • @Daman1628
    @Daman1628 2 роки тому

    How i wish,i watched this video 4 months back.It covered everything which i had to manually discover

  • @kadirdumm8572
    @kadirdumm8572 2 роки тому +1

    I made all of these in the past, great video

  • @harshvardhan1238
    @harshvardhan1238 2 роки тому +1

    "hmm" was epic, nice touch! thanks!

  • @mrunankmistry7255
    @mrunankmistry7255 2 роки тому +1

    This was really helpful!

  • @kj5215
    @kj5215 2 роки тому

    Very Good, Mr. Galen sir.

  • @nirajandata
    @nirajandata 2 роки тому +1

    thank you mr. galen

  • @TheCarloslucerna
    @TheCarloslucerna 2 роки тому +17

    Can you please make a roadmap 😩 you’re soo good at teaching! I want to learn in the way you would recommend it

  • @sobieso
    @sobieso 2 роки тому +2

    great video !

  • @rishikeyyadav5717
    @rishikeyyadav5717 2 роки тому

    I've been using memset for long time..but didn't knew its working is really cool ..

  • @kwanzi.feb2
    @kwanzi.feb2 2 роки тому

    Thanks a lot !

  • @originvlcopy
    @originvlcopy 2 роки тому +2

    Hey colin, can you please show the compile and run command you use?

  • @programinglanguagepascal4248
    @programinglanguagepascal4248 2 роки тому

    nice video

  • @josephwong2832
    @josephwong2832 2 роки тому

    informative video

  • @ahmedcs7156
    @ahmedcs7156 2 роки тому

    can you recommend 1 good youtube video for learning C++ without too much fluff ( just what i need to learn to start competitive programming and learning ds and algos) ?
    thanks

  • @akrzha
    @akrzha 2 роки тому

    Please make some videos related to C++ STL.

  • @abhaypatil2000
    @abhaypatil2000 2 роки тому +2

    What is up with those sneak peeks at your face. NGL was quite hilarious

    • @harshupadhyay4393
      @harshupadhyay4393 2 роки тому

      Can you share the time stamps?

    • @abhaypatil2000
      @abhaypatil2000 2 роки тому

      @@harshupadhyay4393 it is thorughout the video. You must watch the video as well. Really really important to avoid uncalled errors. Just watch at 2x speed. It is manageable.

    • @harshupadhyay4393
      @harshupadhyay4393 2 роки тому

      @@abhaypatil2000 well I did watched the first 10 mins or something, by sneak peaks , do you mean FaceCam? I thought if it is some new glitch?

    • @abhaypatil2000
      @abhaypatil2000 2 роки тому

      @@harshupadhyay4393 later on in the video, he randomly shows his face just to convey his reaction on facecam. Really cracked me uo

    • @harshupadhyay4393
      @harshupadhyay4393 2 роки тому

      @@abhaypatil2000 ohh,then I defo should watch it

  • @yashchauhan5852
    @yashchauhan5852 2 роки тому

    This video is a gem. Enough to earn one more subscriber.

  • @Selim_Hasan_Raj
    @Selim_Hasan_Raj 2 роки тому

    Could you please tell me How the Eps is working? I tried but I don't understand.

  • @abdullasulfikkar5282
    @abdullasulfikkar5282 2 роки тому +3

    Can you make a video on how to handle 128 bit integers in c++?

  • @MiketheCoder
    @MiketheCoder 2 роки тому +1

    Hello Galen Colin

  • @captainswing4040
    @captainswing4040 Рік тому +2

    Man you are really good at from what i've seen but i've got to say that you don't seem to realize how useful a debigger can be
    maybe its because you are so heavily invested in competitive progamming and in those cases i can see your point
    But debuggers have allowed me to find all sorts of errors even logical ones
    A bit too long i know but i just had to say otherwise i wouldn't be able to look the debugger in the eyes next time i get segfault😂😂

    • @rmt3589
      @rmt3589 8 місяців тому +1

      What debuggers do you use?

    • @captainswing4040
      @captainswing4040 8 місяців тому

      @@rmt3589 i use gnu toolkit. so gdb

  • @blackswordsman9745
    @blackswordsman9745 2 роки тому +1

    16:56 (x+mod)%mod is still -1 on my local run.

  • @mr.k6831
    @mr.k6831 2 роки тому +2

    10:28

  • @Dhruv-zl8fo
    @Dhruv-zl8fo 2 роки тому

    __int128