Which of the following runs the fastest?

A

O(log n) 

B

O(n) 

C

O(n log n)

D

O(√n)

উত্তরের বিবরণ

img

অ্যালগরিদমের গতি নির্ভর করে তার time complexity–এর উপর। নিচে প্রতিটি বিকল্পের বিশ্লেষণ দেওয়া হলো—

  • ক) O(log n): এটি logarithmic time complexity, যার বৃদ্ধি হার খুব ধীর। ইনপুটের আকার বাড়লেও সময় ধীরে বাড়ে। উদাহরণ: Binary Search

  • খ) O(n): এটি linear time complexity, যেখানে সময় ইনপুটের আকারের সঙ্গে সরাসরি অনুপাতে বৃদ্ধি পায়। উদাহরণ: Linear Search

  • গ) O(n log n): এটি linearithmic time, যা linear-এর চেয়ে দ্রুত বৃদ্ধি পায় কিন্তু quadratic-এর চেয়ে ধীর। উদাহরণ: MergeSort, QuickSort

  • ঘ) O(√n): এটি square root time, যা linear-এর চেয়ে ধীর কিন্তু logarithmic-এর চেয়ে দ্রুত বৃদ্ধি পায়। এটি কিছু বিশেষ সংখ্যাতত্ত্বভিত্তিক অ্যালগরিদমে দেখা যায়।

উ. ক) O(log n)
ব্যাখ্যা: Logarithmic অ্যালগরিদম সবচেয়ে দ্রুত বৃদ্ধি পাওয়া ধরণগুলোর মধ্যে সবচেয়ে ধীর (অর্থাৎ সবচেয়ে দ্রুত কর্মক্ষম)। তাই O(log n)–এর সময় জটিলতার অ্যালগরিদম সবচেয়ে দ্রুত চলে।

Unfavorite

0

Updated: 13 hours ago

Related MCQ

 If |A| = m, |B| = n, then the number of injective functions A → B (m ≤ n) is:

Created: 1 day ago

A

P(n,m)

B

C(n,m) 

C

nm 

D

m

Unfavorite

0

Updated: 1 day ago

Which one below declares a function pointer (f) pointing to a function taking an int and a float and returning a double? 

Created: 1 day ago

A

double *f (int, float)

B

double (*f) (int, float) 

C

(*double) f (int, float)

D

 double f* (int, float)

Unfavorite

0

Updated: 1 day ago

Which cryptographic algorithm is asymmetric? 

Created: 13 hours ago

A

DES 

B

AES 


C

Triple DES

D

RSA

Unfavorite

0

Updated: 13 hours ago

© LXMCQ, Inc. - All Rights Reserved

Developed by WiztecBD