Algorithm problem summary

Joseph Ring Joseph Ring was originally applied to the scenario of circular linked list. Because it takes time to build the circular linked list itself, we adopt a faster version of container instead #include<iostream> using namespace std; #include<vector> void JohnCircle(vector<int> arr, int m) { int count = 1; auto it = a ...

Added by skatermike21988 on Thu, 16 Dec 2021 22:06:36 +0200

HashMap source code analysis, Java interview knowledge points

*/ public HashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity); if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; if (loadFactor <= 0 || Float.isNaN(load ...

Added by cmay4 on Thu, 16 Dec 2021 07:38:45 +0200

[data structure] we must win this stack

๐Ÿ˜‰ Blog home page: Unlucky salad ๐Ÿฅ— ๐Ÿ’˜ Welcome to pay attention ๐Ÿ‘ comment ๐Ÿ† follow โญ ๏ธ ๐Ÿƒ Stick together and grow together! โœ๏ธ If there are mistakes in the article or you have better ideas, you can comment and point out, thank you! 0. There are words ahead Learn the order of a data structure: Logical structure - storage stru ...

Added by youknowho on Thu, 16 Dec 2021 06:55:57 +0200

[final examination of data structure experiment] - delete the first largest element and its duplicate node in the single linked list

[final examination of data structure experiment] - delete the first largest element and its duplicate node in the single linked list subject Known single linked list A, write an algorithm to delete the first largest element in the single linked list.Given the single linked list L, write an algorithm to delete its duplicate nodes (only one is ...

Added by saidbakr on Thu, 16 Dec 2021 03:18:45 +0200

LeetCode algorithm learning notes - Day4

Java circular linked list Give you a head node of the linked list to judge whether there are links in the linked list.Returns true if there are links in the linked list. Otherwise, false is returned. LeetCode's friends use the fast and slow double pointer writing method to judge... I don't think it's necessary. It's a little inefficient Let's ...

Added by ruzztec on Thu, 16 Dec 2021 01:04:56 +0200

Data structure - Chapter 2 - stack and queue

Stack Basic concepts A stack is a linear table that only allows insertion or deletion at one end. Important terms: Stack top, bottom, empty stack, last in first out (LIFO) Sequential stack #define MAXSIZE 20 / / define the maximum number of stack elements typedef struct { int data[MAXSIZE]; int top; //Stack top pointer } SqStack; Basi ...

Added by cesy on Wed, 15 Dec 2021 21:09:37 +0200

Implementation of bidirectional circular linked list

1.1 basic introduction The two-way circular linked list is connected end to end based on the two-line linked list (prev of the first node points to the last node, and next of the last node points to the first node). 1.2 add operation 1. Train of thought analysis Head insertion When the entire linked list is empty, add operation. ...

Added by shamil on Wed, 15 Dec 2021 19:12:29 +0200

[JAVA dark horse programmer's notes] III P233-P312 (List, Set, comparator, generics, Map, File, IO stream...)

P233 data structure Stack: data entering the stack model is called pressing stack, and data leaving the stack model is elastic stack. Stack is a last in first out model.Queue: the process of data entering the queue model from the back end is called entering the queue, and the process of leaving the queue is called leaving the queue. Queues are ...

Added by maya28 on Wed, 15 Dec 2021 10:45:48 +0200

Bidirectional linked list implementation

1.1 basic introduction 1. Advantages and disadvantages of one-way linked list For one-way linked lists, the search direction can only be one direction, while two-way linked lists can search forward or backward.A one-way linked list cannot be deleted by itself. It needs to rely on auxiliary nodes, while a two-way linked list can be deleted by ...

Added by kpulatsu on Wed, 15 Dec 2021 09:43:21 +0200

Circular linked list and Joseph Ring problem

Circular linked list One. Establishment of linked list The tail node pointer field of the linked list is NULL For the establishment of circular linked list, the tail node refers to the head node void CreatByRear(LinkList head) { Node*r,*s; char name[20]; int number; r=head; printf("Please enter the student's name and student nu ...

Added by somenoise on Sat, 11 Dec 2021 14:10:09 +0200