atony2099 / go_algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

algorithm

references

Problem Solving with Algorithms and Data Structures using Python https://www.codesdope.com/course/algorithms-introduction/

Coin Change

qp7LSd I2okpi

singleLinkedList

  1. the operatin of insertion and deletion don't mean to insert at specify index, not including the search operation, so the bigO is 1;

doubleLinkedList

LRU cahe

  1. hashmap: record the key,value

  2. doubleLinkedList: put the rencently reading or writing data in front of the list(first delete,then insert at the top);

    doubleLinkedList can easily delete and insert;

binary search

time complexiy analyze:

  1. we need to divide by 2 until with have only one element- 𝑛/(2𝑘)=1

  2. we can rewrite it as -

2𝑘=𝑛

by taking log both side, we get

𝑘=log2𝑛

quick sort

dynamic programing

divide big problems into small subproblem;

vs: divide and conquer

the subproblemss are interdependent;

recursion

breaking a problems into smaller and smaller problems;

feature:

  1. algorithm have a base case;
  2. algorithm must change its state and move toward the base case.
  3. call itselft recursively

dynamic programing

  1. what is? an optimization algorithm, optimise rescursion,store the soultion of the subproblems

  2. approach: bottom up vs top up

  3. feature

    solve the prolem withe overlapping subproblems

divide and conquer

  1. what is? e.g.,quick sort, merge sort, binary search

  2. featrue?

    solve the problem indepent

About


Languages

Language:Go 100.0%