• Log in or sign up for an account here: https://www.sythe.org/login

omg homework help!!!

Barz

Apprentice
Banned
Joined
May 24, 2010
Sythe Gold
0
Messages
753
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_ */
 
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)
 
omg homework help!!!
for (i = 0; i < n; i++)
printf(“%d”, 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(“%d %d %d\n”, 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)
wow thx ur the best

wat u think about that one i jus edited in
 
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
 
Runescape Gamblingrunescape gambling
Back
Top