Is there a particular part of these problems that is stumping you? Perhaps breaking them down into smaller sub-problems? Where is it something else?
Based on your original description I was expecting something more heavy on straight CS theory. “how do you sort an unordered binary tree in place“ kind of thing.
I've never been so great with figuring out loops to iterate over things and the like.
And some of the questions being posed (which are all expected to be solved in C) are a little tricky for me to figure out on my own without some of the niceties which I have been exposed to in higher level languages. Perhaps the hardest of these was the Credit Card Validation example. I was stuck for such a long time on trying to figure out how to utilise an array with for loops to multiply every second number of the card backwards. This is Introduction to Computer Science and all of this is from week 1, so I was pretty much falling at the first hurdle.
I tried looking up various solutions in languages which I knew a lot better, so, and example of one of these would be Go.
The logic was there, but I still couldn't understand most of what was going on, unfortunately. Through trial and error, I eventually managed to get something working. >How can you write business logic at work without loops?
It's not that I don't use them, it's that I have a hard time figuring out how to use them in the context of solving the problem.
Maybe you're making it too complicated. The reason for loops is simply that you need to repeat an operation. Call it repetition if that helps. - for x;y;z - repeat a specific number of times, or need an index # - for x in y - iterate over container - while x - repeat while a condition is true - do while x - like while, but run at least once. So, imagine we have a string and need to add 1 to each character. The second bullet above looks best, first if the language is lower level.
From this description it seems you have problems with implementation.
You probably lack in "coding"(maping solution to code) department - it's totally normal in language you don't work in day to day. You are probably less skilled in implementing simple, lower level abstractions - understandable given your background. I have more exp than you - recently I was helping friend with python ML code - it took me 40 mins to code 20 lines. I don't feel bad at all, because even though I knew solution, to write it in python I had to google for each line and read docs to know range handling, dsl of libs, array comprehension syntax, lambdas etc. Good news is that it's easy to get proficient fast by doing such exercises. I can recommend codewars.com
> heavy on straight CS theory. “how do you sort an unordered binary tree in place“ kind of thing.
I was having a related conversation earlier, and feel like I'm reprising the same argument for a new audience, but... I don't see what is either Computer Science or theoretical about that. It seems like an eminently practical task: Handling things in a tree structure, sorting items, and doing work in-place to conserve resources are all very concrete, real-world aspects of writing software. You might not need them in _every_ case, but they aren't really "theory" in any real sense.
If you’re a bog standard “dark matter developer” using high level languages or writing your typical SAAS app, you wouldn’t need it.
I turned down a job offer where the interviewer was more concerned about whether I could write a merge sort on the board (I did), than whether I could design a system. It told me a lot about the kind of people they hire. I spent my first 12 years as a developer doing a lot of bit twiddling in C writing cross platform code with nothing but the standard library, but these days if someone asked me how to sort I would call a library function. Heck even C has a built in sort function.
But those issues are all totally orthogonal to my point.
You can argue that someone doesn't need something, that it's the wrong level of abstraction, or that it's not an appropriate interview question. I even agree to some degree. But that still doesn't make those "CS theory" subjects.
Based on your original description I was expecting something more heavy on straight CS theory. “how do you sort an unordered binary tree in place“ kind of thing.
And some of the questions being posed (which are all expected to be solved in C) are a little tricky for me to figure out on my own without some of the niceties which I have been exposed to in higher level languages.
Perhaps the hardest of these was the Credit Card Validation example.
I was stuck for such a long time on trying to figure out how to utilise an array with for loops to multiply every second number of the card backwards.
This is Introduction to Computer Science and all of this is from week 1, so I was pretty much falling at the first hurdle.
The logic was there, but I still couldn't understand most of what was going on, unfortunately.
Through trial and error, I eventually managed to get something working.
>How can you write business logic at work without loops? It's not that I don't use them, it's that I have a hard time figuring out how to use them in the context of solving the problem.
Continue this thread — 3 replies
Maybe you're making it too complicated. The reason for loops is simply that you need to repeat an operation. Call it repetition if that helps.
- for x;y;z - repeat a specific number of times, or need an index #
- for x in y - iterate over container
- while x - repeat while a condition is true
- do while x - like while, but run at least once.
So, imagine we have a string and need to add 1 to each character. The second bullet above looks best, first if the language is lower level.
You probably lack in "coding"(maping solution to code) department - it's totally normal in language you don't work in day to day. You are probably less skilled in implementing simple, lower level abstractions - understandable given your background.
I have more exp than you - recently I was helping friend with python ML code - it took me 40 mins to code 20 lines. I don't feel bad at all, because even though I knew solution, to write it in python I had to google for each line and read docs to know range handling, dsl of libs, array comprehension syntax, lambdas etc.
Good news is that it's easy to get proficient fast by doing such exercises. I can recommend codewars.com
I was having a related conversation earlier, and feel like I'm reprising the same argument for a new audience, but... I don't see what is either Computer Science or theoretical about that. It seems like an eminently practical task: Handling things in a tree structure, sorting items, and doing work in-place to conserve resources are all very concrete, real-world aspects of writing software. You might not need them in _every_ case, but they aren't really "theory" in any real sense.
I turned down a job offer where the interviewer was more concerned about whether I could write a merge sort on the board (I did), than whether I could design a system. It told me a lot about the kind of people they hire.
I spent my first 12 years as a developer doing a lot of bit twiddling in C writing cross platform code with nothing but the standard library, but these days if someone asked me how to sort I would call a library function. Heck even C has a built in sort function.
You can argue that someone doesn't need something, that it's the wrong level of abstraction, or that it's not an appropriate interview question. I even agree to some degree. But that still doesn't make those "CS theory" subjects.