omg homework help!!!

Discussion in 'Programming General' started by Barz, Sep 12, 2010.

omg homework help!!!
  1. Unread #1 - Sep 12, 2010 at 4:23 PM
  2. Barz
    Joined:
    May 24, 2010
    Posts:
    753
    Referrals:
    0
    Sythe Gold:
    0

    Barz Apprentice
    Banned

    omg homework help!!!

    This project builds on the code provided by the instructor following class. Your assignment is to build the Stack class as described below:

    * Implement the Stack class' constructor and destructor.
    * Implement the following public methods:
    o void push (VALUE value);

    Pushes the object specified by the value parameter onto the top of the stack.
    o VALUE pop ();

    Removes top value from the stack and returns it.
    o VALUE top ();

    Returns the top value from the stack, but does not remove it.
    o Implement the following public "helper" methods:
    + int getSize()

    Returns the number of elements in the array.

    + bool isEmpty()

    Returns true if the list is empty. Otherwise it returns false
    + bool isFull()

    Returns true if the list is full. Returns false to otherwise.

    heres the format of code my teacher gave me

    i might b willing to pay if someone legitmately helps me and brings me up to speed with my class

    Code:
    #ifndef STACK_H_
    #define STACK_H_
    
    template<class TYPE>
    class Stack
    {
    private:
    	class Node
    	{
    	public:
    		TYPE  value;
    		Node *next;
    
    		Node(TYPE theValue, Node *existingList)
    		{
    			value = theValue;
    			next = existingList;
    		}
    	};
    	
    	int size;
    	Node *top;
    
    public:
        class StackFullException {};
        class StackEmptyException {};
    
    	Stack()
    	{
    	}
    
    	TYPE pop()
    	{
    		if (!isEmpty())
    		{
    		}
    		else
    			throw new StackEmptyException();
    	}
    
    	void push(TYPE newValue)
    	{
    		if (!isFull())
    		{
    		}
    		else
    			throw new StackFullException();
    	}
    
    	TYPE getTop()
    	{
    		TYPE result;
    
    		if (!isEmpty())
    		{
    		}
    		else
    			throw new StackEmptyException();
    
    		return result;
    	}
    
    	int getSize()
    	{
    	}
    
    	bool isEmpty()
    	{
    	}
    
    	bool isFull()
    	{
    	}
    };
    
    #endif /* STACK_H_ */
    
     
  3. Unread #2 - Sep 12, 2010 at 6:30 PM
  4. Bdubb
    Joined:
    Nov 1, 2009
    Posts:
    54
    Referrals:
    0
    Sythe Gold:
    0

    Bdubb Member
    Banned

    omg homework help!!!

    for (i = 0; i < n; i++)
    printf(&#8220;%d&#8221;, i);

    loop will execute n times

    O(N)
    f(N) = n

    for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
    for (k = 0; k < n; k++)
    printf(&#8220;%d %d %d\n&#8221;, i, j, k);

    above printf will execute n * n * n = n^3 times

    O(n^3)
    f(N) = n^3

    5) O(N)
    6) O(n^3)
     
  5. Unread #3 - Sep 12, 2010 at 6:31 PM
  6. Barz
    Joined:
    May 24, 2010
    Posts:
    753
    Referrals:
    0
    Sythe Gold:
    0

    Barz Apprentice
    Banned

    omg homework help!!!

    wow thx ur the best

    wat u think about that one i jus edited in
     
  7. Unread #4 - Sep 12, 2010 at 6:41 PM
  8. Bdubb
    Joined:
    Nov 1, 2009
    Posts:
    54
    Referrals:
    0
    Sythe Gold:
    0

    Bdubb Member
    Banned

    omg homework help!!!

    4) Determine the big-O notation for each of the following efficiencies:
    a) 5n^5/2 + n^2/5

    O(n^5)

    b) 6log(n)+9n

    O(n)

    c) 3n^4+nlog(n)

    O(n^4)

    d) 5n^2 +n^3/2

    O(n^3)

    I am not sure about these answers. But they should be max defined term based on n
     
< C++ operator overloading | First legit language [ Read ] >

Users viewing this thread
1 guest


 
 
Adblock breaks this site