Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

complexity-theory

Complexity of recursive factorial program

September 24, 2023 by Tarik

If you take multiplication as O(1), then yes, O(N) is correct. However, note that multiplying two numbers of arbitrary length x is not O(1) on finite hardware — as x tends to infinity, the time needed for multiplication grows (e.g. if you use Karatsuba multiplication, it’s O(x ** 1.585)). You can theoretically do better for … Read more

Categories complexity-theory Tags complexity-theory, factorial Leave a comment

Real-world example of exponential time complexity

August 2, 2023 by Tarik

O(10^N): trying to break a password by testing every possible combination (assuming numerical password of length N) p.s. why is your last example is of complexity O(infinity) ? it’s linear search O(N) .. there are less than 7 billion people in the world.

Categories complexity-theory Tags complexity-theory, exponential Leave a comment

What is O(1) space complexity?

March 20, 2023 by Tarik

To answer your question, if you have a traversal algorithm for traversing the list which allocate a single pointer to do so, the traversal algorithms is considered to be of O(1) space complexity. Additionally, let’s say that traversal algorithm needs not 1 but 1000 pointers, the space complexity is still considered to be O(1). However, … Read more

Categories complexity-theory Tags complexity-theory, space-complexity Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa