mojo666's Profile User Rating: -----

Reputation: 376 Architect
Group:
Expert
Active Posts:
815 (0.38 per day)
Joined:
27-June 09
Profile Views:
12,711
Last Active:
User is offline May 15 2015 02:39 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Mozilla
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0
Expert In:
Computer Science

Latest Visitors

Icon   mojo666 has not set their status

Posts I've Made

  1. In Topic: C++ Linked List Help

    Posted 15 May 2015

    Best practice: you would implement a copy constructor. Once implemented, the line of code that executes it would look like found=new book(list);. If the object is simple enough, you can instead do the dirty method and copy all the properties.

    found = new book();
    found->title=list->title;
    //and do the same for other relevant properties
    
  2. In Topic: C++ Linked List Help

    Posted 15 May 2015

    found and list are both pointers, so when you set found = list; // Add the result to the results array to be displayed later, you are not adding anything to an array. You are setting both pointers to point to the same object. When you then set found->next to null, that is modifying the object that "list" is pointing to.
  3. In Topic: ADT Comples

    Posted 11 May 2015

    Quote

    I need to create an ADT Complex without using a class in c++


    Did you read the requirements correctly? Normally you are just restricted from using existing classes such as the complex class in the standard library.
  4. In Topic: Formal Theory of Complexity Analysis in Specific ProgrammingLanguages?

    Posted 7 May 2015

    Quote

    1. How do you get the analysis to focus on the goal?In the solution, it was O(n) because we are concerned about the complexity of computing Fib(n), not the complexity of doing the matrix multiplication

    Naive matrix multiplication of n by n matrix is O(n^3). Naive matrix multiplication of 2 by 2 matrix is O(2^3) = O(1). Thus the matrix multiplication utilized in this solution does not affect the analysis.

    Quote

    2. How do you get the analysis to consider when something is constant versus something that is variable?

    If it is a variable it is a variable and if it is constant it is constant. if your analysis demonstrates that an algorithm is O(n^x) where n is a variable depending on input and x is 3, then it is O(n^3). N is variable, x is constant.

    Quote

    How do you get the analysis to detect that a loop has been unrolled?

    I don't see how loop unrolling affects analysis. Big-O is concerned with how algorithm run times increase as the input grows. Minor adjustments that save a fraction of a second do not impact this behavior of the algorithm. It still grows at the same rate with the input. O(n)=O(n/4)
  5. In Topic: Formal Theory of Complexity Analysis in Specific ProgrammingLanguages?

    Posted 22 Mar 2015

    Quote

    The thing is that "the number of steps the algorithm will take" and "input parameter" are too abstract for most problems. For instance, it assumes we are dealing with an imperative language, that has a sequence of "steps" that the program can follow.

    Can you provide an example? The best I can think of are declaritive languages that aren't used for implementing algorithms. Rather they use prebuilt algorithms to accomplish specific tasks (SQL, XSLT). Analysis cannot be done in such cases...which has caused quite a bit of problems for me.

    Quote

    Second, it assumes you can easily define what the "input parameter" is, which at times may be almost impossible (specially if it's not a real number/integer/natural)

    If I don't know what the input is, how can I even write a program?

    Quote

    This program above is the easiest program ever, but when you deal with other complexities, specially ones that are inherent to a specific model of computation, or programming language (like recursion, side effects, mutability, and even something as simple as dynamic conditionals) trying to do a "direct argument" is not feasible.

    What can we do with an implementation that we cannot do with an algorithm. Big-o is fine for all the things you listed. You are coming up with a function that tells you how many times the program repeats basic tasks with varying input. We are basically asking "how long will my algorithm run as the input gets bigger" or "Will my program still be effective when I have twice as many customers/vendors/users/products/etc".

    Quote

    Is this ideal? This assumes your problem has a nice mathematical abstraction to it (graphs, matrices, vectors, etc). What if it doesn't?

    Then you can't write an algorithm or a program for it.

    Quote

    So in the end, you would still need to have a 2nd auxiliary analysis of your implementation, to see whether it checks with the "ideal algorithm complexity" or not.
    Why not cut the middle man and do the analysis right there on the "implementation"?


    You can't write a program (implementation) before you have an algorithm. If the implementation is failing, you now have to see if it is a problem with the implementation or the algorithm, which means you need to perform analysis on the algorithm anyways. If it turns out the algorithm sucks, then you just wasted a lot of money having a programmer working on a fruitless idea. You can get away with this for simpler problems, but you seem to be implying more complex problems.

    Quote

    Or straight up define a new system to analize the complexity of programs....Forget about Big O, we'd be talking about a completely new system here....That kind of tutorial is what I'm talking about. It is specifically discussing how to determine Big O for a specific programming language, it's not discussing it about how to do it abstractly. Almost all "Big O tutorials" do the same


    specific programming language (c++) implementation: for(int i=0; i<=n; i++){cout<<n;}
    "abstract": loop from 0 to n and print each number

    Analysis is the same process for both. Can you give an example of a problem that is drastically different between different programming languages or even the abstraction.

    Quote

    Imagine I'm a developer at Facebook. Now I have to find a way to get all the likes a user has, but only the likes of the 15 most popular friends he has, but only of those who have visited at most 2 pages who the original user has visited in the last 2 months.
    What is the input of this algorithm? As in, what is the "n" if this algorithm has O(f(n)) complexity?


    O(f(likes_u, pages_u, friends_u, pages_f[, likes_p])). Big-O can have multiple variables. For example, radix sort is O(k*n)

    Quote

    But I don't think it's ideal to try and blame the "problem" for not fitting into this nice little model, instead of modifying the model to make it adapt to the problem instead.


    What problem doesn't fit into the model?

My Information

Member Title:
D.I.C Addict
Age:
30 years old
Birthday:
July 23, 1984
Gender:
Interests:
Chess, math, computers, AI
Years Programming:
6
Programming Languages:
C++, C#, VB.net, SQL, OCAML, LISP, MIPS

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Friends

Comments

mojo666 has no profile comments yet. Why not say hello?