Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
OldAlias
Nov 2, 2013

big O is rly easy? idk what’s not to get

Adbot
ADBOT LOVES YOU

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

just count the depth of your nested loops, bingo bango

hbag
Feb 13, 2021

how it's calculated, mainly

Cybernetic Vermin
Apr 18, 2005

OldAlias posted:

big O is rly easy? idk what’s not to get

nah. researchers that should know better gently caress up often, e.g. writing O(2^n) when they mean 2^(O(n)), writing O when they mean Omega, plus the folklore definitions of big-o over multiple variables is straight up incorrect.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Cybernetic Vermin posted:

plus the folklore definitions of big-o over multiple variables is straight up incorrect.
how is it incorrect

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

hbag posted:

how it's calculated, mainly

it’s kind of a feeling thing. you count how many nested loops you have and then say “this feels like O(n log n) or whatever

Sagebrush
Feb 26, 2012

Big O is a stupid name. The greeks already had words for big O and little o: omega and omicron. Use those

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

in hbag's defence, if I only ever saw the formal definition of asymptotic complexity (the whole "if for all n > n0 there exists some k s.t. f(n) <= k*g(n) then f(n) = O(g(n))" or whatever it is) then it wouldn't make a lick of sense to me too

the good news is that in the real world those constant factors actually matter, so in practice you're not significantly more wrong if you play it fast and loose with big-o

Cybernetic Vermin
Apr 18, 2005

Dijkstracula posted:

how is it incorrect

people go something like:

f(x,y) \in O(g(x,y)) iff there exists c and m such that f(x,y) < m*g(x) for all x>c and y>c

issue is that this program is then in O(x+y):

code:
int f(int x, int y) {
    if(x==0) {
        return fexp(y,y);
    }
    else {
        return x+y;
    }
}
since picking c>0 immediately makes the exponentiation disappear.

Cybernetic Vermin fucked around with this message at 16:30 on Aug 17, 2023

post hole digger
Mar 21, 2011

it’s easy I’ve done it a bunch of times

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Cybernetic Vermin posted:

people go something like:

f(x,y) \in O(g(x,y)) iff there exists c and m such that f(x,y) < m*g(x) for all x>c and y>c

issue is that this program is then in O(x+y):

code:
int f(int x, int y) {
    if(x==0) {
        return prime_factors(y);
    }
    else {
        return x;
    }
}
since picking c>0 immediately makes the prime factorization disappear.

wow, sounds like picking c>0 is a great trick to speed up your code

post hole digger
Mar 21, 2011

OldAlias posted:

I am now compelled to defend cigs. smoking is good for you, it’s like smoking your vitamins

they come from the earth ✌️

OldAlias
Nov 2, 2013

post hole digger posted:

they come from the earth ✌️

AlbertFlasher
Feb 14, 2006

Hulk Hogan and the Wrestling Boot Band
Sorry but there is only one Big O: https://en.wikipedia.org/wiki/Olympic_Stadium_(Montreal)

shitface
Nov 23, 2006

ok, seriousposting about smoking but I swear I’m not one of those ex-smokers who tut and roll their eyes. i couldn’t give a poo poo about someone else smoking and I don’t even really care about passive smoking. after 30 years of chain smoking, I don’t think a whisp of someone else’s is what’s gonna get me

with that said, if even one person reading this feels in the grip I’m telling you have to fix your head on it before you even try putting down the last one. it’s horribly addictive and mind altering, even from the first one, and it’s not helping you one bit.

OldAlias
Nov 2, 2013

Cybernetic Vermin posted:

nah. researchers that should know better gently caress up often, e.g. writing O(2^n) when they mean 2^(O(n)), writing O when they mean Omega, plus the folklore definitions of big-o over multiple variables is straight up incorrect.

I know in practice poo poo can be tricky sometimes, I remember having to do this poo poo in uni, but the fundamental idea of ‘some algorithms run faster, or slower, than others’ and by what degree isn’t tough like, conceptually to wrap your head around

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

ah, I see what you mean by multiple variables now

yeah honestly I don't know how to reason formally about that function if I'm being honest, but that's another advantage to having gone to a second-rate uni and being sloppy with the technique I guess - I can stare at it for a bit and say "well, seems like if you curried the function of two variables into two functions of one argument and took the max complexity of both, that gets you maybe less wrong" :q:

shitface
Nov 23, 2006

OldAlias posted:

it’s funny how wrong you are in this post, that I’m thinking it either must be a bit or bait, or mb you’re more sheltered than normal

