Main content
Computer science
Course: Computer science > Unit 1
Lesson 1: Intro to algorithmsDiscuss: Algorithms in your life
We've given you a little intro to algorithms, and a few examples. Now before we go further, we want to hear what algorithms you can think of.
Leave a comment below answering one or more of these questions, and check out what other students wrote:
- What algorithms do you use in everyday life? Do you think you could write a program to make them more efficient?
- What algorithms do you think are used by your favorite games and apps?
- Have you ever made an algorithm for a program? What did it do? Was it correct and efficient?
Please use the "Tips/Thanks" tab for your answers, not the "Questions" tab. We look forward to your thoughts!
Want to join the conversation?
- Is an algorithm for wring an algorithm possible to make? Or are we humans an algorithm for making algorithms?(1053 votes)
- There are physic enginges that can simulate a lot of stuff. With simulation you can generate a huge dataset, which is used to make a computer control something according to the "experiences" contained in the datasets.
Example: Give a robot the keyboard and a flight-simulator and tell him: Airplane in the air = GOOD, crash = NOT good, press any keys and check what happens. The robot will produce datasets that lead to a crash and datasets that made a stable flight. With the huge dataset the computer has "algorithms" to maintain a stable flight (and also algorithms that lead to a crash) that he learned by himself.
Well, the physics engine was written by humans - though I do not consider humans to be like algorithms. Is there an algorithm for creativity? I guess not.(19 votes)
- So can you write a program just for making algorithms more efficient, faster?(56 votes)
- To some extent compilers have algorithms that make algorithms more efficient and faster.
Example 1:
if you have some C++ code that looks like:bool a=true;
while(a == true){
//do something, but never change a
}
The compiler may change it to:LABEL:
//do something
goto LABEL
which eliminates the need to have a variable 'a', and eliminates checking if(a ==true)
Example 2:
if you have a calculation in your code that the compiler detects is never used it may eliminate it
Some compilers have settings which determine how aggressive the compiler will be in optimizing your code.
The trade off for using more agressive optimization settings is:
-it typically take longer to compile,
-the compiled code may be unstable
Hope this makes sense(142 votes)
- Couldn't there be algorithms for making algorithms?(27 votes)
- That's what's called machine learning or genetic or evolutionary algorithms. They are some deep subjects. If you want a real brain-breaker, look up those subjects.(60 votes)
- Is there an algorithm to a random number generator?(24 votes)
- A very common pseudo random number generating algorithm is the linear congruential generator. It works like this:
X(0) = seed
X(n+1) = (A * X(n) + B) mod C where A,B,C are carefully chosen constants
(For more info see: https://en.wikipedia.org/wiki/Linear_congruential_generator )
The Mersenne Twister is used for higher quality pseudo random numbers (for things like scientific simulations). (See: https://en.wikipedia.org/wiki/Mersenne_Twister)
For cryptographically secure pseudo random numbers different techniques are used.(27 votes)
- how do you get into computer science and what do you have to have to get a job and what do you get paid, thank you for your convenience(9 votes)
- you just have to keep practicing it and look for job listings for computer science openings but i would look for interships first.(13 votes)
- Since a lot of the work I do involves machine learning, an algorithm I use often is the gradient descent algorithm, which provides a tried-and-true method for using data to optimize parameter weights, which are then used to make a decision about some new, unseen piece of data.(18 votes)
- actually we use algorithms everyday in our daily life any problem or a thing we're solving our brain is algorithming somehow but the whole point is were we we doing algorithms right i don't think so because if we had done such a thing our life would have much changed and here is a question how to make the best algorithm u can imagine ??(5 votes)
- There's no single "best algorithm". The algorithm you use will depend on the situation. One way to determine how good an algorithm is would be to analyze the time complexity, which you will learn about soon.(19 votes)
- Is there an algorithm that artists use without knowing? such as Photoshop artists to know just how to place something to give it depth for an image(6 votes)
- That sounds a lot like n-point perspective.
Basically, following the understanding that objects get smaller the closer they get to the horizon, you can get a general idea of how big or small an object should look, as it's moved closer or further from the observer.
1)Starting with 1 point perspective, you begin by figuring out where your horizon should be.
2)Next, you need to pick a point on the horizon to be your vanishing point - you can think of this as being the end of a really long and stright hallway. As things get further away from the viewer, they start to converge on that point.
3) Next, draw a simple flat shape to extend into the distance. For example, a square.
4) Trace a straight line from each corner of the square to your vanishing point. this gives you an idea of how big your square should appear as it gets further from the viewer.
Most of the steps for this procedure can be repeated for 2, 3.. point perspective for achieving different effects.
2 point perspective - like standing at a street corner.
3 point perspective - like looking up or down at a sky scraper
4 point perspective - kinda like 3 point, but floating in the middle of the skyscraper, able to look down and up
5 and 6 point perspective - Looking through a fish-eye lense or a reflection on a sphere.(8 votes)
- can life be considered an algorithm(5 votes)
- Life as a whole, no. But you use different algorithms in all parts of your life.
An algorithm is a set of instructions or steps like a recipe for a cake.(9 votes)
- In paragraph 5 the question. Have you ever made an algorithm for a program was it correct or efficient? How do you tell whether it was correct or efficient?(2 votes)
- An algorithm is correct when it produces a "correct" or expected result for a given input. To give you an example, a sorting algorithm is correct if it is given 10 unsorted items and it returns precisely 10 items in sorted order. If any item is our of order or the result contains 9 items instead of 10, then the algorithm is not correct.
An efficient algorithm is an algorithm that uses the least amount of resources. Time is commonly used to determine the efficiency of an algorithm. Another measure is the number of instructions or steps an algorithm must perform in order to complete the task.
Hope this helps.(14 votes)