[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 318
Thread images: 26

File: 1474113180240.jpg (184KB, 620x500px) Image search: [Google]
1474113180240.jpg
184KB, 620x500px
What are you working on, /g/?

Old thread: >>59348632
>>
Dumb shitposting general

Let the idea that an n*n matrix is linear continue
>>
>What are you working on, /g/?
>working on
>working
>>
>>59351833
second for all algorithms run in linear time confirmed for new meme
>>
File: 1350594293765.jpg (111KB, 500x500px) Image search: [Google]
1350594293765.jpg
111KB, 500x500px
How do you make a videogame?
>>
>>59351833
>bumping for digits
Also, i'm currently learning how to get started in programming
unfortunately for me, i'm just stuck without having a single clue where to start
>>
>>59351880
step 1) become a loser
>>
>>59351886
Done!
>>

import math;

x = 0;

x = x + 1;

while x > 0
if x == 1
print "Hello world";



this is my first program
>>
>>59351913
It doesn't run
>>
I'm learning p5js and trying to make myself a cool personal website with HTML5 and scripting languages

the internship search is to no avail pls help lads
>>
>>59351913
did you used the notepad?
>>
>>59351872
The real meme is that all nested loops are polynomial
>>
>>59351880
Learn C++
Learn some graphics API/library
Learn some high school math and physics
???
>>
HOW DO YOU MAKE SQUARE MATRICES FROM NON-SQUARE MATRICES, THE GUIDE

1. Measure the dimensions of your numbers. Let's say, they are A and B.
2. Solve the equation, Ax = By
The solution to the equation make the number of elements by each dimension.

Example: here's a bunch of non-square numbers, each has 3*2 measurements.
Solving the equation 3x = 2y, we get x = 2, y = 3.
Thus our matrix is going to be square.
Let's see it:
+-+
+-1

It's one of our non-square numbers.

+-++-+
+-1+-2
+-++-+
+-3+-4
+-++-+
+-5+-6

Look! Our non-square numbers made square matrix!
>>
How often do you take your work home with you?
>>
>>59351949
def f(n):
for i in range(n):
for j in range(n):
pass #basic operation

are you really unironically saying this is a function with linear time complexity?
>>
>>59351949
>/dpt/ is full of undergrads who failed their first algorithms course
Wow, what's new?
>>
>>59351985
No, SOME loops are polynomial. ALL != SOME
>>
>>59351980
Sometimes, then I just finish whatever I needed to finish to be done for the day, call in the next day that I'm working from home today, spend my day on whatever I wanted to spend it without thinking about job and submit the changes at the end of that day that I actually made yesterday.
>>
>>59351995
def f(n):
for i in range(n*n):
pass #basic operation


Ok so just making sure, this has the same complexity as above, correct?
>>
>>59351985
def f(n):
for i in range(n):
for j in range(5):
pass #basic operation

Notice that there is a nested loop and it isn't O(n^2).
>>
>>59351923

import math;

x = 0;

flag = false;

x = x + 1;

if x == 1
flag = true;

while x > 0
if flag == true;
print "hello world";



>>59351939
i used excel
>>
Classes are obsolete when you have heterogeneous lists and tagged types.
>>
>>59352006
No
>>
>>59352005
>call in the next day that I'm working from home today,
That sounds nice, what is your job?
>>
Contrary to popular belief, determining time complexity is NOT as simple as counting the for loops.
>>
>>59352006
Yes

>>59352024
This
>>
>>59352024
That's not a function of a nested loop, technically, since it can be unrolled.
>>
>>59352041
Just a programmer in a small Python workshop.
>>
>>59352048
Oh, so
for i in range(sqrt(n)):
for j in range(sqrt(n)):


is not a nested loop either?
>>
>>59352048
Tell me the time complexity here
void fun(int n) {
for (int i = 0; i < n; i *= 2)
for (int j = 0; j < n; j++)
basic_operation();
}
>>
>>59352080
O(inf) or however you'd write it
>>
>>59352064
That one can be unrolled too, because again it's linear. What are you missing?
>>
>>59352080
O(nlog2(n))
>>
>>59352064
this can be unrolled to
for i in range(sqrt(n)*sqrt(n)): stuff

which will run sqrt(n)*sqrt(n) = n times
it is O(n)
>>
>>59352080
n^2

Can you guys not math?
>>
>>59352122
Look again
>>
>>59352094
Oops, i = 1

THE POINT IS THAT counting for loops is fucking stupid, trying to determine what can and can't be unrolled is fucking stupid, what's easier is just creating a mathematical formula for the number of operations and then reducing this to O notation, like you're fucking supposed to do.

e.g., for nested loops with bounds only depending on 'n', you could find the complexity by multiplying the bounds. For two loops to 'n', it would be n*n = n^2. For a loop to 'n' and a loop to 5, it would be n*5 = O(n)
It's fucking simple.
I hate this website
>>
>>59352117
>Anonymous 03/11/17(Sat)20:26:14 No.59352080 ▶>>59352094 >>59352113 >>59352122
>>>59352048
>Tell me the time complexity here
>void fun(int n) {
> for (int i = 0; i < n; i *= 2)
> for (int j = 0; j < n; j++)
> basic_operation();
>}
>>>
> Anonymous 03/11/17(Sat)20:27:03 No.59352094 ▶
>>>59352080
>O(inf) or however you'd write it
>>>
> Anonymous 03/11/17(Sat)20:27:13 No.59352099 ▶
>>>59352064 (You)
>That one can be unrolled too, because again it's linear. What are you missing?
>>59352064
>>59352099
>>59352024
>>59352006
>>59351985
So tell me, what complexity does printing every element of a matrix exactly ONE time have?
>>
>>59352133
1/2 n * n = 1/2n^2 = n^2

You've never taken a class on this have you?
>>
>>59352153
It's not 1/2 n, it's log2(n), since i multiples itself by 2 each time, not increment of half of n.
>>
>>59352150
n*m if we're referring to matrix dimension, n if we're referring to number of elements
>>
>>59352150
>So tell me, what complexity does printing every element of a matrix exactly ONE time have?
n*m, where n and m represent the number of rows and columns of the matrix, respectively.
>>
>>59352150
For a 2d matrix?

O(n*m) where n and m are the dimensions of the matrix
>>
>>59352177
Yeah fuckwit, the outermost loop completes in 1/2 n operations. Where the FUCK do you think it's exponential?
>autists in charge of FUCKING MULTIPLICATION
>>
>>59352153
The problem says i *= 2, NOT i += 2.
>>
>>59352197
Please be a troll, for the sake of humanity
>>
>>59352197
>>59352177
nvm, I can't read

