Computer experiment of data structure (Chapter II) IV
Computer experiment of data structure (Chapter II) III
12. In an incrementally ordered linear table, there are elements with the same value. If the storage method is a single linked list, remove the elements with the same value so that there are no duplicate elements in the table.
void DeleteEle(LinkList &L)
{
LNode* p = L->next, *q;
...
Added by Beatnik on Sat, 01 Jan 2022 00:54:08 +0200
11, Sequential list and linked list
1. Linearity table
linear list is a finite sequence of n data elements with the same characteristics. It is a data structure widely used in practice. The common linear lists are: sequential list, linked list, stack, queue, string A linear table is logically a linear structure, that is, a continuous straight line. However, the physical stru ...
Added by gregzor on Fri, 31 Dec 2021 21:00:37 +0200
LeetCode algorithm problem collection - linked list
Linked list basic algorithm problem
Definition of linked list (java)
//Definition of single linked list
public class ListNode{
int val;
ListNode next; //Point to next node
ListNode(){}; //Nonparametric structure
ListNode(int val){ this.val=val; }
ListNode(int val,ListNode next){ this.val=val; this.next=next; }
}
1. Remove linked list e ...
Added by UQKdk on Fri, 31 Dec 2021 02:53:26 +0200
Data structure: circular linked list to solve Joseph problem
josephus problem
Origin of the problem
It is said that the famous Jewish historian Josephus had the following story: after the Romans occupied jotapat, 39 Jews hid in a cave with Josephus and his friends. 39 Jews decided that they would rather die than be caught by the enemy, so they decided a way of suicide. 41 people lined up in a circ ...
Added by sullyman on Thu, 30 Dec 2021 10:56:13 +0200
Implementing LRU caching mechanism in Java
Force buckle link
Method 1: use LinkedHashMap
public class LRUCache{
int capacity;
Map<Integer, Integer> map;
public LRUCache(int capacity) {
this.capacity = capacity;
map = new LinkedHashMap<>();
}
public int get(int key) {
if (!map.containsKey(key)) {
return -1;
...
Added by bal bal on Wed, 29 Dec 2021 12:00:58 +0200
Algorithm design and analysis -- linked list
A linked list is a data structure in which objects are arranged in linear order. The linear order of the array is determined by the array subscript. However, unlike the array, the order of the linked list is determined by the pointers in each object. Linked list provides a simple and flexible representation method for dynamic sets, and can supp ...
Added by wpsa on Wed, 29 Dec 2021 01:00:44 +0200
Swipe questions and punch in every day on December 24, 2021
Swipe questions and punch in every day on December 24, 2021
Force deduction - one question per day
Sword finger Offer 36 Binary search tree and bidirectional linked list
Enter a binary search tree and convert the binary search tree into a sorted circular two-way linked list. It is required that no new node can be created, and only the node p ...
Added by ow-phil on Tue, 28 Dec 2021 21:04:58 +0200
2021-08-09 design hash set
Design hash set of leetcode daily question
Title Link: https://leetcode-cn.com/problems/design-hashset/
Topic Description: design a hash set without using any built-in hash table library.
Implement the MyHashSet class:
void add(key) inserts the value key into the hash set. bool contains(key) Returns whether the value key exists in the hash ...
Added by Derleek on Mon, 27 Dec 2021 06:29:56 +0200
[Christmas special session] after brushing this set of linked list questions, I laughed when the interviewer took the linked list test
⭐ Introduction ⭐ ️ Hello, I'm Zhijie. I believe you all know the importance of data structure and algorithm. Among them, the linked list is the top priority. Many brothers feel that it is nothing more than a single linked list and a double linked list. It is very simple to add, delete, change and query. Indeed, although the linked list is sim ...
Added by shock on Mon, 27 Dec 2021 05:21:03 +0200
Watching the children play games immediately solved Joseph's problem
preface
★ this is Xiao Leng's blog ‡ see the column for high-quality technical articles The official account of the individual, sharing some technical articles, and the pit encountered. Current series: data structure series Source code git warehouse‘ Data structure code address Code Git warehouse address
Circular linked list ...
Added by swampster on Sun, 26 Dec 2021 08:29:48 +0200