well ofc but it doesn't mean u should stop on the first solutions that somehow actually works tho it's super inefficient and full of crutches(idk the english word for this, but it's basically a piece of code u write that adresses the symptom rather than the issue, like if u need to output an "i" number and it's always i+2 u just write i-2 instead of looking for why the fuck does it even come out as i+2 in the first place)
i remember when on programming competitions there was like 20 mins left and i had to rapidly add some stupid shit to my program so it passes at least some tests even if it's bad af
i thought that as soon as i encounter 0 in the array then i'll immediately jump out of cycle and end the program, not check all of those other zeros too like "yup, that's zero. 987 more zeros to check"
yes that's what happens
but u still check if p[ i]=0 12 times when u could've checked it not even once if u went 1 to i-1 without any additional if statements
that doens't matter in a small programs like these, where 0.0000000000001 sec. could be something that will determine if ur code is good enough.
ofc it doesn't matter with the capacity of modern processors
but it's not about efficiency
it's about developing a habit
how do u expect some1 to optimize a huge ass project with complex hierarchy if they've never done it because hurr durr who cares about 10^-1234 second of processing time
array is not sorted
array is not supposed to be sorted
i just want to write even numbers and then odd numbers so i put the odd ones to the array until i encounter -1
i want it to stop when i encounter 0 since from the task i know that there will be only a list of natural numbers
dunno, i think meka is right and his analogy is correct as well
u can't expect someone to be 100% efficient, and they don't need to be 100% efficient either at this point. efficiency maybe matters in a year or so when he can write code fluently by himself
^ open the task manager, normal c will use 100% of 1 core to work loops and code, he will get to 0% when waiting for input, the only diference is memory.
compile time has nothing to do with ur programs efficiency
and processor time >>> memory used, ppl have crapton of RAM nowadays
there are ways to calculate algos efficiency based on the input, they even have a subject for that(example https://en.wikipedia.org/wiki/Algorithmic_efficiency) but it's super complicated and i just noped the fuck out of it when i saw it
u don't need it anyway, the difference between the efficiency of the worst program and the best program u can write is super small atm and u shouldn't care about it, u should care about trying to make it as efficient as u can
setting up a good and tabbed {}'s, while setting down commentaries(if needed)
=/= writing an efficient program
i agree that making ur shit understandable is important, esp. in large projects, but that's another habit, u can write tidy and slow progs or write a mess that will still work fast, those are different things but both of them are needed to become a good programmer
I'm just learning linked lists rn, and after cancer (sorry I meant recursion), I'm so tired. I hate recursion. When it works its so satisfying but 70% of the time something goes wrong and I have no idea what. I'm learning program but I suck at the hardware or how they work really and computers in general.
I hate these couple of recursion problems we got. Basically we had a chess board or 2d array of length x by x. Then (recursively), we had to move a knight from the top left corner, to hit every space, counting the steps. Shit got spooky when u wud eventually have ur knight be in a situation where it had no open spaces to move, so it had to backtrack its way, and we had to reverse the stack, and it all went downhill from there. Linked lists so far r fine, but we have literally been covering em for 2 days.
tryna get that pgae
E: deleted so mods don't ban me again for a month
well ofc but it doesn't mean u should stop on the first solutions that somehow actually works tho it's super inefficient and full of crutches(idk the english word for this, but it's basically a piece of code u write that adresses the symptom rather than the issue, like if u need to output an "i" number and it's always i+2 u just write i-2 instead of looking for why the fuck does it even come out as i+2 in the first place)
i remember when on programming competitions there was like 20 mins left and i had to rapidly add some stupid shit to my program so it passes at least some tests even if it's bad af
arin, do you have a sorted array? is it sorted ascending or descending? why would u want ur script to stop when there is something that is not -1
edit: or do u mean null? in java u can save 0 in an array but it returns null when there's nothing in an arrays slot
yes that's what happens
but u still check if p[ i]=0 12 times when u could've checked it not even once if u went 1 to i-1 without any additional if statements
ofc it doesn't matter with the capacity of modern processors
but it's not about efficiency
it's about developing a habit
how do u expect some1 to optimize a huge ass project with complex hierarchy if they've never done it because hurr durr who cares about 10^-1234 second of processing time
array is not sorted
array is not supposed to be sorted
i just want to write even numbers and then odd numbers so i put the odd ones to the array until i encounter -1
i want it to stop when i encounter 0 since from the task i know that there will be only a list of natural numbers
i'm sorry for being this bad
;_;
dunno, i think meka is right and his analogy is correct as well
u can't expect someone to be 100% efficient, and they don't need to be 100% efficient either at this point. efficiency maybe matters in a year or so when he can write code fluently by himself
whatever i probably won't convince u and i'm not gonna try to do it @1 am anyway
no, i know what u mean and i think efficiency is important as fuck as well, no matter the exercise
but a beginner whose code consists of
int i=1;
public void first time{
system.out.print.ln(i)
}
won't need to care about efficiency
Alright Meka
Join the balkan SourPls
so uh.. how do i check how much resources do i spend by running the program?
compile time?
^ open the task manager, normal c will use 100% of 1 core to work loops and code, he will get to 0% when waiting for input, the only diference is memory.
What is worng with u spunki, that clip with 20Year old guys, dating 15 yo girls.
what do u mean by resources
compile time has nothing to do with ur programs efficiency
and processor time >>> memory used, ppl have crapton of RAM nowadays
there are ways to calculate algos efficiency based on the input, they even have a subject for that(example https://en.wikipedia.org/wiki/Algorithmic_efficiency)
but it's super complicated and i just noped the fuck out of it when i saw it
u don't need it anyway, the difference between the efficiency of the worst program and the best program u can write is super small atm and u shouldn't care about it, u should care about trying to make it as efficient as u can
hook and roll WutFace
they're are decent friends, so i'd assume they're the same age (also wtf, the girls don't look 15 at all)
^ memory and cpu, if you dont use malloc, you cant see exactly how many mem you are using.
They look underage you pedo.
Is he making a array? i didnt read the whole discussion
You can create an array without using maloc, just make it a size for it.
like int nigga[10][10]
=/= writing an efficient program
i agree that making ur shit understandable is important, esp. in large projects, but that's another habit, u can write tidy and slow progs or write a mess that will still work fast, those are different things but both of them are needed to become a good programmer
What language is this? It was pascal but I thought I saw some java in there
dunno, im 17 and neither the girls nor the boys look my age/the age of my classmates at ALL. i'd say they're all 19-22ish
java is the best, high five daddy
че ты там написал небось психанул и обматерил меня хдддддддд
I'm just learning linked lists rn, and after cancer (sorry I meant recursion), I'm so tired. I hate recursion. When it works its so satisfying but 70% of the time something goes wrong and I have no idea what. I'm learning program but I suck at the hardware or how they work really and computers in general.
TLDR fuck
High five I guess. Is pascal object based?
What is this abt anyway?
Depends of the use of the array.
pascal is not object oriented and it's an old as fuck dogshit language nobody uses anymore
Pascal is event base? isnt?
Java is object
and c is pure code
whats hard about linked lists? just list1.concat(list2);
recursion is also okay, depends on what u are trying to do (quicksort? binary tree traversal?)
fuck it i didn't sign up for 2 am programming debates i'm out
peace
don't let that fuckboy get a new page
I hate these couple of recursion problems we got. Basically we had a chess board or 2d array of length x by x. Then (recursively), we had to move a knight from the top left corner, to hit every space, counting the steps. Shit got spooky when u wud eventually have ur knight be in a situation where it had no open spaces to move, so it had to backtrack its way, and we had to reverse the stack, and it all went downhill from there. Linked lists so far r fine, but we have literally been covering em for 2 days.
ResidentSleeper
Why is spunki a smurf and why does he/she have a 22% winrate? Why is the profile a girl even tho I guarantee its a guy? So many questions.