then it'd be nlogn yeah
>actually specifying the 2
You know that's not how it works right
>>
>>59352187
>>59352184
>>59352183
So in other words, LINEAR COMPLEXITY. Thank you very much.
>>
>>59351995
This.

A better way to say it would be that any nested loop that iterates over the same range is going to be n^2.
>>
>>59352207
>>59352204
Literally nobody has ever made an algorithm where you need to do i * 2. The code was obfuscated intentionally, like the pigeon that plays Chess.
>>
>>59352197
for n 20, you don't get 2 4 6 8 10 12 14 16 18, you actually get 1 2 4 8 16
>>
>>59352217
Or, to find the complexity of nested loops with bounds that don't depend on the iteration variables, multiply the bounds of each loop?
>>
File: 1486690644495.png (113KB, 255x256px) Image search: [Google]
1486690644495.png
113KB, 255x256px
>>59352227
>>
>>59352214
you were trolling pretty will til then, it was a good run though
>>
>>59352214
No. Specifying elements discards information of a matrix. n*m describes the matrix. Not one person would honestly say matrices are defined by their number of elements.
>>
>>59352213
HAHAHA HE CANT ACTUALLY READ
>>
>>59352248
How the fuck is iterating every element ONCE and ONLY ONCE and performing the basic operation ONCE and ONLY ONCE per element not linear you dumb fuck?
>>
>>59352227
Holy shit have you ever taken a simple course in CS?
I can think of a few algorithms with logarithmic time, two of which specifically does multiply instead of increment the iteration variable
>>
>shitting up two threads because some autismo couldn't be asked to define n and instead posts algorithms without context
>>
File: 1489038622072.jpg (104KB, 768x1024px) Image search: [Google]
1489038622072.jpg
104KB, 768x1024px
>>59351980
I work from home
>>
>>59352269
It's linear in the number of elements, which is m*n.
>>
>>59352269
A function of two arguments cannot be described as just "linear"; it can be described as linear in one or the other arguments, but not "linear in general"
This board fucking sucks at math
>>
What is a code of conduct and why does my project need one?
>>
>>59352269
Because if the number of elements isnt the *size*, the *size* is the input of the function

if the function is defined

def f(n):
for i in range(n*n):
pass #basic operation


the input is *n*, the number of elements/number of times the operaiton is performed is n^2
>>
>>59352269
You can't define a unique matrix by it's number of elements. Trying to create a matrix of 4 elements has infinite possible solutions. You know define has mathematical meaning right?
>>
>>59352306
>Trying to create a matrix of 4 elements has infinite possible solutions.
1*4
2*2
4*1
>>
>>59352309
>he thinks there are only 2d matricies
>>
>>59352291
>>59352287
>>59352302
>>59352306


Are you unable to read? Big O refers to the TIME COMPLEXITY, not the fucking number of elements. The TIME COMPLEXITY of printing every element ONCE is linear, aka O(n)

Nobody gives a fuck about the size of the matrix you dumb fucks.

>>59352302
The input to f is clearly the matrix. The basic operation is printing an element. Are you retarded or just pretending to be?
>>
>>59352312
Good point.
>>
>>59352271
I said by 2, not by anything you moron. Bubblesort doesn't multiply anything by 2, try again.
>>
>/g/ thinks printing elements in an N*M matrix is polynomial
>>
>>59352313
What is n?
>>
File: chen running.gif (17KB, 154x100px) Image search: [Google]
chen running.gif
17KB, 154x100px
>>59352313
Haha. LOOK AT HIS SHITTY BAIT AND LAUGH
>>
Why are there so many raging people ITT, calm down folks.
>>
>>59352313
Time complexity is a function of the size of the inputs. For a matrix, there are two input sizes, 'n' and 'm', and the time complexity is a function of both of those variables.
Specifically we could say T(n,m) = a*n*m + b*n where n and m are the number of rows and columns of the matrix, a is the time it takes to print an element, and b is the time it takes to print a newline.
O notation reduces this to O(n*m)
>>
>>59352341
>get told
>"i-i-i was only pretending you guise"

>>59352332
This

>>59352313
This. I don't know where the fuck "defining a matrix" came from.

>>59352335
Number of elements. In the 2D matrix example, it's N*M.
>>
>>59352367
n is a function of two variable raised to the first power. That makes it a polynomial function
>>
>>59352367
So it's linear in the number of elements, which is n*m. If there's more than one variable, you can't simply say "linear time" because you have to indicate which variable you mean. With one variable, it's implicit.
>>
>>59352320
int fast_exponent (int b, int n) {
int x = 1;
for (int i = 1; i <= n; i *= 2) {
if (n & i)
x *= b;
b *= b;
}
return x;
}


No, this isn't an obscure algorithm, it's actually important in RSA
>>
>>59352360
>Time complexity is a function of the size of the inputs
And what is the input to the algorithm that prints every element of an NxN matrix? Is it not the fucking NxN matrix?

> For a matrix, there are two input sizes, 'n' and 'm', and the time complexity is a function of both of those variables.
The input sizes defines the matrix, not the algorithm. Anyway, by definition, O(n * m) must in this case be linear time, since the basic operation is only performed once for any element.
>>
>>59352320
Instead of thinking it by *= 2, think of it as <<= 1. I could see it being useful it some bit manipulation.
>>
>>59352378
What time complexity does printing every element in a matrix one time have?

Protip: It's not fucking polynomial

>>59352379
See above
>>
>>59351980
I never touch code at home but I'll answer an occasional question
>>
File: 1488855993719.png (557KB, 433x713px) Image search: [Google]
1488855993719.png
557KB, 433x713px
What's a good book for me to better understand time complexity?
>>
def ZeroMatrix(n,m): #this prints a 2D n by m zero matrix
for _i in range(m):
for _j in range(n):
sys.stdout.write("0 ")
sys.stdout.write("\n")


The "inputs" ie "size" of this function are n and m
The "basic operation" of this function is
sys.stdout.write("0 ")


The basic operation runs n*m times
The time complexity is O(n*m)

It is funny that there are people here who would disagree with any of this
>>
>>59352395
For an nxm matrix, would a function in O(n) be linear as well?
For an nxn matrix would a function in O(n) be linear?
>>
>>59352429
This question doesn't really make sense,
Any function in O(n) is <= linear
(I am not arguing for or against whatever point you are making)
>>
>>59352423
Wikipedia probably has everything you need. After looking at algorithms in each common ranges of complexity, you'll get the hang of it.
>>
>>59352236
Yeah, people in this thread are also fucking retarded for thinking that m in the context of Big O can be used for defining the number of items in a matrix as n * m. The total number of elements in a matrix is just described as n in Big O, because it's the amount of data being operated on. m is another variable amount of data that grows with time, but for the sake of big O they're treated as the same variable.

