# Algorithms And Abstract Data Types - Calculator For Performing Matrix Operations

## Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include<stdio.h>
#include<stdlib.h>
#include"List.h"

// Constructors-Destructors ---------------------------------------------------

// freeNode()
// Frees heap memory pointed to by *pN, sets *pN to NULL.
// Private.
void freeNode(Node* pN){
if( pN!=NULL && *pN!=NULL ){
free(*pN);
*pN = NULL;
}
}

// Creates and returns a new empty List.
List newList(void) {
List L = malloc(sizeof(ListObj));
L->head = L->tail = L->cursor = NULL;
L->cursorIndex = -1;
L->length = 0;
return L;
}

// newNode()
// Returns reference to new Node object. Initializes next and data fields.
// Private.
Node newNode(void* data){
Node N = malloc(sizeof(NodeObj));
N->data = data;
N->previous = NULL;
N->next = NULL;
return(N);
}

// Frees all heap memory associated with *pL, and sets
// *pL to NULL.
void freeList(List* pL) {
if(pL != NULL && *pL != NULL) {
while(x != NULL) {
Node temp = x;
x = x->next;
free(temp);
}
free(*pL);
*pL = NULL;
}
}

// Access functions -----------------------------------------------------------

// Returns the number of elements in L.
int length(List L)
{
if( L == NULL ){
printf("List Error: calling getLength() on NULL List reference\n");
exit(1);
}
return(L->length);
}

// Returns index of cursor element if defined, -1 otherwise.
int index(List L)
{
if(L == NULL)
{
printf("List Error: calling index() on NULL List reference\n");
exit(1);
}
return (L->cursorIndex);
}

// Returns front element of L. Pre: length()>0
void* front(List L)
{
if(L->length > 0)
{
}
else{
printf("List Error: calling front() on an empty List\n");
exit(1);
}

}

// Returns back element of L. Pre: length()>0
void* back(List L)
{
if(L->length > 0)
{
return L->tail->data;
}
else{
printf("List Error: calling back() on an empty List\n");
exit...
\$59.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Computer Science - Other Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.