The classic algorithm section of the [pen face]

Source: Internet
Author: User

algorithm theory

2. Definition of algorithmic complexity. The meaning of large o, θ, and small o, respectively.
4. The idea of divide-and-conquer algorithm, classical divide-and-conquer algorithm (full permutation, binary search, merge sort, quick sort , linear time selection, closest point to problem).
5. Dynamic programming Algorithm-solving framework, what are the two elements of the dynamic programming algorithm? What is the memo method?
6. Classical dynamic programming problems (matrix multiplication problem, longest common subsequence problem, 0-1 knapsack problem )。
7. The idea of greedy algorithm, two elements of greedy algorithm.

9. The backtracking method has two typical models in backtracking.
10. Classic Backtracking algorithm (post-n problem, 0-1 knapsack problem, travel salesman problem).
11. Branch-bound method of thinking, which two kinds of branch-bound method.
12. Classical branch-bound algorithm (0-1 knapsack problem, travel salesman problem).

Algorithm Topics

1. Flip the order of the words in the sentence.
title: Enter an English sentence, flipping the order of the words in the sentence, but the order of the characters within the word is unchanged.
words are separated by spaces in sentences. For simplicity, punctuation is treated like ordinary letters.
For example, enter "I am a student.", then output "student. A am I".
2. Find the first character in a string that appears only once. If you enter Abaccdeff, then output B.
3.N Numbers (0,1,..., n-1) Form a circle, starting with the number 0,
each time the number of m digits is removed from this circle (the first is the current number itself, the second is the next number of the current number).
when a number is deleted, the next number from the deleted number continues to delete the first m digits.
find the last number left in this circle.
4. Define the Fibonacci sequence as follows:
/0 n=0
f (n) = 1 N=1
\ f (n-1) +f (n-2) n=2

Enter N to find the nth item of the sequence in the quickest way.
5. Enter two integers n and M, and take a few random numbers from the sequence 1,2,3.......N,
making it and equal to m requires that all possible combinations of them be listed.
6. Write a function whose prototype is int Continumax (char *outputstr,char *intputstr)
Features:
Find the longest consecutive number string in the string, and return the length of this string,
and send this longest number string to one of the function parameters outputstr the memory.
7. Define the left rotation of a string: move several characters in front of the string to the end of the string.
if the string abcdef left rotation 2 bit to get the string cdefab. Please implement the function of string left rotation.
The complexity of a string operation that requires time to be N is O (n), and auxiliary memory is O (1).
8. A step has a total of n levels, if you can jump 1 levels at a time, you can jump 2 levels.
How many total hops are in total, and the time complexity of the algorithm is analyzed.
9. A diagram similar to the structure of the honeycomb, the shortest path to search (5 minutes required)
10. Implement a very advanced character matching algorithm:
give a string of very long strings, asking for strings that meet the requirements, such as the destination string: 123
1******3***2, 12*****3 These are all going to find out.

11. There are n strings of length m+1,
If the last m character of a string matches the first m characters of a string, then two strings can be joined,
Ask these n strings to be a maximum number of strings and return an error if a loop occurs.

12. Find the maximum distance between any two nodes in a binary tree,
The two-node distance is defined as the number of edges between the two nodes,
For example, the distance between a child's node and the parent node is 1, and the distance between the adjacent sibling nodes is 2, which optimizes the complexity of the time space.

13. To find a cut point for a connected graph, the definition of the cut point is that if the node and its associated edges are dropped,
The undirected graph is no longer connected and describes the algorithm.

14. Modify the Append function to implement (linked list) using this function:
Two sets of non-descending lists, 1->2->3 and 2->3->5, and 1->2->3->5
You can only output results, and you cannot modify the data of two linked lists.

15. Find the longest descending subsequence of an array, such as {9,4,3,2,5,4,3,2}, the longest descending subsequence of {9,5,4,3,2}

16. Output the linked list (linked list) from the tail to the head.
Title: Enter the head node of a linked list, which in turn outputs the value of each node from the end of the tail point. The linked list node is defined as follows:
struct ListNode
{
int M_nkey;
listnode* M_pnext;
};

The classic algorithm section of the [pen face]

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.