voidsetfastname (String fastname) { This. Fastname =Fastname; } Public intcompareTo (Object arg0) {name Name=(Name) arg0; intLASTCMP =Lastname.compareto (name.lastname); return(lastcmp!=0?)LastCmp:fastName.compareTo (name.fastname)); }}11. Map Interface:The class that implements the map interface is used to store key-value pairs, and the values stored in the map are identified by keys, so the keys in the map cannot be duplicated.12. Map Common methods:Object put (object key, Object value):
Review the design pattern-strategy Pattern
The design model has been learned before. This soft exam is both a review and an improvement. The soft test needs to use java to learn the design mode. Although the previous learning is C #, the design mode has the same idea. Let's talk about the theme. Next, let's take a look at what is the
(elder brother now has formed habit, see but and so on the word draw a circle), the transition word behind part, often is the question point, the key reading. on the order of doing questions, generally in order to do, of course, because the Sectiona choice of words more time-consuming, you can put the last do. The important thing is to do one or two more real questions, to develop their own habit of doing the problem sequence. More importantly, usually try to follow the test time to answer que
; >>> Click Advanced Settings >>>>>> Select environment variables >>>>>> in the System variables module, click New java_home>>>the value of the >>> variable is:jdk 's installation directory to the bin directory>>> then click New , add The value of the classpath>>> variable: The period of the English. >>> then find the path object >>>The value of the variable is : after the contents of the + English semicolon (; ) +JDK the installation directory to bin CatalogueNow that the JAVA environment c
Transformation//Dog dog = (dog) animal;//add forced type conversion when down transformation//Cat cat = (cat) animal;//This error is prone to downward transformation//to prevent the above error, we use the instanceof keyword if(AnimalinstanceofDog) {Dog Dog=(Dog) animal; }Else{System.out.println ("Animal is not a dog."); } if(AnimalinstanceofCat) {Cat Cat=(Cat) animal; }Else{System.out.println ("Animal is not a cat."); } }}8. Abstract class:The class that is modified by the abs
, Server side: Public classTestUDPServer1 { Public Static voidMain (string[] args)throwsexception{byte[] buf =New byte[1024];//set the character array that holds the dataDatagrampacket DP =NewDatagrampacket (buf, buf.length); Datagramsocket DS=NewDatagramsocket (5888);//set the port number while(true) {ds.receive (DP);//receive request data from clientBytearrayinputstream Bais =NewBytearrayinputstream (BUF); DataInputStream Dis=NewDataInputStream (Bais); System.out.println (Dis.re
exception caught, and the code of the finally segment is processed regardless of whether an exception occurred. 2, the exception of the capture and processing: Public classTest {/** * @paramexception capture and handling*/ Private StaticFileInputStream input; Public Static voidMain (string[] args)throwsFileNotFoundException {Try{//Catching exceptionsinput =NewFileInputStream ("Test.java"); intA =Input.read (); while(A!=-1) {System.out.println (Char) a); A=Input.read (); }
Javase basic review strategy 9 and javase Introduction 9
This article will summarize the thread mechanism in JAVA. When talking about threads, you will certainly ask what is the difference between threads and processes? I also had such questions when I first came into contact with processes. Today I will give you a brief introduction to processes and threads. A Process is a running activity of a computer pr
, outputstream commonly used methods;void write (int b): writes one byte of data to the output stream that is the lower 8 bits of parameter B.void Write (byte[] buffer): Writes an array of type byte to the output streamvoid Write (byte[] buffer, int off, int len): Starts from the specified position (off) in an array of one byte type, and Len bytes is written to the output streamvoid Close (): Close stream frees memory resourcevoid Flush (): Writes all cached data from the output stream to the de
Data structure review notes-binary tree 2 and binary tree
Non-recursive traversal of Binary Trees:
Non-recursive Traversal AlgorithmThe basic idea for implementing non-recursive algorithms: Use stacks:
Void InOrderTraversal (BinTree BT) {BinTree T = BT; Stack S = CreatStack (MaxSize);/* Create and initialize Stack S
operator " >>> " shifts a zero to the leftmost position while the leftmost position after
depends on sign extension.
The bitwise operator performs a bitwise AND operation.The bitwise ^ operator performs a bitwise exclusive OR operation.The bitwise | operator performs a bitwise inclusive OR operatioCode:public class Solution {You need treat n as an unsigned valuepublic int reversebits (int n) {int result = 0;for (int i = +; i > 0; i--) {result = result result = result + (n 1);n =
Review the list and the two-fork tree today based on the Stanford online courseThe recursive definition for the binary tree above is very concise:
A binary tree is either empty (represented by a null pointer), or was made of a single node, where the left and RI ght pointers (recursive definition ahead) each point to a
The data definition of a binary tree is realized in C language. The construction and destruction of a binary tree, as well as the recursive algorithms of the first, middle, and back orders are being studied.
/* Optional /*--------------------------------------------------------------------------------------------*/
// The binary tree
("The and of all elements in the array is:" +getsumarray (arr));}public static int Getsumarray (int[] arr){int sum=arr[0];for (int i=1;i{sum = Sum +arr[i];}return sum;}}4, copy of array.Class Copyarray{public static void Main (string[] args){int[] arr1 = new int[]{1,3,4,5,8};int[] arr2 = new Int[arr1.length];PrintArray (ARR2);System.out.println ("-------------");PrintArray (Copyarray (ARR1,ARR2));}public static int[] Copyarray (int[] arr1, int[] arr2){for (int i=0; i{Arr2[i]=arr1[i];}return arr
Moving handouts ~ Moving handouts ~Binary search feels like it's all about violence every time. 2333, mainly used for descending times · Binary can be used to reduce complexity when complexity is an exponential level • In fact, there are not many examples of special test binary ... is generally a small optimization in the middle ...Then the
Full Binary Tree
Title Link: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblemproblemid=2882
Time limit:2000ms Memory limit:65536k have questions? Dot here ^_^
The topic description in Computer science, a binary tree is a tree data structure in which each node had at the most of the children. Consider an infinite full binary tree (
Learn New, basic review (Binary heap sorting), learn new heap sorting
Learn more, basic review (Binary heap sorting)
Minimum heap (the data in the final array is in descending order) and maximum heap (the data in the final array is in ascending order)
The following example shows the minimum heap.
#include
Cop
Summary and review of data structure coding//about the establishment and hierarchy of binary trees, other basic operations such as traversal (recursive, non-recursive) seeking depth # include ///Hierarchy Traversal idea//from the root each time the team out of an element, will be this element of the Leftchild, Rightchild queue until the team will not be able to queue their last all outData structure (
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.