Article directory Introduction Dynamic sequence list structure 1.Head plug function 2.Header deletion function 3.Tail plug function 4. Tail deletion function 5. Search function 6.Insert function 7. Delete function 8. This program contains a total of 4 files, 2 .c files and 2 .h files 8.1 SeqList.h file 8.2 SeqList.c file 8.3 test.h file 8.4 test.c […]
Tag: insert
[Data structure] Linear list (4) Various operations of doubly linked list (insertion, deletion, search, modification, traversal and printing)
Table of Contents The definition of linear tables and their basic operations (sequential table insertion, deletion, search, modification) 4. Linked storage structure of linear table 1. Single linked list 2. Circular linked list 3. Doubly linked list a. Doubly linked list node structure b. Create a new node c. Insert node at the end of […]
Six major algorithms: insertion, Hill, selection, heap sort, quick sort, counting sort
1. Insertion sort What is insertion sort, and what is the principle of insertion sort? Insertion sort is just like drawing a card and inserting it into the appropriate position. Principle of code implementation: for (int i = 1; i < n; i + + ) { int end = i – 1; int tmp […]
c++ does not insert duplicate elements but does not sort them_Top Ten Classic Sorting Algorithms (Animation Demonstration)
Author | Shura God Tang San Source | urlify.cn/bMfUnu 66 sets of Java practical courses from entry to mastery shared 0. Algorithm Overview 0.1 Algorithm Classification The ten common sorting algorithms can be divided into two major categories: Comparison sorting: Determine the relative order between elements through comparison. Since its time complexity cannot exceed O(nlogn), […]
[Data structure] Linear list (3) Various operations of circular linked list (create, insert, search, delete, modify, traverse and print, release memory space)
Table of Contents The definition of linear tables and their basic operations (sequential table insertion, deletion, search, modification) 4. Linked storage structure of linear table 1. Single linked list 2. Circular linked list a. Circular linked list node structure b. Create new node c. Insert a node at the end of the circular linked list […]
20-Data structure-Internal sort-Insertion sort
Introduction: Insertion sorting basically has two steps. First, obtain the insertion position through comparison, then move to vacate the position that needs to be inserted, and finally insert the value. Table of Contents 1. Direct insertion sort 1.1 Introduction: 1.2 Code 2. Half-way insertion sort 2.1 Introduction: 2.2 Code: 3. Hill sorting 3.1 Introduction: 3.2. […]
Why does HashMap need to be inserted first and then expanded to JDK1.8?
We know that the bottom layer of HashMap is composed of arrays, linked lists, and red-black trees. When HashMap is expanded, in addition to expanding the array capacity to twice the original size, the hash value of all elements will also be recalculated, because after the length is expanded , the hash value also changes […]
Heap sort, quick sort, Hill sort, insertion sort, merge sort, selection sort stability and time complexity
Heap sorting: Use binary trees to implement, build a large heap, and select the largest data (root node) each time Time complexity is O(nlogn), unstable Quick queue: Each sorting can determine the position of an element. The general time complexity is O(nlogn) and is unstable One-time sorting: Select a base element, find the small one […]
Single linked list creation, insertion, deletion, search and output
//Create, insert, delete, search, output //Inserting into a singly linked list is not appropriate considering the bit order. //Singly linked list deletion considers whether the bit order is inappropriate and whether the linked list is empty. Deletion must be done by two pointers in tandem. //Singly linked list search considers whether the bit order is […]
Use PyMysql to insert 100,000 pieces of data into the database
import pymysql conn = pymysql.connect(host=’www.litemall360.com’,port=3306,user=’root’, password=’123456′,database=’litemall’,charset=’utf8′) cursor = conn.cursor() sql1 = “INSERT INTO `litemall`.`litemall_goods` (`id`, `goods_sn`, `name`, `category_id`, `brand_id`, `gallery`, `keywords`, `brief`, `is_on_sale`, `sort_order`, `pic_url`, `share_url`, `is_new`, `is_hot`, `unit`, `counter_price`, `retail_price`, `detail`, `add_time`, `update_time`, `deleted`) VALUES ( {}, {}, ‘Mother’s Day Gift-Comfortable Sleep Set’, {}, ‘1001020’, ‘[“http://yanxuan.nosdn.127.net/355efbcc32981aa3b7869ca07ee47dac.jpg\ “, “http://yanxuan.nosdn.127.net/43e283df216881037b70d8b34f8846d3.jpg”, “http://yanxuan.nosdn.127.net/12e41d7e5dabaf9150a8bb45c41cf422.jpg\\ “, “http://yanxuan.nosdn.127.net/5c1d28e86ccb89980e6054a49571cdec.jpg”]’, ”, ‘Safety and […]