close

MOST POPULAR

Sorry, Posts you requested could not be found...

MOBLIE

Sorry, Not enough posts for this block, please add more posts...

APPLICATIONS

Sorry, Not enough posts for this block, please add more posts...

- Advertisement -
DailyTechWorld

LATEST REVIEWS

Editors' Take

Sorry, Posts you requested could not be found...

Sorry, Posts you requested could not be found...

- Advertisement -
DailyTechWorld

THE LATEST

Others

The Uneven Distribution of Blockchain Digital Technology and the Arrival of New Futures

Blockchain is a term in the field of information technology. In essence, it is a shared database. The data or information stored in it has the characteristics of “unforgeable”, “full trace”, “traceable”, “open and transparent”, and “collective maintenance”. Based on these characteristics, blockchain technology has laid a solid foundation of “trust”, created a reliable “cooperation” mechanism, and it has a broad prospect in application.

In general, blockchain is a decentralized distributed ledger database. The advantage of this distributed ledger is that buyers and sellers can directly trade without any intermediary. Everyone has a backup, even if you have something lost in the ledger, it doesn’t matter much.

If you have a ledger at home, your parents will give you the salary and let you record it on the ledger. You misappropriated a dozen yuan privately because of gluttony, and others don’t even know. But the way to solve the problem with blockchain is that the whole family mobilizes to keep accounts. Not only you are doing so, but your father, mother, brother, sister, younger brother, sister, etc. It cannot be changed, nor can anyone else.

Blockchain is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain technology has been widely used in different industries. Such as product traceability, copyright protection and transaction, payment and settlement, Internet of Things, digital marketing, medical care, etc.

With the continuous application and development of blockchain and people’s in-depth research on blockchain technology, the current problems in blockchain continue to emerge, mainly including:

  • 1. The throughput efficiency of the blockchain is low.
  • 2. Energy consumption and computing power are too concentrated.
  • 3. The time for block confirmation lasts too long.

These uneven or imbalanced problems have severely restricted the development of the blockchain, and it is necessary to continuously explore and alleviate or solve the corresponding problems to expand the application of the blockchain.

Taken BITCOIN-NG by itself, it does but seems to be what it is not, it looks like a kind of blockchains at a distance, but it is detected by close analytics ,and as time goes on, people find it unbelievable , unreality and imbalanced.

For instance, it takes 10 minutes or more to confirm the transaction. The average transaction rate is about 4 transactions per second, and the maximum can reach 7 transactions. This shows the limitations of the current blockchain throughput. At the same time, the BITCOIN-NG block also has security issues.

Firstly, the wallet security issues: the existence of polluting transactions makes it possible for the leader’s private key to be obtained reversely.

Secondly, DOS attacks: Malicious Leaders can carry out DOS attacks by not processing transactions in micro blocks. Although the influence of the previous attack will be eliminated after the next Leader is elected, the 51% computing power attack and equivalently when combined with eclipse attacks, it will still bring to a greatly harmful conclusion.

The third, bifurcation problem: BITCOIN-NG exists in the process of forking the key block, which can only be solved when the next key block is generated and the duration is longer than that of in the micro block.

Energy consumption and concentration of computing power are another drawbacks in the Bitcoin consensus mechanism. The reason is that with the continuous advancement of CPU technology, the computing power of computers has increased geometrically. As the total amount of Bitcoin remains unchanged (21million), then you have to increase the difficulty of mining. In order to ensure the stability of Bitcoin’s block production speed, the PoW mechanism can only obtain the right to bookkeeping through violence, which is the most energy-consuming method, thereby increasing energy consumption.

At the same time, the development of technology and people’s profitability have led to the development of mining machines specifically for mining, and since then a special mining pool has been formed. The computing power is also concentrated on individual organizations and individuals, which makes it easier to form 51% attacks, thereby increasing the security risk of Bitcoin.

In the blockchain, from the customer’s perspective, the current more serious problem is the long confirmation time of the blockchain. In order to ensure that the transaction is not tampered with, the blockchain generally waits for the confirmation of multiple blocks. Bitcoin realizes that when the opponent controls 10% of the computing power, the probability of error is less than 0.1 %at the time when the 6 blocks are confirmed, and the average Bitcoin block interval is as long as 10 minutes. For transaction security, we have to wait at least 60 minutes, which is unimaginable in the daily transaction system.