For example, with bubble sort, you can easily write the algorithm to iterate one less time in the inner loop for each pass of the outer loop, so you're on a list, n, and n -1, or m, making the time complexity n*m, or for each item of n you have to iterate m times. However, in Big O this is still just described as n^2 because it's going to grow faster than something that is O(n).

This whole array nonsense is fucking retarded. Yes, a square matrix will obviously be the number of rows or columns squared, but that has nothing to do Big O, unless creating the matrix is part of the algorithm being analyzed. Talking about a matrix AFTER it's created, the number of items in terms of Big O is just n, and analyzed accordingly.
>>
What you niggas need to understand is that the n in O(n) doesn't refer to a side in the matrix, it refers to every access the algorithm does to the matrix.
>>
>>59352408
A matrix can only be defined in a single variable for one subset of matrices, a trivial set we don't even call matrices. If you are attempting to define all matrices in a single variable then you are not just wrong, but incorrect, by definition. If you're going to be Autistic at least be correct.
>>
>>59352445
I guess I'm saying that linear is a bad way to describe algorithms on non-linear objects
>>
>>59352454
>>59352451
>every function is linear because once the numbers are filled in you only perform operations once
How can you be THIS DUMB
>>
I want to pick up an old computer to start tinkering with BASIC coding the way it used to be. Would you recommend a ZX Spectrum, C64 or an Amiga?
>>
>>59352248
In terms of Big O analysis, it's just the number of elements in a data structure, or n.
>>
>>59352457
Nice weasel words, but you're dodging the fucking question. What time complexity do you think printing every element in an array (2D, 3D, ..., nD) have?

If you answered "linear" to that, then the Big Oh notation for this is O(n) where n refers to the number of elements, not the fucking matrix dimensions.

Invariant: If you answered anything other than linear to that question, you're a fucking retard and need to take an introductory class on algorithms.
>>
>>59351882
Start programming shit
Thats how you start
>>
>>59352478
none. you can run a BASIC environment on your current computer. don't fall for the nostalgia of people who never had to code on these old, slow machines.
>>
>>59352320
>Bubblesort doesn't multiply anything by 2, try again.
No one said anything about bubble sort multiplying anything, fuck head. Bubblesort is a shitty sorting algorithm anyways.
>>
>>59352451
This
>>
>>59352360
>Time complexity is a function of the size of the inputs. For a matrix, there are two input sizes, 'n' and 'm', and the time complexity is a function of both of those variables.
No you piece of fucking shit. The input is just the matrix; it's total number of elements.
>>
>2017
>
#define FOO 1.23
#define BAR 1.23
#if FOO == BAR /* syntax error */
#endif


why is this allowed?
>>
>>59351882
Start with python.
Learn how to print stuff. Learn about if/else, for/while, how to assign and edit variables etc, methods, then you'll be alright to experiment outwards from there. You need the above as your absolute basic concepts.
>>
>>59352454
No, n refers to the size of the problem
n is the size of the problem
n is completely agnostic to the "number of elements operated on" or anything like that, although they often coincide

Take these two functions:
def printSquareMatrix(matrix, n): #in this function n is the TOTAL NUMBER OF ELEMENTS IN THE MATRIX
for i from 1 to sqrt(n)):
for j from 1 to sqrt(n)):
print(matrix[i][j])

def printSquareMatrix(matrix, n): #in this function n is the SIDE LENGTH OF THE MATRIX
for i from 1 to n:
for j from 1 to n:
print(matrix[i][j])


The first one is O(n) where n is the number of elements in the matrix
The second one is O(n^2) where n is the side length of the matrix

what the size: n is is defined by the function signature
>>
>>59352531
FOO and BAR have no type.
>>
>>59352381
>space before the parentheses
What the fuck is the matter with you?
>>
Time complexity is pretty useless if you're not in Big Data(tm).
>>
File: 1485401620626.gif (929KB, 264x320px) Image search: [Google]
1485401620626.gif
929KB, 264x320px
>>59352491
well if you just say start programming shits but i don't know anything about how to program, may it means that i am doing something wrong?
>0/100
i'm not even sure if i have to use the notepad or other program
>>
>>59352535
>No, n refers to the size of the problem
Yes, the MATRIX ITSELF.

>The first one is O(n) where n is the number of elements in the matrix
>The second one is O(n^2) where n is the side length of the matrix
No, they're O(n) in both cases because n refers to the fucking matrix itself.

