21 #ifndef SCIRE_struct_linkedlist_HPP
22 #define SCIRE_struct_linkedlist_HPP
24 #include <unordered_map>
39 template<
typename Type,
typename SzType =
int>
54 void Traverse(
void(*travfunc)(
const Type&))
const;
62 SzType
Insert(Type item, SzType location = 0);
77 virtual SzType
Size()
const;
80 virtual bool Add(
const Type& item)
89 virtual Type
Peek()
const;
163 while (
runr !=
nullptr &&
k-- > 0) {
166 if (
k > 0)
return NULL;
168 while (
runr !=
nullptr) {
191 while (
node !=
nullptr) {
203 while (
node !=
nullptr) {
215 if (
nullptr ==
node) {
248 if (
this->
IsEmpty())
return false;
283 if (
this->
IsEmpty())
return false;
298 if (
cur->
next ==
nullptr)
return false;
315 if (
this->
IsEmpty())
return false;
Node(const Type &newitem, Node *nextNode)
pointer to next item
bool Remove(const Type &item)
remove first item in the linked list that matches passed item.
const Node * Head() const
virtual SzType Size() const
number of elements contained in
SzType Insert(Type item, SzType location=0)
insert a new item in the list with passed item after location nodes
Node * head
points to first item of the list
scire/graph/gale_shapley.hpp
const Type & Item() const
void Traverse(void(*travfunc)(const Type &)) const
Traverse each item of the list.
SinglyList()
initialize a SinglyList object, with head pointing to nullptr
virtual ~SinglyList()
finalize a SinglyList object by deleting all items from the list
represent an item node in Singly Linked List
virtual Type Peek() const
peek into next element contained in
bool RemoveAt(SzType location=0)
remove the item at location
SzType size
track count of items in the list
virtual bool Add(const Type &item)
add an element
friend bool IsBST(const BinaryTree &tree, Type min, Type max)
Node * next
item at this node
virtual bool Deduce()
deduce one element
A Singly Linked List class.