Therefore, whether users want to borrow cycles from the servers deep in the forests of Oregon or the users high on the mountains of Guizhou, they have to think about the throughput rates, energy consumption, time wasted and security in supply chains. If the above mentioned three imbalanced barriers cannot be broken through, the new futures in data exchanges cannot be accomplished.

Don’t exaggerate or be superstitious about blockchain functionality. Industry practice over the years has proven that some blockchain application directions are not feasible. In particular, the modern financial system in the development process of continuous absorption of various technological innovations. Technological innovation will be integrated into the financial system as long as it helps to improve the efficiency of financial resource allocation and the security and convenience of financial transactions. Up to now, no technological innovation has had a disruptive impact on the financial system, and blockchain is no exception. Cryptocurrency supply is inflexible, lacks in-house value support and sovereign credit guarantee, can not effectively perform monetary functions, can not subvert or replace flat money. The anonymity of blockchain instead makes it more difficult to implement anti-money laundering (AML) and “know your customer” (KYC) in financial transactions.

Blockchain applications should be based on the actual situation, not tied to some overly idealized purposes. For example, it is very difficult to replace institutions and trust with technology, and in many scenarios, it is even utopia. For example, de-centralization and centralization have their own applicable scenarios, there is no advantage or disadvantage. In reality, completely centralized and completely centralized scenes are rare. Many blockchain projects start with the purpose of centering, but later more or less introduce a centralized component, otherwise, it will not be able to land. For example, out-of-block information is written into the blockchain, often requiring a trusted centralization mechanism, which is not possible.

At present, the blockchain investment and financing bubble is obvious, speculation, market manipulation, and even illegal behavior is common, especially involving public offerings of Token projects. Relevant government departments should strengthen supervision to guard against financial risks.

Application and analysis of blockchain in the field of securities and futures

Whether it is applied to the management of innovative financial assets and non-financial assets in the global market, or applied to financial supervision and financial risk prevention, blockchain technology is driving changes in the financial industry landscape and building a new type of information and value exchange network.

Blockchain, also known as distributed ledger technology, is the underlying technical framework of Bitcoin and other virtual currencies. Blockchain integrates technologies such as distributed storage, point-to-point transmission, consensus mechanism, and encryption algorithm. It is a multi-disciplinary and cross-field comprehensive innovation.

In a narrow sense, a blockchain is a chained data structure of data blocks organized in chronological order, supplemented by an immutable and undeniable distributed ledger guaranteed by cryptography and other principles. Broadly speaking, blockchain is a value exchange network that uses cryptography, consensus mechanisms, smart contracts, etc. to realize data transmission and access, generation and update, programming and operation, and ultimately completes the transfer of information and capital flows.

In the short term, the application of blockchain in the field of securities and futures faces many challenges. On the one hand, there are uncertainties in laws, regulations and regulatory policies. Once blockchain technology is widely used in the financial industry, it will pose challenges to existing laws, regulations and regulatory frameworks. Therefore, more and more domestic and foreign government agencies and financial regulatory agencies have incorporated blockchain into their regulatory systems.

On the other hand, the blockchain technology itself has yet to be improved. In the actual use of the blockchain system, there may be problems such as node manipulation, transaction privacy leakage, and the centralization of the identity authentication mechanism.

In the long run, the characteristics of blockchain, such as multi-center, non-tamperable, safe and reliable, and privacy protection, are closely integrated with financial business pain points, and will become a key underlying infrastructure in the future. Whether it is applied to the management of innovative financial assets and non-financial assets in the global market, or applied to financial supervision and financial risk prevention, blockchain technology is promoting changes in the financial industry structure and building a new information and value exchange network.

Application exploration of blockchain in the field of securities and futures

The current structural feature of the securities and futures market is that it requires an authoritative third-party agency, information intermediary or central counterparty as a guarantee to help market participants realize the value exchange of assets and rights. As a cross-disciplinary innovation paradigm, blockchain can realize the transformation of the network from centralized trust to weak centralization and multi-centralization with the help of its multi-party consensus mechanism and non-tampering characteristics. It can also bring about “transaction is clearing”. Efficiency improvement.

(1) Transactions in the field of securities and futures

As an emerging business, the domestic over-the-counter derivatives business faces many problems while developing rapidly. Among them, there are two main pain points: one is the high credit risk, and the other is the lack of inter-agency trading market.