Printing every element in a matrix one time and one time only is a fucking linear operation.
>>
File: 81qWefBM0WL._UL1500_.jpg (158KB, 1153x1500px) Image search: [Google]
81qWefBM0WL._UL1500_.jpg
158KB, 1153x1500px
>>59352535
No don't you get it cuck nigger nigger because the algorithm has
 print(matrix[i][j] 
That makes it n

Every algorithm is n
>>
>>59352559
it's pretty useless if you're a normie tier code monkey who makes wordpress websites and fart apps
>>
>>59352533
i will try it anon, my end goal it's to one day being able of create my own AI
>>
>>59352565
>this is a real post
>>
>>59352535
See >>59352525 and >>59352488

Printing every element is linear time, yes or no?

If yes, then the big O notation for that is O(n)

If no, then sodd off, you're wrong.
>>
just fucking stop arguing you failed cs undergrads
>>
File: 5.jpg (60KB, 736x588px) Image search: [Google]
5.jpg
60KB, 736x588px
>>59352598
who are you arguing with?
>>
>>59352567
that would make it O(1) btw
(but i laughed)
>>
>>59352560
Get python 3 from their site. I use netbeans for java, but I'm sure people will give me shit for it. Use any IDE you like. DrPython is alright.
>>
>>59352591
It's dependant on how you define n. Now fuck off with this trash topic
>>
>>59352457
That's not what's being said, you fucking retard. No one is trying to define a matrix as just n. For the sake of BIG O ANALYSIS, analyzing an algorithm that operates on a given matrix g that has x*y elements is just treated as a dataset of size n=x*y. Big O is used to determine how fast the execution time of the algorithm grows with respect to the growth of n.
>>
File: Screenshot_2017-03-11_21-05-25.png (40KB, 710x138px) Image search: [Google]
Screenshot_2017-03-11_21-05-25.png
40KB, 710x138px
>>59352584
>>59352535

Where does it say anything about being the side of a matrix, you dumb fucks?

>>59352629
>It's dependant on how you define n.
n is defined as the growth rate of the function for fucks' sake. an iterating linearly over an N*M matrix has an n growth rate, ergo O(n).
>>
>>59352629
yes, this is all there is to be said about this
the size of a function "n" can be different things, the total number of elements to print or sort, the dimenisions of a matrix,
the square root of the exponent of the logarithm of the fibonnaci number of the number of elements, whatever you want,

and then the time complexity has to be a function of that "n"
>>
>>59352574
Stick with it and you'll grow to love coding unironically. Even if you don't plan on sticking with python long-term it's ideal as a beginner language to get to grips with the core concepts that translate to almost any language. Because it's for newbies the online help is also a lot more accessible.
>>
>>59352627
already downloading python-3.6.0
this one will work?
>>
>>59352473
That's not even close to what I said, child.
>>
>>59352653
O(X) is the growth rate. You can define what constitutes X. There is no "right" answer here. Kys. /thread.
>>
>>59352653
>have a square matrix 10x10
>increase size by 1
>add 21 elements
>then increase another 1
>adds 23 elements
>n is linear
You can print a LIST in n time, but a matrix is PI(ni) where i goes through your dimensions.
>>
>>59352662
Yep. It comes with an editor that works well, you should be good with that. There are plenty of basic tutorials online on where to start, but let me know if you need a hand with anything.
>>
>>59352689
>There is no "right" answer here.
There definitively is, and saying that iterating an 4 by 4 matrix and printing every element (once) is an O(n^2) operating is just fucking wrong.
>>
>>59352661
Thanks for the assistance!
I will learn how to used python and making sure of enjoying it while i'm doing it
>>59352627
also i will try to get the netbeans for java, thanks again for the help anon
>>
>>59352719
Fuck off troll.
>>
>>59352704
>space complexity is the same as time complexity
>>
>>59352730
>i'll call him a troll, that'll show him
If you can't handle being wrong, just refrain from replying.
>>
>>59352704
>n is linear
n is always linear, you piece of shit. n describes the growth of the size of data in an algorithm, whose complexity may grow linearly with n, as a function of n^2, or as function of logn, or fucking whatever, but n is just a variable that describes the linear growth of data.
>>
>>59352714
I really appreciate it anon, i think i will be good with the info you already gave me
I will let you know if i got stuck in something, i'm currently installing the program.
thanks again for halping
>>
>>59352742
Fuck off troll.
>>
>>59352653
n isnt the growth rate of the function, f(n) is the growth rate of the function. f(n) is being compared to some class of function g(n).
for example if f(n) <= g(n) where g(n) = n then f(n) is in the class O(n)

n is simply the size of the problem, the argument of the function that determines how many times it runs
if n is the side length of a square matrix then f(n) will take polynomially more time as n increases linearly,
if n is the length of a 1d array then f(n) will take proportional (linear) time as n increases linearly
if n is the number of elements in a sorted array and you want to find an element in the array f(n) will increase logarithmically as n increases linearly

n is just whatever the input *happens* to be, you cant magically look inside the function and see what it becomes then just say "oh theres 159035 of them so now n=159035 so its linear"
>>
>>59352197
This gave me a chuckle.
>>
>>59352758
>n isnt the growth rate of the function
That's wrong, the rest of your post is working under a false assumption. Dismissed.

See >>59352731

The time complexity of printing every element in an array, no matter how many dimensions, is linear => O(n).

The space complexity of a square matrix is polynomial, but that is disjunct from the time complexity.
>>
>100 posts wasted on useless academic nonsense about big O
>>
>>59352780
>academic
>>
>>59352754
Make me
>>
>>59352780
Someone hasn't had a big O today
>>
>>59352776
>>59352746
>every algorithm is linear because once you know how many operations it takes it takes n operations
Just stop, please stop. You need to get help.
>>
>>59352758
>n=159035 so its linear
That'd be constant, not linear, dipshit.
>>
>>59352790
Yes, academic.
>>
>>59352776
no, it isnt the growth rate
take bubblesort

the function is performed on an ordered set of length n
the function that determines how long it takes is f(n) <= g(n) = n^2 aka O(n^2)

So how is n the growth rate?
f(n) <= n^2 is the growth rate

I don't see what you don't understand

>>59352820
You just corrected my sarcastic impersonation of someone who I was calling wrong
thank you for your dilligence
>>
>>59352818
No one said this, fuck off.

The point is that "hurr durr the size of the problem" in the problem "print every element in an array once" is the size of that array. The growth is linear with the number of elements (size of the array).

Other operations, such as bubble sort, grows polynomial with the size of the array.

I don't understand how this can be controversial in any fucking way?
>>
>>59352780
/dpt/ is fucking garbage just close your browser tab or put it in a minimized window, drink some coffee (or tea or whatever) and put on some music (or no music if you prefer) and do the best programming session you've ever done

https://www.youtube.com/watch?v=5-sfG8BV8wU
>>
>>59352818
That's not what's being said you fucking neanderthal. The growth of n is linear. O(n) is a function of that growth. It could be O(n), linear; O(n^2), polynomial; or O(logn), logarithmic, but IN ALL FUCKING CASES, n just represents a linear growth of the data being operated.

Learn Big O you piece of shit.
>>
>>59352841
See >>59352852

The size of the problem for the problem "print every element in an NxM matrix" is the number of elements in the matrix. If this number grows by one, the complexity of the problem also grows by one. In other words, it's linear, better known as O(n).

In the case of bubble sort, if the size of the problem (in that case, the number of elements that needs to be sorted), grows by one, then the time needed to solve it grows by a polynomial factor.
>>
>>59352653
>n is defined as the growth rate of the function
n is just the size of the input you dingus
>>
>>59352824
This discussion is in no way academic. It's just a bunch of Dunning Kreugers shitposting and calling each other names. In other words, it's exactly like every other /dpt/ only this time we shitpost about big O instead of programming languages.
>>
>>59352893
Size is by definition, not a single number for a matrix. You are wrong by definition, not an opinion.
>>
>>59352916
>Size is by definition, not a single number for a matrix
But size refers to the size of the problem, not the fucking size of the matrix.

Anyway, the point still stands. Even if the size of the matrix grows by m, the size of the problem, or n, ALSO grows by m.

It DOESN'T grow by m^2, which is the case with bubble sort.
>>
File: 1384005083509.png (71KB, 554x436px) Image search: [Google]
1384005083509.png
71KB, 554x436px
>>59352939
>size of the problem
You're not serious right? You can just admit you're being a dumb nigger and stop right?
>>
>>59352916
>not a single number for a matrix.
The size of this matrix
1 2
3 4

is 4.

The size of this matrix
1 2 3 4

is also 4.

The size of this matrix
1
2
3
4

is also 4.
>>
>>59352916
>Size is by definition, not a single number for a matrix.
Yes it is, where n=xy, n=xyz, or what fucking ever. The size of a matrix is a single number, and this size is what is considered as n for the sake of Big O analysis on a given matrix q.

Pro Tip: You can represent a matrix of any dimension as a one dimensional array, and this is in fact how arrays are internally stored in computers.

Go fuck yourself.
>>
>>59352939
wow this is getting too retarded even for me
if function is performed on a n*m matrix
the size of the problem is n*m
if m increase by ONE the run time increases by M
thats POLYNOMIAL
>>
>>59352956
I'm using your own fucking words.

Anyway it doesn't fucking matter, the growth of n is linear with the number of elements in the matrix. Therefore it is O(n).
>>
>>59352973
You are incorrect, by definition.

>The size of a matrix is defined by the number of rows and columns that it contains. A matrix with m rows and n columns is called an m × n matrix or m-by-n matrix, while m and n are called its dimensions. For example, the matrix A above is a 3 × 2 matrix.

If you can find a single source where a matrix is defined in size by its number of elements, you can continue your point of view, otherwise you are worse than wrong.
>>
>>59352984
>the function f(x) = x isn't linear because if x = n*m and I increase m by one, f(n*m) grows by m !!!! that's polynomial!!!!
>>
File: cover_1st_ed.jpg (58KB, 338x417px) Image search: [Google]
cover_1st_ed.jpg
58KB, 338x417px
>>59351880
gameenginebook.com
>>
I have a question regarding reading from text files.

I have a text file containing:
ID: 0|uName: admin|pass: admin
ID: 1|uName: poo|pass: loo
.
.
.

I use a global variable to switch between users, 0 is always admin, 1 is someone else, etc...
How do I display only ID's and names in such a format:
1. admin
2. poo
>>
>>59353030
>read from text file
>display it
seems pretty simple
>>
>>59352994
You arent hearing what were saying
if f is a function of the number of elements its O(n)
if f is a function of the sidelength of the matrix is O(n*n) ie O(n^2)

What you are implying is that pritning the elements in a 2d, 3d, 4d, 5d...nd matrix all have the same time complexity class

>>59353024
where did you get this x from?
the function f(n,m) belongs to the class O(n*m) if there are n*m iterations
please dont misquote me anon :^)
>>
>>59353050
f(n,m) = n * m

