-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Was having few question regarding following functions:
- Confusing functions name
The following 2 functions name quite confusing:
setNextNode<-function(llist){
llist$nextnode
}
setNextElement<-function(llist){
llist$element
}
The contents in those function were showing the nextnode and element of a linked list node.
Why need use "set" instead of show?
Some more, "showElement" instead of "setNextElement" would be better since it is showing the element?
- Unable to add element
addElement<-function(new, llist)
{
if (isEmpty(llist)) {
llist<-linkedlist(new)
} else
{
llist<-linkListNode(llist, new)
}
llist
}
linkListNode <- function(val, node=NULL) {
llist <- new.env(parent=create_emptyenv())
llist$element <- val
llist$nextnode <- node
class(llist) <- "linkList"
llist
}
From the source code provided, I could not find a function call "linkedlist" ?
If the list is not empty, the previous list become a new element and "new" become next node?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels