problemscpp
A collection of my answers to algorithm problems in c++.
|
#include <leetcode.h>
Public 成员函数 | |
MyLinkedList () | |
Initializes the MyLinkedList object. 更多... | |
void | addAtHead (int val) |
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list. 更多... | |
void | addAtIndex (int index, int val) |
Add a node of value val before the indexth node in the linked list. If index equals the length of the linked list, the node will be appended to the end of the linked list. If index is greater than the length, the node will not be inserted. 更多... | |
void | addAtTail (int val) |
Append a node of value val as the last element of the linked list. 更多... | |
void | deleteAtIndex (int index) |
Delete the indexth node in the linked list, if the index is valid. 更多... | |
int | get (int index) const |
Get the value of the indexth node in the linked list. If the index is invalid, return -1. 更多... | |
Private 属性 | |
ListNode * | head |
ListNode * | tail |
在文件 leetcode.h 第 2694 行定义.
leetcode::design_linked_list::MyLinkedList::MyLinkedList | ( | ) |
void leetcode::design_linked_list::MyLinkedList::addAtHead | ( | int | val | ) |
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list.
在文件 leetcode.cpp 第 7340 行定义.
引用了 head, leetcode::ListNode::next , 以及 tail.
被这些函数引用 leetcode::design_linked_list::TEST().
void leetcode::design_linked_list::MyLinkedList::addAtIndex | ( | int | index, |
int | val | ||
) |
Add a node of value val before the indexth node in the linked list. If index equals the length of the linked list, the node will be appended to the end of the linked list. If index is greater than the length, the node will not be inserted.
在文件 leetcode.cpp 第 7355 行定义.
引用了 head, leetcode::ListNode::next , 以及 tail.
被这些函数引用 leetcode::design_linked_list::TEST().
void leetcode::design_linked_list::MyLinkedList::addAtTail | ( | int | val | ) |
Append a node of value val as the last element of the linked list.
在文件 leetcode.cpp 第 7349 行定义.
引用了 leetcode::ListNode::next , 以及 tail.
被这些函数引用 leetcode::design_linked_list::TEST().
void leetcode::design_linked_list::MyLinkedList::deleteAtIndex | ( | int | index | ) |
Delete the indexth node in the linked list, if the index is valid.
在文件 leetcode.cpp 第 7376 行定义.
引用了 head, leetcode::ListNode::next , 以及 tail.
被这些函数引用 leetcode::design_linked_list::TEST().
int leetcode::design_linked_list::MyLinkedList::get | ( | int | index | ) | const |
Get the value of the indexth node in the linked list. If the index is invalid, return -1.
在文件 leetcode.cpp 第 7328 行定义.
引用了 head, leetcode::ListNode::next , 以及 leetcode::ListNode::val.
被这些函数引用 leetcode::design_linked_list::TEST().
|
private |
在文件 leetcode.h 第 2695 行定义.
被这些函数引用 MyLinkedList(), addAtHead(), addAtIndex(), deleteAtIndex() , 以及 get().
|
private |
在文件 leetcode.h 第 2696 行定义.
被这些函数引用 MyLinkedList(), addAtHead(), addAtIndex(), addAtTail() , 以及 deleteAtIndex().