A brief talk on data structure in Java (overview)

Source: Internet
Author: User

The so-called data structure, that is, the existence of one or more relationships between the set of elements and the data elements in the collection of the relationship between the composition. Common data structures include: arrays, stacks, queues, linked lists, trees, graphs, heaps, and hashes.

Arrays (Array)In the program design, in order to deal with the convenience, the same type of a number of variables organized in an orderly form. The collection of these ordered, homogeneous data elements is called an array. In the C language, an array is a constructed data type. An array can be decomposed into multiple array elements, which can be either basic data types or constructed types. Therefore, according to the type of array elements, the array can be divided into numerical array, character array, pointer array, array of structures and other categories.Stacks (Stack)is a special linear table that can only be inserted and deleted at one end. It stores the data according to the advanced principle, the first data is pressed into the bottom of the stack, the final data is at the top of the stack, and the data is read from the top of the stack (the last data is read first).Queuing (queue)A special linear table that allows for deletion only at the front end of the table (front), and in the back end of the table (rear). The end of the insert operation is called the tail of the queue, and the end of the delete operation is called the team header. The queue organizes the data according to the principle of "FIFO" or "Backward out". When there are no elements in the queue, it is called an empty queue.linked list (Linked list)is a non-sequential, non-sequential storage structure on a physical storage unit that can either represent a linear structure or represent a nonlinear structure, and the logical order of the data elements is achieved through the order of the pointers in the linked list. A linked list consists of a series of nodes (each element in the list is called a node) that can be dynamically generated at run time. Each node consists of two parts: one is the data field that stores the data element, and the other is the pointer field that stores the next node address.Trees (tree)is a poor set K containing n (n>0) nodes, and a relationship defined in K n,n satisfies the following conditions: (1) There is only one node K0, he has no precursor for the relationship N, which is called K0 as the root node of the tree.  Referred to as root (root). (2) In addition to K0, each node in K has and has only one precursor for the relationship N. (3) The nodes in K can have M successors (m>=0) for the relationship N.Graph (graph)The graph is composed of set E of the node's poor set V and the edge. Among them, in order to distinguish with the tree structure, the nodes are often called vertices in the graph structure, the edges are the ordered pairs of vertices, if there is an edge between the two vertices, it means that the two vertices have neighboring relations.heaps (heap)In computer science, a heap is a special tree-shaped data structure that has a value for each node. Usually what we call a heap of data structures is a two fork heap. The heap is characterized by the minimum (or maximum) value of the root node, and the two subtrees of the root node are also a heap.Hash List (hash)If there is a record of the same keyword and K in the structure, it must be in the storage location of f (k). As a result, the records can be obtained directly without comparison. The corresponding relationship f is called the hash function, and the table created by this thought is a hash list.

A brief talk on data structure in Java (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.