With the help of blockchain technology, an over-the-counter trading platform can be built to connect a large number of scattered customer resources in various markets. Buyers and sellers can query performance information and lock trading opportunities as long as they analyze the transaction data of the ledger on the node.

With the help of smart contracts on the blockchain over-the-counter trading platform, institutions can broadcast to the entire network when there is a demand for quotations, or obtain transaction quotations on the blockchain in real time, and automatically execute them according to the conditions agreed in the contract; When the contract calculates that the credit risk of the counterparty reaches the pre-warning line, it will automatically alert the institutions involved in the transaction.

(2) The securities and futures field of blockchains

1. Futures brokerage business contract management

Futures companies have strong demand for electronic contracting for brokerage and non-brokerage businesses. The use of blockchain technology to build an electronic contract platform for futures brokerage business will help to combine the life cycle of electronic contract with the characteristics of multi-centrize, non-tamperable and traceable features of blockchain, and open up a series of processes such as authentication, contract formation, flow, signing, filing and legal dispute response, so as to reduce the signing and management costs of futures brokerage business, improve the efficiency of signing and promote the infrastructure construction of the futures industry.

2. The electronicization of private equity

At present, the equity of unlisted companies is often proved by agreement, asset certificate or paper securities. Blockchain can replace paper documents as electronic carriers of private equity, regulate the registration and circulation of such securities, and ensure that there is no possibility of human tampering in the process.

In June 2015, Nasdaq and blockchain start-up Chain established a partnership to use the blockchain platform Linq for the issuance and transfer of private equity. In December 2015, NASDAQ reported the use of Linq to complete and record the first private equity transaction. The first transaction was for Chayn, which digitally identified and recorded private equity.

With blockchain security, transparency, non-tamperability, and ease of traceability, NASDAQ has improved its private equity record and its history of changes to make equity registration more efficient and credible. Start-ups can achieve paperless, compliant and standardized securities registration without relying on third-party public trust.

 (3) Other applications in the field of securities

In addition, blockchain has many other applications in the field of securities and futures. For example, in 2016 the Abu Dhabi Stock Exchange (ADX) launched blockchain voting services, in 2017 JPX published a study on the use of blockchain concept testing in the KYC (Know Your Customer) process, and several domestic exchanges have conducted high-performance alliance chains with market institutions on topics such as main board securities bidding, blockchain application security management, and the use of blockchain technology to build warehouse order systems.

In summary, blockchain is reshaping the basic framework of the financial industry, accelerating the innovation and iteration of securities and futures businesses and products, improving the efficiency of capital markets before, during and after trading, and promoting the upgrading of exchange infrastructure.

 (4) Blockchain in the field of securities and futures development

 (a) Aim at the pain points and keep the first things first

As an important fintech technology, blockchain system research and development should be carried out for the purpose of service business, combining business pain points and business scenarios. The practical experience of domestic and foreign exchanges shows that it is necessary to study blockchain platforms, such as shareholder voting, private equity transactions, settlement, etc., which meet the functional and non-functional needs of their own or industry applications, in order to maximize the characteristics and advantages of blockchain.

(b) Step by step and carefully seek the practical approach.

Blockchain technology is still immature at this stage, although there are many platforms on the market, but they are still in the process of evolution and iteration. In 2015, the UK pioneered the “regulatory sandbox” system. Financial core institutions and regulators may consider using this model to build a “fintech sandbox”.

In a controlled environment, POC verification of innovative technologies such as blockchain is carried out. On the one hand, fintech operators can report frequently to regulators and are subject to review and supervision at any time, and on the other hand, regulators and fintech operators can more effectively assess the true impact of the new system. It is worth mentioning that the POC allows failure to avoid further losses for the next project. From this point of view, POCs and sandboxes are an insurance measure.

(c) It is the stone from another mountain, which can burnish the jade.

Financial core institutions such as exchanges should be open and inclusive to innovative fintech such as blockchain. In the current industry mature application cases less, research accumulation is less, actively explore open and shared cooperative research model, cooperation with specialized blockchain technology companies, integration of technology companies’ technical capabilities and core institutions of resource data advantages, jointly promote blockchain technology research, the formation of a conducive to the domestic securities and futures industry security and efficient development of technology research and application of landing results.

read more
Entertainment

Top Ten High-Scoring Sci-Fi Animation Works, How Many Have You Seen?

Science fiction works can often bring us different feelings and let us enter a world full of magical imagination. It not only brings us unlimited imagination, but also causes reflection on reality and thinking about the future. In addition to having breadth and depth, the works of science fiction can often gain many fans.

