programming algorithms book

Learn about programming algorithms book, we have the largest and most updated programming algorithms book information on alibabacloud.com

Programming algorithms-Number ugly code (C)

number Ugly Code (C)This address: Http://blog.csdn.net/caroline_wendyTitle: We refer to only the numbers of factors 2, 3 and 5 as ugly numbers. Find the 5th ugly number in order from small to large.The ability to set an array including the desired number of ugly , in turn, multiplied by 2, multiplied by 3, multiplied by the smallest number of 5, and finally returned the result.If the 5th ugly number is 5, such as 1, 2, 3, 4 (2*2), 5 are ugly numbers.Code:/* * main.cpp * * Created on:2014.6.12 *

Programming algorithms-Insertion code for ordered double-loop lists (C)

insert code for ordered double-loop list (C)This address: Http://blog.csdn.net/caroline_wendySequential double-loop list insertion, need to find the insertion position, can be used, two pointers , one in front, one in the rear.Ensure that the previous less than equals insert value, followed by greater than or equal to the insertion value.In special cases , insert (greater than or less than the entire list) or single node, the inferred condition is that the pointer points to the first node. You n

Programming algorithms-food chain and code query (c)

Code for checking the food chain (c) Address: http://blog.csdn.net/caroline_wendy Question: There are n animals numbered 1, 2 ,..., n. all animals belong to one of A, B, and C. it is known that a eats B, B eats C, and C eats. Two types of information are provided in order. First, X and Y belong to the same class. Type 2: X eat y. There may be errors and contradictions between the information, and the number of incorrect information is obtained. For example: N = 10 animals, given K = 7 message

Programming algorithms-Two fork search tree and bidirectional linked list code (c + +)

two fork search tree and bidirectional linked list code (c + +)This address: Http://blog.csdn.net/caroline_wendyTitle: Enter a binary search tree to convert the two-fork search tree into a sorted doubly linked list.Requires that no new nodes be created, only pointers to the nodes in the number can be adjusted.Methods: Use the middle sequence to traverse each node and make a connection, that is, Zuozi refers to the front, right subtree refers to, and save the previous node.This procedure includes

Programming algorithms-high-speed Sorting algorithm code (C)

high-speed Sorting algorithm code (C)This address: Http://blog.csdn.net/caroline_wendyThe classic high-speed sorting algorithm , as a programmer, has to be fully handwritten at any time.Code:/* * main.cpp * * Created on:2014.6.12 * author:spike *//*eclipse CDT, gcc 4.8.1*/#include Output: Programming algorithms-high-speed Sorting algorithm code (C)

Programming algorithms-Infer that a binary tree is not a balance tree code (C)

Inferred binary tree is an unbalanced tree code (C)This address: Http://blog.csdn.net/caroline_wendyTitle: Enter the root node of a binary tree and infer that the tree is not a balanced binary tree.Binary balance tree: The depth of the left and right sub-tree of random nodes is not more than 1.The method of sequential traversal is used, and the depth of the left and right subtree is preserved and compared.Code:/* * main.cpp * * Created on:2014.6.12 * author:spike *//*eclipse CDT, gcc 4.8.1*/#inc

Programming Algorithms-Dictionary Participle Code (C)

Dictionary word breaker Code (C)This address: Http://blog.csdn.net/caroline_wendygiven a dictionary, given a word, word breaker.Methods that use deep traversal (DFS) .Use a parameter stringto save the sentence after the current branch's participle; Use one of the vector vectorsto save all possible combinations.Use a validation function to infer whether a sentence is enough to be participle.Code:/* * main.cpp * * Created on:2014.9.18 * author:spike * COPYRIGHT (c) 2014 WCL. All rights reserved. *

Course Learning: Programming and Algorithms

Unit 0-1:1-bit (2^1=2), bit, bit (b) Bytes: 8 bits (2^8=256), Byte (B); 1kb:2^10 bytes (2^13 bit) The ASCII encoding scheme is to represent a letter, number, or punctuation in a single byte. Binary conversion Decimal->n binary: a0xk^0+ .... Anxk^n N Decimal: Take remainder Hexadecimal--binary: 4 binary corresponds to 16 binary C++ Basic program #include Input: scanf ("%d", num) PLACEHOLDER: %d , (int) %c (char), %ul (unsigned long) Note: Multiple

Java concurrent Programming-various lock __ algorithms

Java concurrent Programming-various locks Security and activity are often mutually constrained. We use locks to keep threads safe, but abusing locks can cause lock-order deadlocks. Similarly, we use thread pools and semaphores to constrain the use of resources, But the lack of knowledge of which areas of activity may form a deadlock of resources. Java applications cannot recover from deadlocks, so it is valuable to make sure that your design is able

Programming algorithms-horse racing