it’s absolutely calming it’s a drug in itself. I found em very calming from the very first cig so that’s obviously not withdrawal

you choked your rear end off on your first cigarette. everyone does. 10,000+ later you’re convinced it was a whale of a time. this is the hosed up poo poo smokers tell themselves that ensure that they will never stop. nicotine is like that tng episode where everyone walks around cumming in the turbolift with their AR headsets on

Cybernetic Vermin
Apr 18, 2005

Dijkstracula posted:

ah, I see what you mean by multiple variables now

yeah honestly I don't know how to reason formally about that function if I'm being honest, but that's another advantage to having gone to a second-rate uni and being sloppy with the technique I guess - I can stare at it for a bit and say "well, seems like if you curried the function of two variables into two functions of one argument and took the max complexity of both, that gets you maybe less wrong" :q:

yeah, i think the correct way to define it is along those lines, with a strategic 'max' somewhere. though tbh i think the entire 'c' bit is a mistake, as it only really matters to bound arguments away from zero.

not a very deep issue in practice at any rate, but the fact that tons of books and papers by very clever people fucks this up does illustrate that it is not *that* simple.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i like that this thread is about the time complexity of anti smoking

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

someone itt seems to be getting somewhat riled up, have you considered ingesting a substance that binds to the Alpha-9 and Alpha-10 nAChR receptors, inducing a dopamine release and calming effect

Dijkstracula fucked around with this message at 16:35 on Aug 17, 2023

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Cybernetic Vermin posted:

not a very deep issue in practice at any rate, but the fact that tons of books and papers by very clever people fucks this up does illustrate that it is not *that* simple.
if grad school has taught me anything, it's that I shouldn't be surprised when a very smart person screws up something nominally simple

OldAlias
Nov 2, 2013

shitface posted:

you choked your rear end off on your first cigarette. everyone does. 10,000+ later you’re convinced it was a whale of a time. this is the hosed up poo poo smokers tell themselves that ensure that they will never stop. nicotine is like that tng episode where everyone walks around cumming in the turbolift with their AR headsets on

nah it was smooth as hell and delicious, I was transported straight to flavour town. It was the most enjoyable cig I had just on its own, before I permanently tainted my brain with other substances at least

eventually cigs became only enjoyable to me on certain substances, like opiates, as they acted like a leash for my high and recreated the rush of IV drugs in miniature. its why so many junkies smoke cigs poo poo it feels too good not to

what got me to quit was cuz my doc wouldn’t prescribe me hrt if I didn’t. otherwise what got me to quit was smoking during a flu, which caused me to cough up blood for a week. very spooky & gross. finally it just doesn’t feel anywhere as good as it used to, it’s rly not the same on maintenance drugs, so there’s no real desire to smoke anymore. it’s been… 5 years? more? since I stopped smoking

shitface
Nov 23, 2006

Dijkstracula posted:

someone itt seems to be getting somewhat riled up, have you considered ingesting a substance that binds to the Alpha-9 and Alpha-10 nAChR receptors, inducing a dopamine release and calming effect

Nice edit

Tell me how it will help me

shitface
Nov 23, 2006

OldAlias posted:

nah it was smooth as hell and delicious, I was transported straight to flavour town. It was the most enjoyable cig I had just on its own, before I permanently tainted my brain with other substances at least

eventually cigs became only enjoyable to me on certain substances, like opiates, as they acted like a leash for my high and recreated the rush of IV drugs in miniature. its why so many junkies smoke cigs poo poo it feels too good not to

what got me to quit was cuz my doc wouldn’t prescribe me hrt if I didn’t. otherwise what got me to quit was smoking during a flu, which caused me to cough up blood for a week. very spooky & gross. finally it just doesn’t feel anywhere as good as it used to, it’s rly not the same on maintenance drugs, so there’s no real desire to smoke anymore. it’s been… 5 years? more? since I stopped smoking

Sure. Out of curiously, how long ago was that?

distortion park
Apr 25, 2011


Dijkstracula posted:

just count the depth of your nested loops, bingo bango

this is correct, for example here we can see that multiplying n and m is O(n) (a counterintuitive result, there's no "m", no wonder so many otherwise smart people get it wrong! it's a nice little hack to speed up your code though, make sure the small number goes first):
code:
    let multiply n m = 
        let mutable x = 0
        for i = 1 to n do
            x <- x + m
        x
