r/AskProgramming • • Feb 06 '21

Why is accessing some random element near the start of an array FASTER than accessing a random element near the end?

56 Upvotes

I know they are both O(1) complexity, i'm talking at the hardware level here.

I know the difference is also very, very, very small.

Just recently I was doing a leetcode challenge one of which was a solution where lots of random access is done near the end of a 2D array. I found doing the exact same solution except from the front was ~10-20 ms faster and i'm talking consistently faster. This was in C++ with vectors

I then setup a test in python, and initialised an array of size 1 million, with random elements. I timed random element acccess near both the front and back, and the front of the array consistently produced faster results. I made sure the access was random to eliminate the compilers ability to optimise via caching etc.

Why would this be? I have always had the assumption accessing anywhere in memory should be roughly consistent.

Thanks for any input. Happy to share code if requested.


r/AskProgramming • • Oct 12 '20

does anyone else feel like a fake?

56 Upvotes

sorry if this isn’t the correct sub, r/LearnProgramming is for technical questions only so i figured this was the most appropriate one.

i’m working on my own implementation of bash in rust right now, and every time i can’t figure something out, i usually look up other people’s implementations on github and take ideas from them, like how to make the syscalls or how to tokenize user input.

i always feel like none of my code is actually my own ideas, and they’re all a mishmash of other people’s ideas, and no matter how much i try to put my own spin on things, it’s never “mine”, or my way is never the right way, and other people always do it better than me.

is this feeling common at all?


r/AskProgramming • • Aug 26 '20

do you delete a branch once you merge it into your master branch?

56 Upvotes

I'm still new to git, this is a quick question i had.


r/AskProgramming • • May 20 '20

Algorithms ELI5 what is dynamic programming?

56 Upvotes

I’ve been encountering problems lately where the solution requires a dynamic programming solution, but I can’t wrap my head around how that works. Can some ELI5 it?


r/AskProgramming • • Apr 17 '20

What would you have done as a job if you were born before computers were invented, e.g. the 1700's?

56 Upvotes

r/AskProgramming • • Aug 23 '24

Other Curious about what y'all listen to during intense coding sessions

55 Upvotes

What auditory torture do you inflict upon yourselves to fuel up during intense programming sessions?


r/AskProgramming • • Jun 27 '23

I got fired from my first software dev job due to performance issue. What can I do?

55 Upvotes

Hello,

I am a recent graduate(december 2022) from UCF in Computer Engineering. I started my software dev job in January where I was using C#. I was never too good at Object Oriented Programming. Prior to this job I also never had any C# experience whatsoever. So I started learning and getting more comfortable with the theories and OOP concepts in general. We use Blazor framework for FrontEnd and API development. Since I loved working on FrontEnd for my school projects I was doing okay with the front end (bootstrap, html, not too complicated rendering logic with LINQ queries and all). I even got to try out and do some bUnit testing. I thought I was doing good compared to when I had started.

6 months goes by, I was put on PIP and recently I was let go. It was due to I was still not performing well enough/ was not learning fast enogh/in 6 months didnt improve enough. I gave it my best but still didnt survive the PIP.

One important detail is, the company's software team was just 2 people. Me and my lead and only us 2 are incharge of all the development stuff. But mainly the lead had to do all the planning, training me as well as developing the more complicated patterns/structures that I was experienced enough for. I was trying my best to figure things out on my own, but since I had no one else to ask for help, I would always ask my lead for help when I would get extremely stuck. A lot of the ReactiveUI (it was complicated for me to understand) topics (observables/subscriptions) was foreign to me and learning those was a lot harder in addition to already trying to get more comfortable with OOP. Since I had some questions on a weekly basis perhaps it was a bit too much for him?

Now I am absolutely lost. I feel like I am not good enough. I intend on growing my knoledge still, with LeetCode / HackerRank to improve my problem solving skills/interview prep. And intend on doing some codeacademy classes to do some React projects to become more familiar with frontend work afterwards.

But, since most likely all of you here are much more experienced and talented that I am, I was wondeing based on my situation do you think I may not be cut out of software engineering field? I fell extremely broken for losing my first job in just 6 months and not sure what to think. Any advice would help regarding what to do now, should I consider doing something else, how to get better - what resources should I look into? My goal is to become a good FrontEnd engineer.

