Exemple #1
0
/*
addBackList
param: lst the linkedList
param: e the element to be added
pre: lst is not null
post: lst is not empty, increased size by 1
*/
void addBackList(struct linkedList *lst, TYPE e) {
/* FIXME: you must write this */
    assert(lst != 0);
    //Add link before lst->lastLink
    _addLinkBefore(lst, lst->lastLink, e);
}
Exemple #2
0
/*
	addFrontList
	param: lst the linkedList
	param: e the element to be added
	pre: lst is not null
	post: lst is not empty, increased size by 1
*/
void addFrontList(struct linkedList *lst, TYPE e)
{
	_addLinkBefore(lst, lst->firstLink->next, e);
	
}
void addBackList(struct linkedList *lst, TYPE e){
	assert(lst);
	_addLinkBefore(lst, lst->lastLink, e);
}