mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-12 15:36:05 +00:00
Add dart chapter_computational_complexity (#363)
* add dart chapter_array_and_linkedlist * update my_list.dart * update chapter_array_and_linkedlist * Update my_list.dart * Update array.dart * Update file name * Add chapter_computational_complexity * Add chapter_computational_complexity * add space_complexity class and format code * remove class --------- Co-authored-by: huangjianqing <huangjianqing@52tt.com> Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
* Author: Jefferson (JeffersonHuang77@gmail.com)
|
||||
*/
|
||||
|
||||
import '../utils/ListNode.dart';
|
||||
import '../utils/PrintUtil.dart';
|
||||
import '../utils/list_node.dart';
|
||||
import '../utils/print_util.dart';
|
||||
|
||||
|
||||
class LinkedList {
|
||||
/* 在链表的结点 n0 之后插入结点 P */
|
||||
@@ -62,15 +63,15 @@ int main() {
|
||||
n3.next = n4;
|
||||
|
||||
print('初始化的链表为');
|
||||
PrintUtil().printLinkedList(n0);
|
||||
printLinkedList(n0);
|
||||
|
||||
/* 插入结点 */
|
||||
LinkedList().insert(n0, ListNode(0));
|
||||
PrintUtil().printLinkedList(n0);
|
||||
printLinkedList(n0);
|
||||
|
||||
/* 删除结点 */
|
||||
LinkedList().remove(n0);
|
||||
PrintUtil().printLinkedList(n0);
|
||||
printLinkedList(n0);
|
||||
|
||||
/* 访问结点 */
|
||||
ListNode? node = LinkedList().access(n0, 3);
|
||||
|
||||
Reference in New Issue
Block a user