Thank you in advance. Any types of feedback is appriciated.


r/AskProgramming • • Jun 28 '22

What projects made your Github/Resume pop up ?

55 Upvotes

I absolutely can't come up with a good project idea to work on just for fun!


r/AskProgramming • • Apr 02 '21

Education If you had 10 days on your hands, what tech would you check out?

55 Upvotes

Hi everyone,

So, I'm moving to Switzerland for a software engineering job, and I'm legally required to self-isolate for 10 days upon arrival

Meaning I have 10 days of absolute nothing in a country where I know no one and I cannot leave my house.

What would you advise me to try out in these 10 days?

Personal projects suggestions, cool tech to check out, tutorials.
Anything that comes to mind is appreciated.


r/AskProgramming • • Jan 16 '21

Difference between SOFTWARE DEVELOPER and SOFTWARE ARCHITECT

55 Upvotes

I wanted to know what is the difference between a software developer and a software architect, and what roles do they play in a company.

I also have another doubt, is a systems software engineer the same as a software architect?

NOTE: I humbly request members of this subreddit to understand I am not a very educated person, but very curious and willing to learn about programming. If my question seems stupid please forgive me.


r/AskProgramming • • Jan 12 '21

i found a leaked data base

55 Upvotes

i was googling an email to see if it had any social media or whatever but i found a website on the first search page that has almost 50k email and password written and all are from my country i tried a couple emails to see if they are real and i logged in one Facebook account of the people in the list so is there's anything i can do to help warn these people or take down the site?


r/AskProgramming • • Dec 30 '20

Other Why's it called a vector, anyway?

55 Upvotes

When I hear vector, I think of the geometric concept, not a dynamic size container. Where does the name come from?

This might be a stupid question, but I'm a stupid person.


r/AskProgramming • • Nov 15 '20

[Meta] Can someone try actually reaching the mods?

55 Upvotes

Tried multiple times, never got any sort of response. Both when writing to the mod team ("message the mods) as well as the only actually active user in there (/u/trpcicm) directly.

So ... can someone else try? And if you also get no response, any other idea how we could actually get active mods in there if the mod team is entirely unresponsive?

Cheers :)


r/AskProgramming • • Aug 31 '20

Education How do you keep up to date with the software world?

55 Upvotes

The software world is always changing, so how do you keep up to date with the software world?


r/AskProgramming • • Jul 10 '20

Other Why do programming communities feel so difficult to get involved in?

55 Upvotes

I rarely get involved in tech communities. They're so hard to get into compared to other communities I've tried.

It's like every every comment I make needs to be corrected by another coder. Questions are called bad questions instead of being answered, only question my choice of stack and approach, and my PRs get rejected because I used a standard if statement instead of a ternary operator? What even?

It's so demotivating to even want to try to get involved.

I feel as if I can't contribute anything, even on projects desperately needing help. Only contribution I'm ever able to make it seems is making my own projects using the existing framework as a tool. Get a couple of "that's cool" based on how pretty it looks, and my existence is once again ignored.

Why do all tech communities I've joined seem to feel like this?


r/AskProgramming • • Apr 28 '20

Other Learning C and C++ as a hobbie. Any leads, tips or perhaps tutorials?

55 Upvotes

