• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Help with Algorithmic Complexities

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im working on some problems on Algorithmic complexities would really love if someone just pointed me in the right direction:

I couple questions:

1.) Prove the following using the formal definition of Big-Oh complexity
a.) Prove that if an algorithm has: simple operations, then its complexity is: <-- honestly i don't know what this is asking .


2.)

for this one the variable 'i' is initialized to 3 and then the length is shifted over by "1" and then in the body the array index is shifted to the "right" and whatever value that is , is assigned to the index? Am I correct if so would that give me the contents of anArray after the loop executes?



3.) This one went way over my head:

Determine algorithmic complexity in terms on n .
How would I even start this ?


 
lowercase baba
Posts: 13069
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it's been a few years since i've done anything like this, but...

1) what the heck is a 'simple operation'? is a loop a simple operation? if so, then you can't, because nested loops can have O(n), O(n^2), O(n^3)... complexity, depending on how deep you have nested loops.

2) this should be easy to test...write some code, run it, and see what happens.

3) I think this is pretty straightforward.

Do you know anything about Big-O notation? do you have a book that talks about it at all?
 
Sam Acropolis
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a book but it just scratches the surface in the algorithm concepts.

Thanks for the pointers!
 
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well actually this is what we would think of poor definition, but....

simple complexity is o(c) = order ( constant ) = o(1).

But that said, there is a lot more leaning that needs to go on here.
 
Sam Acropolis
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you know of any good material on the web on Algorithms since my book doesnt go too much into it . I would love to sit down and read a whole bunch on this

@fred rosenberger lol I actually figured it out this morning for some reason when you said "this is pretty straight forward" I was like Hmmm and then Eureka!
 
Rancher
Posts: 4686
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sam Acropolis wrote:Do you know of any good material on the web on Algorithms since my book doesnt go too much into it .



I suggest you go to a local college library and look up the subject. There have been zillions of text books on the topic. No need to buy one, just
spend a few hours reading.
 
expectation is the root of all heartache - shakespeare. tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic