Summary of Common Data Structures and Algorithms (Java Language Description)

This is a data structure and algorithm notebook, writing and organizing some common data structures and their corresponding operations. Each of these class files is a main method class that you can run separately to see the results, and the key descriptions and words you want to say are in the comments to the code. (Welcome to add and improve, January 04, 2019 00:07:40 set as public)

LeetCode

  1. An array of

    • Search two dimensional matrix
    • Duplicate data in an array
    • Merges two ordered arrays
    • Removes duplicates from the sorted array
    • Rotate the array
    • Square an ordered array
    • Find the central index of the array
    • Mobile zero
    • Disrupted array
    • Intersection of two arrays II
    • An increasing triadic subsequence
    • The product of arrays other than themselves
    • Duplicate element II exists
    • There is repeated element III
    • Matrix zero
    • Maximum suborder sum
    • Sort an array by odd or even
  2. The list

    • Print the linked list from end to end
    • Removes a linked list element
    • Delete a node from a linked list
    • Removes duplicate elements from sorted linked lists
    • Check whether the list has rings
    • Palindrome list
  3. string

    • Replaces Spaces in strings
    • Fizz Buzz
    • Validates palindrome characters
    • The length of the last word
    • The most common words
    • The first unique character in a string
    • Sort by character frequency
    • Validates palindrome strings
    • Split palindrome string
    • The word split
  4. Linear data structures and their corresponding common algorithms

    1. Linear list (array based and linked list implementation again)
      • Addition of linear tables (physical structure implementation based on sequential storage)
      • Linear table deletion (Physical structure implementation based on sequential storage)
      • Insertion of linear tables (Physical Structure implementation based on chain storage)
      • Deletion of linear tables (Physical structure implementation based on chained storage)
      • Creation of linear tables (based on the physical structure of chained storage) by head and tail interpolation
      • Find an element in a linear table (physical structure implementation based on chained storage)
    2. The stack
      • Sequential stack (array based stack)
      • Chain stack (stack based on linked list implementation)
      • Valid parentheses
      • Implement a queue with two stacks
    3. The queue
      • Sequential queue (array based queue implementation)
      • Linked queue (queue based on linked list implementation)
      • Circular queue (number based loop)
      • Maximum sliding window
      • Implement a stack with two queues
  5. recursive

    • N factorial
    • Fiboacci sequence
    • Which row is in the problem (recursive, non-recursive implementation respectively)
    • N steps (one step or two steps at a time)
    • Prints all file names in the specified path (recursive and non-recursive implementations respectively)
  6. Divide and conquer

    • X to the n
  7. The sorting

    • Bubble sort
    • Insertion sort
    • Selection sort
    • Quick sort
    • Count sorting
  8. Binary search

    • Binary lookup (recursive and non-recursive implementations)
  9. Binary search variant

    • Find the element whose first value is equal to the given value
    • Finds the element whose last value is equal to the given value
    • Finds the first element greater than or equal to the given value
    • Finds the last element that is less than or equal to the given value
    • The square root of x
  10. reverse

    • Invert an array
    • Reverse a single linked list
    • Invert a binary tree
    • Inverted string
    • Invert the word III in the string
    • Transposed matrix
    • Inverts an interval of a singly linked list
  11. Binary tree

    1. Binary tree
      • The next node in the binary tree
      • The same tree
      • Symmetric binary tree
      • Number of nodes in a binary tree
      • Populates the next right-side node pointer for each node
      • Expand the binary tree into a linked list
      • The largest binary tree
      • Construct a binary tree by traversing pre-order and middle-order sequences
      • A binary tree is constructed by traversing sequences of middle and rear order
      • Look for duplicate subtrees
    2. Binary search tree
      • The KTH smallest element in the binary search tree
      • Convert a binary search tree to a summation tree
      • Validate binary search trees (recursive and non-recursive implementations)
      • A search in a binary search tree
      • Insert operations in binary search trees
      • Delete a node in the binary search tree
      • Insert, traverse, find, delete, reverse binary search tree
      • The most recent common ancestor of a binary tree
      • The most recent common ancestor of a binary lookup tree
      • Right view of a binary tree
      • Zigzag level traversal of binary trees
  12. The heap

    • Big top heap, heap sort
    • TopK
    • The KTH largest element in the array
    • The first K high frequency elements
    • The first K high frequency words
  13. Hash table

    • Valid ectopic words
    • The sum of two Numbers
    • Sum of two numbers II – Enter an ordered array
    • Sum of two numbers IV – Enter BST
    • There are duplicate elements
    • Dictionary serialization
  14. Pray for

    • Strives for the modal
    • Gal.
    • Nim game
    • palindrome
    • Number game
  15. greedy

    • The best time to buy and sell stocks
    • Distribution of biscuits
  16. search

    • Breadth-first search
    • Depth-first search
    • Hierarchical traversal of a binary tree
    • Maximum depth of binary trees (breadth-first non-recursive implementation and depth-first recursive implementation)
    • The minimum depth of a binary tree
  17. figure

    • The representation of figure
  18. pruning

    • Sudoku (sudoku)
  19. LRUCache(least recently used cache)

    • The realization of the LRUCache
  20. Dynamic Programming (DP)

    • Climb the stairs
    • Minimum path sum of a triangle
    • Maximum subsequence of a product
    • Four solutions of Fibonacci series
  21. An operation

    • The number of ones
    • Bit count
    • A number that appears only once
    • The missing number
  22. The sliding window

    • The average of all K consecutive elements of an array

PAT

  1. 1001. Murder (3N +1) Guess (15 points)
  2. 1002. Write the number (20 points).
  3. 1004. Ranking of Achievements (20 points)
  4. 1005. Continue (3n+1) guess (25 points)
  5. 1006. Output integers in a different format (15 marks)
  6. 1007. Prime Pair Conjecture (20 points)
  7. 1008. Array Element Looping right problem (20 points)
  8. 1009. Being sarcastic (20 points)
  9. 1010. Derivative of a Unary Polynomial (25 marks)
  10. A+B and C(15分)
  11. 1012. Numerical classification (20 points)
  12. 1014. A Holmes Appointment (20 points)
  13. 1015. Morality (25 points)(Java version running timeout)
  14. Part A+B(15 marks)
  15. A divided by B(20 marks)