ARTS check-in for the third week, getting better and better

introduction

It’s the third week of study. Anyone who knows Shopkeeper 3 must know that I have been creating technical blogs for 6 years and publish no less than 6 blog posts every month. At the same time, as a developer who loves sharing, activities like ARTS are naturally indispensable to me. Since I plan to share them together, I have done local document recording before, so I can just integrate the content, and then I will start my third week check-in.

Algorithm

This week I want to share an algorithm question that I encountered during an interview. Although I answered it at the time, I personally felt that I didn’t master it well, so I will learn it again this week. The algorithm question is a classic algorithm question from Leetcode: Fibonacci number problem.

The sequence of Fibonacci numbers (usually represented by F(n)) is called the Fibonacci sequence. The sequence starts with 0 and 1, and each subsequent number is the sum of the previous two numbers.

The specific code implementation is as follows:

class Solution {
    public int fib(int n) {
        if(n==0){
            return 0;
        }else if(n==1){
            return 1;
        }else{
            return fib(n-1)+fib(n-2);
        }
    }
}

analyze:

It is implemented using recursion, where the time complexity: O(2^n); the space complexity: O(n), including the space occupied by the system stack that implements recursion in the programming language.

Review

This week I share an English article that I am learning about blockchain. It serves as the "Bible" of the bitcoin blockchain. The English link is Bitcoin: A Peer-to-Peer Electronic Cash System. As the ancestor of the blockchain, the Bitcoin white paper is the "Bible" of the blockchain. Chain's "Bible", I was filled with admiration for Satoshi Nakamoto during the process of analyzing the full text. Share an excerpt from the article below:

The solution we propose begins with a timestamp server. A timestamp server works by taking ahash of a block of items to be timestamped and widely publishing the hash, such as in anewspaper or Usenet post [2-5]. The timestamp proves that the data must have existed at thetime, obviously, in order to get into the hash. Each timestamp includes the previous timestamp inits hash, forming a chain, with each additional timestamp reinforcing the ones before it.

What is explained from this part on is the work done by the miner. A set of data here refers to many transactions, and then this set of data is packaged into a block, and the block is stamped with a timestamp and hashed to ensure the order of time. That is to complete the "ensuring historical order" introduced in Part 2. And because the hash to be obtained is related to the timestamp at that time, this hash marks the time. Because these blocks form a chain, and the growth of blocks is proof of CPU computing power (described later), so because hash->reflects the timestamp->hash is chained together->a new one on the chain The block consumes CPU -> so the previous hash must be correct (the credibility is constantly strengthened).

Technique/Tips

This time I would like to share an important knowledge point about Flutter development. In Flutter development, image uploading and display are also common and necessary operations, especially the operations of setting the avatar information of the APP user and uploading the background image. Uploading and displaying images in Flutter development are also relatively common operations, and there are corresponding components and plug-ins. However, for some extended demand operations, conventional operations cannot meet the needs, so let’s share some commonly used operations in actual business needs. Requirements: Convert the pictures selected from the album to Base64 before displaying them, or display the obtained Base64 pictures. The specific code is as follows:

void _getImage() async{
 
    XFile? file = await ImagePicker().pickImage(source: ImageSource.gallery);
 
    if (file == null) return;
 
    _avataFile = File(file.path);
 
    Uint8List  imageBytes = await _avataFile!.readAsBytes();
 
    String base64 = base64Encode(imageBytes);
 
    String base64Image = "data:image/png;base64," + base64;
 
    print(base64Image);
 
 
}

Share

This time I will share about whether large models are the real silver bullet? This is a problem!

Looking at the actual situation, my point is: large models are not really a silver bullet. While large models perform well on some tasks, they don't solve all problems. Although large models have higher performance and expressiveness, they require huge computing resources and data support, and also face some challenges in practical applications, such as memory usage, inference speed and other issues. At the same time, large models also have some ethical and safety issues that require our attention. Therefore, we cannot rely too much on large models, but must choose the most appropriate tools and methods according to the specific situation.

Conclusion

As I write this, the third week is getting better and better. Generally speaking, I will spend a week's spare time to study these four things respectively. Generally speaking, I will spend some time every day to study these four things respectively, and then I will spend the weekends of the week. To sum up, this method is also quite good. After completing the four things one by one, you can gradually improve your programming thinking, and you can also allow yourself to continue to progress and grow subtly! Let's see you next week!

Guess you like

Origin blog.csdn.net/CC1991_/article/details/133003820