A collection of basic Java issues

Source: Internet
Author: User

    • Java Basics:
    • The difference between ArrayList and LinkedList and the underlying implementation principle
      • ArrayList
        • Add Operation implementation
        • Expansion factor

    • HashMap and Councurrenthashmap
      • HashMap
        • Put operation
        • Expansion mechanism
        • Thread safety issues

    • JVM structure

    • Use of multithreaded synchronized

    • Spring threadlocal Use
    • Redis data types
    • MySQL index underlying (BTree) implementation principle and MySQL database optimization
    • Isolation level for MySQL transactions
      • Four features of MySQL: atomicity, consistency, isolation, persistence
      • MySQL Isolation level:
        • ①serializable (serialization): Can avoid dirty reading, non-repeatable reading, the occurrence of phantom reading.
        • ②repeatable Read (Repeatable Read): Can avoid dirty read, non-repeatable read occurrence.

        • ③read committed (Read Committed): Can avoid the occurrence of dirty reading.

        • ④read UNCOMMITTED (READ UNCOMMITTED): lowest level, no case is guaranteed.
          Note: In the MySQL database, the above four isolation levels are supported, the default is repeatable read (repeatable read), and in the Oracle database, only the serializable (serialization) level and Read Committed (Read Committed) levels are supported. The default is the Read committed level.

  • Binary lookup algorithm (binary lookup)
    • Algorithmic thinking: (Prerequisites: Finding in sorted arrays)
      1. Determine the end of the middle position mid array start low array
      2, need to find the number and mid to make judgments, if the number of queries larger than mid, change low, set low=mid+1, if the number of queries less than mid, change high, set high=mid-1. If the number queried equals the number of the mid subscript, the target is queried (when the loop condition is Low<=high)
      public class BinarySearch {/** * binary search Algorithm * * @param ordered array of Srcarray * @param key Lookup element Vegetarian * @return Key array subscript, not found return-1 */public static void main (string[] args) {int Srcarray               [] = {3,5,11,17,21,23,28,30,32,50,64,78,81,95,101};          System.out.println (Binsearch (srcarray, 0, Srcarray.length-1, 81)); }//Two-point lookup recursive implementation public static int binsearch (int srcarray[], int start, int end, int key) {I               NT mid = (End-start)/2 + start;               if (srcarray[mid] = = key) {return mid;               } if (start >= end) {return-1;               } else if (Key > Srcarray[mid]) {return Binsearch (Srcarray, mid + 1, end, key);               } else if (Key < Srcarray[mid]) {return Binsearch (Srcarray, start, mid-1, key);           } return-1; }//Two minFind normal loop implementation public static int binsearch (int srcarray[], int key) {int mid = SRCARRAY.LENGTH/2;               if (key = = Srcarray[mid]) {return mid;               } int start = 0;               int end = Srcarray.length-1;                   while (start <= end) {mid = (End-start)/2 + start;                   if (Key < Srcarray[mid]) {end = Mid-1;                   } else if (Key > Srcarray[mid]) {start = mid + 1;                   } else {return mid;           }} return-1;  }     }

A collection of basic Java issues

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.