If you're seeing this message, it means we're having trouble loading external resources on our website.

তোমার যদি কোন ওয়েব ফিল্টার দেওয়া থাকে, তাহলে দয়া করে নিশ্চিত কর যে *.kastatic.org এবং *.kasandbox.org ডোমেইনগুলো উন্মুক্ত।

মূল বিষয়বস্তু

এ্যাসিম্প্টোটিক নোটেশানে বিভিন্ন ফাংশন

অ্যাসিম্পটোটিক চিহ্ন ব্যবহার করে কোন অ্যালগোরিদম চলার সময় n দিয়ে প্রকাশ করা হলে, কিছু বিষয়ের দিকে লক্ষ্য রাখতে হবে।
এসো সহজ কোন কিছু দিয়ে শুরু করা যাক। ধরি যে কোন ইনপুটের জন্য একটি অ্যালগোরিদমের ধ্রুবক সময় লাগে। উদাহরণস্বরূপ, যদি ঊর্ধ্বক্রমে বিন্যস্ত কোন অ্যারে থেকে সবচেয়ে ছোট উপাদান নির্ণয় করতে হয়, এর জন্য ধ্রুবক সময় দরকার, কারণ সবচেয়ে ছোট উপাদান 0 ইন্ডেক্সে রয়েছে। যেহেতু আমরা অ্যাসিম্পটোটিক চিহ্নে n ফাংশন ব্যবহার করতে চাই, তাই বলা যেতে পারে, এই অ্যালগোরিদমটি Θ(n0) সময় চলে। কেন? কারণ n0=1 এবং অ্যালগোরিদমের চলার সময় ধ্রুবক 1 এর মধ্যেই থাকে। অনুশীলনে, Θ(n0) লেখা হয়না, কিন্তু; Θ(1) লেখা হয়।
Now suppose an algorithm took Θ(log10n) time. You could also say that it took Θ(log2n) time. Whenever the base of the logarithm is a constant, it doesn't matter what base we use in asymptotic notation. Why not? Because there's a mathematical formula that says
logan=logbnlogba
যা a, b এবং n এর সকল ধনাত্মক সংখ্যার জন্য প্রযোজ্য। সুতরাং, a এবং b ধ্রুবক হলে, logan এবং logbn এর মধ্যকার পার্থক্য হবে শুধু logba এবং এটি একটি ধ্রুবক যা আমরা অ্যাসিম্পটোটিক চিহ্নে বাদ দিতে পারি।
Therefore, we can say that the worst-case running time of binary search is Θ(logan) for any positive constant a. Why? The number of guesses is at most log2n+1, generating and testing each guess takes constant time, and setting up and returning take constant time. However, as a matter of practice, we often write that binary search takes Θ(log2n) time because computer scientists like to think in powers of 2.
অ্যাসিম্পটোটিক চিহ্ন দিয়ে অ্যালগোরিদম বিশ্লেষণ করলে আমরা ফাংশনের একটি ক্রম দেখতে পাই। যদি a এবং b ধ্রুবক এবং a<b হয়, তাহলে Θ(na) চলার সময় Θ(nb) চলার সময় থেকে আরও ধীরে বৃদ্ধি পায়। উদাহরণস্বরূপ, Θ(n) চলার সময়, যা হল Θ(n1), Θ(n2) এর চলার সময় থেকে আরও ধীরে বৃদ্ধি পায়। সূচকগুলো পূর্ণসংখ্যা হওয়ার দরকার নেই। উদাহরণস্বরূপ, Θ(n2) চলার সময় Θ(n2n) চলার সময় থেকে ধীরে বৃদ্ধি পায়, যা হল Θ(n2.5)
The following graph compares the growth of n,n2, and n2.5:
Graph comparing n, n squared, and n to the 2.5 power
Logarithms grow more slowly than polynomials. That is, Θ(log2n) grows more slowly than Θ(na) for any positive constant a. But since the value of log2n increases as n increases, Θ(log2n) grows faster than Θ(1).
The following graph compares the growth of 1, n, and log2n:
Graph comparing 1, log based 2 of n, and n
Here's a list of functions in asymptotic notation that we often encounter when analyzing algorithms, ordered by slowest to fastest growing:
  1. Θ(1)
  2. Θ(log2n)
  3. Θ(n)
  4. Θ(nlog2n)
  5. Θ(n2)
  6. Θ(n2log2n)
  7. Θ(n3)
  8. Θ(2n)
  9. Θ(n!)
Note that an exponential function an, where a>1, grows faster than any polynomial function nb, where b is any constant.
The list above is not exhaustive, there are many functions with running times not listed there. You'll hopefully run into a few of those in your computer science journey.

এই বিষয়বস্তুটি Dartmouth Computer Science এর প্রফেসর Thomas Cormen এবং Devin Balkcom এর সহযোগিতায় এবং একই সাথে খান একাডেমির কম্পিউটিং শিক্ষাক্রম দলের একসাথে কাজ করার মাধ্যমে তৈরি করা হয়েছে। এই বিষয়বস্তু CC-BY-NC-SA দিয়ে লাইসেন্সকৃত।

আলোচনায় অংশ নিতে চাও?

কোন আলাপচারিতা নেই।
ইংরেজি জানো? খান একাডেমির ইংরেজি সাইটে আরো আলোচনা দেখতে এখানে ক্লিক কর।