Horse racing Problems Address: http://blog.csdn.net/caroline_wendy For horse racing, there are 25 horses, three of which are the fastest, five of which are the first. How can I choose? Solution: SimilarK-path Merge Sorting, DividedFive groupsIn the competition, select five first places, then conduct the competition, confirm one, and take the first place away. Then, from the first place queue, select the second place, and place it in the queue for the competition. And so on, selectOpti

Programming algorithms-continuous and maximum sub-array code (c)

Continuous and maximum sub-array code (c) Address: http://blog.csdn.net/caroline_wendy Question: In an array, find the continuous and maximum subsequences. Use two variables, one to store the current value, one to store the maximum value, and a temporary array to update the maximum and array. Time complexity O (n ). Code: /* * main.cpp * * Created on: 2014.9.19 * Author: spike */#include Output: 18: 3 10 -4 7 2 Programming

Programming algorithms-two-part Figure determination Code (C)

Two section Figure Determination Code (C)This address: Http://blog.csdn.net/caroline_wendyTitle: Given a graph with n vertices. To stain each vertex on the graph, and to make the adjacent vertex colors different.Can be dyed in up to 2 colors. There are no heavy edges and closed loops.That is, the problem of binary graph .Using Depth-first search (DFS), dye the vertices to C, and then dye the adjacent edges to-c.Assuming that the adjacent edges are dyed, and the same, the graph is not a binary gr

Programming Algorithms-The Straight Code of Poker (C)

Straight code for Poker (C)This address: Http://blog.csdn.net/caroline_wendyTitle: Randomly draw 5 cards from poker, infer whether a straight, that is, the 5 cards are not continuous.2~10 is the number itself, A is 1, J is one, Q is a, K is 13, and the size of the king can be regarded as random numbers.Sort, infers the number of intervals between strings, assuming that the number is less than or equal to the size of the king, then it is contiguous, otherwise it is not.Code:/* * main.cpp * * Cre

Programming Algorithms-Fence repair (Fence Repair) code (C)

Fence Repair (Fence Repair) code (C)This address: Http://blog.csdn.net/caroline_wendyTitle: Cut a piece of wood into n blocks, cut two pieces at a time, the cost of the split is the length of the board, the minimum cost of dividing the board.The Huffman Code (Huffman).greedy algorithm , similar to two-fork tree structure, the shortest plate and the second short plate is the brothers node , select two minimum planks, the final division, merging Two minimum planks, in turn recursion.Code:/* * main

Fundamentals of programming algorithms-brute force method

teams may be: the number of 1451 teams may be: 1731Horse and TileTotal 100 horses in commonA total of 100 tiles (ancient tiles, very large, very heavy)Every big horse can carry 3 tiles at a time.Every pony can carry 2 tiles at a time.The foal carries 1 pieces of shingles every time 2 poniesAsk for the number of horsesHint: may be multi-solution. To list all the solutions./* Total co-owned 100 horses have a total of 100 tiles (ancient tiles). Very big, very heavy) each horse can carry 3 watts ea

Programming algorithms-Multiple parts and problem codes (C)

multiple parts and problem codes (C)This address: Http://blog.csdn.net/caroline_wendyTitle: There are n different sizes of numbers a, each of each m. The inference can be enough to select some of these numbers to make their and exactly K.Using dynamic Solver (DP),Method 1: dp[i+1][j] = The number of the first n can be added to J, time Complexity O (nKm), is not optimal.Method 2: dp[i+1][j] = When the number of first I is added and the J is obtained, the number of the first I can be the maximum n

Programming algorithms-Reverse-order code in arrays (C)

Reverse-order code in the array (C)This address: Http://blog.csdn.net/caroline_wendyTitle: The two numbers in the array assume that the previous number is greater than the following number, then these two numbers form an inverse pair.Enter an array to find the total number of reverse pairs in this array.Using the merge sort method, the auxiliary space is a sort of array, in order to compare the larger number in the front, to calculate the overall inverse logarithm, not one by one comparison.Comp

Programming algorithms-Converting a string to an integer code (C)

converts a string to an integer code (C)This address: Http://blog.csdn.net/caroline_wendyTitle: Write a function strtoint, simulate the function of Atoi, convert the string to an integer.You need to consider exception handling, positive negative numbers, and the maximum value of int (0x7FFFFFFF) and minimum (0x80000000) .Code:/* * main.cpp * * Created on:2014.7.12 * author:spike * * #include -1:1;num = num*10 + flag* (*digit-' 0 '); if (!minus num>0x7fffffff) | | (Minus num Output:result =-873

"Introduction to Algorithms" dynamic programming-optimal binary search tree

optimal binary search tree.According to the above analysis, we can know that the optimal binary search tree problem is overlapping sub-problem, because if we want to construct an optimal binary search tree, we must first construct its sub-tree, the sub-tree to construct its sub-tree, so go on, there are overlapping sub-problems.? So the optimal binary search tree problem can be solved by using dynamic programming.Problem analysis? It is worth noting that if i=j-1, this subtree does not actually

Total Pages: 11 1 .... 7 8 9 10 11 Go to: Go

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.