I know this is like the most frequently asked question to the programming community but I dare ask this again because most of the answers on internet do not help. Most of them are demotivating ("You crazy? Learn python instead”), some are simply mocking learning ("Lol, programming noobo wants to learn C, hey chap, lemme tell you how to change the color of your command prompt!").

I want to learn it for the thrill of it. I like challenging myself and positive results make me satisfied. So please don't gate keep me.

I am ready to invest 30hrs each week into learning C++. I even know the basics of the language so I dare say I am above the beginner level. Also, suggest only the stuff on internet because no high level books on C++ are available in my city and Amazon does not work here.

Thank you for your time reading this.


r/AskProgramming • • Apr 21 '20

Careers Which computer science courses are actually practical for a self taught programmer to take?

55 Upvotes

Which computer science courses are actually practical for a self taught programmer to take?

I have a job where I sometimes use programming skills, However, it's a support role so not programming all the time and have gotten away with just using the same knowledge about control flow, classes and maps etc.

I haven't really learnt anything new in the last year and I've had this job for 2 years.

So which moocs or courses would actually be useful for me to take to improve without emulating a 3 / 4 year computer science degree?


r/AskProgramming • • Dec 14 '19

What are the most useful mathematical concepts in software?

55 Upvotes

I know gradient descent and latent spaces are useful. Any more examples?


r/AskProgramming • • Dec 05 '19

I feel burned out.

55 Upvotes

Hi !Recently I landed a job in a huge corporation, I thought it was great, but after just few weeks of working there I must say that it's a shitshow. The head director doesn't know a thing about home automation, all they have are just 6 to 10 year old desktop apps that dont even support all of their products.

I was meant to be a C#.NET Core developer, instead after a week of not knowing what to do, and basically sitting around for 8 hours a day drinking coffe, the head director gave me a task to rewrite their core software from C# to NodeJS because he heard it's a 'hot language' I told him that I'll need some time since I never worked with NodeJS or JavaScript, I'm a C/C++ developer. So anyway I started reading the legacy code, and decided to use TypeScript since it transcompiles to JS anyway. The legacy code is a pure hot garbage, circular inheritance, lots of bug, no code structure, everything is just a mess. I received no guidance or a plan on how the software should look, what it should do. All I was told is that they want a REST api to run on top of it. After just two weeks when I'm about 25% done, they want a presentation tomorrow and expect the product to be finished. I've had few meetings and they didn't know what to say, like what the fuck.

What should I do, I'm really stressed out and I know that I'm no way near even getting to the REST part of the api, and they expect me to get it working by tomorrow.


r/AskProgramming • • Aug 31 '26

Career/Edu Is the job market really as dreadful as it seems?

54 Upvotes

I've been a software engineer since 2003, and have been laid off multiple times. Layoffs are common with our jobs, unfortunately, I think it sucks.. I was last laid off in September 2025 and recently started a new job this July. I've been feeling stressed and worried at my new job - I think being new is part of that, but I feel unusually stressed to the point of anxiety. I've started wondering about how long I'll last and what happens if I'm let go soon (and maybe that would ease some of my stress, except for being unemployed).

I've seen a lot of posts online recently about how bad & tough the job market is, people being unemployed for a while, and people being suddenly let go (like this post).

This all makes me wonder, is the job market really as dreadful as it sounds? I don't know if doomscrolling always gives you an accurate picture. But at the same time, the job market does seem tough. Is AI fully to blame? And I wonder how the future will be for our profession. Will I have a normal (and maybe calm) software developer role again (on a good team, with a good company that values its employees)?


r/AskProgramming • • Sep 05 '25

How software engineers keep their knowledge up to date

54 Upvotes

We know that software engineering is a discipline of continuous learning. I've been in the business since 2008, and my main learning resources have always been, and still are, quality articles, Udemy courses and official docs.

However, these days when programmers rely so heavily on AI, I'm curious - do they still bother learning from quality resources? do they read about new features, new syntax, new best practices? Or do they simply say "what for? I just tell Cursor to follow best practices and that's all". I mean, If your only learning tool is AI, how can you judge the quality of its output?


r/AskProgramming • • Apr 19 '25

Why does assembly have shortened instruction names?

54 Upvotes

What are you doing with the time you save by writing mov instead of move, int instead of interrupt.

Wouldn't synthetic sugar make it easier to read?

There is a reason most other languages don't shorten every keyword to that level.


r/AskProgramming • • Nov 13 '21

Why are C API functions are badly named?

54 Upvotes

As an example consider the function strstr(). How is one supposed to understand the usage of this function solely by its name? Had I wrote such function my pull request would have been rejected for bad naming of a function.

Why is that so in the C standard library?


r/AskProgramming • • Aug 17 '21

Algorithms This is a really dumb question, and by "dumb" I mean "why would you even want to know the answer," but are there 32 bit integer values whose bit pattern matches the floating point conversion of that integer?

54 Upvotes

Again, really useless, but I'm more just curious of methods to find out. The easiest way I could think of is to step through integers starting at 1, convert to a single float, and compare the bit patterns. If they aren't equal, then increment. But there's got to be cleverer ways of finding out, right?