Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Cooking recipts are O(1), even/odd compairison is O(1) it all depends on the task, without the code its really hard to follow your astonishment. :)
-
@Hammster Yeah that's what I mean... what about platters of deviled eggs? O(mn), m for the size of the platter, n for the amount of platters. Luckily you can parallellize the process to a large degree, although eggs need to be cooked before peeling, slicing and spicing; garnishing can happen while cooking, and filling can be distributed as well.
I just disagree that cooking recipes are always O(1).
I'm actually working on an interpreter for the esoteric Chef language in Rust, so it supports concurrent recipes (sous-chef, I'm calling it). -
@bittersweet you know that there is stuff like rolled eggs, cooked and ready to serve :P
If a recipe is just list of tasks without any steps that says repeat this and that, i think of it as O(1).
In programming terms, a assembly program that uses no jumps has to be O(1) too since it only works down a task list of assigning stuff from A to B -
@Hammster But then you can call any algorithm O(1), when you remove the loops and just explicitly repeat the instruction a million times in the code, writing if statements in between to return when you reach the desired loop index 🤣
print('*')
if(n==1) return
print('*')
if(n==2) return
print('*')
if(n==3) return
... -
@bittersweet your example has different exit points so it cannot be a static time ;)
If you make a fried egg by the recipe, it is a set list of instructions, always the same instruction for any egg you fry. Therefore it is O(1)
The operations needed to complete the algorithm does not matter, but how constant it is, early returns/loops/breaks/jumps/goto's break the constant behavior, therefore you end up with a higher complexity. -
@Hammster how do you query which of the n receipt you want? A tree is log(n), but a hashmap isn’t REALLY O(1)...
Related Rants
-
dfox14I’ve been inspired by programming many times, but a few early moments really stand out for me. Some of those...
-
donuts21Clearly right now... Just spent 2 days writing a minesweeper clone because I wanted the ability to undo. It's...
-
lucniner15Finally finished both books and got some inspiration on how i wanna code in the future
When I saw an O(1) algorithm solution. I was so amazed that I got goosebump. Still wondering how one is able to come up with such algorithm.
Another times when I understand how the whole thing works in a project. This class is doing this, that class is doing that, this file contains the configuration, etc. Its like everything is connected.
Other times when you see your pet project start to take shape. You just want to cuddle it.
rant
wk79