โจ ๐๐ฎ๐ ๐ญ: ๐ง๐ถ๐บ๐ฒ ๐ฎ๐ป๐ฑ ๐ฆ๐ฝ๐ฎ๐ฐ๐ฒ ๐๐ผ๐บ๐ฝ๐น๐ฒ๐
๐ถ๐๐ โจ
// Good Morning everyone ๐, we are starting this activity with the vision of improvement and building consistency in students, today is the first day of DSA in December, I hope you are excited to get started with it! ๐
๐ An important question while programming is: How efficient is an algorithm or piece of code?
Efficiency covers lots of resources, including:
โข CPU (time) usage
โข memory usage
โข disk usage
โข network usage
All are important but we are mostly concerned about CPU time.
Be careful to differentiate between:
- Performance: how much time/memory/disk/etc. is actually used when a program is run. This depends on the machine, compiler, etc. as well as the code we write.
- Complexity: how do the resource requirements of a program or algorithm scale, i.e. what happens as the size of the problem being solved by the code gets larger. Complexity affects performance but not vice-versa.
The time required by a function/method is proportional to the number of โbasic operationsโ that it performs.
Here are some examples of basic operations:
โข one arithmetic operation (e.g. a+b / a*b)
โข one assignment (e.g. int x = 5)
โข one condition/test (e.g. x == 0)
โข one input read (e.g. reading a variable from console)
โข one output write (e.g. writing a variable on console)
โ๏ธ ๐๐ผ๐ฟ ๐ฏ๐ฒ๐๐๐ฒ๐ฟ ๐๐ป๐ฑ๐ฒ๐ฟ๐๐๐ฎ๐ป๐ฑ๐ถ๐ป๐ด ๐ฟ๐ฒ๐ณ๐ฒ๐ฟ ๐ณ๐ผ๐น๐น๐ผ๐๐ถ๐ป๐ด ๐ฎ๐ฟ๐๐ถ๐ฐ๐น๐ฒ๐ ;
- https://medium.com/@manishsundriyal/overview-time-space-complexity-f973513b701e#:~:text=According%20to%20Wikipedia%2C,grows%2C%20if%20the%20input%20increases
- https://www.geeksforgeeks.org/time-complexity-and-space-complexity/
- https://docs.google.com/document/d/1RCv8SeR4Zlnd13lHPzgrKV-4tzijRBjzGhhsNdGMeEk/edit?usp=sharing
- https://towardsdatascience.com/space-and-time-complexity-in-computer-algorithms-a7fffe9e4683
๐ฝ๏ธ ๐ง๐๐๐ผ๐ฟ๐ถ๐ฎ๐น ๐๐ถ๐ป๐ธ๐;
- https://youtu.be/rq_rwnveh8s
- https://youtu.be/mV3wrLBbuuE
- https://youtu.be/QovOdd80A4s
- https://youtu.be/bQssdSrSGNE
๐จโ๐ป ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ถ๐ป๐ด ๐ฅ๐ผ๐๐ป๐ฑ :
โ
๐ฑ ๐ฏ๐ฎ๐๐ถ๐ฐ ๐ฝ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ด ๐พ๐๐ฒ๐๐๐ถ๐ผ๐ป โ
- https://practice.geeksforgeeks.org/problems/power-of-numbers-1587115620/1?utm_source=gfg&utm_medium=article_practice_tab&utm_campaign=article_practice_tab
- https://www.hackerrank.com/challenges/what-type-of-triangle/problem
- https://practice.geeksforgeeks.org/problems/nth-fibonacci-number1335/1?utm_source=gfg&utm_medium=article_practice_tab&utm_campaign=article_practice_tab
- https://www.hackerrank.com/challenges/printing-pattern-2/problem
- https://practice.geeksforgeeks.org/problems/print-the-pattern-set-1/1