With the popularity of science fiction movies such as “Inception” and “Tenet”, many people pay special attention to science fiction themes, and naturally, they also pay attention to science fiction animation. After all, in anime, there are many sci-fi masterpieces, especially some of the fine sci-fi works, which are even more fascinating. Let’s sum up ten excellent sci-fi animation works, how many have you seen?

10.Doraemon

When it comes to science fiction animations, Doraemon is the one that has to be mentioned. As a science fiction comedy animation, it describes a cat-shaped robot from the 22nd century returning to the 20th century, with the help of various future props taken out of the four-dimensional pocket, to help Nobi to solve the various difficult problems around him.

This work is almost everyone’s childhood memories, and its theme song has also been adapted into various languages, with a high degree of vocalization, which shows the importance of this early science fiction animation in the hearts of the audience.

9.WALL·E

In 2805, human civilization was highly developed, but the earth was no longer suitable for human habitation due to the massive increase in pollution and domestic waste. The people on earth were forced to leave their hometown in a spacecraft for a long and boundless journey into the universe. Before leaving, they entrusted Buynlarge’s company to clean up the earth’s garbage, and the company developed a robot named WALL·E to take on this important task.

These robots work hard day after day and year after year according to the procedures, but with the passage of time and the erosion of the harsh environment, the WALL·Es have been damaged and stopped moving. In the end, only one is still working on this seemingly endless work. After a long time, it began to have its own consciousness. Later, after WALL·E met and fell in love with the robot Eva, it followed Eva into space adventures.

In addition to the love theme of the film, the film is generally regarded as satirizing some lifestyles, including obesity, environmental destruction, consumerism, leadership and other issues.

8.Rick and Morty

Rick and Morty is an American animated science fiction sitcom created by Justin Roiland and Dan Harmon. It tells the story of the genius Frankenstein’s grandfather taking his grandson on various crazy adventures. Every time you watch an episode of this animation, you will involuntarily marvel at the direction of the plot.

Moreover, each episode is an independent story, telling different topics. This science fiction animation is not only rich in plot, but also pays tribute to some classic TV movies from various angles. The most important thing is that there are all kinds of irony to reality and rich imagination of science fiction.

For example, there is an episode called Battery Universe. This episode has very rigorous logic, imaginative plot, and well-controlled time rhythm. It explains the meaninglessness of life and the slavery of a certain meaning. When the scientist of the universe discovers that he is just a battery, it means that he and the battery he developed are just tool people. The profound themes of this episode can’t help but trigger human thinking and reflection on technology and human nature.

7.Ghost In The Shell

The most special thing about “Ghost in the Shell” is its richness. Whether it’s story setting, character creation, visual performance, and theme elaboration, you can have many ways to enter the story. Reading and understanding this animation from any angle, it can shine with a different light, which is intriguing.

In this work, the future is connected with the network system. Because of the advanced technology in the future, it will become common for machinery to replace human organs. This has also led to a very close connection between humans and the Internet.

In this environment, some special forms of crime have begun to appear. In order to solve these crimes, a special operation team Ghost in the Shell was established. This work not only describes crime, but also considers the relationship between humans, machines, and the Internet. This also allows humans to constantly reflect on whether there will be a direct link between the human brain and the network in the future, or whether the network will replace humans.

6.Cowboy Bebop

This is an epoch-making Japanese science fiction animation carefully created in the late 1990s. In 2071, with the realization of super-light-speed navigation technology, human beings can easily move within the solar system. However, due to design errors, this technology triggered the explosion of the moon, and countless lunar debris was attracted to the earth, causing unprecedented Catastrophe. The surviving humans fled the earth and began to build homes across the solar system.

Due to this disaster, the national government and other power institutions are extremely unstable, and public security issues have become a problem. Some organizations have begun to allow individuals to catch wanted criminals in exchange for bonuses. So, four people and one dog got together and roamed in space.

In this animation, various cultural symbols from different countries are blended and become a highly influential sci-fi work.

5.Mighty Atom

Mighty Atom is regarded as one of Japan’s most famous sci-fi comics. The work has been adapted into animation many times. Among them, the first television animation of the 1963 version was Japan’s first television serial animation, which became a sensation in Japan once it came out. This smart, brave, and righteous little robot is almost everyone’s favorite.

As the first domestic TV series animation in the true sense, this animation has been broadcast on TV for four consecutive years, setting and maintaining an unprecedented high rating.

4.Attack on Giant

There are many sci-fi amines, and the Japanese sci-fi anime “Attack on Giant”, which was popular after 2000, occupies an important position. The story takes place in 743 when the world’s natural enemy “giant” suddenly appeared in the world. Humans and their mothers were swallowed by giants.

 With unspeakable hatred and hatred for the giants, he vowed to kill all the giants and join the investigative corps to launch revenge. The animation-derived movies, games, and TV series are all very popular.

3.Psycho-Pass

Psycho-Pass sets the background in the future. Everyone lives in a world controlled by a network system. Everything in this world can be foreseen. A person’s emotions, personal abilities, desires, and psychology can all be expressed in the form of data. So according to the system, a person’s life can be arranged. From what industry you enter and do, or what your partner is like, are arranged according to the system.

Under this system, even crimes can be predicted in advance, because a person’s emotional and psychological fluctuations will manifest as numerical value. In such a general environment, there are special police officers who maintain order, and such police officers will exist as a combination of executive officers and surveillance officers. Such a science fiction animation tells a possible future. We don’t know whether our future world will have such a system.

2.Love, Death&Robots

This is a collection of animated short films, covering many types and forms. Each episode of the short film has a different director and a different subject, including fantasy, science fiction and horror. It shows what a state-of-the-art animation product should look like. Many of the stories have adopted the most imaginative forms of expression. Both content and form make it a unique work.

In general, “Love,Death&Robots” is a very interesting work. It is worth watching whether it is a hardcore anime fan or an audience interested in media innovation.

1.Paprika

This work tells the story of a doctor working in a psychiatric research institute and working with a genius scientist to invent an instrument “DC MINI” that can monitor and change the dreams of patients.

 

This work is not only sci-fi, but also a bit more brainstorming. It seems that this is an anime that is difficult to understand. But in fact, this work mainly talks about the alternation of human dreams and reality.

read more
ReviewTech

Computer Screen Recording Software And Mobile Screen Recording Software

Screen recording software is a tool that you don’t use all the time, but you don’t know where to start when you need it. Which screen recording tool should I choose? When we try to download screen recording software from various platforms, we will find that there are various problems.

  • Recording time limit
  • Advertising is outrageous
  • Poor recording quality

Earlier, a classmate once asked me “Can you recommend several screen recording software?”

Time has passed for a while, and I just need to record some simple video tutorials in the near future, so I have been in the past few months Pay attention to and try out different screen recording software. Today, I will introduce several good screen recording software. You can choose the one that suits you.

1. Captura

If only one screen recording software is recommended, then I would definitely choose Captura.

Captura is a free and open source screen recording tool that can record any area and window on the screen into a video, and you can choose whether to display the mouse, record mouse clicks, keyboard keys, and sounds.

Captura in the video settings, select the recording area, video encoder, frame rate and quality. Above the video, you can see icons such as mouse and finger. Their activation state can determine whether the video will display information such as the mouse, mouse click traces, and pressed keyboard keys.

Captura can meet the needs of most people for screen recording, and can meet most screen recording scenes. It mainly has the following software functions:

  • Voice recording
  • Define cursor
  • Language support Chinese
  • Recording picture quality, clear sound quality
  • Ability to quickly save recorded videos
  • Support screenshot
  • Open source and free
  • Unlimited time
  • Support compact mode
  • Can automatically identify the window, support custom selection of the screen recording area

Also need to add, this powerful screen recording tool installation package is less than 4M, very lightweight, and easy to use. Let’s take a look at a video recorded using Captura.

2. oCam

oCam is a universal camera intended to record a live computer screen. It can be used during situations such as tutorials, troubleshooting a website or sharing a presentation with others via an online webinar. Other common functions include recording videos directly off of popular websites such as YouTube. There is no charge to use this software package.

oCam is a streamlined version of more complicated screen-recording software. It can be a viable alternative for those who may have been looking for a no-frills package that still offers many of the same functions associated with complicated systems.

All recordings can be initiated and terminated with the click of a button and dragging the mouse icon allows the user to resize a specific image. This can be beneficial when recording smaller videos or when only capturing a portion of the page.

All files are immediately saved to the hard drive after recording has stopped.

3.OBS Studio

I think that the 2 screen recording tools introduced above should be able to meet the needs of most students. However, some students will have following questions:

