Java Data structures and algorithms (i): an overview

Source: Internet
Author: User

What does the data structure and algorithm do?

A data structure is a form of organization in a computer's memory space or disk. Data structures include arrays, linked lists, stacks, binary trees, hash tables, and so on. The algorithm handles the data in these structures in various ways, such as finding a particular item of data or sorting the data.

Overview of data structures
Data Advantages Disadvantages
Array Insert fast, and if you know the subscript, you can access it very quickly Find slow, delete slow, fixed size
Ordered array Faster than unordered array lookups Delete and insert slow, fixed size
Stack Provide last-in, first-out mode access Access to other items is slow
Queue Provides first-in, out-of-the-way access Access to other items is slow
Linked list Insert Fast, delete fast Find Slow
Two-fork Tree Find, INSERT, delete fast (such as fruit trees maintain balance) Delete Algorithm Complex
Red-Haishi Find, insert, delete are quick. The tree is always balanced. Algorithmic complexity
2-3-4 Tree Find, insert, delete are quick. The tree is always balanced. Algorithmic complexity
Hash table If the keyword is known, access is extremely fast. Insert Fast Delete slow, if you do not know the keyword access is slow, the use of storage space is not sufficient
Heap Insert, delete fast, access to the largest data items quickly Slow access to other data items
Figure Modeling the real World Some algorithms are slow and complex
An overview of the algorithm

Many of the algorithms that will be discussed apply directly to some special data structures. For most data structures, you need to know how to

    • Insert a new item of data
    • Looking for a particular item of data
    • Delete a specific item of data

You also need to know how to iterate through the data items in a data structure for display or other operations. Another important category of algorithms is sequencing, which has a number of algorithms, which will be discussed later. The concept of recursion is important when designing certain algorithms. Recursion means that a method calls itself.

Java Data structures and algorithms (i): an overview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.