Sword finger offer day10-day13

Sword finger Offer 46. Translate numbers into strings Title: Given a number, we translate it into a string according to the following rules: 0 into "a", 1 into "b", 11 into "l", and 25 into "z". A number may have multiple translations. Please implement a function to calculate how many different translat ...

Posted by fred2k7 on Mon, 18 Oct 2021 11:26:55 -0700

Python implementation bubble_ Select_ Insert_ Quick Sort Method

Python implements multiple sorting methods Bubble sort Overview and Principle Bubble Sort is a basic sorting algorithm. Bubble sorting compares two adjacent elements in the list in turn, replacing the order of the adjacent elements according to the sorting method. To reach the beginning of the list after a round of comparison, make the large ...

Posted by Scip on Mon, 18 Oct 2021 09:58:53 -0700

⭐ Introduction to Algorithms ⭐ Binary Enumeration Simple 14 - LeetCode LCP 28. Purchasing Scheme

1. Title 1. Title Description _Xiaoli will n n Quotations for n parts are stored in an array n u m s ...

Posted by hakmir on Mon, 18 Oct 2021 09:01:36 -0700

Solution to CCPC trial of Software College

preface The problem solution is a little crude. It will be updated and optimized slowly later. Make do with it first. If you have any questions, just say them directly in the group or in the comment area. 7-1 primary school topics For rounding, just judge the last decimal place. Examine the processing of strings. You can also use long double ...

Posted by public-image on Sun, 17 Oct 2021 19:30:41 -0700

Sword finger offer -- the nearest common ancestor of the binary tree (binary search tree + binary tree with pointer to parent node + ordinary binary tree)

Give you a binary tree and two nodes in the binary tree, and find the nearest common ancestor of the two nodes. Nearest common ancestor: "for two nodes p and q with root tree root, the nearest common ancestor is expressed as a node a, which satisfies that a is the ancestor of p and q, and the depth of a is as large as possible (a node can ...

Posted by surfinglight on Sun, 17 Oct 2021 10:22:11 -0700

2021-10-14 Swordfinger offer 2:37~48 Topics + Thoughts + Multiple Solutions

Write before This article uses python as the programming language and the author practices it by himself. The list of topics is: Swordfinger Offer (2nd Edition) ""Swordfinger Offer (2nd Edition)"passes through the world's classic secrets for programmer interviews. Analyse typical programming interviews, collate the basic kno ...

Posted by Journey44 on Sun, 17 Oct 2021 09:42:20 -0700

Initial order of data structure: algorithm complexity

Algorithm complexity Complexity concept The running time of the program needs to consume certain time resources and space (memory) resources. Therefore, the quality of an algorithm is generally measured from the two dimensions of time and space, namely time complexity and space complexity. Time complexity mainly measures the running ...

Posted by robvan75 on Sat, 16 Oct 2021 12:04:47 -0700

Algorithm - delete duplicates in the sorting array [2021-10-16]

2. Delete duplicates in the sort array 2.1 Title Description Given a sort array, you need to   In situ Delete the repeated elements so that each element appears only once, and return the new length of the array after removal. Do not use additional array space, you must In situ   Modify the input array and do it with O(1) extra spac ...

Posted by [e]r!k on Sat, 16 Oct 2021 10:40:21 -0700

Eight Sorting Algorithms

  Classification: 1. Bubble sorting: (Average time complexity: O(n^2)) 1. Basic idea: By comparing the values of adjacent elements from front to back in the column to be sorted, and then exchanging them in reverse order, the larger elements move forward and backward gradually, rising up like bubbles under water. Each round of sorting wil ...

Posted by ukspudnie on Sat, 16 Oct 2021 09:49:41 -0700

Post office location problem -- divide and conquer algorithm -- Java implementation

Problem Description: In a city divided into regular blocks according to the east-west and North-South directions, n settlements are scattered in different blocks. The east-west direction is represented by X coordinate and the north-south direction is represented by Y coordinate. The location of each residential area can be represented by coord ...

Posted by gravedig2 on Sat, 16 Oct 2021 01:26:09 -0700