Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Algorithms

Posted on 2001-09-14
Medium Priority
423 Views
How can I give an example of an algorithm that is

O(1) - bounded (by a constant)time

O(N)- linear time

0
Question by:quietstorm
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 30

Expert Comment

ID: 6483387
Is this homework?

It is against EE policy for experts to do homework questions.

Please attempt to do part of the work, and then ask a specific question when you get stuck.
0

LVL 2

Expert Comment

ID: 6485614
Just go thru some Data Structures Book, may be Horowitz & Sahani will help. You have all the answers you want there.

Babu
0

Accepted Solution

kirsh earned 150 total points
ID: 6486908
Hi,

O(1) : Constant = PRINT "A"
PRINT "B"

O(N) : A loop = READ N
FOR I=1 TO N DO
PRINT "N"

O(N2) : A loop inside a loop = READ N
FOR I=1 TO N DO
FOR I=1 TO L DO
PRINT "L"

This is pseudo-code of course.

Naftali Kirsh.
0

LVL 5

Expert Comment

ID: 6487074
>How can I give an example of an algorithm that is

Yes, you can. Give us some...
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
###### Suggested Courses
Course of the Month4 days, 22 hours left to enroll