How would I calculate an infinite series like this in a loop. 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + etc. The user inputs how far to go like, 1 would be 4, 2 would be 2.667. 3 would be 3.467. How would I account for the fact that there is a + and - that switches?
I need to get input from the user, check the range of the number, then reprint the number to the screen. This is what I have so far
main:
mov ax, 0
mov [sum], ax
beg:
mov eax, 3
mov ebx, 0
mov ecx, chr
mov edx, 3
int 0x80
cmp byte [chr], 0x30
jb e1
cmp byte [chr], 0x39
ja e1...
This is what I have so far for depth
int depth( node * n )
{
int r, l; /* right and left count */
/* early-out if empty */
if( n==0 )
{
/* tree is empty */
return 0;
}
/* initialize to zero */
r=l=0;
/* count max in both directions */
if( n->right )...
I need to write a routine that computes the maximum depth of the tree and run it after each insert and print out the depth. I've tried writing the code but it doesn't print out the depth! Can anyone help??
node *insert(int value, node *n)
{
if (n == NULL)
{
return mkleaf(value) ...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.