What about macOS/Linux users?

What if the simple screen recording function is not enough to meet the complex demand scenarios?

Then OBS studio should be able to answer these two questions.

OBS studio is an open source and free screen recording tool, and supports following 3 major operating systems at the same time.

  • Windows
  • macOS
  • Linux.

In addition, it also has following rich and powerful features,

  • Multi-source scene
  • mixer
  • Rich configuration items, flexible customization

Of course, Personally speaking, although OBS studio is powerful, I don’t use many functions, so I feel a little cumbersome. I prefer to choose oCam or Captura.

Different people have different needs and scenarios, so, here is an option for you to choose the OBS studio.

4. EV Screen Recorder

EV Screen Recorder is a screen recording tool that integrates screen recording and online live broadcast. It supports video transcoding and supports 1080p video quality recording. In addition, it supports the following 3 platforms respectively:

  • Android
  • windows
  • macOS

Therefore, if your mobile phone does not have the screen recording function, you can try EV screen recording.

But it should be pointed out that the EV screen recording tool is not completely free. It is divided into ordinary users and VIP users, and ordinary users support recording for 5 minutes. Of course, I think this is enough for many mobile phones screen recording.

5. ScreenToGif

I’ve been using this tool for a long time, it’s time to recommend this powerful recording tool.

ScreenToGif supports output video formats, but this is not the reason why I like this tool. what attracts me the most is the powerful GIF recording and editing function.

In the process of sharing articles for more than a year, sometimes it is necessary to animate some content. GIF is the best way. In this process, I tried many GIF tools, but in the end I chose ScreenToGif.

It supports custom windows, drawing boards and other functions in GIF recording. In addition, it is also very powerful in GIF editing, skipping frames, deleting similar frames, inverting, zooming, and modifying output quality.

It has the following main features:

  • Record the designated area of ​​the screen and save it directly as a gif animation file
  • Click to pause or resume recording
  • You can choose the recording area by yourself
  • You can continue to run other applications or windows during the recording process
  • You can delete the border
  • Choose a folder to save the file or save the file directly to the desktop;
  • Can add a system cursor to the recording file;
  • It is an .exe file, which takes up little space and is very portable;
  • Use the F key to start/pause or stop recording.

At present, there are many requirements for screen recording on mobile and computer terminals, and many software emerge in endlessly. This article analyzes the advantage and disadvantage of some screen recording software from different angles. I hope you can choose the screen recording software that suits you.

read more
TechTutorial

How To Program Selection Sorting And Bubble Sorting

This chapter introduces the basic concept of selection sorting and bubble sorting. In the programming content of sorting, the most famous is undoubtedly selective sorting and bubble sorting. Today, let us look at the specific code implementation of these two sorting schemes.

1. Selection Sorting

The idea of sorting by selection method:

Compare the first place with all the others, as long as it is smaller than the first place, move to the first place.

After the comparison, the first place is the smallest.

Then compare the second place with all the rest, as long as it is smaller than the second place, then switch to the second place.

After the comparison, the second place is the second smallest and so on.

The specific code is as follows:

public class sort {

            public static void main(String[] args) {

                        int a [] = new int[]{10,30,20,50,40};

                        //Before sorting, print out the content

                        for (int i = 0; i < a.length; i++) {

                                    System.out.print(a[i] + ” “);

                        }

                        System.out.println(” “);

                        //Selection order

                        //Step 1: Compare the first bit with all other bits

                        //If it is found that the data in other locations is smaller than the first one, exchange it

                        for (int i = 1; i < a.length; i++) {

                                    if(a[i]<a[0]){  

                                                int temp = a[0];

                                                a[0] = a[i];

                                                a[i] = temp;

                                    }

                        }

                        //Print out the content

                        //It can be found that the smallest number is at the top

                        for (int i = 0; i < a.length; i++) {

                                    System.out.print(a[i] + ” “);

                        }

                        System.out.println(” “);

                        //Step 2: Compare the second bit with all the remaining bits

                        for (int i = 2; i < a.length; i++) {

                                    if(a[i]<a[1]){  

                                                int temp = a[1];

                                                a[1] = a[i];

                                                a[i] = temp;

                                    }

                        }

                        //Print out the content

                        //It can be found that the penultimate number is in the second position

                        for (int i = 0; i < a.length; i++) {

                                    System.out.print(a[i] + ” “);

                        }

                        System.out.println(” “);              

                        //Can find a pattern

                        //The moving position is gradually increased from 0

                        //So you can put a layer of loop on the outside

                        for (int j = 0; j < a.length-1; j++) {

                                    for (int i = j+1; i < a.length; i++) {

                                                if(a[i]<a[j]){  

                                                            int temp = a[j];

                                                            a[j] = a[i];

                                                            a[i] = temp;

                                                }

                                    }

                        }

                        //Prent out the content

                        for (int i = 0; i < a.length; i++) {

                                    System.out.print(a[i] + ” “);

                        }

                        System.out.println(” “);              

            }

}

