Someone asked me how to learn data structure and algorithm?

How to implement common data structure algorithms in Python? I found a github repository with a star of 66.6K +, which implements a variety of common algorithms in Python, and has a GIF demo, which is highly recommended. (Huang Haiguang)

Warehouse instructions

This repository implements most of the algorithms in Python, primarily for educational purposes, and is therefore slightly less efficient than the industry.

Warehouse Address:

Github.com/TheAlgorith…

Content description

Contains Python implementations of common algorithms such as binary trees, sorting, lookups, and so on. These are the skills that algorithm engineers must master. \

File directory

The demo

Bubble sort

Bucket sort

Quick sort

Typical code

(This is the code for bubble sort) : \

from __future__ import print_function

def bubble_sort(collection):
    """Pure implementation of bubble sort algorithm in Python :param collection: some mutable ordered collection with heterogeneous comparable items inside :return: the same collection ordered by ascending Examples: >>> bubble_sort([0, 5, 3, 2, 2]) [0, 2, 2, 3, 5] >>> bubble_sort([]) [] >>> bubble_sort([-2, -5, -45]) [-45, -5, 2] - > > > bubble_sort ([- 23,0,6-4]) [- 23-4,0,6,34]"""
    length = len(collection)
    for i in range(length- 1):
        swapped = False
        for j in range(length- 1-i):
            if collection[j] > collection[j+1]:
                swapped = True
                collection[j], collection[j+1] = collection[j+1], collection[j]
            if not swapped: break # Stop iteration if the collection is sorted.
        return collection

if __name__ == '__main__':
    try:
        raw_input # Python 2
    except NameError:
        raw_input = input # Python 3
    user_input = raw_input('Enter numbers separated by a comma:').strip()
    unsorted = [int(item) for item in user_input.split(', ')]
    print(*bubble_sort(unsorted), sep=', ')
Copy the code

Other data structure and algorithm design resources are recommended

Recommend three courses I have taken:

Free OF charge I recommend Yan Weimin teacher’s data structure course, can be found on the Internet, with C language to achieve, when the doctor’s exam to learn is this.

Video download link: pan.baidu.com/s/1O3W85I13…

Extraction code: UNM7

I recommend The beauty of Data Structures and Algorithms by Professor Wang Zheng.

Gk. Link/A /108GK, the content is quite comprehensive, learn should have a great help to the algorithm.

Or professor Qin Chao’s video course “Lecture 40 algorithm Clearance” :

urlify.cn/Qn2eA3, for the interview…

conclusion

Github is a repository with a star of 66.6K +, which implements a variety of common algorithms in Python, and also has a GIF demo.

Warehouse Address:

Github.com/TheAlgorith…

Machine Learning Online Manual Deep Learning online Manual AI Basics download (PDF updated to25Note: to join this site's wechat group or QQ group, please reply to "add group" to get a discount station knowledge planet coupon, please reply to "knowledge planet"Copy the code

Like articles, click Looking at the