Data Structure questions

Source: Internet
Author: User
1. Question () 1. A linear table adopts a sequential storage structure. The element length is 4 and the first address is 100. Then, the storage address of the (13th) element with a subscript of 12 is 148. Correct. If the address of the 0th elements is 100, the address of the I element is 100 + 4 * I, and 12 is substituted into 148. () 2. Random Access is not allowed on any linear linked list. Error. For example, if you know the first address of the sequence table and the number of storage units occupied by each data element, you can find the storage address of the I data element, this is also the feature that sequential tables have random access by serial numbers of data elements. () 3. Ordered stack is a stack that specifies the sequence of elements going into the stack. Error. By storage structure, stacks are divided into sequential stacks and chain stacks. The sequential storage structure of stacks is short for sequential stacks, which is a list of restricted operations, but there is no rule on the sequence of elements going into the stack. () 4. Each element in the loop list has a successor. Correct. Note that there may be a written mistake, which should be written as a "circular linked list" instead of a "Circular List ". () 5. delete a node in a binary tree and insert it again to obtain the original binary tree. Error. 2. Fill in blank questions. 6. the time complexity of the following program is ___________. For (int I = 1; I <= m; I ++) for (int j = 1; j <= n; j ++) S + = I Law 1: for Loop: the running time of a for loop is at most the running time of the statements (including tests) in the for loop multiplied by the number of iterations. Rule 2: nested loops: analyze these loops from the inside out. The total run time of a statement in a group of nested loops is the time that the statement runs multiplied by the product of the size of all cycles in the group. For the nested for loop here, according to the above law, the time complexity is O (m * n ). 7. insert an element at the position I (1 ≤ I ≤ n + 1) of the sequence table with the length of n. The number of moving elements is ____________. From the I-th element (original) to the n-th element, each element is moved one after another, which requires n + 1-i times in total. 8. Insert a new node in an ordered single-chain table with n nodes and keep the inserted single-chain table in order. The time complexity of this operation is ______. Locate the node location, O (n), single-chain table insertion, O (n), and the total time complexity is O (n + n) = O (n ). 9. If s [1] ~ is used S [n] is the common storage space of two sequential stacks. The top of the two stacks is t1 and t2 respectively. Which of the following conditions can be used to determine whether a stack can insert new elements _________________. When two stacks are used in a program at the same time, the stacks of the two stacks can be located at both ends of the vector space, so that the two stacks can expand to the middle. When a stack contains more elements than half of the vector space, as long as there are not many elements in the other stack, the former can occupy part of the latter's storage space. The condition for determining whether a stack can insert new elements is & t1! = & T210. set the number of nodes in the forest T to n1, n2, and n3 respectively. After converting the forest into a binary tree, the left subtree of its root node has ________ nodes. The specific method to convert a forest into a binary tree is: ① change each tree in the forest into a binary tree; ② Because the right subtree of the root node of the converted binary tree is empty, therefore, the root nodes of Binary trees can be considered as brothers connecting from left to right to form a binary tree. I personally think that here can fill in 3 answers, n1-1 or n2-1 or n3-1. 11. In the ing matrix with a weight directed graph, the number of non-zero elements on line I is equal _______________. When node Vi is connected to A node Vj, A (I, j) is not 0. 12. In various search methods, the average search length is unrelated to the number of nodes n. Which of the following is the search method _____________. Hash Lookup.

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.