The final output of the console:

2. Bubble Sorting

The idea of bubbling sorting:

The first step: starting from the first digit, compare the two adjacent ones.

If it is found that the former is larger than the latter, the larger data is exchanged at the back. After the cycle comparison is completed, the last bit is the largest.

Step 2: Do it again, but don’t compare the last digit and so on.

The specific code is as follows:

public class sort {

    public static void main(String[] args) {

        int a [] = new int[]{10,30,20,50,20};

        //Before sorting, print out the content

        for (int i = 0; i < a.length; i++) {

            System.out.print(a[i] + ” “);

        }

        System.out.println(” “);

        //Bubble sort

        //The first step: starting from the first digit, compare the two adjacent ones

        //If it is found that the front is larger than the back, then the big data is exchanged at the back

        for (int i = 0; i < a.length-1; i++) {

            if(a[i]>a[i+1]){  

                int temp = a[i];

                a[i] = a[i+1];

                a[i+1] = temp;

            }

        }

        //Print out the content

        //It can be found that the biggest is at the end

        for (int i = 0; i < a.length; i++) {

            System.out.print(a[i] + ” “);

        }

        System.out.println(” “);

        //Step 2: Do it again, but don’t compare the last digit

        for (int i = 0; i < a.length-2; i++) {

            if(a[i]>a[i+1]){  

                int temp = a[i];

                a[i] = a[i+1];

                a[i+1] = temp;

            }

        }

        //Print out the content

        //It can be found that the penultimate is in the penultimate position

        for (int i = 0; i < a.length; i++) {

            System.out.print(a[i] + ” “);

        }

        System.out.println(” “);       

        //You can find a pattern

        //The back boundary is shrinking

        //So you can put a layer of loop on the outside

        for (int j = 0; j < a.length; j++) {

            for (int i = 0; i < a.length-j-1; i++) {

                if(a[i]>a[i+1]){  

                    int temp = a[i];

                    a[i] = a[i+1];

                    a[i+1] = temp;

                }

            }

        }

        //Print out the content

        for (int i = 0; i < a.length; i++) {

            System.out.print(a[i] + ” “);

        }

        System.out.println(” “);       

    }

}

The final output of the console:

3. Exercise-Sort

First create an array of length 8 and fill it with random numbers.

First use the selection method to sort.

Then use the bubble method to sort it backwards.

The specific code is as follows:

public class sort {

    public static void main(String[] args) {

        int a[] = new int[8];

        // Fill with random numbers

        for (int i = 0; i < a.length; i++)

            a[i] = (int) (Math.random() * 100);

        // Before the sequence, print out the content

        for (int i = 0; i < a.length; i++) {

            System.out.print(a[i] + ” “);

        }

        System.out.println(” “);

        // Selection order

        for (int j = 0; j < a.length – 1; j++) {

            for (int i = j + 1; i < a.length; i++) {

                if (a[i] < a[j]) {

                    int temp = a[j];

                    a[j] = a[i];

                    a[i] = temp;

                }

            }

        }

        // Print out the content

        for (int i = 0; i < a.length; i++) {

            System.out.print(a[i] + ” “);

        }

        System.out.println();

        // Bubble sort

        for (int j = 0; j < a.length; j++) {

            for (int i = 0; i < a.length – j – 1; i++) {

                if (a[i] < a[i + 1]) {

                    int temp = a[i];

                    a[i] = a[i + 1];

                    a[i + 1] = temp;

                }

            }

        }

        // Print out the content

        for (int i = 0; i < a.length; i++) {

            System.out.print(a[i] + ” “);

        }

        System.out.println(” “);

    }

}

The final output of the console:

By studying the concepts of selection sorting and bubble sorting, you can define your own array sorted from small to large. These two sorting methods will give you good ideas for designing sorting code.

read more