This is a linear function you fucking idiot.
>>
>>59352994
the matrix is shaped like a square, not like a line. so it's O(n squared), not O(n linear)
>>
>>59353001
In mathematics. In Computer Science, it's just a formatted array of size n.

Now go suck on a thorny dick and choke on the cum, you fucking piece of shit.
>>
>>59353065
This means that the size of the dataset grows exponentially. The execution time is linear.
>>
>>59353076
if you process each element, the execution time is proportional to the number of elements
>>
>>59353072
No, it's not. The representation of a matrix is not the matrix. Don't get them confused.
>>
File: img_034.png (277KB, 416x406px) Image search: [Google]
img_034.png
277KB, 416x406px
>>59353072
>computer science is not a branch of math
LMFAO OH BOY HERE WE GO
>>
>>59353065
>the matrix is shaped like a square, not like a line. so it's O(n squared), not O(n linear)
int matrix[n *n ];

for (int i = 0; i < n * n; ++i)
{
// oh wow it's shaped like a line
}
>>
File: wowza.png (457KB, 1529x893px) Image search: [Google]
wowza.png
457KB, 1529x893px
>>59353059
>f(n,m) = n*m
>this is a linear function you fucking idiot
>this is a linear function
>linear
C U C K M E O U T
>>
>>59353026
Read it.
Arguably not very good, but good options are few.
>>
>>59353087
>if you process each element, the execution time is proportional to the number of elements
>proportional to the number of elements

Yes, exactly. Linear execution time.
>>
>>59353095
>n * n
>n squared
check mate
>>
How the fuck do I name my project? Holy shit this is harder than coding the fucking thing.
>>
>>59353119
but shaped like a line

check mate
>>
>>59353117
no, because the number of elements grows quadratically
>>
>>59353126
Random adjective + noun related to project
>>
>>59353059
Not according to math.
>>
>>59353126
Project2
>>
>>59353095
But that's wrong?
int matrix[n][n];
>>
File: img_073.png (225KB, 344x402px) Image search: [Google]
img_073.png
225KB, 344x402px
>>59353059
>f(n,m) = n * m
>This is a linear function you fucking idiot.
undefined control sequence: function "sides" not found
>>
>>59353137
>but number of elements grow quadratically

How does that matter for the growth of the execution time? Don't confuse space complexity with time complexity. You just said it yourself, the time complexity grows proportional with the number of elements.
>>
File: reallife.png (29KB, 652x618px) Image search: [Google]
reallife.png
29KB, 652x618px
>>
>>59353047
It's simple to display, but how do I display only specific stuff? The data is separated by |, but I don't know how to either: split the data into an array where in one index you have "ID:" and "0" separately, or just split the data by the |.
>>
>>59353030
Depends on the language.
In C++ I would read until you reach the separating char, in your case ':'
Other languages, I might read the entire line and then use regex to find the right part.
>>
>>59353126
put a placeholder name until you think of something or just name it some random crap. most things have pretty dumb names when you think about it
>>
>>59353173
>the time complexity grows proportional with the number of elements
>the number of elements grows quadratically

ok now anon, do the math here, I know im asking alot
>>
>>59353185
>>59353189
I'm using C#.
>>
>>59353185
What language are you using?
>>
>>59353189
You can include regex libraries in c++ too. And really if your format for storing tables is a plaintext format like this and not a binary format the war on processing waste is lost and you should just embrace the slow.
>>
>>59353185
Simple way: Create a matrix for everything you plan to display. Once you get to the control terms, skip to the next row and enter data there. When you want to print it, you know exactly which row contains the data you plan to print, and if you use a "forbidden" character like \n, you can know when you are done with the text that's in the row.
>>
>>59353200
If the number of elements grow by 1, the execution time grow by 1.

If the number of elements grow by M, the execution time grow by M.

Proportional (aka linear) growth. Aka O(n).
>>
>>59353090
doesn't matter, because an algorithm operating on any given matrix's execution time will grow in proportion to n, where n is the total number of elements of a matrix.
>>
>>59353137
the number of elements is however fucking many elements you pass to the function, and the number of operations is the same fucking number
>>
>>59353210
>>59353212
Oh, whoops

C# has a function called split, I think
split('|') or something
>>
>>59353227
But wasn't all of this about square matrices? That's what the original question was about.
>>
It's linear on the number of elements, but nonlinear on the specific dimensions
wew
/thread
>>
>>59353148
The double brackets is just syntactic sugar fuck face. The computer stores it as a normal array.
>>
>>59353252
i feel your pain
>>
>>59353050
But it's not f(n, m). There's only one number of elements, n (or m or x or whatever the fuck you'll call it).
>>
>>59353179
Uh, that function is just a simple multiplication operation. It's not even linear, its constant time. O(1).
>>
>>59353250
>But wasn't all of this about square matrices? That's what the original question was about.
The data structure is irrelevant to the algorithm, it does a pass over all elements in linear time no matter how big the matrix is.
>>
>>59353235
>An n-by-n matrix is known as a square matrix of order n.
you pass in a matrix of order n, which has n^2 elements, so the number of operations is proportional to n^2
>>
>>59353200
>the number of elements grows quadratically
That's irrelevant for Big O analysis of an algorithm.
>>
>>59353225
It'd be even better to use three dimensions: If you create like a 10x10x10 matrix, you can use row 0,0,0 for the first persons ID, the next for the name, then password, etc. I recommend NOT having the dimensions correlate to every id, because then your matrix would grow by size n, instead of being limited to some fixed value (like if you only want 32 people on a game server, you don't need a million sided matrix to keep track of everyone that's active, though your database would need that much space
>>
>>59353274
thats the number of times the basic operation will be performed, im not saying thats the actual function

>>59353267
if the number of elements is n*m, then the functions time complexity is in the class O(n*m)
if the number of elements is k, then the functions time complexity is also O(k)
both can true, at the same time even (infact both are true)
>>
>>59353292
no it isn't, because
>the time complexity grows proportional with the number of elements
and big O can be used for space complexity as well as time complexity so you're double wrong
>>
>>59353289
>the number of operations is proportional
>proportional
Yes, exactly!! It's O(n).

https://en.wikipedia.org/wiki/Proportionality_(mathematics)
>>
>>59353252
>/thread
Wait, we don't have to work on anymore?
>>
>>59353288
>The data structure is irrelevant to the algorithm,
>The data structure is irrelevant to the algorithm,
>The data structure is irrelevant to the algorithm,
A 10x10 matrix takes only 10x the operations of a 1x1 matrix

Spot the mental handicap this anon has.
>>
>>59353289
>>59353317
you're just arguing about whether n is the order or the number of elements now
>>
>>59353288
Sure. But it scales with the size of the matrix. So if n is the order of our square matrix we do O(n^2) work.
>>
>>59353326
Yes, you can all go home now. A desktop thread is waiting for you
>>
>>59353334
Anon you're the one who doesn't get it. That's not what's being claimed at all.
>>
>>59353339
But cannot refer to the order of the matrix and the number of elements in the matrix at the same time.

>>59353335
Big O describes the growth/
>>
>>59353317
if it's proportional to n^2 it's not O(n) you shitty /b/-reject joke of a troll
>>
>>59353250
That doesn't matter, because Big O analysis is only about the algorithm. So it doesn't matter if you'll only ever give it arrays with a squared size, the algorithm is analyzed as the size of the data it operates on, n, grows linearly.

How the data grows isn't relevant to Big O analysis for an algorithm, except that it might make the need for Big O analysis and optimization more important. Big O is just about how an algorithm's execution time changes in response to a linear growth in the data it operates on.
>>
>iterating a 2D array is O(n^2)
>iterating a 3D array is O(n^3)

Holy fuck /g/ is retarded
>>
>>59353383
>if it's proportional to n^2 it's not O(n)
It's linearly proportional to the number of elements in the matrix you fucking imbecile.
>>
>>59353389
>he's still going!
Anon you are so far beyond wrong it's amazing. Did you take drugs to get this retarded?
>>
>>59353393
if you scale a 2d array by 2, it grows to 2^2=4 times the size
if you scale a 3d array by 2, it grows to 2^3=8 times the size

i'd think you were trolling but you might just be mentally challenged
>>
>>59353377
the growth with regard to what? order or number of elements
that's what you're arguing about
>>
>>59353420
>if you scale the array, the array grows by an exponent of it's dimensions
Well, fucking duh.

But we're not talking about the array, we're talking about the algorithm that traverses it.
>>
>>59353315
Yes it is. How fast the data grows in your application is irrelevant to the analysis of an algorithm's time complexity. A time complexity analysis just examines how O, the execution time, changes in response to the linear growth of data, n.

>changing the goalposts
Fuck off.
>>
>>59353439
>linear growth of data
So a linear function describes a linear growth of data, while matrices are literally not linearly defined.
>>
>>59353225
I am currently storing each individual line in an array, but the data of one line is in one index.
>>59353241
Split only works for strings though, and puts them in an array. I could get one line of the array I'm using, convert it to string, then split it, but there has to be a simpler way, right?
>>59353296
Only the 0 ID, the admin will have 3 fields, rest of the users have more.
Also, if the users will grow more in number, it will be inefficient.
>>
O(n) doesn't even have to running times, doesn't have to describe data, and doesn't even have to describe algorithms.
exp(x) = 1 + x + x^/2 + Ω(x^3)
>>
>>59353439
>changing the goalposts
This is probably the most worthless meme fallacy.
>>
>>59353468
it's pretty simple to do it that way
>read file, line by line
>split on '|'
>pick the bits you want
>print
>>
>>59353411
>ad hominem
Try actually learning what big O is, first.
>>
>>59353465
No, you piece of shit. n just represents a linear growth in the data operated on by an algorithm for the sake of Big O analysis of an algorithm.
>>
Moral of the thread: quantify your fucking free variables.
>>
>>59353538
forall n
>>
>>59353495
Find me the linear function which describes the quantity of elements of an n*n*n matrix. I'll wait.

>>59353468
>it will be inefficient
Say you had to go from a 10x10x10 matrix to a 1000x10x10 matrix, where each element was 16-bits (unicode). You'd go from 2KB to 2MB, although anything which needed to sort or find empty users would take a lot of time (unless you kept a dynamically sorted list of empty users
>>
>>59353538
No, I'd rather leave them ambiguous so I can argue on /g/ for a few hours
>>
>>59353439
https://en.wikipedia.org/wiki/Square_matrix
>An n-by-n matrix is known as a square matrix of order n.
kill yourself
>>
>>59353438
1.
f_a(array, n, m) //sees all elements in a n*m matrix
f_b(array, k) //sees all elements in a matrix with k elements

2.
The basic operation for both is "see(x,y)" we will say, and it will be run n*m times for the first one, and k times for the second one

3.
the number of elements in a matrix is equal to the product of its dimensions
that is to say, for any given 2D matrix M with dimenisons n by m, the number of elements in M will be k where k = n*m
tldr; k=n*m

4.
f_a(array,n,m) performs n*m "see(x,y)" calls, therefore it will take an amount of time proportional to m*n
f_b(array,k) will perform k "see(x,y)" calls, therefore it will take an amount of time proportional to k

f_a is in the time complexity class O(m*n)
f_b is in the time complexity class O(k)

5.
(from 3) k = m*n
(from 3,4) O(m*n) = O(k)
(with these definitions for m,n,k)
-------------------------
If anyone disagrees with any of this please let me know!
(and before someone says: yes, the time complexity of f_a(m*n) is O(m*n), and yes, it is also O(k), if you are going to say it is O(k) and NOT O(m*n) I would like to point out that k=m*n)
>>
>>59353575
>so I can argue on /g/ for a few hours
you're a joke dude
>>
>>59353592
the time complexity of f_a(array,m,n) is O(m,n)
(just correcting the last line)
>>
int array_wide[1][4] = {
{1, 2, 3, 4}
};

int array_square[2][2] = {
{1, 2}, {3, 4}
};

int array_long[4][1] = {
{1}, {2}, {3}, {4}
};

void print_array(int** matrix, size_t n, size_t m)
{
for (size_t i = 0; i < n * m; ++i)
{
printf("%3d ", matrix[i / n][i % m]);
if (i % m == 0 && i > 0) printf("\n");
}
}

int main()
{
print_array(array_wide, 1, 4); // HURR DURR it's linear O(n * 1) lolololol
print_array(array_square, 2, 2); // HURR DURR it's squared O(n^2) lolololol

print_array(array_long, 4, 1); // herp derp it's linear again O(1 * m) lolololo
return 0;
}


This is how retarded you guys are. The print_array function's complexity OBVIOUSLY DOESN'T CHANGE because of the input you give it. It's complexity clearly grows linearly with the number of elements in total.

I could have trivially changed the matrix definitions to 1D arrays and passed that in as well.
>>
>>59351855
>n*n matrix
Wait, you guys seriously believe this? Anyone who spouts that shit has never had an ounce of formal training in computer science. Must be the "self taught" iPhoneusing- pseudo intellectual poseurs.
>>
>>59353592
See >>59353614
>>
>>59353618
1/8 are you even trying
>>
>>59353592
k is not linear because if is dependent on two variables of order 1. You left that part conspicuously out.
>>
File: asymptotic.png (108KB, 1047x533px) Image search: [Google]
asymptotic.png
108KB, 1047x533px
>n - number of elements in matrix
>print matrix - O(n)
>n - matrix dimension
>print matrix - O(n^2)

So when we talk about everything else we assume n - input size, when we talk about matrix operations it is more comfy to use dimension as n to show "true nature" and when we talk about graphs we use |V| and |E| and shit gets even more confusing. Am I correct?
>>
>>59353563
>return x * y * z
>O(1)
lol

Anyways, my point is that for an algorithm that operates on a given matrix, the time complexity analysis of that algorithm simply looks at how the execution time would grow as the size of the data being operated on grows linearly. That's what Big O analysis of an algorithm means. If you can't get that, you're just dense.
>>
File: 1484251473423.jpg (78KB, 600x600px) Image search: [Google]
1484251473423.jpg
78KB, 600x600px
>/g/
>knowing the difference between time and space complexity
>>
>>59353590
>didn't even read my fucking post
That has nothing to do with analyzing the time complexity of an algorithm you piece of shit.
>>
>>59353488
>>59353563
string[] Length1 = File.ReadAllLines("Test.txt");
string[] arrUser = Length1[Account.User].Split('|');


Code related, is if I want to store the data of the current user in the array. The first line gets all the data from the file, then puts it as a string at each index. So you're saying I should go through the whole array again by length, split it's contents with the | in my case, then print it out in a loop?
>>
>>59353648
>the time complexity analysis of that algorithm simply looks at how the execution time would grow as the size of the data being operated on grows linearly.
wrong
>>
>>59353644
Analysisfags blown the fuck out. Your mental handicap is LITERALLY wrong.

I can't wait to taste the salt
>b-b-b-but that is wrong
>>
>>59353688
(You)
>>
>>59353673
File.ReadAllLines("Test.txt").Select(line => line.Split('|')).Select(x => (x[1], x[3])
or something like that, wait for a LINQfag to show up
>>
>>59353673
What

I'd just read a line until it got until a newline, then take that line and enter elements into the row until you run into the control term then go to the next.

I only into C/C++.
>>
>>59353630
>>59353614
it is O(length of matrix * height of matrix) and O(the number of elements in the matrix)
length of matrix * height of matrix = the number of elements in the matrix
It just depends on the inputs to the function
Sometimes youll want to know how long the function will take with respect to the dimensions
sometimes you'll want to know how long the function will take with respect to the total number of elements

>>59353641
k is only dependent on k in this example, k just happens to only ever be n*m
if k is 1 the function will call see() 2 times
if k is 2 the function will call see() 2 times
if m & n are both 1 the function will call see() 1 times
if m & n are both 2 the fcuntion will call see() 4 times

the time complexity function increases linearly with k and "polynomially" w.r.t. n & m
>>
>>59353676
>wrong
>For example, when analyzing some algorithm, one might find that the time (or the
>number of steps) it takes to complete a problem of size n is given
>size n
>analyzing an algorithm is a function of the size n
>n grow linearly for the sake of such an analysis
>http://web.mit.edu/16.070/www/lecture/big_o.pdf

>you
>BTFO
>>
>>59353724
You're trying to make a compromise that isn't there.

dimensions m * n
total elements N = m * n


You cannot say that O(N) and O(m * n) are polynomial when O(N) grows linearly with N.
>>
>>59353754
http://mirror.ninja/5yqnil
>>
>>59353644
>size of a matrix is n
>single variable input
>Big O not applicable
You're not correct.
>>
>>59353724
k cannot be known until m*n is calculated (as the number of elements does not, and I'll say this again for the 50th time you dumb niggers, define a matrix). k is only linearly dependent for surprise, a linear matrix, not every matrix. For every matrix, k is equal to the result of a polynomial function.

I'll say it differently again because you retards cannot seem to grasp it: k does not exist, it is dependent on the results of multiplying the dimensions of the matrix. It is a derived term of multiple dimensions.

Read
>>59353644
>>
>>59353763
Im not saying O(N) is polynomial
O(N) is linear wrt N

but i also showed that N always = m*n in the case i was discussing
>>
>>59353787
i am arguing the same point as you you fucking retard

if the size of the problem is defined as k where k is the number of elements the time complexity is O(k)
if the size of the problem is defined as (n,m) where there are n*m elements the time complexity is O(n*m)
>>
>>59353103
>>59353144
>>59353160
It's linear in n*m you dolts.
I'm not even that guy but holy shit apply yourself.
>>
>>59353708
>>59353719
Did it a bit differently, hopefully it works without complicating things in the long run. In addition to the code above:
for(int i = 0;i<Length1.Length;i++)
{
string[] test = Length1[i].Split('|');
Console.WriteLine(test[0].Substring(4) + test[1].Substring(7));
}

This will output 0admin 1poo ... ...
Which is pretty much what I wanted. Shame I have to use so many arrays though.
>>
>>59353832
its linear wrt n*m
its polynomial wrt n and m
>>
>>59353792
But that's absurd, in the case where m = n, then O(m * n) would be polynomial. But it cannot be wrt number of elements.
>>
File: img_79.png (124KB, 240x338px) Image search: [Google]
img_79.png
124KB, 240x338px
>>59353832
>damage control
>doesn't know what linear means
>"dude exp(x) is linear in exp(x) you fucking idiots!!!"
LMFAO I CAN'T BREATHE
>>
Hello folks. I wanna set something up on my website. I want to be able to have people input data and select choices and then based on that i want it to generate something for them. I know this sounds very vague but i just want to know where i should start to look to learn how to create something like this.
>>
>>59353754
>doesn't reference the paper

>didn't even READ his link
>One caveat here: the number of summands has to be constant and may not depend on n.
This notation can also be used with multiple variables and with other expressions on the
right side of the equal sign. The notation:
f(n,m) = n2 + m3 + O(n+m)
represents the statement:
∃C ∃ N ∀ n,m>N : f(n,m)n2+m3+C(n+m)
>>
>>59353724
>Sometimes youll want to know how long the function
Yeah, I guess it has something to do with the most expensive operation. For instance, it's more important to know that matrix mult takes O(n^3) multiplications, where n is dimension
>>
>>59353818
>>59353792
THEN LITERALLY EVERY FUNCTION IS LINEAR YOU STUPID NIGGERS

All you do is say N = <anything in the big O> and voila it's linear
>>
how do i pick favorite language
>>
Every single thing can be done in constant time, we just haven't discovered the algorithms yet.
>>
File: yoshikawa_smug1.png (306KB, 352x512px) Image search: [Google]
yoshikawa_smug1.png
306KB, 352x512px
>>59353930
By doing some programming.
>>
>>59353870
>>>4chan.org/g/wdg
People here don't like webdev

[spoiler]basic php, javascript and html should be enough. visit w3schools[/spoiler]
>>
>>59353967
*hardware
>>
>>59353930
pick the language you enjoy writing code the most in
>>
>>59353980

Thank you
>>
>>59353989
how to pick language?
>>
>>59353916
no, I am arguing the same point as you!
for any function of n that takes f(n) time to run, you can devise some function of g(f(n)) that takes O(f(n)), g(n) is only linear wrt f(n), not linear wrt n

I feel like math goes over alot of your heads pretty fast
>>
>>59353644
http://people.cs.ksu.edu/~rhowell/asymptotic.pdf

Here's the actual paper. Seems interesting enough for anyone interested in complexity notation.
>>
>>59353868
Good job intentionally misunderstanding what I am trying to say.
Judging whether an algorithm is polynomial requires a statement about the size of the input.
Yes, you could say that input size of a matrix is n*m, but that is, in this case, unnecessary as the printing algorithm is concerned with the number of elements, not the dimension of the matrix.
The input size is O(n), where n is the number of elements, and the complexity of the algorithm is O(n), which makes this linear in the input size (just like complexity O(nm) would make it linear in the input size O(nm)).
>>
>>59354005
Use the axiom of countable choice
>>
File: img_42.png (125KB, 309x355px) Image search: [Google]
img_42.png
125KB, 309x355px
>>59354020
>damage control v.2.0
>>
>>59354011
>I feel like math goes over alot of your heads pretty fast
Shut the fuck up, you're redefining the definition of Big O.

The algorithm "print every item in a matrix once" grows linearly with the number of elements in the matrix. Period. End of fucking discussion. You cannot arbitrarily start introducing "but order of matrix" in to the definition.
>>
>>59354048
Why are you arguing two wrong things with yourself?
>>
>>59354048
Oh my goodness man calm down

>The algorithm "print every item in a matrix once" grows linearly with the number of elements in the matrix.
yes
the algorithm also grows polynomially with respect to the dimensions

what is wrong with what im saying?
>>
>>59354046
Says the faggot arguing exclusively with meme arrows and weeb avatars.
>>
print([1') is O(1)
print([1, 2, 3]) is O(n)
print([ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]) is O(n^2)


>/g/ logic
>>
>>59354081
>the algorithm also grows polynomially with respect to the dimensions
That's not how you use big O.

>what is wrong with what im saying?
We're talking about growth in time complexity, not the size.
>>
File: img_000.png (227KB, 468x460px) Image search: [Google]
img_000.png
227KB, 468x460px
>>59354094
>he thinks I'm arguing with him
>can't distinguish between when a person is arguing and when he's laughing at and insulting him for being a clown
>>
>>59354127
Man you're even better at damage control than you claim me to be.
>>
>>59352780
>>59352824

>Anime avatars and memes
>academic discussion
>>
File: img_021.png (132KB, 257x233px) Image search: [Google]
img_021.png
132KB, 257x233px
>>59354146
>acts like a retard
>gets called out
>makes wrong assumption
>gets called out
>uses words he doesn't understand
>gets called out
>"h-hurr damage control!1!1"
LOVING
EVERY
LAUGH
>>
>>59354178
>being this butthurt
>>
What's the average and worst case time complexity of averaging two ints, /dpt/ ?
>>
File: img_099.png (236KB, 528x573px) Image search: [Google]
img_099.png
236KB, 528x573px
>>59354193
My ass feels great thank you very much
>>
>>59354178
You didn't call me out on anything, what are you talking about?
>>
>>59354216
O(⊥)
>>
>>59354216
Division is the most expensive operation in averaging, there is constant numbers of division, hence O(1).
>>
>>59354216
O(n + m)
>>
>>59354222
Enjoyed my cock then? :^)
>>
https://arxiv.org/abs/1309.3210

Now here's a doc on Big O notation
>>
>>59351833
After the whole PS3 thing today, I started looking at that cool wavey animation at the bottom of the page, on https://rpcs3.net/.
I made a CodePen of that thing, which I took from the GitHub files, if anyone wants to see.

http://codepen.io/Metalmacher/pen/KWmqbz
>>
New thread:

>>59354282
>>59354282
>>59354282
>>
>>59354258
Webcuck detected
>>
>>59354216
O(2^n) Because you have 2 numbers and they could be any number n.
>>
>>59354307
Correct
>>
>>59352560
You are doing something wrong if you didn't do the tiniest bit of Google searching before you came here.
Learn to use Google. You'll need it when programming.

Use an editor with line numbers available. It'll be a pain if you don't have that.
>>
Creating a makefile generation language using aspects of multistage programming. It's all in Lua. The only deps are luafilesystem and lpeg.
>>
>>59351880

just use unity, there's a bunch of official tutorial (complete with assets that you can use)
Thread posts: 318
Thread images: 26


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.