[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/sci/ - Science & Math


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: exercises.png (25 KB, 1354x518)
25 KB PNG
Book: Algorithms in C from Robert Sedgewick

Searching online, the only thing I find is this excerpt from Wikipedia:

"In more complicated usage, O ( ⋅ ) can appear in different places in an equation, even several times on each side.
The meaning of such statements is as follows: for any functions which satisfy each O ( ⋅ ) on the left side, there are some functions satisfying each O ( ⋅ ) on the right side, such that substituting all these functions into the equation makes the two sides equal"
>>
>>17025313
1. Start from AOPS Prealgebra
2. Just get a Pro Max San Sama OpenAI Claude subscription.
>>
>>17025317
Can you do it?
>>
For example, in the fourth part:

let h1 = f - g = O(h(n))
then:
f = g + h1 and h1 = O(h(n)),
therefore:
f = g + O(h) holds.

Do you think it's okay?
>>
File: TAOCP O(n).jpg (154 KB, 957x211)
154 KB JPG
>>17025313
Just apply the definition of O(f(N)), most of these are just finding the constant M in the inequality for the right hand side.
>>
>>17025313
f(N) -> O(f(N))
proof: it's trivial
cO(f(N) -> O(f(N))
proof: left as exercise to the reader
>>
1 and 2 are trivial from the definition.
3 follows from one and two
4 might as well be trivial too but f = f - g + g = O(h) + g
5 follows from 3
6 follows from 2 and 3.
btw this is a blatant homework thread, you could have easily just asked AI instead of wasting my time.
>>
>>17025404
1 and 2 come from the axioms used to construct most modern computers and arent trivial
>>
>>17025313
Get LLM to create you a complete Algorithm ebook. With improvements for each chapter from AI.
>>
>>17025704
>1 and 2 come from the axioms used to construct most modern computers and arent trivial
Explain.
>>
>>17025712
its non trivial to explain it bro
>>
>>17025313
for cO(f(N)) = O(c f(N)) to be a non-trivial statement we would need the exact definition the book uses for these expressions because depending on how you introduce any of this it is trivial.
>>
File: file.png (32 KB, 1062x177)
32 KB PNG
Why is the Wikipedo definition for big O so awkward? Why a domain D when NO other definition (and no practical application I know of) needs anything other than an interval? Why not just
[eqn]
g(n) = O(f(n)) \iff \limsup_{x\to x_0} \frac{|g(n)|}{f(n)} < \infty
[/eqn]
>>
>>17026365
ugh, [math]n\to\infty[/math], for real analysis sometimes it makes sense to have x0 where x0 is usually infinity
>>
>∞
>>
>/sci/ is incapable of applying a definition to simple examples
How low the mighty have fallen
>>
>>17026374
I would unironically love to do it but I am not going to do it from a definition other than the book's, that would be cheating. But frankly I would say it suffices to prove a select few things.
[eqn]
f \in O(f)
[/eqn]
Trivially true because [math] \limsup_{n\to\infty} \frac{|f|}{|f|} = 1 < \infty [/math]
[eqn]
O(c f) = c O(f) ~ (c \neq 0)
[/eqn]
is true because if c is nonzero then c and 1/c are finite and whatever the limit is without c is just scaled by a finite factor.
The fourth is true because conventionally it is defined to be eqvilanent.
Next,
[eqn]
a\in O(f), b\in O(g)\Rightarrow\limsup\frac{|ab|}{|fg|} \leq \limsup\frac{|a|}{|f|}\limsup\frac{|b|}{|g|}<\infty
[/eqn]
which implies [math]O(f)O(g)\subseteq O(fg)[/math] which is a valid transformation to make whenever you can replace a set by a superset without loss of generality.
Finally,
[eqn]
h\in O(f) \wedge f\in O(g) \Rightarrow \limsup \frac{|h|}{|g|} = \limsup \frac{|hf|}{|gf|} \leq \limsup \frac{|h|}{|f|} \limsup \frac{|f|}{|g|} < \infty \Rightarrow O(f)\subseteq O(g)
[/eqn]
>>
>>17025313
wtf is this even supposed to teach you?
>>
>>17025313
You should probably read Knuth's Concrete Math before attempting any book on algorithms.
>>
>>17026388
isn't O(cf) = cO(f) true for c = 0 as well?
>>
>>17026480
Not quite, O(0) contains more than the null function, but the thing I left unsaid that was the main reason I excluded c=0 is that [math] O(cf) = O(f) [/math] is only true for nonzero c.
>>
>>17026505
>O(0) contains more than the null function
what else does it contain?
>>
>>17026508
Every function that is 0 eventually, for example the step function [math]\Theta(-x)[/math]. Most of the caveats are a consequence of us including functions that aren't monotonic, which are usually the most relevant for algorithms and such.
>>
>>17026524
Oooooh shit good point. Nice.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.