similarly taking a power of x^y is O(xy) (you loop over multiply x y times, no optimisations available here sadly unlike for multiplication):
code:
    let power x y =
        let mutable temp = 1
        for i = 1 to y do
            temp <- multiply x temp
        temp

OldAlias
Nov 2, 2013

how long ago was what? my first cig I was 15 in Italy, I think in the city of Perugia. I bummed a malboro red from a friend, it was absurdly delicious and felt better than it had any right to. I ended up buying packs of lucky strikes and gauloises, the latter of which was one of my goto brands for a while as I could get em in Canada

and then I smoked for … a decade? maybe slightly longer, but not by much

shitface
Nov 23, 2006

OldAlias posted:

how long ago was what? my first cig I was 15 in Italy, I think in the city of Perugia. I bummed a malboro red from a friend, it was absurdly delicious and felt better than it had any right to. I ended up buying packs of lucky strikes and gauloises, the latter of which was one of my goto brands for a while as I could get em in Canada

and then I smoked for … a decade? maybe slightly longer, but not by much

k. if you’re happy with it, i’m ok with it. I’m really only trying to speak with people who hate it and want to stop. I hated it but could never give it up until I stopped lying to myself about why I did it. It doesn’t help, not at all. Once you’re addicted, the best you can do is quelling the addiction (or understanding it, realizing it’s ultimately pointless and just not doing that)

shitface fucked around with this message at 17:09 on Aug 17, 2023

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


OldAlias posted:

how long ago was what? my first cig I was 15 in Italy, I think in the city of Perugia. I bummed a malboro red from a friend, it was absurdly delicious and felt better than it had any right to. I ended up buying packs of lucky strikes and gauloises, the latter of which was one of my goto brands for a while as I could get em in Canada

Anyway, for this delicious quiche you’re going to need eggs, spinach, chorizo

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

shitface posted:

this is horrible advice and won’t work for most people. unless you fix the thinking that drives you to do it there is a very high relapse of, iirc, 90%. the physical addiction part of smoking is relatively easy to kick, it’s all the bullshit “good things” smokers believe about it will drive them back to it.

it doesn’t calm you down, that’s just staving off of the current withdrawals. there’s nothing magic about the after sex or dinner cigarette, it’s just you didn’t smoke for longer than usual. that high feeling you get after you didn’t have one for a while is oxygen deprivation and you can just hold your breath instead if you particularly enjoy it

smoking is the continual, expensive, deadlyl pursuit of feeling normal like people who don’t smoke at all

yeah so anyway if you want to stop smoking, its easy: just dont smoke any more cigarettes.-

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


it’s so weird to see rotor trolling, an otherwise earnest and caring pillar of the community

post hole digger
Mar 21, 2011

rotor posted:

yeah so anyway if you want to stop smoking, its easy: just dont smoke any more cigarettes.-

post hole digger
Mar 21, 2011

Armitag3 posted:

it’s so weird to see rotor trolling, an otherwise earnest and caring pillar of the community

its not trolling hes right.

post hole digger
Mar 21, 2011

same with drinking. just dont do it anymore.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
people fail at quitting smoking because they dont actually WANT to quit smoking, they just know they should

akadajet
Sep 14, 2003

Sagebrush posted:

Big O is a stupid name. The greeks already had words for big O and little o: omega and omicron. Use those

You just tell the interviewer: I got you're big O right here! :goatsecx:

Then you are guaranteed to get the job.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

if your time complexity is too big, use a hash table instead

if your smoking addition is too strong, switch to hash instead

akadajet
Sep 14, 2003

Dijkstracula posted:

if your time complexity is too big, use a hash table instead

if your smoking addition is too strong, switch to hash instead

:hmmyes:

hbag
Feb 13, 2021

fart simpson posted:

it’s kind of a feeling thing. you count how many nested loops you have and then say “this feels like O(n log n) or whatever

...so its made up and fake?

Adbot
ADBOT LOVES YOU

hbag
Feb 13, 2021

Cybernetic Vermin posted:

people go something like:

f(x,y) \in O(g(x,y)) iff there exists c and m such that f(x,y) < m*g(x) for all x>c and y>c

issue is that this program is then in O(x+y):

code:
int f(int x, int y) {
    if(x==0) {
        return fexp(y,y);
    }
    else {
        return x+y;
    }
}
since picking c>0 immediately makes the exponentiation disappear.

if i need to understand this to get a computer touching job i might as well just put in my application at mcdonalds now

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply